@fiduswriter/editor 0.1.20 → 0.1.21

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 (786) hide show
  1. package/dist/bibliography/tools.d.ts +14 -0
  2. package/dist/bibliography/tools.d.ts.map +1 -0
  3. package/dist/bibliography/tools.js +1 -1
  4. package/dist/bibliography/tools.js.map +1 -1
  5. package/dist/citations/index.d.ts +17 -0
  6. package/dist/citations/index.d.ts.map +1 -0
  7. package/dist/citations/index.js +22 -13
  8. package/dist/citations/index.js.map +1 -1
  9. package/dist/citations/render.d.ts +29 -0
  10. package/dist/citations/render.d.ts.map +1 -0
  11. package/dist/citations/render.js +25 -8
  12. package/dist/citations/render.js.map +1 -1
  13. package/dist/clipboard/copy/index.d.ts +2 -0
  14. package/dist/clipboard/copy/index.d.ts.map +1 -0
  15. package/dist/clipboard/copy/index.js.map +1 -1
  16. package/dist/clipboard/copy/schema.d.ts +4 -0
  17. package/dist/clipboard/copy/schema.d.ts.map +1 -0
  18. package/dist/clipboard/copy/schema.js +6 -5
  19. package/dist/clipboard/copy/schema.js.map +1 -1
  20. package/dist/clipboard/copy/serializers.d.ts +24 -0
  21. package/dist/clipboard/copy/serializers.d.ts.map +1 -0
  22. package/dist/clipboard/copy/serializers.js +19 -9
  23. package/dist/clipboard/copy/serializers.js.map +1 -1
  24. package/dist/clipboard/paste/fidus_writer.d.ts +7 -0
  25. package/dist/clipboard/paste/fidus_writer.d.ts.map +1 -0
  26. package/dist/clipboard/paste/fidus_writer.js +5 -2
  27. package/dist/clipboard/paste/fidus_writer.js.map +1 -1
  28. package/dist/clipboard/paste/general.d.ts +18 -0
  29. package/dist/clipboard/paste/general.d.ts.map +1 -0
  30. package/dist/clipboard/paste/general.js +18 -6
  31. package/dist/clipboard/paste/general.js.map +1 -1
  32. package/dist/clipboard/paste/google_docs.d.ts +6 -0
  33. package/dist/clipboard/paste/google_docs.d.ts.map +1 -0
  34. package/dist/clipboard/paste/google_docs.js +3 -2
  35. package/dist/clipboard/paste/google_docs.js.map +1 -1
  36. package/dist/clipboard/paste/html.d.ts +22 -0
  37. package/dist/clipboard/paste/html.d.ts.map +1 -0
  38. package/dist/clipboard/paste/html.js +15 -0
  39. package/dist/clipboard/paste/html.js.map +1 -1
  40. package/dist/clipboard/paste/index.d.ts +3 -0
  41. package/dist/clipboard/paste/index.d.ts.map +1 -0
  42. package/dist/clipboard/paste/index.js.map +1 -1
  43. package/dist/clipboard/paste/libreoffice_writer.d.ts +5 -0
  44. package/dist/clipboard/paste/libreoffice_writer.d.ts.map +1 -0
  45. package/dist/clipboard/paste/libreoffice_writer.js +2 -2
  46. package/dist/clipboard/paste/libreoffice_writer.js.map +1 -1
  47. package/dist/clipboard/paste/microsoft_word.d.ts +7 -0
  48. package/dist/clipboard/paste/microsoft_word.d.ts.map +1 -0
  49. package/dist/clipboard/paste/microsoft_word.js +13 -14
  50. package/dist/clipboard/paste/microsoft_word.js.map +1 -1
  51. package/dist/clipboard/paste/text.d.ts +11 -0
  52. package/dist/clipboard/paste/text.d.ts.map +1 -0
  53. package/dist/clipboard/paste/text.js +5 -3
  54. package/dist/clipboard/paste/text.js.map +1 -1
  55. package/dist/collab/chat.d.ts +24 -0
  56. package/dist/collab/chat.d.ts.map +1 -0
  57. package/dist/collab/chat.js +46 -16
  58. package/dist/collab/chat.js.map +1 -1
  59. package/dist/collab/colors.d.ts +16 -0
  60. package/dist/collab/colors.d.ts.map +1 -0
  61. package/dist/collab/colors.js +6 -0
  62. package/dist/collab/colors.js.map +1 -1
  63. package/dist/collab/doc.d.ts +147 -0
  64. package/dist/collab/doc.d.ts.map +1 -0
  65. package/dist/collab/doc.js +77 -42
  66. package/dist/collab/doc.js.map +1 -1
  67. package/dist/collab/index.d.ts +23 -0
  68. package/dist/collab/index.d.ts.map +1 -0
  69. package/dist/collab/index.js +14 -3
  70. package/dist/collab/index.js.map +1 -1
  71. package/dist/collab/merge/changeset.d.ts +23 -0
  72. package/dist/collab/merge/changeset.d.ts.map +1 -0
  73. package/dist/collab/merge/changeset.js +5 -4
  74. package/dist/collab/merge/changeset.js.map +1 -1
  75. package/dist/collab/merge/editor.d.ts +53 -0
  76. package/dist/collab/merge/editor.d.ts.map +1 -0
  77. package/dist/collab/merge/editor.js +62 -35
  78. package/dist/collab/merge/editor.js.map +1 -1
  79. package/dist/collab/merge/footnotes.d.ts +26 -0
  80. package/dist/collab/merge/footnotes.d.ts.map +1 -0
  81. package/dist/collab/merge/footnotes.js +14 -5
  82. package/dist/collab/merge/footnotes.js.map +1 -1
  83. package/dist/collab/merge/index.d.ts +32 -0
  84. package/dist/collab/merge/index.d.ts.map +1 -0
  85. package/dist/collab/merge/index.js +38 -26
  86. package/dist/collab/merge/index.js.map +1 -1
  87. package/dist/collab/merge/recreate_transform.d.ts +4 -0
  88. package/dist/collab/merge/recreate_transform.d.ts.map +1 -0
  89. package/dist/collab/merge/recreate_transform.js +25 -5
  90. package/dist/collab/merge/recreate_transform.js.map +1 -1
  91. package/dist/collab/merge/schema.d.ts +4 -0
  92. package/dist/collab/merge/schema.d.ts.map +1 -0
  93. package/dist/collab/merge/schema.js +35 -26
  94. package/dist/collab/merge/schema.js.map +1 -1
  95. package/dist/collab/merge/state_plugins/action.d.ts +16 -0
  96. package/dist/collab/merge/state_plugins/action.d.ts.map +1 -0
  97. package/dist/collab/merge/state_plugins/action.js +4 -5
  98. package/dist/collab/merge/state_plugins/action.js.map +1 -1
  99. package/dist/collab/merge/state_plugins/clipboard.d.ts +6 -0
  100. package/dist/collab/merge/state_plugins/clipboard.d.ts.map +1 -0
  101. package/dist/collab/merge/state_plugins/clipboard.js +1 -1
  102. package/dist/collab/merge/state_plugins/clipboard.js.map +1 -1
  103. package/dist/collab/merge/state_plugins/diff.d.ts +32 -0
  104. package/dist/collab/merge/state_plugins/diff.d.ts.map +1 -0
  105. package/dist/collab/merge/state_plugins/diff.js +108 -84
  106. package/dist/collab/merge/state_plugins/diff.js.map +1 -1
  107. package/dist/collab/merge/state_plugins/index.d.ts +3 -0
  108. package/dist/collab/merge/state_plugins/index.d.ts.map +1 -0
  109. package/dist/collab/merge/state_plugins/index.js.map +1 -1
  110. package/dist/collab/merge/tools.d.ts +11 -0
  111. package/dist/collab/merge/tools.d.ts.map +1 -0
  112. package/dist/collab/merge/tools.js +16 -14
  113. package/dist/collab/merge/tools.js.map +1 -1
  114. package/dist/collab/templates.d.ts +14 -0
  115. package/dist/collab/templates.d.ts.map +1 -0
  116. package/dist/collab/templates.js +1 -1
  117. package/dist/collab/templates.js.map +1 -1
  118. package/dist/comments/comment.d.ts +29 -0
  119. package/dist/comments/comment.d.ts.map +1 -0
  120. package/dist/comments/comment.js +12 -0
  121. package/dist/comments/comment.js.map +1 -1
  122. package/dist/comments/editors/answer.d.ts +14 -0
  123. package/dist/comments/editors/answer.d.ts.map +1 -0
  124. package/dist/comments/editors/answer.js +5 -3
  125. package/dist/comments/editors/answer.js.map +1 -1
  126. package/dist/comments/editors/comment.d.ts +65 -0
  127. package/dist/comments/editors/comment.d.ts.map +1 -0
  128. package/dist/comments/editors/comment.js +43 -14
  129. package/dist/comments/editors/comment.js.map +1 -1
  130. package/dist/comments/editors/index.d.ts +4 -0
  131. package/dist/comments/editors/index.d.ts.map +1 -0
  132. package/dist/comments/editors/index.js.map +1 -1
  133. package/dist/comments/editors/notify.d.ts +3 -0
  134. package/dist/comments/editors/notify.d.ts.map +1 -0
  135. package/dist/comments/editors/notify.js.map +1 -1
  136. package/dist/comments/editors/schema.d.ts +12 -0
  137. package/dist/comments/editors/schema.d.ts.map +1 -0
  138. package/dist/comments/editors/schema.js +5 -5
  139. package/dist/comments/editors/schema.js.map +1 -1
  140. package/dist/comments/index.d.ts +10 -0
  141. package/dist/comments/index.d.ts.map +1 -0
  142. package/dist/comments/index.js +5 -2
  143. package/dist/comments/index.js.map +1 -1
  144. package/dist/comments/interactions.d.ts +49 -0
  145. package/dist/comments/interactions.d.ts.map +1 -0
  146. package/dist/comments/interactions.js +33 -18
  147. package/dist/comments/interactions.js.map +1 -1
  148. package/dist/comments/store.d.ts +59 -0
  149. package/dist/comments/store.d.ts.map +1 -0
  150. package/dist/comments/store.js +36 -16
  151. package/dist/comments/store.js.map +1 -1
  152. package/dist/contacts/add_dialog.d.ts +7 -0
  153. package/dist/contacts/add_dialog.d.ts.map +1 -0
  154. package/dist/contacts/add_dialog.js +25 -26
  155. package/dist/contacts/add_dialog.js.map +1 -1
  156. package/dist/contacts/templates.d.ts +12 -0
  157. package/dist/contacts/templates.d.ts.map +1 -0
  158. package/dist/contacts/templates.js +3 -2
  159. package/dist/contacts/templates.js.map +1 -1
  160. package/dist/copyright_dialog/index.d.ts +25 -0
  161. package/dist/copyright_dialog/index.d.ts.map +1 -0
  162. package/dist/copyright_dialog/index.js +34 -26
  163. package/dist/copyright_dialog/index.js.map +1 -1
  164. package/dist/copyright_dialog/templates.d.ts +17 -0
  165. package/dist/copyright_dialog/templates.d.ts.map +1 -0
  166. package/dist/copyright_dialog/templates.js.map +1 -1
  167. package/dist/databases/bibliography.d.ts +42 -0
  168. package/dist/databases/bibliography.d.ts.map +1 -0
  169. package/dist/databases/bibliography.js +24 -9
  170. package/dist/databases/bibliography.js.map +1 -1
  171. package/dist/databases/images.d.ts +66 -0
  172. package/dist/databases/images.d.ts.map +1 -0
  173. package/dist/databases/images.js +19 -9
  174. package/dist/databases/images.js.map +1 -1
  175. package/dist/databases/index.d.ts +26 -0
  176. package/dist/databases/index.d.ts.map +1 -0
  177. package/dist/databases/index.js +9 -8
  178. package/dist/databases/index.js.map +1 -1
  179. package/dist/dialogs/citation.d.ts +58 -0
  180. package/dist/dialogs/citation.d.ts.map +1 -0
  181. package/dist/dialogs/citation.js +43 -22
  182. package/dist/dialogs/citation.js.map +1 -1
  183. package/dist/dialogs/code_block.d.ts +25 -0
  184. package/dist/dialogs/code_block.d.ts.map +1 -0
  185. package/dist/dialogs/code_block.js +32 -11
  186. package/dist/dialogs/code_block.js.map +1 -1
  187. package/dist/dialogs/contributor.d.ts +13 -0
  188. package/dist/dialogs/contributor.d.ts.map +1 -0
  189. package/dist/dialogs/contributor.js +17 -20
  190. package/dist/dialogs/contributor.js.map +1 -1
  191. package/dist/dialogs/figure.d.ts +51 -0
  192. package/dist/dialogs/figure.d.ts.map +1 -0
  193. package/dist/dialogs/figure.js +123 -81
  194. package/dist/dialogs/figure.js.map +1 -1
  195. package/dist/dialogs/index.d.ts +11 -0
  196. package/dist/dialogs/index.d.ts.map +1 -0
  197. package/dist/dialogs/index.js.map +1 -1
  198. package/dist/dialogs/language.d.ts +10 -0
  199. package/dist/dialogs/language.d.ts.map +1 -0
  200. package/dist/dialogs/language.js +4 -1
  201. package/dist/dialogs/language.js.map +1 -1
  202. package/dist/dialogs/link.d.ts +30 -0
  203. package/dist/dialogs/link.d.ts.map +1 -0
  204. package/dist/dialogs/link.js +27 -15
  205. package/dist/dialogs/link.js.map +1 -1
  206. package/dist/dialogs/math.d.ts +22 -0
  207. package/dist/dialogs/math.d.ts.map +1 -0
  208. package/dist/dialogs/math.js +27 -14
  209. package/dist/dialogs/math.js.map +1 -1
  210. package/dist/dialogs/ordered_list.d.ts +22 -0
  211. package/dist/dialogs/ordered_list.d.ts.map +1 -0
  212. package/dist/dialogs/ordered_list.js +12 -5
  213. package/dist/dialogs/ordered_list.js.map +1 -1
  214. package/dist/dialogs/revision.d.ts +8 -0
  215. package/dist/dialogs/revision.d.ts.map +1 -0
  216. package/dist/dialogs/revision.js +2 -0
  217. package/dist/dialogs/revision.js.map +1 -1
  218. package/dist/dialogs/subsup.d.ts +5 -0
  219. package/dist/dialogs/subsup.d.ts.map +1 -0
  220. package/dist/dialogs/subsup.js +3 -3
  221. package/dist/dialogs/subsup.js.map +1 -1
  222. package/dist/dialogs/table.d.ts +33 -0
  223. package/dist/dialogs/table.d.ts.map +1 -0
  224. package/dist/dialogs/table.js +43 -21
  225. package/dist/dialogs/table.js.map +1 -1
  226. package/dist/dialogs/templates.d.ts +85 -0
  227. package/dist/dialogs/templates.d.ts.map +1 -0
  228. package/dist/dialogs/templates.js +8 -8
  229. package/dist/dialogs/templates.js.map +1 -1
  230. package/dist/document_template/exporter.d.ts +23 -0
  231. package/dist/document_template/exporter.d.ts.map +1 -0
  232. package/dist/document_template/exporter.js +14 -5
  233. package/dist/document_template/exporter.js.map +1 -1
  234. package/dist/document_template/index.d.ts +35 -0
  235. package/dist/document_template/index.d.ts.map +1 -0
  236. package/dist/document_template/index.js +61 -53
  237. package/dist/document_template/index.js.map +1 -1
  238. package/dist/document_template/schema.d.ts +13 -0
  239. package/dist/document_template/schema.d.ts.map +1 -0
  240. package/dist/document_template/schema.js +2 -2
  241. package/dist/document_template/schema.js.map +1 -1
  242. package/dist/documents/access_rights/index.d.ts +85 -0
  243. package/dist/documents/access_rights/index.d.ts.map +1 -0
  244. package/dist/documents/access_rights/index.js +96 -60
  245. package/dist/documents/access_rights/index.js.map +1 -1
  246. package/dist/documents/access_rights/templates.d.ts +47 -0
  247. package/dist/documents/access_rights/templates.d.ts.map +1 -0
  248. package/dist/documents/access_rights/templates.js.map +1 -1
  249. package/dist/e2ee/snapshot-manager.d.ts +120 -0
  250. package/dist/e2ee/snapshot-manager.d.ts.map +1 -0
  251. package/dist/e2ee/snapshot-manager.js +27 -38
  252. package/dist/e2ee/snapshot-manager.js.map +1 -1
  253. package/dist/exporter/native/copy.d.ts +16 -0
  254. package/dist/exporter/native/copy.d.ts.map +1 -0
  255. package/dist/exporter/native/copy.js +51 -35
  256. package/dist/exporter/native/copy.js.map +1 -1
  257. package/dist/exporter/native/file.d.ts +6 -0
  258. package/dist/exporter/native/file.d.ts.map +1 -0
  259. package/dist/exporter/native/file.js +1 -1
  260. package/dist/exporter/native/file.js.map +1 -1
  261. package/dist/exporter/native/index.d.ts +4 -0
  262. package/dist/exporter/native/index.d.ts.map +1 -0
  263. package/dist/exporter/native/index.js.map +1 -1
  264. package/dist/exporter/native/revision.d.ts +8 -0
  265. package/dist/exporter/native/revision.d.ts.map +1 -0
  266. package/dist/exporter/native/revision.js +2 -2
  267. package/dist/exporter/native/revision.js.map +1 -1
  268. package/dist/exporter/native/zip.d.ts +2 -0
  269. package/dist/exporter/native/zip.d.ts.map +1 -0
  270. package/dist/exporter/native/zip.js.map +1 -1
  271. package/dist/footnotes/editor.d.ts +25 -0
  272. package/dist/footnotes/editor.d.ts.map +1 -0
  273. package/dist/footnotes/editor.js +5 -3
  274. package/dist/footnotes/editor.js.map +1 -1
  275. package/dist/footnotes/index.d.ts +11 -0
  276. package/dist/footnotes/index.d.ts.map +1 -0
  277. package/dist/footnotes/index.js +5 -2
  278. package/dist/footnotes/index.js.map +1 -1
  279. package/dist/footnotes/layout.d.ts +15 -0
  280. package/dist/footnotes/layout.d.ts.map +1 -0
  281. package/dist/footnotes/layout.js +26 -17
  282. package/dist/footnotes/layout.js.map +1 -1
  283. package/dist/footnotes/state_plugins/access_rights.d.ts +6 -0
  284. package/dist/footnotes/state_plugins/access_rights.d.ts.map +1 -0
  285. package/dist/footnotes/state_plugins/access_rights.js +1 -1
  286. package/dist/footnotes/state_plugins/access_rights.js.map +1 -1
  287. package/dist/footnotes/state_plugins/index.d.ts +2 -0
  288. package/dist/footnotes/state_plugins/index.d.ts.map +1 -0
  289. package/dist/footnotes/state_plugins/index.js.map +1 -1
  290. package/dist/images/edit_dialog/model.d.ts +4 -0
  291. package/dist/images/edit_dialog/model.d.ts.map +1 -0
  292. package/dist/images/edit_dialog/model.js.map +1 -1
  293. package/dist/index.d.ts +74 -0
  294. package/dist/index.d.ts.map +1 -0
  295. package/dist/index.js +86 -59
  296. package/dist/index.js.map +1 -1
  297. package/dist/keymap.d.ts +5 -0
  298. package/dist/keymap.d.ts.map +1 -0
  299. package/dist/keymap.js +1 -1
  300. package/dist/keymap.js.map +1 -1
  301. package/dist/marginboxes/index.d.ts +107 -0
  302. package/dist/marginboxes/index.d.ts.map +1 -0
  303. package/dist/marginboxes/index.js +165 -88
  304. package/dist/marginboxes/index.js.map +1 -1
  305. package/dist/marginboxes/templates.d.ts +118 -0
  306. package/dist/marginboxes/templates.d.ts.map +1 -0
  307. package/dist/marginboxes/templates.js +25 -24
  308. package/dist/marginboxes/templates.js.map +1 -1
  309. package/dist/menus/code_block/index.d.ts +2 -0
  310. package/dist/menus/code_block/index.d.ts.map +1 -0
  311. package/dist/menus/code_block/index.js.map +1 -1
  312. package/dist/menus/code_block/model.d.ts +14 -0
  313. package/dist/menus/code_block/model.d.ts.map +1 -0
  314. package/dist/menus/code_block/model.js +5 -4
  315. package/dist/menus/code_block/model.js.map +1 -1
  316. package/dist/menus/figure/index.d.ts +3 -0
  317. package/dist/menus/figure/index.d.ts.map +1 -0
  318. package/dist/menus/figure/index.js.map +1 -1
  319. package/dist/menus/figure/model.d.ts +32 -0
  320. package/dist/menus/figure/model.d.ts.map +1 -0
  321. package/dist/menus/figure/model.js +11 -12
  322. package/dist/menus/figure/model.js.map +1 -1
  323. package/dist/menus/figure/utils.d.ts +3 -0
  324. package/dist/menus/figure/utils.d.ts.map +1 -0
  325. package/dist/menus/figure/utils.js +4 -1
  326. package/dist/menus/figure/utils.js.map +1 -1
  327. package/dist/menus/headerbar/index.d.ts +3 -0
  328. package/dist/menus/headerbar/index.d.ts.map +1 -0
  329. package/dist/menus/headerbar/index.js.map +1 -1
  330. package/dist/menus/headerbar/model.d.ts +192 -0
  331. package/dist/menus/headerbar/model.d.ts.map +1 -0
  332. package/dist/menus/headerbar/model.js +141 -110
  333. package/dist/menus/headerbar/model.js.map +1 -1
  334. package/dist/menus/headerbar/view.d.ts +89 -0
  335. package/dist/menus/headerbar/view.d.ts.map +1 -0
  336. package/dist/menus/headerbar/view.js +76 -45
  337. package/dist/menus/headerbar/view.js.map +1 -1
  338. package/dist/menus/image/index.d.ts +2 -0
  339. package/dist/menus/image/index.d.ts.map +1 -0
  340. package/dist/menus/image/index.js.map +1 -1
  341. package/dist/menus/image/model.d.ts +18 -0
  342. package/dist/menus/image/model.d.ts.map +1 -0
  343. package/dist/menus/image/model.js +2 -2
  344. package/dist/menus/image/model.js.map +1 -1
  345. package/dist/menus/index.d.ts +10 -0
  346. package/dist/menus/index.d.ts.map +1 -0
  347. package/dist/menus/index.js.map +1 -1
  348. package/dist/menus/navigator/index.d.ts +2 -0
  349. package/dist/menus/navigator/index.d.ts.map +1 -0
  350. package/dist/menus/navigator/index.js.map +1 -1
  351. package/dist/menus/navigator/model.d.ts +9 -0
  352. package/dist/menus/navigator/model.d.ts.map +1 -0
  353. package/dist/menus/navigator/model.js.map +1 -1
  354. package/dist/menus/ordered_list/index.d.ts +2 -0
  355. package/dist/menus/ordered_list/index.d.ts.map +1 -0
  356. package/dist/menus/ordered_list/index.js.map +1 -1
  357. package/dist/menus/ordered_list/model.d.ts +11 -0
  358. package/dist/menus/ordered_list/model.d.ts.map +1 -0
  359. package/dist/menus/ordered_list/model.js +1 -1
  360. package/dist/menus/ordered_list/model.js.map +1 -1
  361. package/dist/menus/selection/index.d.ts +3 -0
  362. package/dist/menus/selection/index.d.ts.map +1 -0
  363. package/dist/menus/selection/index.js.map +1 -1
  364. package/dist/menus/selection/model.d.ts +16 -0
  365. package/dist/menus/selection/model.d.ts.map +1 -0
  366. package/dist/menus/selection/model.js +18 -16
  367. package/dist/menus/selection/model.js.map +1 -1
  368. package/dist/menus/selection/view.d.ts +49 -0
  369. package/dist/menus/selection/view.d.ts.map +1 -0
  370. package/dist/menus/selection/view.js +33 -18
  371. package/dist/menus/selection/view.js.map +1 -1
  372. package/dist/menus/table/index.d.ts +2 -0
  373. package/dist/menus/table/index.d.ts.map +1 -0
  374. package/dist/menus/table/index.js.map +1 -1
  375. package/dist/menus/table/model.d.ts +39 -0
  376. package/dist/menus/table/model.d.ts.map +1 -0
  377. package/dist/menus/table/model.js +53 -50
  378. package/dist/menus/table/model.js.map +1 -1
  379. package/dist/menus/toolbar/index.d.ts +3 -0
  380. package/dist/menus/toolbar/index.d.ts.map +1 -0
  381. package/dist/menus/toolbar/index.js.map +1 -1
  382. package/dist/menus/toolbar/model.d.ts +125 -0
  383. package/dist/menus/toolbar/model.d.ts.map +1 -0
  384. package/dist/menus/toolbar/model.js +160 -140
  385. package/dist/menus/toolbar/model.js.map +1 -1
  386. package/dist/menus/toolbar/view.d.ts +72 -0
  387. package/dist/menus/toolbar/view.d.ts.map +1 -0
  388. package/dist/menus/toolbar/view.js +61 -36
  389. package/dist/menus/toolbar/view.js.map +1 -1
  390. package/dist/navigator/index.d.ts +38 -0
  391. package/dist/navigator/index.d.ts.map +1 -0
  392. package/dist/navigator/index.js +42 -21
  393. package/dist/navigator/index.js.map +1 -1
  394. package/dist/no_collab_save/index.d.ts +20 -0
  395. package/dist/no_collab_save/index.d.ts.map +1 -0
  396. package/dist/no_collab_save/index.js +20 -11
  397. package/dist/no_collab_save/index.js.map +1 -1
  398. package/dist/plugins/citation_dialog/index.d.ts +2 -0
  399. package/dist/plugins/citation_dialog/index.d.ts.map +1 -0
  400. package/dist/plugins/citation_dialog/index.js.map +1 -1
  401. package/dist/plugins/editor/index.d.ts +2 -0
  402. package/dist/plugins/editor/index.d.ts.map +1 -0
  403. package/dist/plugins/editor/index.js.map +1 -1
  404. package/dist/state_plugins/access_rights.d.ts +6 -0
  405. package/dist/state_plugins/access_rights.d.ts.map +1 -0
  406. package/dist/state_plugins/access_rights.js +5 -3
  407. package/dist/state_plugins/access_rights.js.map +1 -1
  408. package/dist/state_plugins/citation_render.d.ts +9 -0
  409. package/dist/state_plugins/citation_render.d.ts.map +1 -0
  410. package/dist/state_plugins/citation_render.js +12 -43
  411. package/dist/state_plugins/citation_render.js.map +1 -1
  412. package/dist/state_plugins/clipboard.d.ts +12 -0
  413. package/dist/state_plugins/clipboard.d.ts.map +1 -0
  414. package/dist/state_plugins/clipboard.js +13 -11
  415. package/dist/state_plugins/clipboard.js.map +1 -1
  416. package/dist/state_plugins/code_block.d.ts +6 -0
  417. package/dist/state_plugins/code_block.d.ts.map +1 -0
  418. package/dist/state_plugins/code_block.js +23 -9
  419. package/dist/state_plugins/code_block.js.map +1 -1
  420. package/dist/state_plugins/collab_carets.d.ts +26 -0
  421. package/dist/state_plugins/collab_carets.d.ts.map +1 -0
  422. package/dist/state_plugins/collab_carets.js +24 -16
  423. package/dist/state_plugins/collab_carets.js.map +1 -1
  424. package/dist/state_plugins/comments.d.ts +15 -0
  425. package/dist/state_plugins/comments.d.ts.map +1 -0
  426. package/dist/state_plugins/comments.js +26 -21
  427. package/dist/state_plugins/comments.js.map +1 -1
  428. package/dist/state_plugins/contributor_input/dropup.d.ts +17 -0
  429. package/dist/state_plugins/contributor_input/dropup.d.ts.map +1 -0
  430. package/dist/state_plugins/contributor_input/dropup.js +19 -20
  431. package/dist/state_plugins/contributor_input/dropup.js.map +1 -1
  432. package/dist/state_plugins/contributor_input/index.d.ts +3 -0
  433. package/dist/state_plugins/contributor_input/index.d.ts.map +1 -0
  434. package/dist/state_plugins/contributor_input/index.js.map +1 -1
  435. package/dist/state_plugins/contributor_input/node_view.d.ts +7 -0
  436. package/dist/state_plugins/contributor_input/node_view.d.ts.map +1 -0
  437. package/dist/state_plugins/contributor_input/node_view.js.map +1 -1
  438. package/dist/state_plugins/contributor_input/plugin.d.ts +19 -0
  439. package/dist/state_plugins/contributor_input/plugin.d.ts.map +1 -0
  440. package/dist/state_plugins/contributor_input/plugin.js +14 -45
  441. package/dist/state_plugins/contributor_input/plugin.js.map +1 -1
  442. package/dist/state_plugins/document_template.d.ts +33 -0
  443. package/dist/state_plugins/document_template.d.ts.map +1 -0
  444. package/dist/state_plugins/document_template.js +34 -15
  445. package/dist/state_plugins/document_template.js.map +1 -1
  446. package/dist/state_plugins/figure.d.ts +6 -0
  447. package/dist/state_plugins/figure.d.ts.map +1 -0
  448. package/dist/state_plugins/figure.js +26 -8
  449. package/dist/state_plugins/figure.js.map +1 -1
  450. package/dist/state_plugins/footnote_markers.d.ts +15 -0
  451. package/dist/state_plugins/footnote_markers.d.ts.map +1 -0
  452. package/dist/state_plugins/footnote_markers.js +72 -153
  453. package/dist/state_plugins/footnote_markers.js.map +1 -1
  454. package/dist/state_plugins/headerbar.d.ts +6 -0
  455. package/dist/state_plugins/headerbar.d.ts.map +1 -0
  456. package/dist/state_plugins/headerbar.js +1 -1
  457. package/dist/state_plugins/headerbar.js.map +1 -1
  458. package/dist/state_plugins/index.d.ts +28 -0
  459. package/dist/state_plugins/index.d.ts.map +1 -0
  460. package/dist/state_plugins/index.js +13 -12
  461. package/dist/state_plugins/index.js.map +1 -1
  462. package/dist/state_plugins/inline_math.d.ts +6 -0
  463. package/dist/state_plugins/inline_math.d.ts.map +1 -0
  464. package/dist/state_plugins/inline_math.js +28 -19
  465. package/dist/state_plugins/inline_math.js.map +1 -1
  466. package/dist/state_plugins/inline_reference/dropup.d.ts +62 -0
  467. package/dist/state_plugins/inline_reference/dropup.d.ts.map +1 -0
  468. package/dist/state_plugins/inline_reference/dropup.js +17 -17
  469. package/dist/state_plugins/inline_reference/dropup.js.map +1 -1
  470. package/dist/state_plugins/inline_reference/index.d.ts +2 -0
  471. package/dist/state_plugins/inline_reference/index.d.ts.map +1 -0
  472. package/dist/state_plugins/inline_reference/index.js.map +1 -1
  473. package/dist/state_plugins/inline_reference/plugin.d.ts +35 -0
  474. package/dist/state_plugins/inline_reference/plugin.d.ts.map +1 -0
  475. package/dist/state_plugins/inline_reference/plugin.js +68 -55
  476. package/dist/state_plugins/inline_reference/plugin.js.map +1 -1
  477. package/dist/state_plugins/jump_hidden_nodes.d.ts +5 -0
  478. package/dist/state_plugins/jump_hidden_nodes.d.ts.map +1 -0
  479. package/dist/state_plugins/jump_hidden_nodes.js +35 -22
  480. package/dist/state_plugins/jump_hidden_nodes.js.map +1 -1
  481. package/dist/state_plugins/links.d.ts +11 -0
  482. package/dist/state_plugins/links.d.ts.map +1 -0
  483. package/dist/state_plugins/links.js +39 -25
  484. package/dist/state_plugins/links.js.map +1 -1
  485. package/dist/state_plugins/marginboxes.d.ts +6 -0
  486. package/dist/state_plugins/marginboxes.d.ts.map +1 -0
  487. package/dist/state_plugins/marginboxes.js +2 -1
  488. package/dist/state_plugins/marginboxes.js.map +1 -1
  489. package/dist/state_plugins/ordered_list_menu.d.ts +6 -0
  490. package/dist/state_plugins/ordered_list_menu.d.ts.map +1 -0
  491. package/dist/state_plugins/ordered_list_menu.js +20 -6
  492. package/dist/state_plugins/ordered_list_menu.js.map +1 -1
  493. package/dist/state_plugins/placeholders.d.ts +6 -0
  494. package/dist/state_plugins/placeholders.d.ts.map +1 -0
  495. package/dist/state_plugins/placeholders.js +18 -54
  496. package/dist/state_plugins/placeholders.js.map +1 -1
  497. package/dist/state_plugins/search.d.ts +34 -0
  498. package/dist/state_plugins/search.d.ts.map +1 -0
  499. package/dist/state_plugins/search.js +31 -27
  500. package/dist/state_plugins/search.js.map +1 -1
  501. package/dist/state_plugins/selection_menu.d.ts +6 -0
  502. package/dist/state_plugins/selection_menu.d.ts.map +1 -0
  503. package/dist/state_plugins/selection_menu.js +1 -1
  504. package/dist/state_plugins/selection_menu.js.map +1 -1
  505. package/dist/state_plugins/settings.d.ts +8 -0
  506. package/dist/state_plugins/settings.d.ts.map +1 -0
  507. package/dist/state_plugins/settings.js +31 -21
  508. package/dist/state_plugins/settings.js.map +1 -1
  509. package/dist/state_plugins/table.d.ts +6 -0
  510. package/dist/state_plugins/table.d.ts.map +1 -0
  511. package/dist/state_plugins/table.js +33 -13
  512. package/dist/state_plugins/table.js.map +1 -1
  513. package/dist/state_plugins/tag_input/index.d.ts +3 -0
  514. package/dist/state_plugins/tag_input/index.d.ts.map +1 -0
  515. package/dist/state_plugins/tag_input/index.js.map +1 -1
  516. package/dist/state_plugins/tag_input/node_view.d.ts +7 -0
  517. package/dist/state_plugins/tag_input/node_view.d.ts.map +1 -0
  518. package/dist/state_plugins/tag_input/node_view.js.map +1 -1
  519. package/dist/state_plugins/tag_input/plugin.d.ts +14 -0
  520. package/dist/state_plugins/tag_input/plugin.d.ts.map +1 -0
  521. package/dist/state_plugins/tag_input/plugin.js +7 -6
  522. package/dist/state_plugins/tag_input/plugin.js.map +1 -1
  523. package/dist/state_plugins/toc_render.d.ts +6 -0
  524. package/dist/state_plugins/toc_render.d.ts.map +1 -0
  525. package/dist/state_plugins/toc_render.js +59 -96
  526. package/dist/state_plugins/toc_render.js.map +1 -1
  527. package/dist/state_plugins/toolbar.d.ts +6 -0
  528. package/dist/state_plugins/toolbar.d.ts.map +1 -0
  529. package/dist/state_plugins/toolbar.js +1 -1
  530. package/dist/state_plugins/toolbar.js.map +1 -1
  531. package/dist/state_plugins/track/find_selected_changes.d.ts +13 -0
  532. package/dist/state_plugins/track/find_selected_changes.d.ts.map +1 -0
  533. package/dist/state_plugins/track/find_selected_changes.js +4 -3
  534. package/dist/state_plugins/track/find_selected_changes.js.map +1 -1
  535. package/dist/state_plugins/track/helpers.d.ts +29 -0
  536. package/dist/state_plugins/track/helpers.d.ts.map +1 -0
  537. package/dist/state_plugins/track/helpers.js +9 -3
  538. package/dist/state_plugins/track/helpers.js.map +1 -1
  539. package/dist/state_plugins/track/index.d.ts +3 -0
  540. package/dist/state_plugins/track/index.d.ts.map +1 -0
  541. package/dist/state_plugins/track/index.js.map +1 -1
  542. package/dist/state_plugins/track/plugin.d.ts +14 -0
  543. package/dist/state_plugins/track/plugin.d.ts.map +1 -0
  544. package/dist/state_plugins/track/plugin.js +10 -6
  545. package/dist/state_plugins/track/plugin.js.map +1 -1
  546. package/dist/tools/index.d.ts +4 -0
  547. package/dist/tools/index.d.ts.map +1 -0
  548. package/dist/tools/index.js.map +1 -1
  549. package/dist/tools/key_bindings/index.d.ts +7 -0
  550. package/dist/tools/key_bindings/index.d.ts.map +1 -0
  551. package/dist/tools/key_bindings/index.js +1 -3
  552. package/dist/tools/key_bindings/index.js.map +1 -1
  553. package/dist/tools/key_bindings/templates.d.ts +2 -0
  554. package/dist/tools/key_bindings/templates.d.ts.map +1 -0
  555. package/dist/tools/key_bindings/templates.js.map +1 -1
  556. package/dist/tools/search_replace/index.d.ts +28 -0
  557. package/dist/tools/search_replace/index.d.ts.map +1 -0
  558. package/dist/tools/search_replace/index.js +53 -27
  559. package/dist/tools/search_replace/index.js.map +1 -1
  560. package/dist/tools/search_replace/templates.d.ts +6 -0
  561. package/dist/tools/search_replace/templates.d.ts.map +1 -0
  562. package/dist/tools/search_replace/templates.js.map +1 -1
  563. package/dist/tools/word_count/index.d.ts +15 -0
  564. package/dist/tools/word_count/index.d.ts.map +1 -0
  565. package/dist/tools/word_count/index.js +2 -1
  566. package/dist/tools/word_count/index.js.map +1 -1
  567. package/dist/tools/word_count/templates.d.ts +11 -0
  568. package/dist/tools/word_count/templates.d.ts.map +1 -0
  569. package/dist/tools/word_count/templates.js.map +1 -1
  570. package/dist/track/accept.d.ts +3 -0
  571. package/dist/track/accept.d.ts.map +1 -0
  572. package/dist/track/accept.js +10 -5
  573. package/dist/track/accept.js.map +1 -1
  574. package/dist/track/accept_all.d.ts +3 -0
  575. package/dist/track/accept_all.d.ts.map +1 -0
  576. package/dist/track/accept_all.js +2 -2
  577. package/dist/track/accept_all.js.map +1 -1
  578. package/dist/track/accept_all_no_insertions.d.ts +3 -0
  579. package/dist/track/accept_all_no_insertions.d.ts.map +1 -0
  580. package/dist/track/accept_all_no_insertions.js +2 -2
  581. package/dist/track/accept_all_no_insertions.js.map +1 -1
  582. package/dist/track/amend_transaction.d.ts +5 -0
  583. package/dist/track/amend_transaction.d.ts.map +1 -0
  584. package/dist/track/amend_transaction.js +55 -32
  585. package/dist/track/amend_transaction.js.map +1 -1
  586. package/dist/track/delete.d.ts +3 -0
  587. package/dist/track/delete.d.ts.map +1 -0
  588. package/dist/track/delete.js +4 -3
  589. package/dist/track/delete.js.map +1 -1
  590. package/dist/track/index.d.ts +6 -0
  591. package/dist/track/index.d.ts.map +1 -0
  592. package/dist/track/index.js.map +1 -1
  593. package/dist/track/mod.d.ts +10 -0
  594. package/dist/track/mod.d.ts.map +1 -0
  595. package/dist/track/mod.js +9 -5
  596. package/dist/track/mod.js.map +1 -1
  597. package/dist/track/reject.d.ts +3 -0
  598. package/dist/track/reject.d.ts.map +1 -0
  599. package/dist/track/reject.js +14 -5
  600. package/dist/track/reject.js.map +1 -1
  601. package/dist/track/reject_all.d.ts +3 -0
  602. package/dist/track/reject_all.d.ts.map +1 -0
  603. package/dist/track/reject_all.js +6 -2
  604. package/dist/track/reject_all.js.map +1 -1
  605. package/dist/types.d.ts +182 -0
  606. package/dist/types.d.ts.map +1 -0
  607. package/dist/types.js +17 -0
  608. package/dist/types.js.map +1 -0
  609. package/package.json +38 -3
  610. package/src/bibliography/{tools.js → tools.ts} +16 -5
  611. package/src/citations/{index.js → index.ts} +100 -80
  612. package/src/citations/{render.js → render.ts} +43 -15
  613. package/src/clipboard/copy/{schema.js → schema.ts} +19 -8
  614. package/src/clipboard/copy/{serializers.js → serializers.ts} +44 -32
  615. package/src/clipboard/paste/{fidus_writer.js → fidus_writer.ts} +28 -8
  616. package/src/clipboard/paste/{general.js → general.ts} +28 -13
  617. package/src/clipboard/paste/{google_docs.js → google_docs.ts} +7 -4
  618. package/src/clipboard/paste/{html.js → html.ts} +35 -8
  619. package/src/clipboard/paste/{libreoffice_writer.js → libreoffice_writer.ts} +4 -4
  620. package/src/clipboard/paste/{microsoft_word.js → microsoft_word.ts} +22 -21
  621. package/src/clipboard/paste/{text.js → text.ts} +11 -7
  622. package/src/collab/{chat.js → chat.ts} +78 -27
  623. package/src/collab/{colors.js → colors.ts} +21 -5
  624. package/src/collab/{doc.js → doc.ts} +290 -184
  625. package/src/collab/{index.js → index.ts} +47 -13
  626. package/src/collab/merge/{changeset.js → changeset.ts} +33 -20
  627. package/src/collab/merge/{editor.js → editor.ts} +211 -107
  628. package/src/collab/merge/{footnotes.js → footnotes.ts} +43 -22
  629. package/src/collab/merge/{index.js → index.ts} +147 -70
  630. package/src/collab/merge/{recreate_transform.js → recreate_transform.ts} +60 -29
  631. package/src/collab/merge/{schema.js → schema.ts} +55 -35
  632. package/src/collab/merge/state_plugins/{action.js → action.ts} +65 -27
  633. package/src/collab/merge/state_plugins/{clipboard.js → clipboard.ts} +13 -3
  634. package/src/collab/merge/state_plugins/{diff.js → diff.ts} +279 -168
  635. package/src/collab/merge/{tools.js → tools.ts} +57 -27
  636. package/src/collab/{templates.js → templates.ts} +17 -2
  637. package/src/comments/{comment.js → comment.ts} +26 -0
  638. package/src/comments/editors/{answer.js → answer.ts} +27 -12
  639. package/src/comments/editors/{comment.js → comment.ts} +112 -36
  640. package/src/comments/editors/{notify.js → notify.ts} +6 -1
  641. package/src/comments/editors/{schema.js → schema.ts} +9 -8
  642. package/src/comments/index.ts +16 -0
  643. package/src/comments/{interactions.js → interactions.ts} +150 -89
  644. package/src/comments/{store.js → store.ts} +149 -73
  645. package/src/contacts/{add_dialog.js → add_dialog.ts} +50 -37
  646. package/src/contacts/{templates.js → templates.ts} +9 -3
  647. package/src/copyright_dialog/{index.js → index.ts} +92 -57
  648. package/src/copyright_dialog/{templates.js → templates.ts} +18 -3
  649. package/src/databases/{bibliography.js → bibliography.ts} +62 -36
  650. package/src/databases/{images.js → images.ts} +146 -96
  651. package/src/databases/index.ts +116 -0
  652. package/src/dialogs/{citation.js → citation.ts} +187 -106
  653. package/src/dialogs/{code_block.js → code_block.ts} +75 -33
  654. package/src/dialogs/{contributor.js → contributor.ts} +74 -49
  655. package/src/dialogs/{figure.js → figure.ts} +250 -149
  656. package/src/dialogs/{language.js → language.ts} +11 -6
  657. package/src/dialogs/{link.js → link.ts} +105 -60
  658. package/src/dialogs/{math.js → math.ts} +56 -28
  659. package/src/dialogs/{ordered_list.js → ordered_list.ts} +25 -12
  660. package/src/dialogs/{revision.js → revision.ts} +13 -9
  661. package/src/dialogs/{subsup.js → subsup.ts} +9 -7
  662. package/src/dialogs/{table.js → table.ts} +129 -70
  663. package/src/dialogs/{templates.js → templates.ts} +102 -22
  664. package/src/document_template/exporter.ts +158 -0
  665. package/src/document_template/{index.js → index.ts} +158 -117
  666. package/src/document_template/{schema.js → schema.ts} +31 -28
  667. package/src/documents/access_rights/{index.js → index.ts} +240 -123
  668. package/src/documents/access_rights/{templates.js → templates.ts} +41 -5
  669. package/src/e2ee/{snapshot-manager.js → snapshot-manager.ts} +80 -49
  670. package/src/exporter/native/copy.ts +302 -0
  671. package/src/exporter/native/{file.js → file.ts} +12 -5
  672. package/src/exporter/native/{revision.js → revision.ts} +17 -9
  673. package/src/footnotes/{editor.js → editor.ts} +37 -18
  674. package/src/footnotes/index.ts +21 -0
  675. package/src/footnotes/{layout.js → layout.ts} +53 -36
  676. package/src/footnotes/state_plugins/{access_rights.js → access_rights.ts} +6 -4
  677. package/src/global.d.ts +29 -0
  678. package/src/images/edit_dialog/{model.js → model.ts} +1 -1
  679. package/src/{index.js → index.ts} +193 -132
  680. package/src/{keymap.js → keymap.ts} +36 -16
  681. package/src/marginboxes/{index.js → index.ts} +341 -171
  682. package/src/marginboxes/{templates.js → templates.ts} +236 -38
  683. package/src/menus/code_block/{model.js → model.ts} +16 -5
  684. package/src/menus/figure/{model.js → model.ts} +21 -16
  685. package/src/menus/figure/utils.ts +13 -0
  686. package/src/menus/headerbar/{model.js → model.ts} +243 -153
  687. package/src/menus/headerbar/{view.js → view.ts} +189 -92
  688. package/src/menus/image/{model.js → model.ts} +13 -4
  689. package/src/menus/navigator/{model.js → model.ts} +6 -1
  690. package/src/menus/ordered_list/{model.js → model.ts} +2 -1
  691. package/src/menus/selection/{model.js → model.ts} +38 -20
  692. package/src/menus/selection/{view.js → view.ts} +88 -35
  693. package/src/menus/table/{model.js → model.ts} +84 -63
  694. package/src/menus/toolbar/{model.js → model.ts} +267 -215
  695. package/src/menus/toolbar/{view.js → view.ts} +135 -65
  696. package/src/modules.d.ts +84 -0
  697. package/src/navigator/{index.js → index.ts} +90 -56
  698. package/src/no_collab_save/{index.js → index.ts} +54 -31
  699. package/src/state_plugins/{access_rights.js → access_rights.ts} +12 -7
  700. package/src/state_plugins/citation_render.ts +63 -0
  701. package/src/state_plugins/{clipboard.js → clipboard.ts} +38 -23
  702. package/src/state_plugins/{code_block.js → code_block.ts} +62 -28
  703. package/src/state_plugins/{collab_carets.js → collab_carets.ts} +56 -25
  704. package/src/state_plugins/{comments.js → comments.ts} +70 -40
  705. package/src/state_plugins/contributor_input/{dropup.js → dropup.ts} +70 -38
  706. package/src/state_plugins/contributor_input/{node_view.js → node_view.ts} +13 -4
  707. package/src/state_plugins/contributor_input/{plugin.js → plugin.ts} +74 -75
  708. package/src/state_plugins/{document_template.js → document_template.ts} +108 -49
  709. package/src/state_plugins/{figure.js → figure.ts} +61 -23
  710. package/src/state_plugins/footnote_markers.ts +142 -0
  711. package/src/state_plugins/{headerbar.js → headerbar.ts} +4 -2
  712. package/src/state_plugins/{index.js → index.ts} +23 -56
  713. package/src/state_plugins/{inline_math.js → inline_math.ts} +151 -65
  714. package/src/state_plugins/inline_reference/{dropup.js → dropup.ts} +68 -34
  715. package/src/state_plugins/inline_reference/{plugin.js → plugin.ts} +221 -101
  716. package/src/state_plugins/jump_hidden_nodes.ts +67 -0
  717. package/src/state_plugins/{links.js → links.ts} +153 -99
  718. package/src/state_plugins/marginboxes.ts +17 -0
  719. package/src/state_plugins/{ordered_list_menu.js → ordered_list_menu.ts} +43 -17
  720. package/src/state_plugins/placeholders.ts +78 -0
  721. package/src/state_plugins/{search.js → search.ts} +110 -48
  722. package/src/state_plugins/{selection_menu.js → selection_menu.ts} +4 -2
  723. package/src/state_plugins/{settings.js → settings.ts} +68 -39
  724. package/src/state_plugins/table.ts +169 -0
  725. package/src/state_plugins/tag_input/{node_view.js → node_view.ts} +12 -3
  726. package/src/state_plugins/tag_input/plugin.ts +292 -0
  727. package/src/state_plugins/toc_render.ts +133 -0
  728. package/src/state_plugins/{toolbar.js → toolbar.ts} +4 -2
  729. package/src/state_plugins/track/{find_selected_changes.js → find_selected_changes.ts} +34 -19
  730. package/src/state_plugins/track/{helpers.js → helpers.ts} +36 -10
  731. package/src/state_plugins/track/{plugin.js → plugin.ts} +38 -14
  732. package/src/tools/key_bindings/{index.js → index.ts} +7 -3
  733. package/src/tools/key_bindings/{templates.js → templates.ts} +1 -1
  734. package/src/tools/search_replace/{index.js → index.ts} +115 -69
  735. package/src/tools/search_replace/{templates.js → templates.ts} +6 -1
  736. package/src/tools/word_count/{index.js → index.ts} +16 -6
  737. package/src/tools/word_count/{templates.js → templates.ts} +10 -1
  738. package/src/track/{accept.js → accept.ts} +20 -9
  739. package/src/track/{accept_all.js → accept_all.ts} +27 -17
  740. package/src/track/{accept_all_no_insertions.js → accept_all_no_insertions.ts} +16 -10
  741. package/src/track/{amend_transaction.js → amend_transaction.ts} +130 -70
  742. package/src/track/{delete.js → delete.ts} +15 -12
  743. package/src/track/{mod.js → mod.ts} +51 -32
  744. package/src/track/{reject.js → reject.ts} +34 -19
  745. package/src/track/{reject_all.js → reject_all.ts} +44 -24
  746. package/src/types.ts +214 -0
  747. package/src/comments/index.js +0 -11
  748. package/src/databases/index.js +0 -69
  749. package/src/document_template/exporter.js +0 -97
  750. package/src/exporter/native/copy.js +0 -191
  751. package/src/footnotes/index.js +0 -16
  752. package/src/menus/figure/utils.js +0 -5
  753. package/src/state_plugins/citation_render.js +0 -88
  754. package/src/state_plugins/footnote_markers.js +0 -238
  755. package/src/state_plugins/jump_hidden_nodes.js +0 -58
  756. package/src/state_plugins/marginboxes.js +0 -14
  757. package/src/state_plugins/placeholders.js +0 -123
  758. package/src/state_plugins/table.js +0 -127
  759. package/src/state_plugins/tag_input/plugin.js +0 -278
  760. package/src/state_plugins/toc_render.js +0 -160
  761. /package/src/clipboard/copy/{index.js → index.ts} +0 -0
  762. /package/src/clipboard/paste/{index.js → index.ts} +0 -0
  763. /package/src/collab/merge/state_plugins/{index.js → index.ts} +0 -0
  764. /package/src/comments/editors/{index.js → index.ts} +0 -0
  765. /package/src/dialogs/{index.js → index.ts} +0 -0
  766. /package/src/exporter/native/{index.js → index.ts} +0 -0
  767. /package/src/exporter/native/{zip.js → zip.ts} +0 -0
  768. /package/src/footnotes/state_plugins/{index.js → index.ts} +0 -0
  769. /package/src/menus/code_block/{index.js → index.ts} +0 -0
  770. /package/src/menus/figure/{index.js → index.ts} +0 -0
  771. /package/src/menus/headerbar/{index.js → index.ts} +0 -0
  772. /package/src/menus/image/{index.js → index.ts} +0 -0
  773. /package/src/menus/{index.js → index.ts} +0 -0
  774. /package/src/menus/navigator/{index.js → index.ts} +0 -0
  775. /package/src/menus/ordered_list/{index.js → index.ts} +0 -0
  776. /package/src/menus/selection/{index.js → index.ts} +0 -0
  777. /package/src/menus/table/{index.js → index.ts} +0 -0
  778. /package/src/menus/toolbar/{index.js → index.ts} +0 -0
  779. /package/src/plugins/citation_dialog/{index.js → index.ts} +0 -0
  780. /package/src/plugins/editor/{index.js → index.ts} +0 -0
  781. /package/src/state_plugins/contributor_input/{index.js → index.ts} +0 -0
  782. /package/src/state_plugins/inline_reference/{index.js → index.ts} +0 -0
  783. /package/src/state_plugins/tag_input/{index.js → index.ts} +0 -0
  784. /package/src/state_plugins/track/{index.js → index.ts} +0 -0
  785. /package/src/tools/{index.js → index.ts} +0 -0
  786. /package/src/track/{index.js → index.ts} +0 -0
@@ -5,6 +5,10 @@ import {
5
5
  TextSelection
6
6
  } from "prosemirror-state"
7
7
  import {Decoration, DecorationSet} from "prosemirror-view"
8
+ import type {Node as ProseMirrorNode} from "prosemirror-model"
9
+ import type {EditorState} from "prosemirror-state"
10
+ import type {EditorView} from "prosemirror-view"
11
+
8
12
  import {COMMENT_ONLY_ROLES, READ_ONLY_ROLES} from "../../index.js"
9
13
  import {elementDisabled} from "../../menus/toolbar/model.js"
10
14
  import {
@@ -15,10 +19,47 @@ import {
15
19
  filterCrossRefs
16
20
  } from "./dropup.js"
17
21
 
22
+ import type {Editor} from "../../types.js"
23
+
18
24
  const key = new PluginKey("inlineReference")
19
25
 
20
- export const getInlineReferenceState = state => key.getState(state)
21
- export const setInlineReferenceState = (tr, state) => tr.setMeta(key, state)
26
+ interface BibliographyEntry {
27
+ id: number
28
+ entry_key: string
29
+ author: string
30
+ title: string
31
+ year: string
32
+ source: string
33
+ entry: Record<string, unknown>
34
+ }
35
+
36
+ interface CrossRefTarget {
37
+ id: string
38
+ text: string
39
+ }
40
+
41
+ interface InlineReferenceState {
42
+ active: boolean
43
+ from: number
44
+ query: string
45
+ selectedIndex: number
46
+ listActive: boolean
47
+ isEdit: boolean
48
+ referenceNodePos: number
49
+ bibList: BibliographyEntry[]
50
+ widgetId: string | undefined
51
+ cursorAtStart: boolean | undefined
52
+ decos: DecorationSet
53
+ }
54
+
55
+ export const getInlineReferenceState = (state: EditorState) => key.getState(state)
56
+
57
+ export const setInlineReferenceState = (
58
+ tr: {
59
+ setMeta: (key: PluginKey, state: Partial<InlineReferenceState>) => unknown
60
+ },
61
+ state: Partial<InlineReferenceState>
62
+ ) => tr.setMeta(key, state)
22
63
 
23
64
  /**
24
65
  * Check if citations can be inserted at the given position.
@@ -26,7 +67,7 @@ export const setInlineReferenceState = (tr, state) => tr.setMeta(key, state)
26
67
  * (allowed elements per doc part, protected sections) — the same conditions
27
68
  * that disable the toolbar citation button.
28
69
  */
29
- function canActivateInlineReference(editor) {
70
+ function canActivateInlineReference(editor: Editor): boolean {
30
71
  // Mirror the template-based restriction check used by the toolbar button.
31
72
  if (
32
73
  editor &&
@@ -38,12 +79,25 @@ function canActivateInlineReference(editor) {
38
79
  return true
39
80
  }
40
81
 
82
+ interface ParsedCitation {
83
+ references: Array<{
84
+ id: number
85
+ prefix?: string
86
+ locator?: string
87
+ }>
88
+ format: string
89
+ }
90
+
41
91
  /**
42
92
  * Parse inline citation text into references array.
43
93
  * Format: @key[prefix][locator];key2[prefix2][locator2]
44
94
  * Returns {references, format} or null if any key cannot be resolved.
45
95
  */
46
- function parseCitationText(text, bibEntries, bibDB) {
96
+ function parseCitationText(
97
+ text: string,
98
+ bibEntries: BibliographyEntry[],
99
+ bibDB: {addReference(entry: Record<string, unknown>, id: number): number}
100
+ ): ParsedCitation | null {
47
101
  let format = "autocite"
48
102
  let body = text
49
103
  if (body.startsWith("@@")) {
@@ -57,7 +111,7 @@ function parseCitationText(text, bibEntries, bibDB) {
57
111
  return null
58
112
  }
59
113
 
60
- const references = []
114
+ const references: ParsedCitation["references"] = []
61
115
  const parts = body.split(";")
62
116
 
63
117
  for (const part of parts) {
@@ -82,7 +136,7 @@ function parseCitationText(text, bibEntries, bibDB) {
82
136
  // addReference then writes into the document DB, corrupting it.
83
137
  id = bibDB.addReference(bibEntry.entry, id)
84
138
  }
85
- const ref = {id}
139
+ const ref: ParsedCitation["references"][number] = {id}
86
140
  if (match[2]) {
87
141
  ref.prefix = match[2]
88
142
  }
@@ -102,7 +156,7 @@ function parseCitationText(text, bibEntries, bibDB) {
102
156
  /**
103
157
  * Extract the active reference index based on cursor offset.
104
158
  */
105
- function getActiveRefIndex(text, cursorOffset) {
159
+ function getActiveRefIndex(text: string, cursorOffset: number): number {
106
160
  let pos = 0
107
161
  const parts = text.split(";")
108
162
  for (let i = 0; i < parts.length; i++) {
@@ -118,7 +172,7 @@ function getActiveRefIndex(text, cursorOffset) {
118
172
  /**
119
173
  * Get the query (key being typed) for the active reference.
120
174
  */
121
- function getActiveQuery(text, activeIndex) {
175
+ function getActiveQuery(text: string, activeIndex: number): string {
122
176
  const parts = text.split(";")
123
177
  let part = parts[activeIndex] || ""
124
178
  if (part.startsWith("@@")) {
@@ -133,7 +187,11 @@ function getActiveQuery(text, activeIndex) {
133
187
  /**
134
188
  * Replace the key of the active reference while preserving prefix/locator.
135
189
  */
136
- function replaceActiveKey(text, activeIndex, newKey) {
190
+ function replaceActiveKey(
191
+ text: string,
192
+ activeIndex: number,
193
+ newKey: string
194
+ ): string {
137
195
  const parts = text.split(";")
138
196
  let part = parts[activeIndex] || ""
139
197
  let trigger = ""
@@ -153,9 +211,16 @@ function replaceActiveKey(text, activeIndex, newKey) {
153
211
  /**
154
212
  * Convert a citation node back to its inline text representation.
155
213
  */
156
- function citationToText(node, bibEntries) {
157
- const format = node.attrs.format
158
- const references = node.attrs.references || []
214
+ function citationToText(
215
+ node: ProseMirrorNode,
216
+ bibEntries: BibliographyEntry[]
217
+ ): string {
218
+ const format = node.attrs.format as string
219
+ const references = (node.attrs.references || []) as Array<{
220
+ id: number
221
+ prefix?: string
222
+ locator?: string
223
+ }>
159
224
  const parts = references.map(ref => {
160
225
  const entry = bibEntries.find(e => e.id === ref.id)
161
226
  const key = entry ? entry.entry_key : ""
@@ -175,7 +240,7 @@ function citationToText(node, bibEntries) {
175
240
  return "@" + body
176
241
  }
177
242
 
178
- function getInputCursorPos(el) {
243
+ function getInputCursorPos(el: HTMLElement): number {
179
244
  const sel = window.getSelection()
180
245
  if (!sel || !sel.rangeCount) {
181
246
  return (el.textContent || "").length
@@ -187,13 +252,13 @@ function getInputCursorPos(el) {
187
252
  return range.startOffset
188
253
  }
189
254
 
190
- function setInputCursorPos(el, pos) {
255
+ function setInputCursorPos(el: HTMLElement, pos: number): void {
191
256
  const textNode = el.firstChild
192
257
  if (!textNode) {
193
258
  return
194
259
  }
195
260
  const range = document.createRange()
196
- const safePos = Math.max(0, Math.min(pos, textNode.length))
261
+ const safePos = Math.max(0, Math.min(pos, (textNode as Text).length))
197
262
  range.setStart(textNode, safePos)
198
263
  range.collapse(true)
199
264
  const sel = window.getSelection()
@@ -206,7 +271,11 @@ function setInputCursorPos(el, pos) {
206
271
  /**
207
272
  * Create the inline citation widget DOM element.
208
273
  */
209
- function createInlineReferenceWidget(editor, pluginState, key) {
274
+ function createInlineReferenceWidget(
275
+ editor: Editor,
276
+ pluginState: InlineReferenceState,
277
+ pluginKey: PluginKey
278
+ ): HTMLElement {
210
279
  const view = editor.currentView || editor.view
211
280
  const container = document.createElement("span")
212
281
  container.className = "inline-reference-widget"
@@ -223,8 +292,10 @@ function createInlineReferenceWidget(editor, pluginState, key) {
223
292
  const dropUpWrapper = document.createElement("span")
224
293
  dropUpWrapper.className = "drop-up-outer inline-reference-drop-up"
225
294
 
226
- function renderDropUp() {
227
- const currentState = key.getState(view.state)
295
+ function renderDropUp(): void {
296
+ const currentState = pluginKey.getState(view.state) as
297
+ | InlineReferenceState
298
+ | undefined
228
299
  if (!currentState?.active) {
229
300
  return
230
301
  }
@@ -232,7 +303,9 @@ function createInlineReferenceWidget(editor, pluginState, key) {
232
303
  const citDisabled = elementDisabled(editor, "citation")
233
304
  const xrefDisabled = elementDisabled(editor, "cross_reference")
234
305
  const isXrefMode = !xrefDisabled && rawText.startsWith("@#")
235
- let citationMatches, xrefMatches, activeCitIndex
306
+ let citationMatches: BibliographyEntry[],
307
+ xrefMatches: CrossRefTarget[],
308
+ activeCitIndex: number
236
309
  if (isXrefMode) {
237
310
  // Cross-reference mode: only show cross-refs, filter by id/text
238
311
  citationMatches = []
@@ -279,7 +352,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
279
352
  )
280
353
  setInputCursorPos(input, newCursor + entry.entry_key.length)
281
354
  view.dispatch(
282
- view.state.tr.setMeta(key, {
355
+ view.state.tr.setMeta(pluginKey, {
283
356
  action: "updateQuery",
284
357
  query: input.textContent
285
358
  })
@@ -294,7 +367,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
294
367
  input.textContent = `@#${target.id}`
295
368
  setInputCursorPos(input, input.textContent.length)
296
369
  view.dispatch(
297
- view.state.tr.setMeta(key, {
370
+ view.state.tr.setMeta(pluginKey, {
298
371
  action: "updateQuery",
299
372
  query: input.textContent
300
373
  })
@@ -314,12 +387,11 @@ function createInlineReferenceWidget(editor, pluginState, key) {
314
387
  }
315
388
  }
316
389
 
317
- input.addEventListener("input", event => {
318
- event.stopPropagation()
390
+ input.addEventListener("input", () => {
319
391
  const text = input.textContent || ""
320
392
  if (!text) {
321
393
  // Everything including `@` was deleted — remove the node.
322
- view.dispatch(view.state.tr.setMeta(key, {action: "cancelDelete"}))
394
+ view.dispatch(view.state.tr.setMeta(pluginKey, {action: "cancelDelete"}))
323
395
  view.focus()
324
396
  return
325
397
  }
@@ -330,7 +402,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
330
402
  setInputCursorPos(input, cursorPos + 1)
331
403
  }
332
404
  view.dispatch(
333
- view.state.tr.setMeta(key, {
405
+ view.state.tr.setMeta(pluginKey, {
334
406
  action: "updateQuery",
335
407
  query: input.textContent
336
408
  })
@@ -344,7 +416,9 @@ function createInlineReferenceWidget(editor, pluginState, key) {
344
416
 
345
417
  input.addEventListener("keydown", event => {
346
418
  event.stopPropagation()
347
- const currentState = key.getState(view.state)
419
+ const currentState = pluginKey.getState(view.state) as
420
+ | InlineReferenceState
421
+ | undefined
348
422
  if (!currentState?.active) {
349
423
  return
350
424
  }
@@ -354,7 +428,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
354
428
  if (getInputCursorPos(input) === 0) {
355
429
  event.preventDefault()
356
430
  view.dispatch(
357
- view.state.tr.setMeta(key, {action: "cancelLeft"})
431
+ view.state.tr.setMeta(pluginKey, {action: "cancelLeft"})
358
432
  )
359
433
  view.focus()
360
434
  }
@@ -366,7 +440,9 @@ function createInlineReferenceWidget(editor, pluginState, key) {
366
440
  ) {
367
441
  event.preventDefault()
368
442
  view.dispatch(
369
- view.state.tr.setMeta(key, {action: "commitAndRight"})
443
+ view.state.tr.setMeta(pluginKey, {
444
+ action: "commitAndRight"
445
+ })
370
446
  )
371
447
  view.focus()
372
448
  }
@@ -374,10 +450,12 @@ function createInlineReferenceWidget(editor, pluginState, key) {
374
450
  case "ArrowDown":
375
451
  event.preventDefault()
376
452
  {
377
- const currentState = key.getState(view.state)
378
- if (!currentState.listActive) {
453
+ const state = pluginKey.getState(view.state) as
454
+ | InlineReferenceState
455
+ | undefined
456
+ if (!state?.listActive) {
379
457
  view.dispatch(
380
- view.state.tr.setMeta(key, {
458
+ view.state.tr.setMeta(pluginKey, {
381
459
  action: "select",
382
460
  index: 0,
383
461
  listActive: true
@@ -385,9 +463,9 @@ function createInlineReferenceWidget(editor, pluginState, key) {
385
463
  )
386
464
  } else {
387
465
  view.dispatch(
388
- view.state.tr.setMeta(key, {
466
+ view.state.tr.setMeta(pluginKey, {
389
467
  action: "select",
390
- index: currentState.selectedIndex + 1,
468
+ index: state.selectedIndex + 1,
391
469
  listActive: true
392
470
  })
393
471
  )
@@ -398,21 +476,20 @@ function createInlineReferenceWidget(editor, pluginState, key) {
398
476
  case "ArrowUp":
399
477
  event.preventDefault()
400
478
  {
401
- const currentState = key.getState(view.state)
402
- if (
403
- currentState.listActive &&
404
- currentState.selectedIndex > 0
405
- ) {
479
+ const state = pluginKey.getState(view.state) as
480
+ | InlineReferenceState
481
+ | undefined
482
+ if (state?.listActive && state.selectedIndex > 0) {
406
483
  view.dispatch(
407
- view.state.tr.setMeta(key, {
484
+ view.state.tr.setMeta(pluginKey, {
408
485
  action: "select",
409
- index: currentState.selectedIndex - 1,
486
+ index: state.selectedIndex - 1,
410
487
  listActive: true
411
488
  })
412
489
  )
413
490
  } else {
414
491
  view.dispatch(
415
- view.state.tr.setMeta(key, {
492
+ view.state.tr.setMeta(pluginKey, {
416
493
  action: "select",
417
494
  index: -1,
418
495
  listActive: false
@@ -425,7 +502,9 @@ function createInlineReferenceWidget(editor, pluginState, key) {
425
502
  case "Enter":
426
503
  event.preventDefault()
427
504
  {
428
- const currentState = key.getState(view.state)
505
+ const state = pluginKey.getState(view.state) as
506
+ | InlineReferenceState
507
+ | undefined
429
508
  const rawText = input.textContent || ""
430
509
  const citDisabledEnter = elementDisabled(editor, "citation")
431
510
  const xrefDisabledEnter = elementDisabled(
@@ -434,7 +513,9 @@ function createInlineReferenceWidget(editor, pluginState, key) {
434
513
  )
435
514
  const isXrefMode =
436
515
  !xrefDisabledEnter && rawText.startsWith("@#")
437
- let citMatches, xrefMatchesEnter, activeIndexEnter
516
+ let citMatches: BibliographyEntry[],
517
+ xrefMatchesEnter: CrossRefTarget[],
518
+ activeIndexEnter: number
438
519
  if (isXrefMode) {
439
520
  citMatches = []
440
521
  xrefMatchesEnter = filterCrossRefs(
@@ -448,7 +529,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
448
529
  const query = getActiveQuery(rawText, activeIndexEnter)
449
530
  citMatches = citDisabledEnter
450
531
  ? []
451
- : filterBibliography(currentState.bibList, query)
532
+ : filterBibliography(state?.bibList || [], query)
452
533
  xrefMatchesEnter = xrefDisabledEnter
453
534
  ? []
454
535
  : filterCrossRefs(crossRefList, query)
@@ -457,12 +538,12 @@ function createInlineReferenceWidget(editor, pluginState, key) {
457
538
  citMatches.length + xrefMatchesEnter.length
458
539
  const selectedIndex = Math.max(
459
540
  0,
460
- Math.min(currentState.selectedIndex, totalEnter - 1)
541
+ Math.min(state?.selectedIndex ?? -1, totalEnter - 1)
461
542
  )
462
543
  if (
463
- currentState.listActive &&
544
+ state?.listActive &&
464
545
  totalEnter > 0 &&
465
- currentState.selectedIndex >= 0
546
+ state.selectedIndex >= 0
466
547
  ) {
467
548
  if (selectedIndex < citMatches.length) {
468
549
  // Insert selected citation key into input
@@ -480,7 +561,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
480
561
  ) + entry.entry_key.length
481
562
  setInputCursorPos(input, newCursor)
482
563
  view.dispatch(
483
- view.state.tr.setMeta(key, {
564
+ view.state.tr.setMeta(pluginKey, {
484
565
  action: "updateQuery",
485
566
  query: input.textContent
486
567
  })
@@ -495,7 +576,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
495
576
  input.textContent = `@#${target.id}`
496
577
  setInputCursorPos(input, input.textContent.length)
497
578
  view.dispatch(
498
- view.state.tr.setMeta(key, {
579
+ view.state.tr.setMeta(pluginKey, {
499
580
  action: "updateQuery",
500
581
  query: input.textContent
501
582
  })
@@ -505,7 +586,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
505
586
  } else {
506
587
  // Not in list mode or no matches: commit what we have
507
588
  view.dispatch(
508
- view.state.tr.setMeta(key, {action: "commit"})
589
+ view.state.tr.setMeta(pluginKey, {action: "commit"})
509
590
  )
510
591
  view.focus()
511
592
  }
@@ -513,7 +594,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
513
594
  break
514
595
  case "Escape":
515
596
  event.preventDefault()
516
- view.dispatch(view.state.tr.setMeta(key, {action: "cancel"}))
597
+ view.dispatch(view.state.tr.setMeta(pluginKey, {action: "cancel"}))
517
598
  view.focus()
518
599
  break
519
600
  case "Home":
@@ -529,7 +610,7 @@ function createInlineReferenceWidget(editor, pluginState, key) {
529
610
  if ((input.textContent || "").length <= 1) {
530
611
  event.preventDefault()
531
612
  view.dispatch(
532
- view.state.tr.setMeta(key, {action: "cancelDelete"})
613
+ view.state.tr.setMeta(pluginKey, {action: "cancelDelete"})
533
614
  )
534
615
  view.focus()
535
616
  }
@@ -539,14 +620,14 @@ function createInlineReferenceWidget(editor, pluginState, key) {
539
620
  if ((input.textContent || "").length <= 1) {
540
621
  event.preventDefault()
541
622
  view.dispatch(
542
- view.state.tr.setMeta(key, {action: "cancelDelete"})
623
+ view.state.tr.setMeta(pluginKey, {action: "cancelDelete"})
543
624
  )
544
625
  view.focus()
545
626
  }
546
627
  break
547
628
  case "Tab":
548
629
  event.preventDefault()
549
- view.dispatch(view.state.tr.setMeta(key, {action: "commit"}))
630
+ view.dispatch(view.state.tr.setMeta(pluginKey, {action: "commit"}))
550
631
  break
551
632
  default:
552
633
  break
@@ -555,14 +636,16 @@ function createInlineReferenceWidget(editor, pluginState, key) {
555
636
 
556
637
  input.addEventListener("focusout", event => {
557
638
  const related = event.relatedTarget
558
- if (container.contains(related)) {
639
+ if (container.contains(related as globalThis.Node | null)) {
559
640
  return
560
641
  }
561
642
  const myWidgetId = pluginState.widgetId
562
643
  setTimeout(() => {
563
- const currentState = key.getState(view.state)
644
+ const currentState = pluginKey.getState(view.state) as
645
+ | InlineReferenceState
646
+ | undefined
564
647
  if (currentState?.active && currentState.widgetId === myWidgetId) {
565
- view.dispatch(view.state.tr.setMeta(key, {action: "commit"}))
648
+ view.dispatch(view.state.tr.setMeta(pluginKey, {action: "commit"}))
566
649
  }
567
650
  }, 1)
568
651
  })
@@ -589,14 +672,20 @@ function createInlineReferenceWidget(editor, pluginState, key) {
589
672
  return container
590
673
  }
591
674
 
592
- export const inlineReferencePlugin = options => {
675
+ export const inlineReferencePlugin = (options: {editor: Editor}): Plugin => {
593
676
  const editor = options.editor
594
- const bibDB = editor.mod.db.bibDB
677
+ const bibDB = (editor.mod.db?.bibDB || {}) as {
678
+ addReference(entry: Record<string, unknown>, id: number): number
679
+ }
680
+
681
+ const appConfig = editor.app as {
682
+ config?: {user?: {preferences?: {inline_references?: boolean}}}
683
+ }
595
684
 
596
685
  const enabled =
597
- editor.app.config.user?.preferences?.inline_references === true &&
598
- !READ_ONLY_ROLES.includes(editor.docInfo.access_rights) &&
599
- !COMMENT_ONLY_ROLES.includes(editor.docInfo.access_rights)
686
+ appConfig.config?.user?.preferences?.inline_references === true &&
687
+ !READ_ONLY_ROLES.includes(editor.docInfo.access_rights as string) &&
688
+ !COMMENT_ONLY_ROLES.includes(editor.docInfo.access_rights as string)
600
689
 
601
690
  if (!enabled) {
602
691
  return new Plugin({
@@ -615,7 +704,7 @@ export const inlineReferencePlugin = options => {
615
704
  return new Plugin({
616
705
  key,
617
706
  state: {
618
- init() {
707
+ init(): InlineReferenceState {
619
708
  return {
620
709
  active: false,
621
710
  from: 0,
@@ -630,22 +719,24 @@ export const inlineReferencePlugin = options => {
630
719
  decos: DecorationSet.empty
631
720
  }
632
721
  },
633
- apply(tr, prev, _oldState, _state) {
634
- let next = {...prev}
722
+ apply(tr, prev, _oldState, _state): InlineReferenceState {
723
+ let next = {...prev} as InlineReferenceState
635
724
  const meta = tr.getMeta(key)
636
725
 
637
726
  if (meta?.action === "activate") {
638
727
  next = {
639
728
  active: true,
640
- from: meta.from,
641
- query: meta.query || "",
729
+ from: meta.from as number,
730
+ query: (meta.query as string) || "",
642
731
  selectedIndex: -1,
643
732
  listActive: false,
644
- isEdit: meta.isEdit || false,
645
- referenceNodePos: meta.referenceNodePos || 0,
646
- bibList: meta.bibList || [],
733
+ isEdit: (meta.isEdit as boolean) || false,
734
+ referenceNodePos: (meta.referenceNodePos as number) || 0,
735
+ bibList: (meta.bibList as BibliographyEntry[]) || [],
647
736
  widgetId: Math.random().toString(36).slice(2),
648
- cursorAtStart: meta.cursorAtStart,
737
+ cursorAtStart: meta.cursorAtStart as
738
+ | boolean
739
+ | undefined,
649
740
  decos: DecorationSet.empty
650
741
  }
651
742
  } else if (meta?.action === "deactivate") {
@@ -663,12 +754,12 @@ export const inlineReferencePlugin = options => {
663
754
  decos: DecorationSet.empty
664
755
  }
665
756
  } else if (meta?.action === "select") {
666
- next.selectedIndex = meta.index
757
+ next.selectedIndex = meta.index as number
667
758
  if (meta.listActive !== undefined) {
668
- next.listActive = meta.listActive
759
+ next.listActive = meta.listActive as boolean
669
760
  }
670
761
  } else if (meta?.action === "updateQuery") {
671
- next.query = meta.query
762
+ next.query = meta.query as string
672
763
  next.selectedIndex = -1
673
764
  next.listActive = false
674
765
  }
@@ -716,14 +807,16 @@ export const inlineReferencePlugin = options => {
716
807
  }
717
808
  },
718
809
  appendTransaction: (trs, oldState, newState) => {
719
- const oldPluginState = key.getState(oldState)
810
+ const oldPluginState = key.getState(oldState) as
811
+ | InlineReferenceState
812
+ | undefined
720
813
  const meta = trs.find(tr => tr.getMeta(key))?.getMeta(key)
721
814
 
722
815
  if (
723
816
  meta?.action === "commit" ||
724
817
  meta?.action === "commitAndRight"
725
818
  ) {
726
- if (!oldPluginState.active) {
819
+ if (!oldPluginState?.active) {
727
820
  return null
728
821
  }
729
822
  const query = oldPluginState.query
@@ -824,6 +917,9 @@ export const inlineReferencePlugin = options => {
824
917
  }
825
918
 
826
919
  if (meta?.action === "cancel") {
920
+ if (!oldPluginState) {
921
+ return null
922
+ }
827
923
  if (oldPluginState.isEdit) {
828
924
  // Editing: just deactivate, leave reference unchanged
829
925
  const node = newState.doc.nodeAt(
@@ -849,6 +945,9 @@ export const inlineReferencePlugin = options => {
849
945
  }
850
946
 
851
947
  if (meta?.action === "cancelDelete") {
948
+ if (!oldPluginState) {
949
+ return null
950
+ }
852
951
  if (oldPluginState.isEdit) {
853
952
  // Delete the reference node entirely.
854
953
  const existingNode = newState.doc.nodeAt(
@@ -873,6 +972,9 @@ export const inlineReferencePlugin = options => {
873
972
  }
874
973
 
875
974
  if (meta?.action === "cancelLeft") {
975
+ if (!oldPluginState) {
976
+ return null
977
+ }
876
978
  if (oldPluginState.isEdit) {
877
979
  const tr = newState.tr.setSelection(
878
980
  TextSelection.create(
@@ -894,7 +996,7 @@ export const inlineReferencePlugin = options => {
894
996
  }
895
997
 
896
998
  if (meta?.action === "openDialog") {
897
- if (oldPluginState.active && oldPluginState.isEdit) {
999
+ if (oldPluginState?.active && oldPluginState.isEdit) {
898
1000
  // Deactivate the inline editor and leave a NodeSelection on
899
1001
  // the citation so CitationDialog opens with its content.
900
1002
  const node = newState.doc.nodeAt(
@@ -915,13 +1017,13 @@ export const inlineReferencePlugin = options => {
915
1017
  }
916
1018
 
917
1019
  if (meta?.action === "insertCrossRef") {
918
- if (!oldPluginState.active) {
1020
+ if (!oldPluginState?.active) {
919
1021
  return null
920
1022
  }
921
1023
  const crossRefNode =
922
1024
  newState.schema.nodes.cross_reference.create({
923
- id: meta.id,
924
- title: meta.title
1025
+ id: meta.id as string,
1026
+ title: meta.title as string | null
925
1027
  })
926
1028
  if (oldPluginState.isEdit) {
927
1029
  // Replace the existing citation node with a cross_reference.
@@ -957,7 +1059,7 @@ export const inlineReferencePlugin = options => {
957
1059
  }
958
1060
  }
959
1061
 
960
- if (oldPluginState.active) {
1062
+ if (oldPluginState?.active) {
961
1063
  // If selection moved away from the widget, commit
962
1064
  if (
963
1065
  trs.some(tr => tr.selectionSet) &&
@@ -1127,11 +1229,20 @@ export const inlineReferencePlugin = options => {
1127
1229
  return null
1128
1230
  },
1129
1231
  props: {
1130
- decorations(state) {
1131
- const pluginState = key.getState(state)
1232
+ decorations(state: EditorState) {
1233
+ const pluginState = key.getState(state) as
1234
+ | InlineReferenceState
1235
+ | undefined
1132
1236
  return pluginState?.decos || DecorationSet.empty
1133
1237
  },
1134
- handleClickOn(_view, _pos, node, nodePos, _event, _direct) {
1238
+ handleClickOn(
1239
+ _view: EditorView,
1240
+ _pos: number,
1241
+ node: ProseMirrorNode,
1242
+ nodePos: number,
1243
+ _event: MouseEvent,
1244
+ _direct: boolean
1245
+ ) {
1135
1246
  if (node.type.name === "citation") {
1136
1247
  const bibList = buildBibliographyList(editor)
1137
1248
  const text = citationToText(node, bibList)
@@ -1173,21 +1284,22 @@ export const inlineReferencePlugin = options => {
1173
1284
  return false
1174
1285
  },
1175
1286
  handleDOMEvents: {
1176
- mousedown(view, event) {
1287
+ mousedown(view: EditorView, event: MouseEvent) {
1177
1288
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
1178
1289
  return false
1179
1290
  }
1180
1291
  if (event.button !== 0) {
1181
1292
  return false
1182
1293
  }
1183
- const citTarget = event.target.closest(".citation")
1294
+ const target = event.target as HTMLElement | null
1295
+ const citTarget = target?.closest(".citation")
1184
1296
  const xrefTarget =
1185
- !citTarget && event.target.closest(".cross-reference")
1186
- const target = citTarget || xrefTarget
1187
- if (!target) {
1297
+ !citTarget && target?.closest(".cross-reference")
1298
+ const closest = citTarget || xrefTarget
1299
+ if (!closest) {
1188
1300
  return false
1189
1301
  }
1190
- let pos = view.posAtDOM(target, 0)
1302
+ let pos = view.posAtDOM(closest, 0)
1191
1303
  let node = view.state.doc.nodeAt(pos)
1192
1304
  if (
1193
1305
  !node ||
@@ -1196,7 +1308,9 @@ export const inlineReferencePlugin = options => {
1196
1308
  ) {
1197
1309
  return false
1198
1310
  }
1199
- const pluginState = key.getState(view.state)
1311
+ const pluginState = key.getState(view.state) as
1312
+ | InlineReferenceState
1313
+ | undefined
1200
1314
  if (pluginState?.active) {
1201
1315
  // Commit current widget first
1202
1316
  const commitTr = view.state.tr.setMeta(key, {
@@ -1213,7 +1327,7 @@ export const inlineReferencePlugin = options => {
1213
1327
  return false
1214
1328
  }
1215
1329
  }
1216
- let query, bibList
1330
+ let query: string, bibList: BibliographyEntry[]
1217
1331
  if (node.type.name === "citation") {
1218
1332
  bibList = buildBibliographyList(editor)
1219
1333
  query = citationToText(node, bibList)
@@ -1240,15 +1354,18 @@ export const inlineReferencePlugin = options => {
1240
1354
  event.preventDefault()
1241
1355
  return true
1242
1356
  },
1243
- click(view, event) {
1357
+ click(view: EditorView, event: MouseEvent) {
1244
1358
  // Fallback click handler for touch devices and cases where
1245
1359
  // mousedown/handleClickOn did not fire.
1246
- const pluginState = key.getState(view.state)
1360
+ const pluginState = key.getState(view.state) as
1361
+ | InlineReferenceState
1362
+ | undefined
1247
1363
  if (pluginState?.active) {
1248
- const target = event.target.closest(
1364
+ const target = event.target as HTMLElement | null
1365
+ const closest = target?.closest(
1249
1366
  ".inline-reference-widget"
1250
1367
  )
1251
- if (target) {
1368
+ if (closest) {
1252
1369
  // Click inside widget: let widget handle it
1253
1370
  return false
1254
1371
  }
@@ -1266,11 +1383,12 @@ export const inlineReferencePlugin = options => {
1266
1383
  if (event.ctrlKey || event.metaKey || event.shiftKey) {
1267
1384
  return false
1268
1385
  }
1269
- const target = event.target.closest(".citation")
1270
- if (!target) {
1386
+ const target = event.target as HTMLElement | null
1387
+ const closest = target?.closest(".citation")
1388
+ if (!closest) {
1271
1389
  return false
1272
1390
  }
1273
- const pos = view.posAtDOM(target, 0)
1391
+ const pos = view.posAtDOM(closest, 0)
1274
1392
  const node = view.state.doc.nodeAt(pos)
1275
1393
  if (!node || node.type.name !== "citation") {
1276
1394
  return false
@@ -1295,8 +1413,10 @@ export const inlineReferencePlugin = options => {
1295
1413
  return true
1296
1414
  }
1297
1415
  },
1298
- handleKeyDown(view, event) {
1299
- const pluginState = key.getState(view.state)
1416
+ handleKeyDown(view: EditorView, event: KeyboardEvent) {
1417
+ const pluginState = key.getState(view.state) as
1418
+ | InlineReferenceState
1419
+ | undefined
1300
1420
  if (!pluginState?.active) {
1301
1421
  if (event.key === "@") {
1302
1422
  const $pos = view.state.selection.$head