@lblod/ember-rdfa-editor-lblod-plugins 0.4.1 → 1.0.0-alpha.2

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 (316) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/addon/components/article-structure-plugin/article-structure-card.hbs +10 -0
  3. package/addon/components/article-structure-plugin/article-structure-card.ts +33 -0
  4. package/addon/components/article-structure-plugin/structure-card.hbs +46 -0
  5. package/addon/components/article-structure-plugin/structure-card.ts +124 -0
  6. package/addon/components/au-native-input.hbs +30 -0
  7. package/addon/components/au-native-input.ts +47 -0
  8. package/addon/components/besluit-plugin/besluit-context-card.hbs +44 -0
  9. package/addon/components/besluit-plugin/besluit-context-card.ts +138 -0
  10. package/addon/components/besluit-plugin/besluit-plugin-card.hbs +20 -0
  11. package/addon/components/besluit-plugin/besluit-plugin-card.ts +40 -0
  12. package/addon/components/besluit-type-plugin/{besluit-type-select.js → besluit-type-select.ts} +8 -4
  13. package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -0
  14. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +218 -0
  15. package/addon/components/citation-plugin/citation-card.hbs +118 -0
  16. package/addon/components/citation-plugin/citation-card.ts +230 -0
  17. package/addon/components/citation-plugin/citation-insert.hbs +20 -0
  18. package/addon/components/citation-plugin/citation-insert.ts +102 -0
  19. package/addon/components/{citaten-plugin → citation-plugin}/citations/article-list.hbs +2 -2
  20. package/addon/components/{citaten-plugin → citation-plugin}/citations/article-preview.hbs +0 -0
  21. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-detail.hbs +9 -6
  22. package/addon/components/{citaten-plugin/citations/decision-detail.js → citation-plugin/citations/decision-detail.ts} +30 -31
  23. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-list.hbs +2 -2
  24. package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-preview.hbs +0 -0
  25. package/addon/components/citation-plugin/citations/search-modal.hbs +254 -0
  26. package/addon/components/{citaten-plugin/citations/search-modal.js → citation-plugin/citations/search-modal.ts} +117 -90
  27. package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.hbs +0 -0
  28. package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.hbs +0 -0
  29. package/addon/components/import-snippet-plugin/card.ts +119 -0
  30. package/addon/components/insert-variable-plugin/insert-variable-card.hbs +2 -1
  31. package/addon/components/insert-variable-plugin/insert-variable-card.ts +134 -0
  32. package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-card.hbs → card.hbs} +3 -1
  33. package/addon/components/rdfa-date-plugin/card.ts +72 -0
  34. package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.hbs → date-time-picker.hbs} +0 -0
  35. package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.js → date-time-picker.ts} +26 -12
  36. package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-insert.hbs → insert.hbs} +0 -0
  37. package/addon/components/rdfa-date-plugin/insert.ts +45 -0
  38. package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +58 -0
  39. package/addon/components/roadsign-regulation-plugin/measure-template.ts +35 -0
  40. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +2 -2
  41. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +60 -0
  42. package/addon/components/roadsign-regulation-plugin/{roadsigns-modal.js → roadsigns-modal.ts} +103 -66
  43. package/addon/components/roadsign-regulation-plugin/{roadsigns-pagination.js → roadsigns-pagination.ts} +7 -3
  44. package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +32 -0
  45. package/addon/components/standard-template-plugin/{template-card.hbs → card.hbs} +0 -0
  46. package/addon/components/standard-template-plugin/card.ts +11 -0
  47. package/addon/components/standard-template-plugin/template-provider.hbs +3 -1
  48. package/addon/components/standard-template-plugin/template-provider.ts +75 -0
  49. package/addon/components/table-of-contents-plugin/card.hbs +12 -1
  50. package/addon/components/table-of-contents-plugin/card.ts +60 -0
  51. package/addon/components/table-of-contents-plugin/{inline-components → ember-nodes}/outline.hbs +2 -2
  52. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +9 -0
  53. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +95 -0
  54. package/addon/components/template-variable-plugin/template-variable-card.hbs +2 -1
  55. package/addon/components/template-variable-plugin/template-variable-card.ts +227 -0
  56. package/addon/helpers/{limit-text.js → limit-text.ts} +2 -2
  57. package/addon/models/instruction.ts +18 -0
  58. package/addon/models/measure.ts +38 -0
  59. package/addon/models/sign.ts +36 -0
  60. package/addon/models/template.ts +14 -0
  61. package/addon/plugins/article-structure-plugin/commands/index.ts +6 -0
  62. package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +80 -0
  63. package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +130 -0
  64. package/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.ts +26 -0
  65. package/addon/plugins/article-structure-plugin/commands/remove-structure.ts +21 -0
  66. package/addon/plugins/article-structure-plugin/commands/unwrap-structure.ts +40 -0
  67. package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +66 -0
  68. package/addon/plugins/article-structure-plugin/constants.ts +11 -0
  69. package/addon/plugins/article-structure-plugin/index.ts +70 -0
  70. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +94 -0
  71. package/addon/plugins/article-structure-plugin/structures/article.ts +129 -0
  72. package/addon/plugins/article-structure-plugin/structures/chapter.ts +83 -0
  73. package/addon/plugins/article-structure-plugin/structures/index.ts +33 -0
  74. package/addon/plugins/article-structure-plugin/structures/section.ts +82 -0
  75. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +65 -0
  76. package/addon/plugins/article-structure-plugin/structures/subsection.ts +83 -0
  77. package/addon/plugins/article-structure-plugin/structures/title.ts +83 -0
  78. package/addon/plugins/article-structure-plugin/utils/namespace.ts +25 -0
  79. package/addon/plugins/article-structure-plugin/utils/structure.ts +162 -0
  80. package/addon/plugins/besluit-plugin/commands/get-article-nodes-for-besluit.ts +30 -0
  81. package/addon/plugins/besluit-plugin/commands/index.ts +4 -0
  82. package/addon/plugins/besluit-plugin/commands/insert-article.ts +70 -0
  83. package/addon/plugins/besluit-plugin/commands/insert-title.ts +67 -0
  84. package/addon/plugins/besluit-plugin/commands/move-article.ts +69 -0
  85. package/addon/plugins/besluit-plugin/commands/recalculate-article-numbers.ts +44 -0
  86. package/addon/plugins/besluit-plugin/index.ts +11 -0
  87. package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +35 -0
  88. package/addon/plugins/besluit-type-plugin/index.ts +6 -0
  89. package/addon/{utils/fetchBesluitTypes.js → plugins/besluit-type-plugin/utils/fetchBesluitTypes.ts} +35 -16
  90. package/addon/plugins/citation-plugin/index.ts +216 -0
  91. package/addon/plugins/citation-plugin/marks/citation.ts +27 -0
  92. package/addon/plugins/citation-plugin/utils/cited-text.ts +17 -0
  93. package/addon/{utils/legislation-types.js → plugins/citation-plugin/utils/legislation-types.ts} +17 -3
  94. package/addon/plugins/citation-plugin/utils/process-match.ts +132 -0
  95. package/addon/{utils/vlaamse-codex.js → plugins/citation-plugin/utils/vlaamse-codex.ts} +160 -41
  96. package/addon/plugins/import-snippet-plugin.ts +6 -0
  97. package/addon/plugins/insert-variable-plugin/index.ts +11 -0
  98. package/addon/{utils/variable-plugins/default-variable-types.js → plugins/insert-variable-plugin/utils/constants.ts} +18 -7
  99. package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +41 -0
  100. package/addon/plugins/rdfa-date-plugin/commands/index.ts +1 -0
  101. package/addon/plugins/rdfa-date-plugin/commands/modify-date.ts +48 -0
  102. package/addon/plugins/rdfa-date-plugin/index.ts +11 -0
  103. package/addon/plugins/roadsign-regulation-plugin/index.ts +6 -0
  104. package/addon/plugins/roadsign-regulation-plugin/utils/constants.ts +8 -0
  105. package/addon/{utils/roadsign-regulation-plugin/fetchData.js → plugins/roadsign-regulation-plugin/utils/fetchData.ts} +20 -3
  106. package/addon/plugins/roadsign-regulation-plugin/utils/includeInstructions.ts +16 -0
  107. package/addon/plugins/standard-template-plugin/index.ts +6 -0
  108. package/addon/plugins/standard-template-plugin/utils/instantiate-uuids.ts +48 -0
  109. package/addon/plugins/table-of-contents-plugin/index.ts +14 -0
  110. package/addon/plugins/table-of-contents-plugin/nodes/index.ts +1 -0
  111. package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +53 -0
  112. package/addon/plugins/table-of-contents-plugin/utils/constants.ts +17 -0
  113. package/addon/plugins/template-variable-plugin/index.ts +6 -0
  114. package/addon/plugins/template-variable-plugin/utils/constants.ts +2 -0
  115. package/addon/plugins/template-variable-plugin/utils/fetch-data.ts +62 -0
  116. package/addon/services/{import-rdfa-snippet.js → import-rdfa-snippet.ts} +48 -36
  117. package/addon/services/roadsign-registry.ts +288 -0
  118. package/addon/services/{standard-template-plugin.js → standard-template-plugin.ts} +17 -11
  119. package/addon/utils/memoize.ts +8 -0
  120. package/addon/utils/option.ts +58 -0
  121. package/addon/utils/sparql-helpers.ts +27 -0
  122. package/app/components/article-structure-plugin/article-structure-card.js +1 -0
  123. package/app/components/article-structure-plugin/structure-card.js +1 -0
  124. package/app/components/{citaten-plugin/citaat-card.js → au-native-input.js} +1 -1
  125. package/app/components/{citaten-plugin/citations/article-list.js → besluit-plugin/besluit-context-card.js} +1 -1
  126. package/app/components/besluit-plugin/besluit-plugin-card.js +1 -0
  127. package/app/components/{citaten-plugin/citations/modal.js → citation-plugin/citation-card.js} +1 -1
  128. package/app/components/citation-plugin/citation-insert.js +1 -0
  129. package/app/components/{citaten-plugin/citations/decision-list.js → citation-plugin/citations/article-list.js} +1 -1
  130. package/app/components/{citaten-plugin → citation-plugin}/citations/article-preview.js +1 -1
  131. package/app/components/{citaten-plugin → citation-plugin}/citations/decision-detail.js +1 -1
  132. package/app/components/citation-plugin/citations/decision-list.js +1 -0
  133. package/app/components/{citaten-plugin → citation-plugin}/citations/decision-preview.js +1 -1
  134. package/app/components/citation-plugin/citations/modal.js +1 -0
  135. package/app/components/{citaten-plugin → citation-plugin}/citations/search-modal.js +1 -1
  136. package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.js +1 -1
  137. package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.js +1 -1
  138. package/app/components/{citaten-plugin/citaat-insert.js → rdfa-date-plugin/card.js} +1 -1
  139. package/app/components/rdfa-date-plugin/date-time-picker.js +1 -0
  140. package/app/components/rdfa-date-plugin/insert.js +1 -0
  141. package/app/components/standard-template-plugin/card.js +1 -0
  142. package/app/components/table-of-contents-plugin/ember-nodes/outline.js +1 -0
  143. package/app/components/table-of-contents-plugin/ember-nodes/table-of-contents.js +1 -0
  144. package/app/styles/citaten-plugin.scss +1 -1
  145. package/components/article-structure-plugin/article-structure-card.d.ts +17 -0
  146. package/components/article-structure-plugin/structure-card.d.ts +32 -0
  147. package/components/au-native-input.d.ts +20 -0
  148. package/components/besluit-plugin/besluit-context-card.d.ts +24 -0
  149. package/components/besluit-plugin/besluit-plugin-card.d.ts +14 -0
  150. package/components/besluit-type-plugin/besluit-type-select.d.ts +11 -0
  151. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +46 -0
  152. package/components/citation-plugin/citation-card.d.ts +51 -0
  153. package/components/citation-plugin/citation-insert.d.ts +24 -0
  154. package/components/citation-plugin/citations/decision-detail.d.ts +26 -0
  155. package/components/citation-plugin/citations/search-modal.d.ts +67 -0
  156. package/components/import-snippet-plugin/card.d.ts +19 -0
  157. package/components/insert-variable-plugin/insert-variable-card.d.ts +31 -0
  158. package/components/rdfa-date-plugin/card.d.ts +20 -0
  159. package/components/rdfa-date-plugin/date-time-picker.d.ts +32 -0
  160. package/components/rdfa-date-plugin/insert.d.ts +12 -0
  161. package/components/roadsign-regulation-plugin/expanded-measure.d.ts +20 -0
  162. package/components/roadsign-regulation-plugin/measure-template.d.ts +14 -0
  163. package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +12 -0
  164. package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +57 -0
  165. package/components/roadsign-regulation-plugin/roadsigns-pagination.d.ts +19 -0
  166. package/components/roadsign-regulation-plugin/roadsigns-table.d.ts +9 -0
  167. package/components/standard-template-plugin/card.d.ts +9 -0
  168. package/components/standard-template-plugin/template-provider.d.ts +17 -0
  169. package/components/table-of-contents-plugin/card.d.ts +20 -0
  170. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +22 -0
  171. package/components/template-variable-plugin/template-variable-card.d.ts +27 -0
  172. package/helpers/limit-text.d.ts +8 -0
  173. package/index.js +5 -0
  174. package/models/instruction.d.ts +8 -0
  175. package/models/measure.d.ts +14 -0
  176. package/models/sign.d.ts +12 -0
  177. package/models/template.d.ts +13 -0
  178. package/package.json +29 -8
  179. package/plugins/article-structure-plugin/commands/index.d.ts +6 -0
  180. package/plugins/article-structure-plugin/commands/insert-structure.d.ts +5 -0
  181. package/plugins/article-structure-plugin/commands/move-selected-structure.d.ts +10 -0
  182. package/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +3 -0
  183. package/plugins/article-structure-plugin/commands/remove-structure.d.ts +7 -0
  184. package/plugins/article-structure-plugin/commands/unwrap-structure.d.ts +8 -0
  185. package/plugins/article-structure-plugin/commands/wrap-structure-content.d.ts +8 -0
  186. package/plugins/article-structure-plugin/constants.d.ts +5 -0
  187. package/plugins/article-structure-plugin/index.d.ts +41 -0
  188. package/plugins/article-structure-plugin/structures/article-paragraph.d.ts +4 -0
  189. package/plugins/article-structure-plugin/structures/article.d.ts +6 -0
  190. package/plugins/article-structure-plugin/structures/chapter.d.ts +4 -0
  191. package/plugins/article-structure-plugin/structures/index.d.ts +17 -0
  192. package/plugins/article-structure-plugin/structures/section.d.ts +4 -0
  193. package/plugins/article-structure-plugin/structures/structure-header.d.ts +2 -0
  194. package/plugins/article-structure-plugin/structures/subsection.d.ts +4 -0
  195. package/plugins/article-structure-plugin/structures/title.d.ts +4 -0
  196. package/plugins/article-structure-plugin/utils/namespace.d.ts +6 -0
  197. package/plugins/article-structure-plugin/utils/structure.d.ts +20 -0
  198. package/plugins/besluit-plugin/commands/get-article-nodes-for-besluit.d.ts +5 -0
  199. package/plugins/besluit-plugin/commands/index.d.ts +4 -0
  200. package/plugins/besluit-plugin/commands/insert-article.d.ts +3 -0
  201. package/plugins/besluit-plugin/commands/insert-title.d.ts +2 -0
  202. package/plugins/besluit-plugin/commands/move-article.d.ts +2 -0
  203. package/plugins/besluit-plugin/commands/recalculate-article-numbers.d.ts +2 -0
  204. package/plugins/besluit-plugin/index.d.ts +3 -0
  205. package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +10 -0
  206. package/plugins/besluit-type-plugin/index.d.ts +2 -0
  207. package/plugins/besluit-type-plugin/utils/fetchBesluitTypes.d.ts +12 -0
  208. package/plugins/citation-plugin/index.d.ts +31 -0
  209. package/plugins/citation-plugin/marks/citation.d.ts +2 -0
  210. package/plugins/citation-plugin/utils/cited-text.d.ts +3 -0
  211. package/plugins/citation-plugin/utils/legislation-types.d.ts +24 -0
  212. package/plugins/citation-plugin/utils/process-match.d.ts +23 -0
  213. package/plugins/citation-plugin/utils/vlaamse-codex.d.ts +56 -0
  214. package/plugins/import-snippet-plugin.d.ts +2 -0
  215. package/plugins/insert-variable-plugin/index.d.ts +2 -0
  216. package/plugins/insert-variable-plugin/utils/constants.d.ts +7 -0
  217. package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +5 -0
  218. package/plugins/rdfa-date-plugin/commands/index.d.ts +1 -0
  219. package/plugins/rdfa-date-plugin/commands/modify-date.d.ts +2 -0
  220. package/plugins/rdfa-date-plugin/index.d.ts +3 -0
  221. package/plugins/roadsign-regulation-plugin/index.d.ts +2 -0
  222. package/plugins/roadsign-regulation-plugin/utils/constants.d.ts +3 -0
  223. package/plugins/roadsign-regulation-plugin/utils/fetchData.d.ts +8 -0
  224. package/plugins/roadsign-regulation-plugin/utils/includeInstructions.d.ts +2 -0
  225. package/plugins/standard-template-plugin/index.d.ts +2 -0
  226. package/plugins/standard-template-plugin/utils/instantiate-uuids.d.ts +15 -0
  227. package/plugins/table-of-contents-plugin/index.d.ts +3 -0
  228. package/plugins/table-of-contents-plugin/nodes/index.d.ts +1 -0
  229. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +4 -0
  230. package/plugins/table-of-contents-plugin/utils/constants.d.ts +7 -0
  231. package/plugins/template-variable-plugin/index.d.ts +2 -0
  232. package/plugins/template-variable-plugin/utils/constants.d.ts +1 -0
  233. package/plugins/template-variable-plugin/utils/fetch-data.d.ts +9 -0
  234. package/services/import-rdfa-snippet.d.ts +99 -0
  235. package/services/roadsign-registry.d.ts +42 -0
  236. package/services/standard-template-plugin.d.ts +21 -0
  237. package/translations/en-US.yaml +64 -1
  238. package/translations/nl-BE.yaml +66 -3
  239. package/tsconfig.json +34 -9
  240. package/types/config/environment.d.ts +22 -0
  241. package/types/ember-mu-transform-helpers/transforms/string-set.d.ts +14 -0
  242. package/types/lblod/frontend-gelinkt-notuleren/models/account.d.ts +10 -0
  243. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid-classificatie-code.d.ts +10 -0
  244. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid.d.ts +12 -0
  245. package/types/lblod/frontend-gelinkt-notuleren/models/gebruiker-model.d.ts +18 -0
  246. package/types/lblod/frontend-gelinkt-notuleren/services/current-session.d.ts +30 -0
  247. package/types/lblod/marawa/dom-helpers.d.ts +4 -0
  248. package/types/lblod/marawa/ember-object-mock.d.ts +3 -0
  249. package/types/lblod/marawa/node-walker.d.ts +18 -0
  250. package/types/lblod/marawa/range-helpers.d.ts +10 -0
  251. package/types/lblod/marawa/rdfa-attributes.d.ts +25 -0
  252. package/types/lblod/marawa/rdfa-block.d.ts +22 -0
  253. package/types/lblod/marawa/rdfa-context-scanner.d.ts +13 -0
  254. package/types/lblod/marawa/rdfa-helpers.d.ts +22 -0
  255. package/types/lblod/marawa/rich-node.d.ts +50 -0
  256. package/types/lblod/marawa/triple.d.ts +16 -0
  257. package/utils/memoize.d.ts +1 -0
  258. package/utils/option.d.ts +14 -0
  259. package/utils/sparql-helpers.d.ts +7 -0
  260. package/addon/commands/generate-template-command.js +0 -35
  261. package/addon/commands/insert-and-collapse.js +0 -32
  262. package/addon/commands/modify-date-command.js +0 -42
  263. package/addon/components/besluit-type-plugin/toolbar-dropdown.js +0 -188
  264. package/addon/components/citaten-plugin/citaat-card.hbs +0 -76
  265. package/addon/components/citaten-plugin/citaat-card.js +0 -286
  266. package/addon/components/citaten-plugin/citaat-insert.hbs +0 -20
  267. package/addon/components/citaten-plugin/citaat-insert.js +0 -68
  268. package/addon/components/citaten-plugin/citations/search-modal.hbs +0 -175
  269. package/addon/components/import-snippet-plugin/card.js +0 -95
  270. package/addon/components/insert-variable-plugin/insert-variable-card.js +0 -125
  271. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -71
  272. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -24
  273. package/addon/components/roadsign-regulation-plugin/expanded-measure.js +0 -38
  274. package/addon/components/roadsign-regulation-plugin/measure-template.js +0 -30
  275. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.js +0 -101
  276. package/addon/components/roadsign-regulation-plugin/roadsigns-table.js +0 -24
  277. package/addon/components/standard-template-plugin/template-card.js +0 -7
  278. package/addon/components/standard-template-plugin/template-provider.js +0 -75
  279. package/addon/components/table-of-contents-plugin/card.js +0 -53
  280. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.hbs +0 -9
  281. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -100
  282. package/addon/components/template-variable-plugin/template-variable-card.js +0 -230
  283. package/addon/constants.js +0 -24
  284. package/addon/initializers/plugin-initializer.js +0 -75
  285. package/addon/inline-components/table-of-contents.js +0 -43
  286. package/addon/marks/citaten-mark.js +0 -32
  287. package/addon/models/instruction.js +0 -19
  288. package/addon/models/measure.js +0 -46
  289. package/addon/models/sign.js +0 -37
  290. package/addon/models/template.js +0 -9
  291. package/addon/plugins/besluit-type-plugin.js +0 -16
  292. package/addon/plugins/citaten-plugin.js +0 -22
  293. package/addon/plugins/generate-template-plugin.js +0 -16
  294. package/addon/plugins/import-snippet-plugin.js +0 -16
  295. package/addon/plugins/insert-variable-plugin.js +0 -19
  296. package/addon/plugins/rdfa-date-plugin.js +0 -26
  297. package/addon/plugins/roadsign-regulation-plugin.js +0 -24
  298. package/addon/plugins/standard-template-plugin.js +0 -33
  299. package/addon/plugins/table-of-contents-plugin.js +0 -27
  300. package/addon/plugins/template-variable-plugin.js +0 -21
  301. package/addon/services/roadsign-registry.js +0 -240
  302. package/addon/utils/generate-template-plugin/default-resources.js +0 -9
  303. package/addon/utils/instantiate-uuids.js +0 -34
  304. package/addon/utils/memoize.js +0 -8
  305. package/addon/utils/processMatch.js +0 -80
  306. package/addon/utils/roadsign-regulation-plugin/includeInstructions.js +0 -10
  307. package/addon/utils/variable-plugins/fetch-data.js +0 -98
  308. package/app/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -1
  309. package/app/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -1
  310. package/app/components/rdfa-date-plugin/rdfa-date-time-picker.js +0 -1
  311. package/app/components/standard-template-plugin/template-card.js +0 -1
  312. package/app/components/table-of-contents-plugin/inline-components/outline.js +0 -1
  313. package/app/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -1
  314. package/app/initializers/plugin-initializer.js +0 -4
  315. package/types/dummy/index.d.ts +0 -1
  316. package/types/ember-data/types/registries/model.d.ts +0 -6
@@ -1,286 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { tracked } from '@glimmer/tracking';
3
- // import { task } from 'ember-concurrency-decorators';
4
- import { task, timeout } from 'ember-concurrency';
5
- import { action } from '@ember/object';
6
- import { capitalize } from '@ember/string';
7
- import processMatch from '../../utils/processMatch';
8
- import { cleanCaches, fetchDecisions } from '../../utils/vlaamse-codex';
9
- import {
10
- LEGISLATION_TYPE_CONCEPTS,
11
- LEGISLATION_TYPES,
12
- } from '../../utils/legislation-types';
13
- import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
14
-
15
- const BASIC_MULTIPLANE_CHARACTER = '\u0021-\uFFFF'; // most of the characters used around the world
16
-
17
- // Regex nicely structured:
18
- // (
19
- // (
20
- // \w*decreet |
21
- // omzendbrief |
22
- // verdrag |
23
- // grondwetswijziging |
24
- // samenwerkingsakkoord |
25
- // \w*wetboek |
26
- // protocol |
27
- // besluit[^\S\n]van[^\S\n]de[^\S\n]vlaamse[^\S\n]regering |
28
- // geco[öo]rdineerde wetten |
29
- // \w*wet |
30
- // koninklijk[^\S\n]?besluit |
31
- // ministerieel[^\S\n]?besluit |
32
- // genummerd[^\S\n]?koninklijk[^\S\n]?besluit
33
- // )
34
- // [^\S\n]*
35
- // (
36
- // ([^\S\n] | [\u0021-\uFFFF\d;:'"()&\-_]){3,}
37
- // )?
38
- // )
39
- const NNWS = '[^\\S\\n]';
40
- const CITATION_REGEX = new RegExp(
41
- `((\\w*decreet|omzendbrief|verdrag|grondwetswijziging|samenwerkingsakkoord|\\w*wetboek|protocol|besluit${NNWS}van${NNWS}de${NNWS}vlaamse${NNWS}regering|geco[öo]rdineerde${NNWS}wetten|\\w*wet|koninklijk${NNWS}?besluit|ministerieel${NNWS}?besluit|genummerd${NNWS}?koninklijk${NNWS}?besluit|\\w*${NNWS}?besluit)${NNWS}*((${NNWS}|[${BASIC_MULTIPLANE_CHARACTER};:'"()&-_]){3,})?)`,
42
- 'uig'
43
- );
44
-
45
- export default class CitaatCardComponent extends Component {
46
- @tracked pageNumber = 0;
47
- @tracked pageSize = 5;
48
- @tracked totalSize;
49
- @tracked decisions = [];
50
- @tracked error;
51
- @tracked showModal = false;
52
- @tracked showCard = false;
53
- @tracked decision;
54
- @tracked legislationTypeUri;
55
- @tracked legislationTypeUriAfterTimeout;
56
- @tracked text;
57
- @tracked textAfterTimeout;
58
- @tracked markSelected;
59
- liveHighlights;
60
-
61
- constructor() {
62
- super(...arguments);
63
- this.liveHighlights = this.args.controller.createLiveMarkSet({
64
- datastoreQuery: (datastore) => {
65
- const matches = datastore
66
- .match(null, '>http://data.vlaanderen.be/ns/besluit#motivering')
67
- .searchTextIn('predicate', CITATION_REGEX);
68
- const resultMatches = matches.filter((match) => {
69
- return (
70
- datastore
71
- .limitToRange(match.range, {
72
- type: 'rangeTouches',
73
- includeEndTags: true,
74
- })
75
- .match(null, '>http://data.europa.eu/eli/ontology#cites').size ===
76
- 0
77
- );
78
- });
79
- resultMatches.forEach((match) => (match.range = match.groupRanges[1]));
80
- return resultMatches;
81
- },
82
-
83
- liveMarkSpecs: [
84
- {
85
- name: 'citaten',
86
- attributesBuilder: (textMatch) => {
87
- const result = processMatch(textMatch);
88
- return {
89
- setBy: 'citaten-plugin',
90
- text: result.text,
91
- legislationTypeUri: result.legislationTypeUri,
92
- };
93
- },
94
- },
95
- 'highlighted',
96
- ],
97
- });
98
- this.controller.onEvent(
99
- 'selectionChanged',
100
- this.onSelectionChanged.bind(this)
101
- );
102
- }
103
-
104
- onSelectionChanged() {
105
- const range = this.controller.selection.lastRange;
106
- if (!range) {
107
- return;
108
- }
109
- const marks = range.getMarks();
110
- let selectionMark;
111
- for (let mark of marks) {
112
- if (mark.name === 'citaten') {
113
- selectionMark = mark;
114
- break;
115
- }
116
- }
117
- if (selectionMark) {
118
- if (this.showCard) {
119
- //Card was already shown, update search condition and trigger search debounced
120
- this.text = selectionMark.attributes.text;
121
- this.legislationTypeUri = selectionMark.attributes.legislationTypeUri;
122
- this.markSelected = selectionMark;
123
- this.updateSearch.perform();
124
- } else {
125
- //When card is renderend first time, the resource will automatically trigger, no updateSearch is needed, but make sure to first set the search conditions, before showing the card.
126
- //When not first time, but reopened, search terms could not have changed yet, so also no updateSearch needed
127
- this.text = selectionMark.attributes.text;
128
- this.legislationTypeUri = selectionMark.attributes.legislationTypeUri;
129
- if (
130
- this.legislationTypeUriAfterTimeout &&
131
- (this.legislationTypeUri !== this.legislationTypeUriAfterTimeout ||
132
- this.text !== this.textAfterTimeout)
133
- ) {
134
- //Convoluted, but this is when you switch from one reference insertion to another
135
- this.updateSearchImmediate.perform();
136
- }
137
- this.markSelected = selectionMark;
138
- this.showCard = true;
139
- }
140
- } else {
141
- this.showCard = false;
142
- //Would be nice, but this triggers way to often causing the cancellation of useful requests
143
- //this.decisionResource.cancel();
144
- }
145
- }
146
-
147
- get controller() {
148
- return this.args.controller;
149
- }
150
-
151
- get legislationTypes() {
152
- return Object.keys(LEGISLATION_TYPES).map(capitalize);
153
- }
154
-
155
- get legislationSelected() {
156
- const found = LEGISLATION_TYPE_CONCEPTS.find(
157
- (c) => c.value === this.legislationTypeUri
158
- );
159
- return capitalize(found ? found.label : LEGISLATION_TYPE_CONCEPTS[0].label);
160
- }
161
-
162
- decisionResource = trackedTask(this, this.resourceSearch, () => [
163
- this.textAfterTimeout,
164
- this.legislationTypeUriAfterTimeout,
165
- this.pageNumber,
166
- this.pageSize,
167
- ]);
168
-
169
- @task({ restartable: true })
170
- *updateSearch() {
171
- yield timeout(500);
172
- this.textAfterTimeout = this.text;
173
- this.legislationTypeUriAfterTimeout = this.legislationTypeUri;
174
- }
175
-
176
- @task({ restartable: true })
177
- *updateSearchImmediate() {
178
- this.textAfterTimeout = this.text;
179
- this.legislationTypeUriAfterTimeout = this.legislationTypeUri;
180
- yield;
181
- }
182
-
183
- @task({ restartable: true })
184
- *resourceSearch() {
185
- this.error = null;
186
- yield undefined; //To prevent other variables used below (this.text and this.legislationTypeUri) to trigger a retrigger.
187
- const abortController = new AbortController();
188
- const signal = abortController.signal;
189
- try {
190
- // Split search string by grouping on non-whitespace characters
191
- // This probably needs to be more complex to search on group of words
192
- const words =
193
- (this.textAfterTimeout || this.text || '').match(/\S+/g) || [];
194
- const filter = {
195
- type: this.legislationTypeUriAfterTimeout || this.legislationTypeUri,
196
- };
197
- const results = yield fetchDecisions(
198
- words,
199
- filter,
200
- this.pageNumber,
201
- this.pageSize,
202
- signal
203
- );
204
- this.totalCount = results.totalCount;
205
- return results.decisions;
206
- } catch (e) {
207
- console.warn(e); // eslint-ignore-line no-console
208
- this.totalCount = 0;
209
- this.error = e;
210
- return [];
211
- } finally {
212
- //Abort all requests now that this task has either successfully finished or has been cancelled
213
- abortController.abort();
214
- }
215
- }
216
-
217
- @action
218
- selectLegislationType(type) {
219
- type = type.toLowerCase();
220
- const found = LEGISLATION_TYPE_CONCEPTS.find(
221
- (c) => c.label.toLowerCase() === type
222
- );
223
- this.legislationTypeUri = found
224
- ? found.value
225
- : LEGISLATION_TYPE_CONCEPTS[0].value;
226
- this.legislationTypeUriAfterTimeout = this.legislationTypeUri;
227
- }
228
-
229
- @action
230
- openDecisionDetailModal(decision) {
231
- this.decision = decision;
232
- this.showModal = true;
233
- }
234
-
235
- @action
236
- openSearchModal() {
237
- this.decisionResource.cancel();
238
- this.decision = null;
239
- this.showModal = true;
240
- }
241
-
242
- @action
243
- closeModal(lastSearchType, lastSearchTerm) {
244
- this.showModal = false;
245
- this.decision = null;
246
- if (lastSearchType) this.legislationTypeUri = lastSearchType;
247
- if (lastSearchTerm) this.text = lastSearchTerm;
248
- if (lastSearchType || lastSearchTerm) this.updateSearchImmediate.perform();
249
- }
250
-
251
- @action
252
- insertDecisionCitation(decision) {
253
- const type = decision.legislationType.label;
254
- const uri = decision.uri;
255
- const title = decision.title;
256
- const range = this.controller.rangeFactory.fromAroundNode(
257
- this.markSelected.node
258
- );
259
- const citationHtml = `${
260
- type ? type : ''
261
- } <a class="annotation" href="${uri}" property="eli:cites" typeof="eli:LegalExpression">${title}</a>&nbsp;`;
262
- this.controller.executeCommand('insert-html', citationHtml, range);
263
- }
264
-
265
- @action
266
- insertArticleCitation(decision, article) {
267
- const type = decision.legislationType.label;
268
- const uri = article.uri;
269
- const title = `${decision.title}, ${article.number}`;
270
- const range = this.controller.rangeFactory.fromAroundNode(
271
- this.markSelected.node
272
- );
273
- const citationHtml = `${
274
- type ? type : ''
275
- } <a class="annotation" href="${uri}" property="eli:cites" typeof="eli:LegalExpression">${title}</a>&nbsp;`;
276
- this.controller.executeCommand('insert-html', citationHtml, range);
277
- }
278
-
279
- async willDestroy() {
280
- // Not necessary as ember-concurrency does this for us.
281
- // this.decisionResource.cancel();
282
- cleanCaches();
283
- this.liveHighlights.destroy();
284
- super.willDestroy();
285
- }
286
- }
@@ -1,20 +0,0 @@
1
- <AuList::Item>
2
- <AuButton
3
- @icon="add"
4
- @iconAlignment="left"
5
- @skin="link"
6
- @disabled={{this.disableInsert}}
7
- {{on 'click' this.openModal}}>
8
- {{t "citaten-plugin.insert.title"}}
9
- </AuButton>
10
- </AuList::Item>
11
-
12
- {{#if this.showModal}}
13
- <CitatenPlugin::Citations::SearchModal
14
- @closeModal={{this.closeModal}}
15
- @insertDecisionCitation={{this.insertDecisionCitation}}
16
- @insertArticleCitation={{this.insertArticleCitation}}
17
- @legislationTypeUri={{this.legislationTypeUri}}
18
- @text={{this.text}}
19
- />
20
- {{/if}}
@@ -1,68 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
- import { tracked } from '@glimmer/tracking';
4
- import { LEGISLATION_TYPES } from '../../utils/legislation-types';
5
- export default class EditorPluginsCitaatInsertComponent extends Component {
6
- @tracked disableInsert = false;
7
- @tracked showModal = false;
8
- @tracked legislationTypeUri = LEGISLATION_TYPES.decreet;
9
- @tracked text = '';
10
-
11
- constructor() {
12
- super(...arguments);
13
- this.args.controller.onEvent(
14
- 'selectionChanged',
15
- this.onSelectionChanged.bind(this)
16
- );
17
- }
18
-
19
- onSelectionChanged() {
20
- const selectedRange = this.args.controller.selection.lastRange;
21
- if (!selectedRange) {
22
- return;
23
- }
24
- const limitedDatastore = this.args.controller.datastore.limitToRange(
25
- selectedRange,
26
- 'rangeIsInside'
27
- );
28
- const motivering = limitedDatastore
29
- .match(null, '>http://data.vlaanderen.be/ns/besluit#motivering')
30
- .asQuads()
31
- .next().value;
32
- this.disableInsert = motivering ? false : true;
33
- }
34
-
35
- @action
36
- openModal() {
37
- this.showModal = true;
38
- }
39
-
40
- @action
41
- closeModal() {
42
- this.showModal = false;
43
- }
44
-
45
- @action
46
- insertDecisionCitation(decision) {
47
- const type = decision.legislationType.label;
48
- const uri = decision.uri;
49
- const title = decision.title;
50
- const range = this.args.controller.selection.lastRange;
51
- const citationHtml = `${
52
- type ? type : ''
53
- } <a class="annotation" href="${uri}" property="eli:cites" typeof="eli:LegalExpression">${title}</a>&nbsp;`;
54
- this.args.controller.executeCommand('insert-html', citationHtml, range);
55
- }
56
-
57
- @action
58
- insertArticleCitation(decision, article) {
59
- const type = decision.legislationType.label;
60
- const uri = article.uri;
61
- const title = `${decision.title}, ${article.number}`;
62
- const range = this.args.controller.selection.lastRange;
63
- const citationHtml = `${
64
- type ? type : ''
65
- } <a class="annotation" href="${uri}" property="eli:cites" typeof="eli:LegalExpression">${title}</a>&nbsp;`;
66
- this.args.controller.executeCommand('insert-html', citationHtml, range);
67
- }
68
- }
@@ -1,175 +0,0 @@
1
- <AuModal
2
- @modalOpen={{true}}
3
- @closeModal={{fn this.closeModal this.legislationTypeUri this.text}}
4
- @title={{t "citaten-plugin.card.title"}}
5
- @size="large"
6
- @padding="none" as |modal|>
7
- {{#if this.selectedDecision}}
8
- <modal.Body>
9
- <CitatenPlugin::Citations::DecisionDetail
10
- @insertDecisionCitation={{this.insertDecisionCitation}}
11
- @insertArticleCitation={{this.insertArticleCitation}}
12
- @close={{this.closeDecisionDetail}}
13
- @decision={{this.selectedDecision}} />
14
- </modal.Body>
15
- {{else}}
16
- <modal.Body>
17
- <AuMainContainer class="citaten--main-container" as |mc|>
18
- <mc.sidebar class="citaten--sidebar" @scroll={{true}}>
19
- <div class="au-c-sidebar">
20
- <div class="au-c-sidebar__content au-u-padding">
21
- <AuLabel class="au-margin-bottom-small" for="typeofdocumentexpanded" @inline={{false}} @required={{false}} @error={{false}} @warning={{false}}>{{t "citaten-plugin.search.type"}}</AuLabel>
22
- <PowerSelect
23
- id="typeofdocumentexpanded"
24
- @renderInPlace={{true}}
25
- @allowClear={{false}}
26
- @disabled={{false}}
27
- @searchEnabled={{true}}
28
- @loadingMessage={{t "citaten-plugin.alert.loading"}}
29
- @noMatchesMessage={{t "citaten-plugin.alert.no-results"}}
30
- @searchMessage={{t "citaten-plugin.search.placeholder"}}
31
- @options={{this.legislationTypes}}
32
- @selected={{this.legislationSelected}}
33
- @onChange={{this.selectLegislationType}}
34
- as |type|>
35
- {{type}}
36
- </PowerSelect>
37
- <AuLabel class="au-u-margin-top au-margin-bottom-small" for="searchtermexpanded" @inline={{false}} @required={{false}} @error={{false}} @warning={{false}}>{{t "citaten-plugin.search.term"}}</AuLabel>
38
- <AuInput
39
- id="searchtermexpanded"
40
- @type="text"
41
- @width="block"
42
- @icon="search"
43
- @iconAlignment="right"
44
- @value={{this.text}}
45
- placeholder={{t "citaten-plugin.search.placeholder"}}
46
- {{on "input" (perform this.updateSearch)}}/>
47
- <AuHr @size="large" />
48
- {{! Date of document }}
49
- <AuLabel class="au-u-margin-top au-u-margin-bottom-small" for="search-codex-datum-document-van" @inline={{false}}>{{t "citaten-plugin.search.date-document"}}</AuLabel>
50
- {{! From }}
51
- <AuFormRow @alignment="pre" class="au-u-margin-bottom-tiny">
52
- <AuLabel for="search-codex-datum-document-van" class="au-u-hidden-visually">{{t "citaten-plugin.search.date-document-from"}}</AuLabel>
53
- <AuLabel for="search-codex-datum-document-van" aria-hidden="true" class="au-u-1-4" @inline={{true}}>{{t "citaten-plugin.search.from"}}</AuLabel>
54
- <AuDatePicker
55
- @id="search-codex-datum-document-van"
56
- @alignment="top"
57
- @onChange={{this.updateDocumentDateFrom}}
58
- @value={{this.documentDateFrom}}
59
- @min={{this.minDate}}
60
- @max={{this.maxDate}}
61
- @localization={{this.datePickerLocalization}} />
62
- </AuFormRow>
63
- {{! To }}
64
- <AuFormRow @alignment="pre">
65
- <AuLabel for="search-codex-datum-document-tot" class="au-u-hidden-visually">{{t "citaten-plugin.search.date-document-to"}}</AuLabel>
66
- <AuLabel for="search-codex-datum-document-tot" aria-hidden="true" class="au-u-1-4" @inline={{true}}>{{t "citaten-plugin.search.to"}}</AuLabel>
67
- <AuDatePicker
68
- @id="search-codex-datum-document-tot"
69
- @alignment="top"
70
- @onChange={{this.updateDocumentDateTo}}
71
- @value={{this.documentDateTo}}
72
- @min={{this.minDate}}
73
- @max={{this.maxDate}}
74
- @localization={{this.datePickerLocalization}} />
75
- </AuFormRow>
76
-
77
- {{! Date of staatsblad }}
78
- <AuLabel class="au-u-margin-top au-u-margin-bottom-small" for="search-codex-datum-staatsblad-van" @inline={{false}}>{{t "citaten-plugin.search.date-publication"}}</AuLabel>
79
- {{! From }}
80
- <AuFormRow @alignment="pre" class="au-u-margin-bottom-tiny">
81
- <AuLabel for="search-codex-datum-staatsblad-van" class="au-u-hidden-visually">{{t "citaten-plugin.search.date-publication-from"}}</AuLabel>
82
- <AuLabel for="search-codex-datum-staatsblad-van" aria-hidden="true" class="au-u-1-4" @inline={{true}}>{{t "citaten-plugin.search.from"}}</AuLabel>
83
- <AuDatePicker
84
- @id="search-codex-datum-staatsblad-van"
85
- @alignment="top"
86
- @onChange={{this.updatePublicationDateFrom}}
87
- @value={{this.publicationDateFrom}}
88
- @min={{this.minDate}}
89
- @max={{this.maxDate}}
90
- @localization={{this.datePickerLocalization}} />
91
- </AuFormRow>
92
- {{! To }}
93
- <AuFormRow @alignment="pre">
94
- <AuLabel for="search-codex-datum-staatsblad-tot" class="au-u-hidden-visually">{{t "citaten-plugin.search.date-publication-to"}}</AuLabel>
95
- <AuLabel for="search-codex-datum-staatsblad-tot" aria-hidden="true" class="au-u-1-4" @inline={{true}}>{{t "citaten-plugin.search.to"}}</AuLabel>
96
- <AuDatePicker
97
- @id="search-codex-datum-staatsblad-tot"
98
- @alignment="top"
99
- @onChange={{this.updatePublicationDateTo}}
100
- @value={{this.publicationDateTo}}
101
- @min={{this.minDate}}
102
- @max={{this.maxDate}}
103
- @localization={{this.datePickerLocalization}} />
104
- </AuFormRow>
105
- </div>
106
- </div>
107
- </mc.sidebar>
108
- <mc.content>
109
- {{#if this.decisionResource.isRunning}}
110
- <div class="au-u-margin">
111
- <AuLoader @padding="large" />
112
- <span class="au-u-hidden-visually">{{t "citaten-plugin.alert.loading"}}</span>
113
- </div>
114
- {{else}}
115
- {{#if this.error}}
116
- <CitatenPlugin::Helpers::AlertLoadError @fullSize={{true}} @error={{this.error}} class="au-u-margin"/>
117
- {{else}}
118
- {{#if this.decisionResource.value.length}}
119
- <div class="citaten--container-content au-u-padding-top-small au-u-padding-bottom-small">
120
- <CitatenPlugin::Citations::DecisionList
121
- @decisions={{this.decisionResource.value}}
122
- @onCitationInsert={{this.insertDecisionCitation}}
123
- @onCitationDetails={{this.openDecisionDetail}}
124
- @fullSize={{true}} />
125
- </div>
126
- {{else}}
127
- <CitatenPlugin::Helpers::AlertNoItems @fullSize={{true}} class="au-u-margin" />
128
- {{/if}}
129
- {{/if}}
130
- {{/if}}
131
- {{#if this.decisionResource.value.length}}
132
- {{! Pagination in the footer of the dialog }}
133
- <div class="citaten--container-footer au-u-background-gray-100">
134
- <AuToolbar
135
- @border="top"
136
- @size="large"
137
- @nowrap={{true}}>
138
- <div class="au-c-pagination">
139
- <p>
140
- <span class="au-u-hidden-visually">{{t "citaten-plugin.search.results"}}</span>
141
- <strong>
142
- {{this.rangeStart}} - {{this.rangeEnd}}
143
- </strong>
144
- {{t "citaten-plugin.pagination.of"}}
145
- {{this.totalCount}}
146
- </p>
147
- <div class="au-c-pagination__list-item">
148
- {{#unless this.isFirstPage}}
149
- <AuButton
150
- @skin="link"
151
- @icon="nav-left"
152
- @iconAlignment="left"
153
- {{on "click" this.previousPage}}>
154
- {{t "citaten-plugin.pagination.previous"}}
155
- </AuButton>
156
- {{/unless}}
157
- {{#unless this.isLastPage}}
158
- <AuButton
159
- @skin="link"
160
- @icon="nav-right"
161
- @iconAlignment="right"
162
- {{on "click" this.nextPage}}>
163
- {{t "citaten-plugin.pagination.next"}}
164
- </AuButton>
165
- {{/unless}}
166
- </div>
167
- </div>
168
- </AuToolbar>
169
- </div>
170
- {{/if}}
171
- </mc.content>
172
- </AuMainContainer>
173
- </modal.Body>
174
- {{/if}}
175
- </AuModal>
@@ -1,95 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { inject as service } from '@ember/service';
3
- import { action } from '@ember/object';
4
- import { tracked } from '@glimmer/tracking';
5
-
6
- export default class ImportSnippetPluginCard extends Component {
7
- @service importRdfaSnippet;
8
- @tracked snippets = [];
9
- @tracked besluitNode;
10
-
11
- constructor() {
12
- super(...arguments);
13
- this.args.controller.onEvent(
14
- 'selectionChanged',
15
- this.selectionChangedHandler
16
- );
17
- }
18
-
19
- @action
20
- selectionChangedHandler() {
21
- const { controller } = this.args;
22
- const selectedRange = controller.selection.lastRange;
23
- if (!selectedRange) {
24
- console.info(
25
- 'Selection did not have a range, skipping handling of the selectionChanged event'
26
- );
27
- return;
28
- }
29
- this.snippets = this.importRdfaSnippet.snippetsForType('roadsign');
30
- const limitedDatastore = controller.datastore.limitToRange(
31
- selectedRange,
32
- 'rangeIsInside'
33
- );
34
- const besluit = limitedDatastore
35
- .match(null, 'a', '>http://data.vlaanderen.be/ns/besluit#Besluit')
36
- .asSubjectNodes()
37
- .next().value;
38
- if (besluit) {
39
- this.besluitNode = [...besluit.nodes][0];
40
- } else {
41
- this.besluitNode = undefined;
42
- }
43
- }
44
-
45
- @action
46
- insert(snippet, type) {
47
- const html = this.generateSnippetHtml(snippet, type);
48
- let rangeToInsert;
49
- if (this.besluitNode) {
50
- rangeToInsert = this.args.controller.rangeFactory.fromInNode(
51
- this.besluitNode,
52
- this.besluitNode.getMaxOffset(),
53
- this.besluitNode.getMaxOffset()
54
- );
55
- } else {
56
- rangeToInsert = this.args.controller.selection.lastRange;
57
- }
58
- if (rangeToInsert) {
59
- this.args.controller.executeCommand('insert-html', html, rangeToInsert);
60
- this.importRdfaSnippet.removeSnippet(snippet);
61
- } else {
62
- console.warn('Could not find a range to insert, so we skipped inserting');
63
- }
64
- }
65
-
66
- generateSnippetHtml(snippet, type) {
67
- if (type === 'attachment') {
68
- return `
69
- <div property="http://lblod.data.gift/vocabularies/editor/isLumpNode">
70
- <div
71
- resource="${snippet.source}"
72
- property="http://data.europa.eu/eli/ontology#related_to"
73
- typeof="http://xmlns.com/foaf/0.1/Document http://lblod.data.gift/vocabularies/editor/SnippetAttachment"
74
- >
75
- Bijlage uit externe bron <a href="${snippet.source}">${
76
- new URL(snippet.source).hostname
77
- }</a>
78
- <div property="http://www.w3.org/ns/prov#value">${
79
- snippet.content
80
- }</div>
81
- </div>
82
- </div>
83
- `;
84
- } else {
85
- return `
86
- <div property="http://lblod.data.gift/vocabularies/editor/isLumpNode">
87
- Bijlage uit externe bron
88
- <div property="http://data.europa.eu/eli/ontology#related_to" resource="${snippet.source}">
89
- <div property="http://www.w3.org/ns/prov#value">${snippet.content}</div>
90
- </div>
91
- </div>
92
- `;
93
- }
94
- }
95
- }