@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
@@ -0,0 +1,80 @@
1
+ import {
2
+ Command,
3
+ NodeSelection,
4
+ TextSelection,
5
+ } from '@lblod/ember-rdfa-editor';
6
+ import recalculateStructureNumbers from './recalculate-structure-numbers';
7
+ import { StructureSpec } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
8
+ import { findAncestorOfType } from '../utils/structure';
9
+ import wrapStructureContent from './wrap-structure-content';
10
+ import IntlService from 'ember-intl/services/intl';
11
+
12
+ const insertStructure = (
13
+ structureSpec: StructureSpec,
14
+ intl: IntlService
15
+ ): Command => {
16
+ return (state, dispatch) => {
17
+ const { schema, selection } = state;
18
+ const contextNodeTypes = structureSpec.context
19
+ .map((nodeType) => schema.nodes[nodeType])
20
+ .filter((nodeSpec) => !!nodeSpec);
21
+ const parent = findAncestorOfType(selection, ...contextNodeTypes);
22
+ if (!parent) {
23
+ return false;
24
+ }
25
+ const { depth } = parent;
26
+ const index = selection.$from.index(depth);
27
+ if (
28
+ !parent.node.canReplaceWith(
29
+ index + 1,
30
+ index + 1,
31
+ schema.nodes[structureSpec.name]
32
+ )
33
+ ) {
34
+ return wrapStructureContent(structureSpec, parent, intl)(state, dispatch);
35
+ }
36
+ if (dispatch) {
37
+ const { node: newStructureNode, selectionConfig } =
38
+ structureSpec.constructor({ schema, intl });
39
+ const transaction = state.tr;
40
+ let insertRange: { from: number; to: number };
41
+ if (
42
+ parent.node.childCount === 1 &&
43
+ parent.node.firstChild?.type === schema.nodes['paragraph'] &&
44
+ parent.node.firstChild.firstChild?.type === schema.nodes['placeholder']
45
+ ) {
46
+ insertRange = {
47
+ from: parent.pos + 1,
48
+ to: parent.pos + parent.node.nodeSize - 1,
49
+ };
50
+ } else {
51
+ insertRange = {
52
+ from: selection.$from.after(depth + 1),
53
+ to: selection.$from.after(depth + 1),
54
+ };
55
+ }
56
+
57
+ transaction.replaceWith(
58
+ insertRange.from,
59
+ insertRange.to,
60
+ newStructureNode
61
+ );
62
+ const newSelection =
63
+ selectionConfig.type === 'node'
64
+ ? NodeSelection.create(
65
+ transaction.doc,
66
+ insertRange.from + selectionConfig.relativePos
67
+ )
68
+ : TextSelection.create(
69
+ transaction.doc,
70
+ insertRange.from + selectionConfig.relativePos
71
+ );
72
+ transaction.setSelection(newSelection);
73
+ recalculateStructureNumbers(transaction, structureSpec);
74
+ dispatch(transaction);
75
+ }
76
+ return true;
77
+ };
78
+ };
79
+
80
+ export default insertStructure;
@@ -0,0 +1,130 @@
1
+ import {
2
+ Command,
3
+ NodeSelection,
4
+ NodeType,
5
+ PNode,
6
+ Schema,
7
+ TextSelection,
8
+ } from '@lblod/ember-rdfa-editor';
9
+ import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
10
+ import { ArticleStructurePluginOptions } from '..';
11
+ import { findAncestorOfType } from '../utils/structure';
12
+ import recalculateStructureNumbers from './recalculate-structure-numbers';
13
+ import { findNodes } from '@lblod/ember-rdfa-editor/utils/position-utils';
14
+ import IntlService from 'ember-intl/services/intl';
15
+ const moveSelectedStructure = (
16
+ options: ArticleStructurePluginOptions,
17
+ direction: 'up' | 'down',
18
+ intl: IntlService
19
+ ): Command => {
20
+ return (state, dispatch) => {
21
+ const { doc, selection, schema } = state;
22
+ const structureSpecs = options.map((type) => schema.nodes[type.name]);
23
+ const currentStructure = findAncestorOfType(selection, ...structureSpecs);
24
+ if (!currentStructure || currentStructure.pos === -1) {
25
+ return false;
26
+ }
27
+ const insertionRange = calculateInsertionRange(
28
+ doc,
29
+ currentStructure.pos,
30
+ currentStructure.node.type,
31
+ direction,
32
+ schema
33
+ );
34
+ if (insertionRange === null || insertionRange === undefined) {
35
+ return false;
36
+ }
37
+ const isNodeSelection = selection instanceof NodeSelection;
38
+ const relativeSelectionOffset = selection.from - currentStructure.pos;
39
+ const currentStructureSpec = unwrap(
40
+ options.find((spec) => spec.name === currentStructure.node.type.name)
41
+ );
42
+ if (dispatch) {
43
+ const transaction = state.tr;
44
+ transaction.delete(
45
+ currentStructure.pos,
46
+ currentStructure.pos + currentStructure.node.nodeSize
47
+ );
48
+ const parent = doc.resolve(currentStructure.pos).parent;
49
+ if (parent.childCount === 1) {
50
+ transaction.insert(
51
+ currentStructure.pos,
52
+ schema.node(schema.nodes['placeholder'], {
53
+ placeholderText: intl.t(
54
+ 'article-structure-plugin.placeholder.generic.body'
55
+ ),
56
+ })
57
+ );
58
+ }
59
+ const mappedFrom = transaction.mapping.map(insertionRange.from);
60
+ const mappedTo =
61
+ insertionRange.from === insertionRange.to
62
+ ? mappedFrom
63
+ : transaction.mapping.map(insertionRange.to);
64
+ transaction.replaceWith(mappedFrom, mappedTo, currentStructure.node);
65
+ const newSelectionPos = mappedFrom + relativeSelectionOffset;
66
+ const newSelection = isNodeSelection
67
+ ? NodeSelection.create(transaction.doc, newSelectionPos)
68
+ : TextSelection.create(transaction.doc, newSelectionPos);
69
+ transaction.setSelection(newSelection);
70
+ recalculateStructureNumbers(transaction, currentStructureSpec);
71
+ dispatch(transaction);
72
+ }
73
+ return true;
74
+ };
75
+ };
76
+
77
+ export function calculateInsertionRange(
78
+ doc: PNode,
79
+ pos: number, // position of structure we want to move
80
+ nodeType: NodeType,
81
+ direction: 'up' | 'down',
82
+ schema: Schema
83
+ ): { from: number; to: number } | null {
84
+ const resolvedPosition = doc.resolve(pos);
85
+ const containerNode = resolvedPosition.parent;
86
+ const index = resolvedPosition.index();
87
+ if (direction === 'up' && index !== 0) {
88
+ const position = resolvedPosition.posAtIndex(index - 1);
89
+ return { from: position, to: position };
90
+ } else if (direction === 'down' && index !== containerNode.childCount - 1) {
91
+ // We need to insert after the node below so we do index + 2 instead of index + 1
92
+ const position = resolvedPosition.posAtIndex(index + 2);
93
+ return { from: position, to: position };
94
+ } else {
95
+ const containerRange = findNodes(
96
+ doc,
97
+ pos,
98
+ true,
99
+ direction === 'up',
100
+ ({ from }) => {
101
+ const node = doc.nodeAt(from);
102
+ if (node && node !== containerNode) {
103
+ const indexToTest = direction === 'up' ? node.childCount : 0;
104
+ if (node.canReplaceWith(indexToTest, indexToTest, nodeType)) {
105
+ return true;
106
+ }
107
+ }
108
+ return false;
109
+ }
110
+ ).next().value;
111
+ if (containerRange) {
112
+ const { from, to } = containerRange;
113
+ const containerNode = doc.nodeAt(from);
114
+ if (!containerNode) return null;
115
+ if (
116
+ containerNode.firstChild?.type === schema.nodes['paragraph'] &&
117
+ containerNode.firstChild.firstChild?.type ===
118
+ schema.nodes['placeholder']
119
+ ) {
120
+ return { from: from + 1, to: to - 1 };
121
+ } else {
122
+ const position = direction === 'up' ? to - 1 : from + 1;
123
+ return { from: position, to: position };
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ }
129
+
130
+ export default moveSelectedStructure;
@@ -0,0 +1,26 @@
1
+ import { PNode, Transaction } from '@lblod/ember-rdfa-editor';
2
+ import { StructureSpec } from '..';
3
+
4
+ export default function recalculateStructureNumbers(
5
+ transaction: Transaction,
6
+ ...structureSpecs: StructureSpec[]
7
+ ) {
8
+ const doc = transaction.doc;
9
+ const indices = new Array<number>(structureSpecs.length).fill(1);
10
+ const contexts: (PNode | null)[] = new Array<PNode | null>(
11
+ structureSpecs.length
12
+ ).fill(null);
13
+ doc.descendants((node, pos, parent) => {
14
+ structureSpecs.forEach((spec, i) => {
15
+ if (node.type.name === spec.name) {
16
+ if (!spec.continuous && !(parent === contexts[i])) {
17
+ indices[i] = 1;
18
+ contexts[i] = parent;
19
+ }
20
+ spec.updateNumber({ number: indices[i], pos, transaction });
21
+ indices[i] += 1;
22
+ }
23
+ });
24
+ });
25
+ return transaction;
26
+ }
@@ -0,0 +1,21 @@
1
+ import { Command, PNode } from '@lblod/ember-rdfa-editor';
2
+ import { ArticleStructurePluginOptions } from '..';
3
+ import recalculateStructureNumbers from './recalculate-structure-numbers';
4
+
5
+ const removeStructure = (
6
+ structure: { pos: number; node: PNode },
7
+ options: ArticleStructurePluginOptions
8
+ ): Command => {
9
+ return (state, dispatch) => {
10
+ if (dispatch) {
11
+ const { pos, node } = structure;
12
+ const transaction = state.tr;
13
+ transaction.replace(pos, pos + node.nodeSize);
14
+ recalculateStructureNumbers(transaction, ...options);
15
+ dispatch(transaction);
16
+ }
17
+ return true;
18
+ };
19
+ };
20
+
21
+ export default removeStructure;
@@ -0,0 +1,40 @@
1
+ import { Command, PNode } from '@lblod/ember-rdfa-editor';
2
+ import {
3
+ ArticleStructurePluginOptions,
4
+ StructureSpec,
5
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
6
+ import recalculateStructureNumbers from './recalculate-structure-numbers';
7
+
8
+ const unwrapStructure = (
9
+ structure: {
10
+ pos: number;
11
+ node: PNode;
12
+ type: StructureSpec;
13
+ },
14
+ options: ArticleStructurePluginOptions
15
+ ): Command => {
16
+ return (state, dispatch) => {
17
+ const { doc } = state;
18
+ const { pos, node, type } = structure;
19
+ if (!type.content) {
20
+ return false;
21
+ }
22
+ const contentToUnwrap = type.content({ pos, state });
23
+
24
+ const resolvedPos = doc.resolve(pos);
25
+ const parent = resolvedPos.parent;
26
+ const index = resolvedPos.index();
27
+ if (!parent.canReplace(index, index + 1, contentToUnwrap)) {
28
+ return false;
29
+ }
30
+ if (dispatch) {
31
+ const transaction = state.tr;
32
+ transaction.replaceWith(pos, pos + node.nodeSize, contentToUnwrap);
33
+ recalculateStructureNumbers(transaction, ...options);
34
+ dispatch(transaction);
35
+ }
36
+ return true;
37
+ };
38
+ };
39
+
40
+ export default unwrapStructure;
@@ -0,0 +1,66 @@
1
+ import {
2
+ Command,
3
+ NodeSelection,
4
+ PNode,
5
+ TextSelection,
6
+ } from '@lblod/ember-rdfa-editor';
7
+ import { StructureSpec } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
8
+ import IntlService from 'ember-intl/services/intl';
9
+ import recalculateStructureNumbers from './recalculate-structure-numbers';
10
+
11
+ const wrapStructureContent = (
12
+ structureSpec: StructureSpec,
13
+ parent: {
14
+ node: PNode;
15
+ pos: number;
16
+ },
17
+ intl: IntlService
18
+ ): Command => {
19
+ return (state, dispatch) => {
20
+ const { schema } = state;
21
+ const { node, pos } = parent;
22
+ if (
23
+ !node.canReplaceWith(0, node.childCount, schema.nodes[structureSpec.name])
24
+ ) {
25
+ return false;
26
+ }
27
+ const contentToWrap = node?.content;
28
+ let result: {
29
+ node: PNode;
30
+ selectionConfig: {
31
+ relativePos: number;
32
+ type: 'node' | 'text';
33
+ };
34
+ };
35
+ try {
36
+ result = structureSpec.constructor({
37
+ schema,
38
+ content: contentToWrap,
39
+ intl,
40
+ });
41
+ } catch (e) {
42
+ return false;
43
+ }
44
+ const { node: wrappingNode, selectionConfig } = result;
45
+ if (dispatch) {
46
+ const transaction = state.tr;
47
+ transaction.replaceWith(pos + 1, pos + node.nodeSize - 1, wrappingNode);
48
+ const newSelection =
49
+ selectionConfig.type === 'node'
50
+ ? NodeSelection.create(
51
+ transaction.doc,
52
+ pos + 1 + selectionConfig.relativePos
53
+ )
54
+ : TextSelection.create(
55
+ transaction.doc,
56
+ pos + 1 + selectionConfig.relativePos
57
+ );
58
+ transaction.setSelection(newSelection);
59
+ recalculateStructureNumbers(transaction, structureSpec);
60
+ dispatch(transaction);
61
+ }
62
+ return true;
63
+ };
64
+ };
65
+
66
+ export default wrapStructureContent;
@@ -0,0 +1,11 @@
1
+ import { namespace } from './utils/namespace';
2
+
3
+ export const SAY = namespace('https://say.data.gift/ns/', 'say');
4
+ export const RDF = namespace(
5
+ 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
6
+ 'rdf'
7
+ );
8
+
9
+ export const ELI = namespace('http://data.europa.eu/eli/ontology#', 'eli');
10
+ export const XSD = namespace('http://www.w3.org/2001/XMLSchema#', 'xsd');
11
+ export const EXT = namespace('http://mu.semte.ch/vocabularies/ext/', 'ext');
@@ -0,0 +1,70 @@
1
+ import {
2
+ Fragment,
3
+ PNode,
4
+ Schema,
5
+ WidgetSpec,
6
+ EditorState,
7
+ } from '@lblod/ember-rdfa-editor';
8
+ import IntlService from 'ember-intl/services/intl';
9
+ import { Transaction } from 'prosemirror-state';
10
+ import { STRUCTURE_SPECS } from './structures';
11
+
12
+ export type SpecName = string;
13
+
14
+ export type StructureSpec = {
15
+ name: SpecName;
16
+ context: SpecName[];
17
+ translations: {
18
+ insert: string;
19
+ move: {
20
+ up: string;
21
+ down: string;
22
+ };
23
+ remove: string;
24
+ };
25
+ constructor: (args: {
26
+ schema: Schema;
27
+ number?: number;
28
+ intl?: IntlService;
29
+ content?: PNode | Fragment;
30
+ }) => {
31
+ node: PNode;
32
+ selectionConfig: {
33
+ relativePos: number;
34
+ type: 'node' | 'text';
35
+ };
36
+ };
37
+ updateNumber: (args: {
38
+ number: number;
39
+ pos: number;
40
+ transaction: Transaction;
41
+ }) => Transaction;
42
+ content?: (args: { pos: number; state: EditorState }) => Fragment;
43
+ continuous: boolean;
44
+ };
45
+
46
+ export type ArticleStructurePluginOptions = StructureSpec[];
47
+
48
+ export const articleStructureInsertWidget: (
49
+ options?: ArticleStructurePluginOptions
50
+ ) => WidgetSpec = (options) => {
51
+ return {
52
+ componentName: 'article-structure-plugin/article-structure-card',
53
+ desiredLocation: 'insertSidebar',
54
+ widgetArgs: {
55
+ options: options ?? STRUCTURE_SPECS,
56
+ },
57
+ };
58
+ };
59
+
60
+ export const articleStructureContextWidget: (
61
+ options?: ArticleStructurePluginOptions
62
+ ) => WidgetSpec = (options) => {
63
+ return {
64
+ componentName: 'article-structure-plugin/structure-card',
65
+ desiredLocation: 'sidebar',
66
+ widgetArgs: {
67
+ options: options ?? STRUCTURE_SPECS,
68
+ },
69
+ };
70
+ };
@@ -0,0 +1,94 @@
1
+ import { NodeSpec } from '@lblod/ember-rdfa-editor';
2
+ import { StructureSpec } from '..';
3
+ import { v4 as uuid } from 'uuid';
4
+ import { ELI, SAY, XSD } from '../constants';
5
+ import { hasRDFaAttribute } from '../utils/namespace';
6
+
7
+ const PLACEHOLDERS = {
8
+ body: 'article-structure-plugin.placeholder.paragraph.body',
9
+ };
10
+
11
+ export const articleParagraphSpec: StructureSpec = {
12
+ name: 'article_paragraph',
13
+ context: ['article_body'],
14
+ translations: {
15
+ insert: 'article-structure-plugin.insert.paragraph',
16
+ move: {
17
+ up: 'article-structure-plugin.moveUp.paragraph',
18
+ down: 'article-structure-plugin.moveDown.paragraph',
19
+ },
20
+ remove: 'article-structure-plugin.remove.paragraph',
21
+ },
22
+ continuous: true,
23
+ constructor: ({ schema, number, intl }) => {
24
+ const numberConverted = number?.toString() ?? '1';
25
+ const node = schema.node(
26
+ `article_paragraph`,
27
+ {
28
+ resource: `http://data.lblod.info/paragraphs/${uuid()}`,
29
+ number: numberConverted,
30
+ },
31
+ schema.node('placeholder', {
32
+ placeholderText: intl?.t(PLACEHOLDERS.body),
33
+ })
34
+ );
35
+ return { node, selectionConfig: { relativePos: 1, type: 'node' } };
36
+ },
37
+ updateNumber: ({ number, pos, transaction }) => {
38
+ const numberConverted = number.toString();
39
+ return transaction.setNodeAttribute(pos, 'number', numberConverted);
40
+ },
41
+ };
42
+
43
+ export const article_paragraph: NodeSpec = {
44
+ content: 'text*|placeholder',
45
+ inline: false,
46
+ attrs: {
47
+ resource: {},
48
+ number: {
49
+ default: '1',
50
+ },
51
+ },
52
+ toDOM(node) {
53
+ return [
54
+ 'div',
55
+ {
56
+ property: SAY('hasParagraph').prefixed,
57
+ typeof: SAY('Paragraph').prefixed,
58
+ resource: node.attrs.resource as string,
59
+ },
60
+ '$',
61
+ [
62
+ 'span',
63
+ { property: ELI('number').prefixed, datatype: XSD('integer').prefixed },
64
+ node.attrs.number,
65
+ ],
66
+ '. ',
67
+ ['span', { property: SAY('body').prefixed }, 0],
68
+ ];
69
+ },
70
+ parseDOM: [
71
+ {
72
+ tag: 'div',
73
+ getAttrs(element: HTMLElement) {
74
+ const numberSpan = element.querySelector(`
75
+ span[property~='${ELI('number').prefixed}'],
76
+ span[property~='${ELI('number').full}']`);
77
+ if (
78
+ hasRDFaAttribute(element, 'property', SAY('hasParagraph')) &&
79
+ hasRDFaAttribute(element, 'typeof', SAY('Paragraph')) &&
80
+ element.getAttribute('resource') &&
81
+ numberSpan
82
+ ) {
83
+ return {
84
+ resource: element.getAttribute('resource'),
85
+ number: numberSpan.textContent,
86
+ };
87
+ }
88
+ return false;
89
+ },
90
+ contentElement: `span[property~='${SAY('body').prefixed}'],
91
+ span[property~='${SAY('body').full}']`,
92
+ },
93
+ ],
94
+ };
@@ -0,0 +1,129 @@
1
+ import { NodeSpec } from '@lblod/ember-rdfa-editor';
2
+ import { StructureSpec } from '..';
3
+ import {
4
+ constructStructureBodyNodeSpec,
5
+ constructStructureNodeSpec,
6
+ getStructureHeaderAttrs,
7
+ } from '../utils/structure';
8
+ import { v4 as uuid } from 'uuid';
9
+ import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
10
+ import { ELI, EXT, SAY, XSD } from '../constants';
11
+
12
+ const PLACEHOLDERS = {
13
+ title: 'article-structure-plugin.placeholder.article.heading',
14
+ body: 'article-structure-plugin.placeholder.article.body',
15
+ };
16
+ export const articleSpec: StructureSpec = {
17
+ name: 'article',
18
+ context: ['title_body', 'chapter_body', 'section_body', 'subsection_body'],
19
+ translations: {
20
+ insert: 'article-structure-plugin.insert.article',
21
+ move: {
22
+ up: 'article-structure-plugin.moveUp.article',
23
+ down: 'article-structure-plugin.moveDown.article',
24
+ },
25
+ remove: 'article-structure-plugin.remove.article',
26
+ },
27
+ continuous: true,
28
+ constructor: ({ schema, number, content, intl }) => {
29
+ const numberConverted = number?.toString() ?? '1';
30
+ const node = schema.node(
31
+ `article`,
32
+ { resource: `http://data.lblod.info/articles/${uuid()}` },
33
+ [
34
+ schema.node(
35
+ 'article_header',
36
+ { level: 4, number: numberConverted },
37
+ schema.node('placeholder', {
38
+ placeholderText: intl?.t(PLACEHOLDERS.title),
39
+ })
40
+ ),
41
+ schema.node(
42
+ `article_body`,
43
+ {},
44
+ content ??
45
+ schema.node(
46
+ 'paragraph',
47
+ {},
48
+ schema.node('placeholder', {
49
+ placeholderText: intl?.t(PLACEHOLDERS.body),
50
+ })
51
+ )
52
+ ),
53
+ ]
54
+ );
55
+ const selectionConfig: {
56
+ relativePos: number;
57
+ type: 'text' | 'node';
58
+ } = content
59
+ ? { relativePos: 5, type: 'text' }
60
+ : { relativePos: 6, type: 'node' };
61
+ return {
62
+ node,
63
+ selectionConfig,
64
+ };
65
+ },
66
+ updateNumber: ({ number, pos, transaction }) => {
67
+ const numberConverted = number.toString();
68
+ return transaction.setNodeAttribute(pos + 1, 'number', numberConverted);
69
+ },
70
+ content: ({ pos, state }) => {
71
+ const node = unwrap(state.doc.nodeAt(pos));
72
+ return node.child(1).content;
73
+ },
74
+ };
75
+
76
+ export const article = constructStructureNodeSpec({
77
+ type: SAY('Article'),
78
+ content: 'article_header article_body',
79
+ });
80
+
81
+ export const article_header: NodeSpec = {
82
+ content: 'text*|placeholder',
83
+ inline: false,
84
+ attrs: {
85
+ number: {
86
+ default: '1',
87
+ },
88
+ property: {
89
+ default: SAY('heading').prefixed,
90
+ },
91
+ },
92
+ toDOM(node) {
93
+ return [
94
+ 'div',
95
+ { property: node.attrs.property as string },
96
+ 'Artikel ',
97
+ [
98
+ 'span',
99
+ { property: ELI('number').prefixed, datatype: XSD('string').prefixed },
100
+ node.attrs.number,
101
+ ],
102
+ ': ',
103
+ [
104
+ 'span',
105
+ {
106
+ property: EXT('title').prefixed,
107
+ },
108
+ 0,
109
+ ],
110
+ ];
111
+ },
112
+ parseDOM: [
113
+ {
114
+ tag: 'div',
115
+ getAttrs(element: HTMLElement) {
116
+ const headerAttrs = getStructureHeaderAttrs(element);
117
+ if (headerAttrs) {
118
+ return headerAttrs;
119
+ }
120
+ return false;
121
+ },
122
+ contentElement: `span[property~='${EXT('title').prefixed}']`,
123
+ },
124
+ ],
125
+ };
126
+
127
+ export const article_body = constructStructureBodyNodeSpec({
128
+ content: '(paragraph|article_paragraph)+',
129
+ });