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.

192 lines
7.2 KiB

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