@conduction/nextcloud-vue 2.161.0 → 2.163.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue2.js +3 -2
  2. package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue2.js.map +1 -1
  3. package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue3.js.map +1 -1
  4. package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue.js +1 -1
  5. package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js +2 -1
  6. package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js.map +1 -1
  7. package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue3.js.map +1 -1
  8. package/dist/esm/components/CnChipListManager/CnChipListManager.vue.js +9 -0
  9. package/dist/esm/components/CnChipListManager/CnChipListManager.vue.js.map +1 -0
  10. package/dist/esm/components/CnChipListManager/CnChipListManager.vue2.js +304 -0
  11. package/dist/esm/components/CnChipListManager/CnChipListManager.vue2.js.map +1 -0
  12. package/dist/esm/components/CnChipListManager/CnChipListManager.vue3.js +161 -0
  13. package/dist/esm/components/CnChipListManager/CnChipListManager.vue3.js.map +1 -0
  14. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  15. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +2 -1
  16. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  17. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  18. package/dist/esm/components/CnDataTable/CnDataTable.vue2.js +8 -8
  19. package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
  20. package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
  21. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
  22. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js +23 -0
  23. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
  24. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
  25. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
  26. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +48 -5
  27. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
  28. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +2 -1
  29. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
  30. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
  31. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +4 -3
  32. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
  33. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
  34. package/dist/esm/components/CnFilesBrowser/filesBrowser.js +6 -5
  35. package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
  36. package/dist/esm/components/CnFilesBrowser/openRegisterSource.js +2 -1
  37. package/dist/esm/components/CnFilesBrowser/openRegisterSource.js.map +1 -1
  38. package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
  39. package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js +2 -1
  40. package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js.map +1 -1
  41. package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue3.js.map +1 -1
  42. package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue.js +1 -1
  43. package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue2.js +4 -0
  44. package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue2.js.map +1 -1
  45. package/dist/esm/components/CnFilterRowsEditor/CnFilterRowsEditor.vue3.js.map +1 -1
  46. package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue.js +1 -1
  47. package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue2.js.map +1 -1
  48. package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js +41 -39
  49. package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js.map +1 -1
  50. package/dist/esm/components/CnFolderSidebar/webdavFolders.js +2 -1
  51. package/dist/esm/components/CnFolderSidebar/webdavFolders.js.map +1 -1
  52. package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
  53. package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js +2 -2
  54. package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
  55. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
  56. package/dist/esm/components/CnIconPicker/CnIconPicker.vue.js +1 -1
  57. package/dist/esm/components/CnIconPicker/CnIconPicker.vue2.js +4 -3
  58. package/dist/esm/components/CnIconPicker/CnIconPicker.vue2.js.map +1 -1
  59. package/dist/esm/components/CnIconPicker/CnIconPicker.vue3.js.map +1 -1
  60. package/dist/esm/components/CnIconPicker/iconCatalogues.js +16 -3
  61. package/dist/esm/components/CnIconPicker/iconCatalogues.js.map +1 -1
  62. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +87 -11
  63. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  64. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +2 -2
  65. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  66. package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue.js +1 -1
  67. package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue2.js +2 -1
  68. package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue2.js.map +1 -1
  69. package/dist/esm/components/CnLinksWidgetForm/CnLinksWidgetForm.vue3.js.map +1 -1
  70. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
  71. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +6 -1
  72. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
  73. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
  74. package/dist/esm/components/CnMenuWidget/menuActive.js +2 -1
  75. package/dist/esm/components/CnMenuWidget/menuActive.js.map +1 -1
  76. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue.js +1 -1
  77. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +1 -1
  78. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
  79. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
  80. package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue.js +1 -1
  81. package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue2.js +4 -0
  82. package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue2.js.map +1 -1
  83. package/dist/esm/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue3.js.map +1 -1
  84. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
  85. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +39 -2
  86. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
  87. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js +1 -1
  88. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
  89. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue.js +1 -1
  90. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -1
  91. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
  92. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue3.js.map +1 -1
  93. package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue.js +1 -1
  94. package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue2.js +10 -1
  95. package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue2.js.map +1 -1
  96. package/dist/esm/components/CnPageTreeNode/CnPageTreeRow.vue3.js.map +1 -1
  97. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  98. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +5 -5
  99. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  100. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  101. package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue2.js +22 -0
  102. package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue2.js.map +1 -1
  103. package/dist/esm/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue3.js.map +1 -1
  104. package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue.js +1 -1
  105. package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue2.js +4 -0
  106. package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue2.js.map +1 -1
  107. package/dist/esm/components/CnStagesWidgetForm/CnStagesWidgetForm.vue3.js.map +1 -1
  108. package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue.js +1 -1
  109. package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue2.js +1 -1
  110. package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue2.js.map +1 -1
  111. package/dist/esm/components/CnWalkthrough/CnWalkthrough.vue3.js.map +1 -1
  112. package/dist/esm/composables/indexSources.js +30 -2
  113. package/dist/esm/composables/indexSources.js.map +1 -1
  114. package/dist/esm/index.js +1 -0
  115. package/dist/esm/index.js.map +1 -1
  116. package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue.js +1 -1
  117. package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue2.js +2 -1
  118. package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue2.js.map +1 -1
  119. package/dist/esm/integrations/builtin/analytics/CnAnalyticsCard.vue3.js.map +1 -1
  120. package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue.js +1 -1
  121. package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue2.js +3 -2
  122. package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue2.js.map +1 -1
  123. package/dist/esm/integrations/builtin/analytics/CnAnalyticsTab.vue3.js.map +1 -1
  124. package/dist/esm/integrations/builtin/email/CnEmailTab.vue.js +1 -1
  125. package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js +130 -1
  126. package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js.map +1 -1
  127. package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js +27 -16
  128. package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js.map +1 -1
  129. package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue.js +1 -1
  130. package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue2.js +2 -1
  131. package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue2.js.map +1 -1
  132. package/dist/esm/integrations/builtin/photos/CnPhotosCard.vue3.js.map +1 -1
  133. package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue.js +1 -1
  134. package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue2.js +2 -1
  135. package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue2.js.map +1 -1
  136. package/dist/esm/integrations/builtin/photos/CnPhotosTab.vue3.js.map +1 -1
  137. package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue.js +1 -1
  138. package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue2.js +2 -6
  139. package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue2.js.map +1 -1
  140. package/dist/esm/integrations/builtin/xwiki/CnXwikiCard.vue3.js.map +1 -1
  141. package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue.js +1 -1
  142. package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue2.js +2 -6
  143. package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue2.js.map +1 -1
  144. package/dist/esm/integrations/builtin/xwiki/CnXwikiTab.vue3.js.map +1 -1
  145. package/dist/esm/integrations/utils/marker.js +35 -6
  146. package/dist/esm/integrations/utils/marker.js.map +1 -1
  147. package/dist/esm/l10n/en.json.js +17 -1
  148. package/dist/esm/l10n/en.json.js.map +1 -1
  149. package/dist/esm/l10n/nl.json.js +17 -1
  150. package/dist/esm/l10n/nl.json.js.map +1 -1
  151. package/dist/esm/library-style.js +1 -1
  152. package/dist/esm/nextcloud-vue.css +1038 -822
  153. package/dist/esm/utils/buildManifestRoutes.js +2 -1
  154. package/dist/esm/utils/buildManifestRoutes.js.map +1 -1
  155. package/dist/esm/utils/cnFetch.js +1 -15
  156. package/dist/esm/utils/cnFetch.js.map +1 -1
  157. package/dist/esm/utils/fillTemplate.js +32 -2
  158. package/dist/esm/utils/fillTemplate.js.map +1 -1
  159. package/dist/esm/utils/forge.js +4 -1
  160. package/dist/esm/utils/forge.js.map +1 -1
  161. package/dist/esm/utils/htmlToText.js +36 -0
  162. package/dist/esm/utils/htmlToText.js.map +1 -0
  163. package/dist/esm/utils/myTeam.js +17 -3
  164. package/dist/esm/utils/myTeam.js.map +1 -1
  165. package/dist/esm/utils/prototypeKeys.js +20 -0
  166. package/dist/esm/utils/prototypeKeys.js.map +1 -0
  167. package/dist/esm/utils/rowAggregate.js +20 -1
  168. package/dist/esm/utils/rowAggregate.js.map +1 -1
  169. package/dist/esm/utils/toastUiRawHtmlGuard.js +166 -0
  170. package/dist/esm/utils/toastUiRawHtmlGuard.js.map +1 -0
  171. package/dist/esm/utils/trailingSlashes.js +24 -0
  172. package/dist/esm/utils/trailingSlashes.js.map +1 -0
  173. package/dist/nextcloud-vue.cjs.js +12490 -11295
  174. package/dist/nextcloud-vue.cjs.js.map +2 -2
  175. package/dist/nextcloud-vue.css +1038 -822
  176. package/l10n/en.json +17 -1
  177. package/l10n/nl.json +17 -1
  178. package/package.json +1 -1
  179. package/src/components/CnActionsMenu/CnActionsMenu.vue +3 -2
  180. package/src/components/CnAddressSearch/CnAddressSearch.vue +2 -1
  181. package/src/components/CnChipListManager/CnChipListManager.vue +504 -0
  182. package/src/components/CnChipListManager/index.js +4 -0
  183. package/src/components/CnDashboardPage/CnDashboardPage.vue +2 -1
  184. package/src/components/CnDataTable/CnDataTable.vue +8 -8
  185. package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +23 -0
  186. package/src/components/CnFactsWidget/CnFactsWidget.vue +49 -5
  187. package/src/components/CnFilesBrowser/CnFilesBrowser.vue +4 -3
  188. package/src/components/CnFilesBrowser/filesBrowser.js +6 -5
  189. package/src/components/CnFilesBrowser/openRegisterSource.js +2 -1
  190. package/src/components/CnFilesWidget/CnFilesWidget.vue +2 -1
  191. package/src/components/CnFilterRowsEditor/CnFilterRowsEditor.vue +4 -0
  192. package/src/components/CnFlowRunsWidget/CnFlowRunsWidget.vue +1 -1
  193. package/src/components/CnFolderSidebar/webdavFolders.js +2 -1
  194. package/src/components/CnFormDialog/CnFormDialog.vue +2 -2
  195. package/src/components/CnIconPicker/CnIconPicker.vue +4 -3
  196. package/src/components/CnIconPicker/iconCatalogues.js +16 -3
  197. package/src/components/CnIndexPage/CnIndexPage.vue +89 -13
  198. package/src/components/CnLinksWidgetForm/CnLinksWidgetForm.vue +2 -1
  199. package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +6 -1
  200. package/src/components/CnMenuWidget/menuActive.js +2 -1
  201. package/src/components/CnObjectListWidget/CnObjectListWidget.vue +1 -1
  202. package/src/components/CnObjectListWidgetForm/CnObjectListWidgetForm.vue +4 -0
  203. package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +40 -3
  204. package/src/components/CnPageTreeNode/CnPageTreeNode.vue +2 -1
  205. package/src/components/CnPageTreeNode/CnPageTreeRow.vue +10 -1
  206. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +5 -5
  207. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +22 -0
  208. package/src/components/CnStagesWidgetForm/CnStagesWidgetForm.vue +4 -0
  209. package/src/components/CnWalkthrough/CnWalkthrough.vue +1 -1
  210. package/src/components/index.js +1 -0
  211. package/src/composables/indexSources.js +30 -2
  212. package/src/css/dialog.css +7 -0
  213. package/src/css/look-board-detail.css +41 -4
  214. package/src/css/look-board.css +64 -2
  215. package/src/index.js +1 -0
  216. package/src/integrations/builtin/analytics/CnAnalyticsCard.vue +2 -1
  217. package/src/integrations/builtin/analytics/CnAnalyticsTab.vue +3 -2
  218. package/src/integrations/builtin/email/CnEmailTab.vue +155 -4
  219. package/src/integrations/builtin/photos/CnPhotosCard.vue +2 -1
  220. package/src/integrations/builtin/photos/CnPhotosTab.vue +2 -1
  221. package/src/integrations/builtin/xwiki/CnXwikiCard.vue +2 -6
  222. package/src/integrations/builtin/xwiki/CnXwikiTab.vue +2 -6
  223. package/src/integrations/utils/marker.js +35 -6
  224. package/src/utils/buildManifestRoutes.js +2 -1
  225. package/src/utils/cnFetch.js +3 -15
  226. package/src/utils/fillTemplate.js +32 -2
  227. package/src/utils/forge.js +3 -1
  228. package/src/utils/htmlToText.js +33 -0
  229. package/src/utils/myTeam.js +17 -3
  230. package/src/utils/prototypeKeys.js +17 -0
  231. package/src/utils/rowAggregate.js +19 -0
  232. package/src/utils/toastUiRawHtmlGuard.js +162 -0
  233. package/src/utils/trailingSlashes.js +21 -0
@@ -27,6 +27,25 @@ function isRowAggregate(agg) {
27
27
  return Boolean(agg && agg.register && agg.schema && (agg.op === 'count' || (agg.op === 'max' && agg.field)))
28
28
  }
29
29
 
30
+ /**
31
+ * One row's figures in a map of rows, created on first use. Rows live in a
32
+ * Map and figures in a prototype-less object, so a row id or figure key such
33
+ * as `__proto__` stays an ordinary key.
34
+ *
35
+ * @param {Map<string, object>} rows The figures by row id.
36
+ * @param {string|number} rowId The row id (read as a string).
37
+ * @return {object} The row's figures, by key.
38
+ */
39
+ function cellsOf(rows, rowId) {
40
+ const key = String(rowId);
41
+ let cells = rows.get(key);
42
+ if (!cells) {
43
+ cells = Object.create(null);
44
+ rows.set(key, cells);
45
+ }
46
+ return cells
47
+ }
48
+
30
49
  /**
31
50
  * Fill an aggregate's `where` for one row: a string `"@self.<path>"` reads
32
51
  * that path of the row, everything else is passed through.
@@ -68,5 +87,5 @@ async function fetchRowAggregate(agg, row, readValue = readPath) {
68
87
  return (data && (data.total ?? (Array.isArray(data.results) ? data.results.length : undefined))) ?? 0
69
88
  }
70
89
 
71
- export { fetchRowAggregate, isRowAggregate, resolveRowWhere };
90
+ export { cellsOf, fetchRowAggregate, isRowAggregate, resolveRowWhere };
72
91
  //# sourceMappingURL=rowAggregate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rowAggregate.js","sources":["../../../src/utils/rowAggregate.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * rowAggregate: one row's figure over its related OpenRegister objects, as\n * a table's `aggregate` column and a record list's `aggregates` read it.\n * `op: \"count\"` asks `_limit=0` for the total; `op: \"max\"` asks for the one\n * object with the highest `field` (`_limit=1`, sorted descending) and keeps\n * that value, null when there is none.\n *\n * @module utils/rowAggregate\n * @spec openspec/changes/record-list-row-aggregates/specs/record-list/spec.md#requirement-a-record-list-row-can-carry-a-figure-over-its-related-objects\n */\n\nimport axios from '@nextcloud/axios'\nimport { generateUrl } from '@nextcloud/router'\nimport { readPath } from './readPath.js'\n\n/**\n * Whether an aggregate declaration can be asked.\n *\n * @param {object} agg The declaration `{ register, schema, op, field?, where? }`.\n * @return {boolean} True for a count, or a max that names its field.\n */\nexport function isRowAggregate(agg) {\n\treturn Boolean(agg && agg.register && agg.schema && (agg.op === 'count' || (agg.op === 'max' && agg.field)))\n}\n\n/**\n * Fill an aggregate's `where` for one row: a string `\"@self.<path>\"` reads\n * that path of the row, everything else is passed through.\n *\n * @param {object} where The `where` map (may be undefined).\n * @param {object} row The row.\n * @param {Function} [readValue] How a path is read off the row; `readPath` by default.\n * @return {object} The filter map.\n */\nexport function resolveRowWhere(where, row, readValue = readPath) {\n\tconst out = {}\n\tfor (const [key, value] of Object.entries(where || {})) {\n\t\tout[key] = typeof value === 'string' && value.startsWith('@self.') ? readValue(row, value.slice('@self.'.length)) : value\n\t}\n\treturn out\n}\n\n/**\n * Ask OpenRegister for one row's aggregate.\n *\n * @param {object} agg The declaration.\n * @param {object} row The row.\n * @param {Function} [readValue] How a path is read off the row.\n * @return {Promise<number|unknown|null>} The count, the highest value, or null when there is none.\n */\nexport async function fetchRowAggregate(agg, row, readValue = readPath) {\n\tconst where = resolveRowWhere(agg.where, row, readValue)\n\tconst isMax = agg.op === 'max'\n\tconst params = isMax\n\t\t? { ...where, _limit: 1, [`_order[${agg.field}]`]: 'desc' }\n\t\t: { ...where, _limit: 0 }\n\tconst res = await axios.get(generateUrl(`/apps/openregister/api/objects/${agg.register}/${agg.schema}`), { params })\n\tconst data = res && res.data\n\tif (isMax) {\n\t\tconst first = data && Array.isArray(data.results) ? data.results[0] : undefined\n\t\tconst top = first === undefined ? undefined : readPath(first, agg.field)\n\t\treturn top === undefined || top === '' ? null : top\n\t}\n\treturn (data && (data.total ?? (Array.isArray(data.results) ? data.results.length : undefined))) ?? 0\n}\n"],"names":["axios"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,GAAG,EAAE;AACpC,CAAC,OAAO,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAA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W,CAAC,CAAC,+BAA+B,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,EAAC;AACrH,CAAC,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,KAAI;AAC7B,CAAC,IAAI,KAAK,EAAE;AACZ,EAAE,MAAM,KAAK,GAAG,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,UAAS;AACjF,EAAE,MAAM,GAAG,GAAG,KAAK,KAAK,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,EAAC;AAC1E,EAAE,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,GAAG,IAAI,GAAG,GAAG;AACrD,EAAE;AACF,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,KAAK,CAAC;AACtG;;;;"}
1
+ {"version":3,"file":"rowAggregate.js","sources":["../../../src/utils/rowAggregate.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * rowAggregate: one row's figure over its related OpenRegister objects, as\n * a table's `aggregate` column and a record list's `aggregates` read it.\n * `op: \"count\"` asks `_limit=0` for the total; `op: \"max\"` asks for the one\n * object with the highest `field` (`_limit=1`, sorted descending) and keeps\n * that value, null when there is none.\n *\n * @module utils/rowAggregate\n * @spec openspec/changes/record-list-row-aggregates/specs/record-list/spec.md#requirement-a-record-list-row-can-carry-a-figure-over-its-related-objects\n */\n\nimport axios from '@nextcloud/axios'\nimport { generateUrl } from '@nextcloud/router'\nimport { readPath } from './readPath.js'\n\n/**\n * Whether an aggregate declaration can be asked.\n *\n * @param {object} agg The declaration `{ register, schema, op, field?, where? }`.\n * @return {boolean} True for a count, or a max that names its field.\n */\nexport function isRowAggregate(agg) {\n\treturn Boolean(agg && agg.register && agg.schema && (agg.op === 'count' || (agg.op === 'max' && agg.field)))\n}\n\n/**\n * One row's figures in a map of rows, created on first use. Rows live in a\n * Map and figures in a prototype-less object, so a row id or figure key such\n * as `__proto__` stays an ordinary key.\n *\n * @param {Map<string, object>} rows The figures by row id.\n * @param {string|number} rowId The row id (read as a string).\n * @return {object} The row's figures, by key.\n */\nexport function cellsOf(rows, rowId) {\n\tconst key = String(rowId)\n\tlet cells = rows.get(key)\n\tif (!cells) {\n\t\tcells = Object.create(null)\n\t\trows.set(key, cells)\n\t}\n\treturn cells\n}\n\n/**\n * Fill an aggregate's `where` for one row: a string `\"@self.<path>\"` reads\n * that path of the row, everything else is passed through.\n *\n * @param {object} where The `where` map (may be undefined).\n * @param {object} row The row.\n * @param {Function} [readValue] How a path is read off the row; `readPath` by default.\n * @return {object} The filter map.\n */\nexport function resolveRowWhere(where, row, readValue = readPath) {\n\tconst out = {}\n\tfor (const [key, value] of Object.entries(where || {})) {\n\t\tout[key] = typeof value === 'string' && value.startsWith('@self.') ? readValue(row, value.slice('@self.'.length)) : value\n\t}\n\treturn out\n}\n\n/**\n * Ask OpenRegister for one row's aggregate.\n *\n * @param {object} agg The declaration.\n * @param {object} row The row.\n * @param {Function} [readValue] How a path is read off the row.\n * @return {Promise<number|unknown|null>} The count, the highest value, or null when there is none.\n */\nexport async function fetchRowAggregate(agg, row, readValue = readPath) {\n\tconst where = resolveRowWhere(agg.where, row, readValue)\n\tconst isMax = agg.op === 'max'\n\tconst params = isMax\n\t\t? { ...where, _limit: 1, [`_order[${agg.field}]`]: 'desc' }\n\t\t: { ...where, _limit: 0 }\n\tconst res = await axios.get(generateUrl(`/apps/openregister/api/objects/${agg.register}/${agg.schema}`), { params })\n\tconst data = res && res.data\n\tif (isMax) {\n\t\tconst first = data && Array.isArray(data.results) ? data.results[0] : undefined\n\t\tconst top = first === undefined ? undefined : readPath(first, agg.field)\n\t\treturn top === undefined || top === '' ? null : top\n\t}\n\treturn (data && (data.total ?? (Array.isArray(data.results) ? data.results.length : undefined))) ?? 0\n}\n"],"names":["axios"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,GAAG,EAAE;AACpC,CAAC,OAAO,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,KAAK,OAAO,KAAK,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7G,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE;AACrC,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAC;AAC1B,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAC;AAC1B,CAAC,IAAI,CAAC,KAAK,EAAE;AACb,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAC;AAC7B,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAC;AACtB,EAAE;AACF,CAAC,OAAO,KAAK;AACb,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,GAAG,QAAQ,EAAE;AAClE,CAAC,MAAM,GAAG,GAAG,GAAE;AACf,CAAC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,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AAM,GAAG,GAAG,KAAK,KAAK,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,EAAC;AAC1E,EAAE,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,GAAG,IAAI,GAAG,GAAG;AACrD,EAAE;AACF,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,KAAK,CAAC;AACtG;;;;"}
@@ -0,0 +1,166 @@
1
+ import { toastUiSanitizer } from './toastUiSanitizer.js';
2
+
3
+ /**
4
+ * SPDX-License-Identifier: EUPL-1.2
5
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
6
+ *
7
+ * Runs every raw HTML string that `@toast-ui/editor` turns into DOM through
8
+ * DOMPurify 3 (`toastUiSanitizer`) first.
9
+ *
10
+ * `customHTMLSanitizer` covers the preview and the HTML renderer only. When
11
+ * the WYSIWYG editor converts markdown (initial value, `setMarkdown`, a mode
12
+ * switch, `getHTML`), its raw HTML block and inline converters call the
13
+ * DOMPurify 2.3.3 copy inlined in the package and write the result into a
14
+ * `div` of the live document with `innerHTML`. The package is unmaintained,
15
+ * so no release fixes that, and patching the bundle would only hold where
16
+ * the patch is applied: each consuming app resolves and bundles
17
+ * `@toast-ui/editor` itself. This guard works on the editor instance, so it
18
+ * travels with CnMarkdownEditor into every app.
19
+ *
20
+ * What it changes, per instance:
21
+ * - the `htmlBlock` and `htmlInline` converters see the node's literal
22
+ * sanitised by DOMPurify 3 (restored afterwards, so the markdown source and
23
+ * its syntax tree stay untouched);
24
+ * - pasted HTML is sanitised after Toast UI's own clean-up and before
25
+ * ProseMirror parses it;
26
+ * - `setHTML` sanitises its argument.
27
+ * DOMPurify 2.3.3 still runs inside Toast UI, but only on output DOMPurify 3
28
+ * already produced.
29
+ *
30
+ * @module utils/toastUiRawHtmlGuard
31
+ */
32
+
33
+
34
+ // Toast UI's own tag grammar (`reHTMLTag`): its converters read the tag name
35
+ // with it and throw when a literal does not start with a tag.
36
+ const TAG_NAME = '[A-Za-z][A-Za-z0-9-]*';
37
+ const ATTRIBUTE = '(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"\'=<>`\\x00-\\x20]+|\'[^\']*\'|"[^"]*"))?)';
38
+ const OPEN_TAG = new RegExp(`^<(${TAG_NAME})${ATTRIBUTE}*\\s*/?>`, 'i');
39
+ const CLOSE_TAG = new RegExp(`^</(${TAG_NAME})\\s*>`, 'i');
40
+ // Toast UI renders a block holding a comment as plain text.
41
+ const HTML_COMMENT = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/;
42
+
43
+ // An opening tag no Toast UI converter or schema mark handles: converting it
44
+ // adds nothing, which is what the sanitiser asked for.
45
+ const INERT_OPEN_TAG = '<span>';
46
+
47
+ const GUARDED = Symbol('cnToastUiRawHtmlGuard');
48
+
49
+ /**
50
+ * The literal of a raw HTML block, sanitised.
51
+ *
52
+ * @param {string} literal The block's source HTML.
53
+ * @return {string} HTML that starts with a tag, as Toast UI requires.
54
+ */
55
+ function sanitizeHtmlBlockLiteral(literal) {
56
+ if (HTML_COMMENT.test(literal)) {
57
+ return literal
58
+ }
59
+ const clean = toastUiSanitizer(literal);
60
+ return OPEN_TAG.test(clean) ? clean : `<div>${clean}</div>`
61
+ }
62
+
63
+ /**
64
+ * The literal of one raw inline HTML tag, sanitised.
65
+ *
66
+ * @param {string} literal The tag's source, e.g. `<img src=x>` or `</b>`.
67
+ * @return {string} The sanitised tag.
68
+ */
69
+ function sanitizeHtmlInlineLiteral(literal) {
70
+ const close = CLOSE_TAG.exec(literal);
71
+ if (close) {
72
+ return `</${close[1]}>`
73
+ }
74
+ if (!OPEN_TAG.test(literal)) {
75
+ return literal
76
+ }
77
+ const open = OPEN_TAG.exec(toastUiSanitizer(literal));
78
+ return open ? open[0] : INERT_OPEN_TAG
79
+ }
80
+
81
+ /**
82
+ * Wrap one markdown-to-WYSIWYG converter so it reads a sanitised literal.
83
+ *
84
+ * @param {object} convertors The instance's `toWwConvertors` map.
85
+ * @param {string} type `htmlBlock` or `htmlInline`.
86
+ * @param {(literal: string) => string} sanitize Literal sanitiser for that type.
87
+ * @return {void}
88
+ */
89
+ function wrapConvertor(convertors, type, sanitize) {
90
+ const original = convertors[type];
91
+ if (typeof original !== 'function') {
92
+ return
93
+ }
94
+ convertors[type] = function(state, node, context) {
95
+ const literal = node.literal;
96
+ node.literal = sanitize(typeof literal === 'string' ? literal : '');
97
+ try {
98
+ return original.call(this, state, node, context)
99
+ } finally {
100
+ node.literal = literal;
101
+ }
102
+ };
103
+ }
104
+
105
+ /**
106
+ * Install the guard on a constructed Toast UI editor. Safe to call more than
107
+ * once; does nothing on an object without Toast UI's internals.
108
+ *
109
+ * @param {object} editor A `@toast-ui/editor` instance.
110
+ * @return {object} The same editor.
111
+ */
112
+ function guardToastUiEditor(editor) {
113
+ if (!editor || editor[GUARDED]) {
114
+ return editor
115
+ }
116
+ const convertors = editor.convertor && editor.convertor.toWwConvertors;
117
+ const view = editor.wwEditor && editor.wwEditor.view;
118
+ if (!convertors || !view || typeof view.setProps !== 'function') {
119
+ return editor
120
+ }
121
+ wrapConvertor(convertors, 'htmlBlock', sanitizeHtmlBlockLiteral);
122
+ wrapConvertor(convertors, 'htmlInline', sanitizeHtmlInlineLiteral);
123
+
124
+ const transformPastedHTML = view.props.transformPastedHTML;
125
+ view.setProps({
126
+ transformPastedHTML(html, pmView) {
127
+ const cleaned = typeof transformPastedHTML === 'function' ? transformPastedHTML(html, pmView) : html;
128
+ return toastUiSanitizer(cleaned)
129
+ },
130
+ });
131
+
132
+ editor[GUARDED] = true;
133
+ return editor
134
+ }
135
+
136
+ /**
137
+ * A subclass of the Toast UI editor class with the guard installed.
138
+ *
139
+ * The constructor converts `initialValue` through `setMarkdown` before it
140
+ * returns, so the guard is installed from that override, ahead of the first
141
+ * conversion.
142
+ *
143
+ * @param {new (options?: object) => object} Editor The `@toast-ui/editor` default export.
144
+ * @return {new (options?: object) => object} The guarded editor class.
145
+ */
146
+ function guardedToastUiEditorClass(Editor) {
147
+ return class GuardedToastUiEditor extends Editor {
148
+ constructor(options) {
149
+ super(options);
150
+ guardToastUiEditor(this);
151
+ }
152
+
153
+ setMarkdown(markdown, cursorToEnd) {
154
+ guardToastUiEditor(this);
155
+ return super.setMarkdown(markdown, cursorToEnd)
156
+ }
157
+
158
+ setHTML(html, cursorToEnd) {
159
+ guardToastUiEditor(this);
160
+ return super.setHTML(toastUiSanitizer(html), cursorToEnd)
161
+ }
162
+ }
163
+ }
164
+
165
+ export { guardToastUiEditor, guardedToastUiEditorClass, sanitizeHtmlBlockLiteral, sanitizeHtmlInlineLiteral };
166
+ //# sourceMappingURL=toastUiRawHtmlGuard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toastUiRawHtmlGuard.js","sources":["../../../src/utils/toastUiRawHtmlGuard.js"],"sourcesContent":["/**\n * SPDX-License-Identifier: EUPL-1.2\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n *\n * Runs every raw HTML string that `@toast-ui/editor` turns into DOM through\n * DOMPurify 3 (`toastUiSanitizer`) first.\n *\n * `customHTMLSanitizer` covers the preview and the HTML renderer only. When\n * the WYSIWYG editor converts markdown (initial value, `setMarkdown`, a mode\n * switch, `getHTML`), its raw HTML block and inline converters call the\n * DOMPurify 2.3.3 copy inlined in the package and write the result into a\n * `div` of the live document with `innerHTML`. The package is unmaintained,\n * so no release fixes that, and patching the bundle would only hold where\n * the patch is applied: each consuming app resolves and bundles\n * `@toast-ui/editor` itself. This guard works on the editor instance, so it\n * travels with CnMarkdownEditor into every app.\n *\n * What it changes, per instance:\n * - the `htmlBlock` and `htmlInline` converters see the node's literal\n * sanitised by DOMPurify 3 (restored afterwards, so the markdown source and\n * its syntax tree stay untouched);\n * - pasted HTML is sanitised after Toast UI's own clean-up and before\n * ProseMirror parses it;\n * - `setHTML` sanitises its argument.\n * DOMPurify 2.3.3 still runs inside Toast UI, but only on output DOMPurify 3\n * already produced.\n *\n * @module utils/toastUiRawHtmlGuard\n */\n\nimport { toastUiSanitizer } from './toastUiSanitizer.js'\n\n// Toast UI's own tag grammar (`reHTMLTag`): its converters read the tag name\n// with it and throw when a literal does not start with a tag.\nconst TAG_NAME = '[A-Za-z][A-Za-z0-9-]*'\nconst ATTRIBUTE = '(?:\\\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\\\s*=\\\\s*(?:[^\"\\'=<>`\\\\x00-\\\\x20]+|\\'[^\\']*\\'|\"[^\"]*\"))?)'\nconst OPEN_TAG = new RegExp(`^<(${TAG_NAME})${ATTRIBUTE}*\\\\s*/?>`, 'i')\nconst CLOSE_TAG = new RegExp(`^</(${TAG_NAME})\\\\s*>`, 'i')\n// Toast UI renders a block holding a comment as plain text.\nconst HTML_COMMENT = /<! ---->|<!--(?:-?[^>-])(?:-?[^-])*-->/\n\n// An opening tag no Toast UI converter or schema mark handles: converting it\n// adds nothing, which is what the sanitiser asked for.\nconst INERT_OPEN_TAG = '<span>'\n\nconst GUARDED = Symbol('cnToastUiRawHtmlGuard')\n\n/**\n * The literal of a raw HTML block, sanitised.\n *\n * @param {string} literal The block's source HTML.\n * @return {string} HTML that starts with a tag, as Toast UI requires.\n */\nexport function sanitizeHtmlBlockLiteral(literal) {\n\tif (HTML_COMMENT.test(literal)) {\n\t\treturn literal\n\t}\n\tconst clean = toastUiSanitizer(literal)\n\treturn OPEN_TAG.test(clean) ? clean : `<div>${clean}</div>`\n}\n\n/**\n * The literal of one raw inline HTML tag, sanitised.\n *\n * @param {string} literal The tag's source, e.g. `<img src=x>` or `</b>`.\n * @return {string} The sanitised tag.\n */\nexport function sanitizeHtmlInlineLiteral(literal) {\n\tconst close = CLOSE_TAG.exec(literal)\n\tif (close) {\n\t\treturn `</${close[1]}>`\n\t}\n\tif (!OPEN_TAG.test(literal)) {\n\t\treturn literal\n\t}\n\tconst open = OPEN_TAG.exec(toastUiSanitizer(literal))\n\treturn open ? open[0] : INERT_OPEN_TAG\n}\n\n/**\n * Wrap one markdown-to-WYSIWYG converter so it reads a sanitised literal.\n *\n * @param {object} convertors The instance's `toWwConvertors` map.\n * @param {string} type `htmlBlock` or `htmlInline`.\n * @param {(literal: string) => string} sanitize Literal sanitiser for that type.\n * @return {void}\n */\nfunction wrapConvertor(convertors, type, sanitize) {\n\tconst original = convertors[type]\n\tif (typeof original !== 'function') {\n\t\treturn\n\t}\n\tconvertors[type] = function(state, node, context) {\n\t\tconst literal = node.literal\n\t\tnode.literal = sanitize(typeof literal === 'string' ? literal : '')\n\t\ttry {\n\t\t\treturn original.call(this, state, node, context)\n\t\t} finally {\n\t\t\tnode.literal = literal\n\t\t}\n\t}\n}\n\n/**\n * Install the guard on a constructed Toast UI editor. Safe to call more than\n * once; does nothing on an object without Toast UI's internals.\n *\n * @param {object} editor A `@toast-ui/editor` instance.\n * @return {object} The same editor.\n */\nexport function guardToastUiEditor(editor) {\n\tif (!editor || editor[GUARDED]) {\n\t\treturn editor\n\t}\n\tconst convertors = editor.convertor && editor.convertor.toWwConvertors\n\tconst view = editor.wwEditor && editor.wwEditor.view\n\tif (!convertors || !view || typeof view.setProps !== 'function') {\n\t\treturn editor\n\t}\n\twrapConvertor(convertors, 'htmlBlock', sanitizeHtmlBlockLiteral)\n\twrapConvertor(convertors, 'htmlInline', sanitizeHtmlInlineLiteral)\n\n\tconst transformPastedHTML = view.props.transformPastedHTML\n\tview.setProps({\n\t\ttransformPastedHTML(html, pmView) {\n\t\t\tconst cleaned = typeof transformPastedHTML === 'function' ? transformPastedHTML(html, pmView) : html\n\t\t\treturn toastUiSanitizer(cleaned)\n\t\t},\n\t})\n\n\teditor[GUARDED] = true\n\treturn editor\n}\n\n/**\n * A subclass of the Toast UI editor class with the guard installed.\n *\n * The constructor converts `initialValue` through `setMarkdown` before it\n * returns, so the guard is installed from that override, ahead of the first\n * conversion.\n *\n * @param {new (options?: object) => object} Editor The `@toast-ui/editor` default export.\n * @return {new (options?: object) => object} The guarded editor class.\n */\nexport function guardedToastUiEditorClass(Editor) {\n\treturn class GuardedToastUiEditor extends Editor {\n\t\tconstructor(options) {\n\t\t\tsuper(options)\n\t\t\tguardToastUiEditor(this)\n\t\t}\n\n\t\tsetMarkdown(markdown, cursorToEnd) {\n\t\t\tguardToastUiEditor(this)\n\t\t\treturn super.setMarkdown(markdown, cursorToEnd)\n\t\t}\n\n\t\tsetHTML(html, cursorToEnd) {\n\t\t\tguardToastUiEditor(this)\n\t\t\treturn super.setHTML(toastUiSanitizer(html), cursorToEnd)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA,MAAM,QAAQ,GAAG,wBAAuB;AACxC,MAAM,SAAS,GAAG,gGAA+F;AACjH,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAC;AACvE,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAC;AAC1D;AACA,MAAM,YAAY,GAAG,yCAAwC;AAC7D;AACA;AACA;AACA,MAAM,cAAc,GAAG,SAAQ;AAC/B;AACA,MAAM,OAAO,GAAG,MAAM,CAAC,uBAAuB,EAAC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,OAAO,EAAE;AAClD,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;AACjC,EAAE,OAAO,OAAO;AA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AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,MAAM,EAAE;AAClD,CAAC,OAAO,MAAM,oBAAoB,SAAS,MAAM,CAAC;AAClD,EAAE,WAAW,CAAC,OAAO,EAAE;AACvB,GAAG,KAAK,CAAC,OAAO,EAAC;AACjB,GAAG,kBAAkB,CAAC,IAAI,EAAC;AAC3B,GAAG;AACH;AACA,EAAE,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE;AACrC,GAAG,kBAAkB,CAAC,IAAI,EAAC;AAC3B,GAAG,OAAO,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC;AAClD,GAAG;AACH;AACA,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE;AAC7B,GAAG,kBAAkB,CAAC,IAAI,EAAC;AAC3B,GAAG,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;AAC5D,GAAG;AACH,EAAE;AACF;;;;"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ *
5
+ * Trailing-slash trimming, with no imports, so any module can use it.
6
+ */
7
+
8
+ /**
9
+ * Drop trailing `/` characters in one linear pass (a `/\/+$/` pattern
10
+ * backtracks quadratically on a long run of slashes).
11
+ *
12
+ * @param {string} value The string to trim.
13
+ * @return {string} The string without trailing slashes.
14
+ */
15
+ function stripTrailingSlashes(value) {
16
+ let end = value.length;
17
+ while (end > 0 && value.charCodeAt(end - 1) === 47) {
18
+ end--;
19
+ }
20
+ return value.slice(0, end)
21
+ }
22
+
23
+ export { stripTrailingSlashes };
24
+ //# sourceMappingURL=trailingSlashes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trailingSlashes.js","sources":["../../../src/utils/trailingSlashes.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * Trailing-slash trimming, with no imports, so any module can use it.\n */\n\n/**\n * Drop trailing `/` characters in one linear pass (a `/\\/+$/` pattern\n * backtracks quadratically on a long run of slashes).\n *\n * @param {string} value The string to trim.\n * @return {string} The string without trailing slashes.\n */\nexport function stripTrailingSlashes(value) {\n\tlet end = value.length\n\twhile (end > 0 && value.charCodeAt(end - 1) === 47) {\n\t\tend--\n\t}\n\treturn value.slice(0, end)\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,KAAK,EAAE;AAC5C,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,OAAM;AACvB,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;AACrD,EAAE,GAAG,GAAE;AACP,EAAE;AACF,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;AAC3B;;;;"}