Repo for the search and displace core module including the interface to select files and search and displace operations to run on them. https://searchanddisplace.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
6.9 KiB

3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="p-d-flex p-flex-row p-jc-between p-ai-stretch">
  3. <!-- <Toast /> -->
  4. <Card
  5. class="p-mr-2 p-as-stretch file-card"
  6. >
  7. <template #header>
  8. <Toolbar>
  9. <template #left>
  10. <h3>Original document content</h3>
  11. </template>
  12. </Toolbar>
  13. </template>
  14. <template #content>
  15. <div class="md-viewer">
  16. <template v-if="fileContent === ''">
  17. <Skeleton /><br />
  18. <Skeleton /><br />
  19. <Skeleton /><br />
  20. <Skeleton /><br />
  21. <Skeleton /><br />
  22. <Skeleton /><br />
  23. <Skeleton /><br />
  24. </template>
  25. <template v-else>
  26. <vue-markdown :source="fileContent" />
  27. </template>
  28. </div>
  29. </template>
  30. </Card>
  31. <Card
  32. class="p-mr-2 p-as-stretch file-card"
  33. >
  34. <template #header>
  35. <Toolbar>
  36. <template #left>
  37. <h3>Processed document content</h3>
  38. </template>
  39. <template #right>
  40. <Button
  41. label="Download document"
  42. icon="pi pi-download"
  43. class="p-button-secondary p-button-outlined p-button-sm"
  44. @click="downloadOdt()"/>
  45. <Button
  46. label="Run filters"
  47. icon="pi pi-play"
  48. class="p-button-success p-button-outlined p-button-sm"
  49. :disabled="fileContent == ''"
  50. @click="runSearchers()"/>
  51. <Button
  52. label="Toggle filters list"
  53. icon="pi pi-list"
  54. class="p-button-info p-button-outlined p-button-sm"
  55. @click="toggleSearchersSidebar()"/>
  56. </template>
  57. </Toolbar>
  58. </template>
  59. <template #content>
  60. <div class="md-viewer">
  61. <template v-if="processing === true">
  62. <Skeleton /><br />
  63. <Skeleton /><br />
  64. <Skeleton /><br />
  65. <Skeleton /><br />
  66. <Skeleton /><br />
  67. <Skeleton /><br />
  68. <Skeleton /><br />
  69. </template>
  70. <template v-else-if="processedFileContent !== ''">
  71. <vue-markdown :source="processedFileContent" />
  72. </template>
  73. <template v-else>
  74. <Message severity="info" :closable="false">
  75. Not processed yet. Please select and run some filters to see the result.
  76. </Message>
  77. </template>
  78. </div>
  79. </template>
  80. </Card>
  81. <Sidebar
  82. :visible.sync="searchersSidebarVisible"
  83. :showCloseIcon="true"
  84. class="p-sidebar-md"
  85. position="right">
  86. <div class="p-grid p-jc-between sidebar-title-container">
  87. <div class="p-col sidebar-title">
  88. <h3>Document searchers</h3>
  89. </div>
  90. <div class="p-col-2">
  91. <Button
  92. icon="pi pi-plus"
  93. class="p-button-success p-button-sm p-button-text add-searchers"
  94. @click="toggleSearchersDialog(true)"
  95. aria:haspopup="true"
  96. aria-controls="searcers_dialog" />
  97. </div>
  98. </div>
  99. <Dialog
  100. header="Available document searchers"
  101. :visible.sync="searchersDialogVisible"
  102. :maximizable="true"
  103. :style="{width: '50vw'}"
  104. :contentStyle="{overflow: 'visible'}"
  105. id="searcers_dialog"
  106. ref="searcers-dialog">
  107. <DataTable
  108. :value.sync="searchersData"
  109. :selection.sync="selectedSearchers"
  110. dataKey="id"
  111. selectionMode="multiple"
  112. class="p-datatable-sm"
  113. :metaKeySelection="false"
  114. :paginator="true" :rows="10"
  115. paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown"
  116. currentPageReportTemplate="Showing {first} to {last} of {totalRecords}"
  117. :rowsPerPageOptions="[10,20,50]">
  118. <Column selectionMode="multiple" headerStyle="width: 3em"></Column>
  119. <Column field="name" header="Name" sortable></Column>
  120. </DataTable>
  121. <template #footer>
  122. <Button
  123. label="Done"
  124. icon="pi pi-check"
  125. class="p-button-info p-button-outlined p-button-sm"
  126. @click="toggleSearchersDialog(false)"/>
  127. </template>
  128. </Dialog>
  129. <DataTable
  130. :value.sync="selectedSearchers"
  131. dataKey="id"
  132. class="p-datatable-sm"
  133. :expandedRows.sync="expandedRows"
  134. @row-reorder="onSelectedSearchersReorder">
  135. <Column :rowReorder="true" headerStyle="width: 3rem" />
  136. <Column field="name" header="Name">
  137. </Column>
  138. <Column :expander="true" headerStyle="width: 3rem" />
  139. <template #expansion="slotProps">
  140. <div class="options-subtable">
  141. <div class="p-fluid">
  142. <div class="p-field">
  143. <label :for="`replace_with__${slotProps.data.id}`">
  144. Replace values with:
  145. </label>
  146. <InputText
  147. :id="`replace_with__${slotProps.data.id}`"
  148. type="text"
  149. class="p-inputtext-sm"
  150. v-model="searchersOptions[slotProps.data.id]"/>
  151. </div>
  152. </div>
  153. </div>
  154. </template>
  155. </DataTable>
  156. </Sidebar>
  157. </div>
  158. </template>
  159. <script lang="ts" src="./ProcessFile.ts"></script>
  160. <style lang="scss" src="./ProcessFile.scss"></style>