@novaprose/core 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +57 -20
  2. package/dist/{advlist-FH3K3AAQ.js → advlist-5FNKPLUX.js} +11 -20
  3. package/dist/advlist-5FNKPLUX.js.map +1 -0
  4. package/dist/{autolink-IDJWAL2V.js → autolink-45LTODWB.js} +7 -4
  5. package/dist/{autolink-IDJWAL2V.js.map → autolink-45LTODWB.js.map} +1 -1
  6. package/dist/{autoresize-4ZEPQCHP.js → autoresize-UB3GOA6D.js} +2 -2
  7. package/dist/{autosave-DH7SO4UQ.js → autosave-GMWJ5BPE.js} +7 -11
  8. package/dist/autosave-GMWJ5BPE.js.map +1 -0
  9. package/dist/{charmap-F7EVJ56K.js → charmap-2GC7LF7G.js} +7 -12
  10. package/dist/charmap-2GC7LF7G.js.map +1 -0
  11. package/dist/{chunk-MOO4PJGI.js → chunk-5AW2HHG6.js} +16 -1
  12. package/dist/chunk-5AW2HHG6.js.map +1 -0
  13. package/dist/{chunk-55LD2TT2.js → chunk-DWZLSZDG.js} +1550 -935
  14. package/dist/chunk-DWZLSZDG.js.map +1 -0
  15. package/dist/{chunk-YZPJQB3I.js → chunk-FCMZ7TUQ.js} +308 -34
  16. package/dist/chunk-FCMZ7TUQ.js.map +1 -0
  17. package/dist/{chunk-6GWG2BLC.js → chunk-HPLT3XRZ.js} +1 -1
  18. package/dist/chunk-HPLT3XRZ.js.map +1 -0
  19. package/dist/{chunk-HZRIBOPW.js → chunk-JPJVTB45.js} +38 -2
  20. package/dist/chunk-JPJVTB45.js.map +1 -0
  21. package/dist/{chunk-6AL2IS6V.js → chunk-KPE3QRPB.js} +206 -404
  22. package/dist/chunk-KPE3QRPB.js.map +1 -0
  23. package/dist/chunk-KWXFL4WS.js +174 -0
  24. package/dist/chunk-KWXFL4WS.js.map +1 -0
  25. package/dist/chunk-ND2CWNVG.js +51 -0
  26. package/dist/chunk-ND2CWNVG.js.map +1 -0
  27. package/dist/chunk-PVFKXRID.js +27 -0
  28. package/dist/chunk-PVFKXRID.js.map +1 -0
  29. package/dist/chunk-R2UMUCVI.js +351 -0
  30. package/dist/chunk-R2UMUCVI.js.map +1 -0
  31. package/dist/{chunk-GHEFKKRC.js → chunk-T3GY6IVK.js} +41 -24
  32. package/dist/chunk-T3GY6IVK.js.map +1 -0
  33. package/dist/{comments-panel-FYJE3U64.js → comments-panel-HXMWSRAW.js} +5 -3
  34. package/dist/comments-panel-HXMWSRAW.js.map +1 -0
  35. package/dist/{directionality-MF5HDXH3.js → directionality-5JLWQGP2.js} +13 -11
  36. package/dist/directionality-5JLWQGP2.js.map +1 -0
  37. package/dist/editor-CXkltf1R.d.ts +1886 -0
  38. package/dist/editor-CgSBFTke.d.cts +1886 -0
  39. package/dist/{emoticons-SONBUCFV.js → emoticons-ZD6ZRIWG.js} +7 -12
  40. package/dist/emoticons-ZD6ZRIWG.js.map +1 -0
  41. package/dist/form-dialog-QH6KAERD.js +180 -0
  42. package/dist/form-dialog-QH6KAERD.js.map +1 -0
  43. package/dist/html-rules-api-D3fKQi-R.d.cts +40 -0
  44. package/dist/html-rules-api-D3fKQi-R.d.ts +40 -0
  45. package/dist/html-rules.cjs +480 -0
  46. package/dist/html-rules.cjs.map +1 -0
  47. package/dist/html-rules.d.cts +87 -0
  48. package/dist/html-rules.d.ts +87 -0
  49. package/dist/html-rules.js +413 -0
  50. package/dist/html-rules.js.map +1 -0
  51. package/dist/i18n/de.cjs +324 -0
  52. package/dist/i18n/de.cjs.map +1 -0
  53. package/dist/i18n/de.d.cts +9 -0
  54. package/dist/i18n/de.d.ts +9 -0
  55. package/dist/i18n/de.js +303 -0
  56. package/dist/i18n/de.js.map +1 -0
  57. package/dist/i18n/es.cjs +324 -0
  58. package/dist/i18n/es.cjs.map +1 -0
  59. package/dist/i18n/es.d.cts +9 -0
  60. package/dist/i18n/es.d.ts +9 -0
  61. package/dist/i18n/es.js +303 -0
  62. package/dist/i18n/es.js.map +1 -0
  63. package/dist/i18n/fr.cjs +324 -0
  64. package/dist/i18n/fr.cjs.map +1 -0
  65. package/dist/i18n/fr.d.cts +9 -0
  66. package/dist/i18n/fr.d.ts +9 -0
  67. package/dist/i18n/fr.js +303 -0
  68. package/dist/i18n/fr.js.map +1 -0
  69. package/dist/i18n/it.cjs +324 -0
  70. package/dist/i18n/it.cjs.map +1 -0
  71. package/dist/i18n/it.d.cts +9 -0
  72. package/dist/i18n/it.d.ts +9 -0
  73. package/dist/i18n/it.js +303 -0
  74. package/dist/i18n/it.js.map +1 -0
  75. package/dist/i18n/pt-BR.cjs +324 -0
  76. package/dist/i18n/pt-BR.cjs.map +1 -0
  77. package/dist/i18n/pt-BR.d.cts +9 -0
  78. package/dist/i18n/pt-BR.d.ts +9 -0
  79. package/dist/i18n/pt-BR.js +303 -0
  80. package/dist/i18n/pt-BR.js.map +1 -0
  81. package/dist/i18n/ru.cjs +324 -0
  82. package/dist/i18n/ru.cjs.map +1 -0
  83. package/dist/i18n/ru.d.cts +10 -0
  84. package/dist/i18n/ru.d.ts +10 -0
  85. package/dist/i18n/ru.js +303 -0
  86. package/dist/i18n/ru.js.map +1 -0
  87. package/dist/index-C603bU6r.d.cts +216 -0
  88. package/dist/index-C603bU6r.d.ts +216 -0
  89. package/dist/index.cjs +3422 -1179
  90. package/dist/index.cjs.map +1 -1
  91. package/dist/index.d.cts +50 -1555
  92. package/dist/index.d.ts +50 -1555
  93. package/dist/index.js +278 -147
  94. package/dist/index.js.map +1 -1
  95. package/dist/{insertdatetime-X2T4ZY6R.js → insertdatetime-CRO7TJAQ.js} +10 -16
  96. package/dist/insertdatetime-CRO7TJAQ.js.map +1 -0
  97. package/dist/markdown.cjs +273 -0
  98. package/dist/markdown.cjs.map +1 -0
  99. package/dist/markdown.d.cts +23 -0
  100. package/dist/markdown.d.ts +23 -0
  101. package/dist/markdown.js +241 -0
  102. package/dist/markdown.js.map +1 -0
  103. package/dist/{nonbreaking-PP4KIJSR.js → nonbreaking-66LFZV2W.js} +8 -7
  104. package/dist/nonbreaking-66LFZV2W.js.map +1 -0
  105. package/dist/paste-office-F3QW4WWO.js +440 -0
  106. package/dist/paste-office-F3QW4WWO.js.map +1 -0
  107. package/dist/{quickbars-3WKHLKAR.js → quickbars-7E2QRS7J.js} +13 -9
  108. package/dist/quickbars-7E2QRS7J.js.map +1 -0
  109. package/dist/{revisionhistory-FYRVDGRA.js → revisionhistory-DXE7KU4R.js} +18 -32
  110. package/dist/revisionhistory-DXE7KU4R.js.map +1 -0
  111. package/dist/table-SSNABG5W.js +301 -0
  112. package/dist/table-SSNABG5W.js.map +1 -0
  113. package/dist/{visualblocks-NPTMWFXD.js → visualblocks-6DLBXYOA.js} +8 -7
  114. package/dist/visualblocks-6DLBXYOA.js.map +1 -0
  115. package/package.json +45 -5
  116. package/src/style.css +291 -29
  117. package/dist/advlist-FH3K3AAQ.js.map +0 -1
  118. package/dist/autosave-DH7SO4UQ.js.map +0 -1
  119. package/dist/charmap-F7EVJ56K.js.map +0 -1
  120. package/dist/chunk-55LD2TT2.js.map +0 -1
  121. package/dist/chunk-6AL2IS6V.js.map +0 -1
  122. package/dist/chunk-6GWG2BLC.js.map +0 -1
  123. package/dist/chunk-6RJENZXT.js +0 -104
  124. package/dist/chunk-6RJENZXT.js.map +0 -1
  125. package/dist/chunk-GHEFKKRC.js.map +0 -1
  126. package/dist/chunk-HZRIBOPW.js.map +0 -1
  127. package/dist/chunk-MOO4PJGI.js.map +0 -1
  128. package/dist/chunk-YZPJQB3I.js.map +0 -1
  129. package/dist/comments-panel-FYJE3U64.js.map +0 -1
  130. package/dist/directionality-MF5HDXH3.js.map +0 -1
  131. package/dist/emoticons-SONBUCFV.js.map +0 -1
  132. package/dist/insertdatetime-X2T4ZY6R.js.map +0 -1
  133. package/dist/nonbreaking-PP4KIJSR.js.map +0 -1
  134. package/dist/quickbars-3WKHLKAR.js.map +0 -1
  135. package/dist/revisionhistory-FYRVDGRA.js.map +0 -1
  136. package/dist/visualblocks-NPTMWFXD.js.map +0 -1
  137. /package/dist/{autoresize-4ZEPQCHP.js.map → autoresize-UB3GOA6D.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,22 +1,23 @@
1
1
  import {
2
+ API_CHANGE_META,
2
3
  ContentRules,
3
4
  DEFAULT_MENUBAR,
4
5
  DEFAULT_MENUS,
5
6
  Editor,
7
+ Formatter,
6
8
  HTMLSerializer,
7
9
  KNOWN_STYLES,
8
10
  KNOWN_TAGS,
11
+ REMOTE_CHANGE_META,
9
12
  clearSearch,
10
13
  countWords,
11
14
  createEditor,
12
- createTranslator,
13
15
  defaultColors,
14
16
  defaultFontFamilies,
15
17
  defaultFontSizes,
16
18
  defaultLineHeights,
17
19
  defaultSlashCommands,
18
20
  defaultToolbar,
19
- en,
20
21
  findMatches,
21
22
  findNext,
22
23
  formatHTML,
@@ -32,15 +33,13 @@ import {
32
33
  parserFor,
33
34
  printContent,
34
35
  rankSlashCommands,
35
- registerLanguage,
36
36
  replaceAll,
37
37
  replaceCurrent,
38
- ru,
39
38
  setLineHeight,
40
39
  setSearch,
41
40
  setStyle,
42
41
  toggleFullscreen
43
- } from "./chunk-55LD2TT2.js";
42
+ } from "./chunk-DWZLSZDG.js";
44
43
  import {
45
44
  COMMENT_ID_RE,
46
45
  COMMENT_MAX_LENGTH,
@@ -51,39 +50,18 @@ import {
51
50
  } from "./chunk-Z3ELZ77W.js";
52
51
  import {
53
52
  applyLink,
54
- createTable,
53
+ attachFilePicker,
55
54
  getSelectedImage,
56
- hasHeaderColumn,
57
- hasHeaderRow,
58
- insertTable,
59
- isInTable,
60
55
  normalizeUrl,
61
56
  openImageAltDialog,
62
57
  openImageDialog,
63
58
  openLinkDialog,
64
59
  removeLink,
65
- setCellBackground,
66
60
  setImageAttrs,
67
61
  setImageWidthFraction,
68
- tableCommands,
69
62
  textField,
70
63
  uploadImages
71
- } from "./chunk-6AL2IS6V.js";
72
- import {
73
- createSchema,
74
- cssValue,
75
- imageSize,
76
- schema
77
- } from "./chunk-YZPJQB3I.js";
78
- import {
79
- pickLabels
80
- } from "./chunk-6RJENZXT.js";
81
- import {
82
- h
83
- } from "./chunk-HZRIBOPW.js";
84
- import {
85
- icons
86
- } from "./chunk-MOO4PJGI.js";
64
+ } from "./chunk-KPE3QRPB.js";
87
65
  import {
88
66
  commands,
89
67
  getActiveAlign,
@@ -92,17 +70,50 @@ import {
92
70
  isCommandActive,
93
71
  isMarkActive,
94
72
  isNodeActive,
95
- isSafeImageUrl,
96
- isSafeLinkUrl,
97
73
  marksOf,
98
74
  nodesOf,
99
75
  setLink
100
- } from "./chunk-GHEFKKRC.js";
76
+ } from "./chunk-T3GY6IVK.js";
77
+ import {
78
+ createTable,
79
+ hasHeaderColumn,
80
+ hasHeaderRow,
81
+ insertTable,
82
+ setCellBackground,
83
+ tableCommands
84
+ } from "./chunk-KWXFL4WS.js";
85
+ import {
86
+ createSchema,
87
+ cssValue,
88
+ imageSize,
89
+ isInTable,
90
+ schema
91
+ } from "./chunk-FCMZ7TUQ.js";
92
+ import {
93
+ createTranslator,
94
+ en,
95
+ getPluginMessages,
96
+ pickLabels,
97
+ registerLanguage
98
+ } from "./chunk-R2UMUCVI.js";
99
+ import {
100
+ icons
101
+ } from "./chunk-5AW2HHG6.js";
101
102
  import {
102
103
  definePlugin,
103
104
  isPluginRegistered,
104
105
  registerPlugin
105
- } from "./chunk-6GWG2BLC.js";
106
+ } from "./chunk-HPLT3XRZ.js";
107
+ import {
108
+ h
109
+ } from "./chunk-JPJVTB45.js";
110
+ import {
111
+ registerHtmlRules
112
+ } from "./chunk-ND2CWNVG.js";
113
+ import {
114
+ isSafeImageUrl,
115
+ isSafeLinkUrl
116
+ } from "./chunk-PVFKXRID.js";
106
117
 
107
118
  // src/plugins/anchor.ts
108
119
  import { NodeSelection } from "prosemirror-state";
@@ -114,13 +125,6 @@ var LABELS = {
114
125
  hint: "Letters, digits, \u201C-\u201D, \u201C_\u201D, \u201C.\u201D; must start with a letter. Link to it with #ID.",
115
126
  invalid: "Use letters, digits, \u201C-\u201D, \u201C_\u201D or \u201C.\u201D, starting with a letter",
116
127
  save: "Save"
117
- },
118
- ru: {
119
- title: "\u042F\u043A\u043E\u0440\u044C",
120
- id: "\u0418\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440",
121
- hint: "\u041B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB, \xAB.\xBB; \u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441 \u0431\u0443\u043A\u0432\u044B. \u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u044F\u043A\u043E\u0440\u044C \u2014 #\u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440.",
122
- invalid: "\u0422\u043E\u043B\u044C\u043A\u043E \u043B\u0430\u0442\u0438\u043D\u0441\u043A\u0438\u0435 \u0431\u0443\u043A\u0432\u044B, \u0446\u0438\u0444\u0440\u044B, \xAB-\xBB, \xAB_\xBB \u0438\u043B\u0438 \xAB.\xBB, \u043F\u0435\u0440\u0432\u0430\u044F \u2014 \u0431\u0443\u043A\u0432\u0430",
123
- save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C"
124
128
  }
125
129
  };
126
130
  var ID_RE = /^[A-Za-z][\w.-]{0,63}$/;
@@ -155,7 +159,7 @@ var anchor_default = definePlugin({
155
159
  }
156
160
  },
157
161
  setup(editor) {
158
- const labels = pickLabels(editor, LABELS);
162
+ const labels = pickLabels(editor, "anchor", LABELS);
159
163
  const selectedAnchor = () => {
160
164
  const { selection } = editor.view.state;
161
165
  return selection instanceof NodeSelection && selection.node.type.name === "anchor" ? selection : null;
@@ -201,8 +205,7 @@ import { keymap } from "prosemirror-keymap";
201
205
 
202
206
  // src/plugins/mentions.ts
203
207
  var LABELS2 = {
204
- en: { list: "People", empty: "No matches" },
205
- ru: { list: "\u041B\u044E\u0434\u0438", empty: "\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E" }
208
+ en: { list: "People", empty: "No matches" }
206
209
  };
207
210
  var MENTION_ID_RE = /^[\w.@:+-]{1,128}$/;
208
211
  var MAX_NAME = 80;
@@ -263,7 +266,7 @@ var mentions_default = definePlugin({
263
266
  console.warn("[nova] mentions: set pluginOptions.mentions.fetch to search people");
264
267
  return;
265
268
  }
266
- const labels = pickLabels(editor, LABELS2);
269
+ const labels = pickLabels(editor, "mentions", LABELS2);
267
270
  const max = options.maxResults ?? 8;
268
271
  let found = /* @__PURE__ */ new Map();
269
272
  editor.ui.registry.addAutocompleter("mentions", {
@@ -322,34 +325,6 @@ var LABELS3 = {
322
325
  edited: "edited",
323
326
  you: "you",
324
327
  count: "{count} comments"
325
- },
326
- ru: {
327
- add: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",
328
- show: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",
329
- panel: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",
330
- guest: "\u0413\u043E\u0441\u0442\u044C",
331
- newComment: "\u041D\u043E\u0432\u044B\u0439 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",
332
- placeholder: "\u041D\u0430\u043F\u0438\u0448\u0438\u0442\u0435 \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\u2026",
333
- replyPlaceholder: "\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C\u2026",
334
- comment: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
335
- reply: "\u041E\u0442\u0432\u0435\u0442\u0438\u0442\u044C",
336
- cancel: "\u041E\u0442\u043C\u0435\u043D\u0430",
337
- save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C",
338
- edit: "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",
339
- remove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
340
- resolve: "\u0420\u0435\u0448\u0435\u043D\u043E",
341
- reopen: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u043D\u043E\u0432\u0430",
342
- deleteThread: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435",
343
- close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438",
344
- showResolved: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0440\u0435\u0448\u0451\u043D\u043D\u044B\u0435",
345
- resolvedBy: "\u0420\u0435\u0448\u0435\u043D\u043E: {name}",
346
- orphan: "\u041F\u0440\u043E\u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442 \u0443\u0434\u0430\u043B\u0451\u043D",
347
- empty: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442. \u0412\u044B\u0434\u0435\u043B\u0438\u0442\u0435 \u0442\u0435\u043A\u0441\u0442 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \xAB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439\xBB ({shortcut}).",
348
- people: "\u041B\u044E\u0434\u0438",
349
- noPeople: "\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E",
350
- edited: "\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u043E",
351
- you: "\u0432\u044B",
352
- count: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0435\u0432: {count}"
353
328
  }
354
329
  };
355
330
  var ICON_ADD = icons.commentAdd;
@@ -477,7 +452,7 @@ var comments_default = definePlugin({
477
452
  ];
478
453
  },
479
454
  setup(editor) {
480
- const labels = pickLabels(editor, LABELS3);
455
+ const labels = pickLabels(editor, "comments", LABELS3);
481
456
  const options = editor.options.pluginOptions?.comments ?? {};
482
457
  const store = options.store ?? createCommentStore(options.threads ?? [], options.onChange);
483
458
  const author = {
@@ -509,12 +484,29 @@ var comments_default = definePlugin({
509
484
  const dispatchMeta = (meta) => editor.view.dispatch(editor.view.state.tr.setMeta(commentsKey, meta));
510
485
  let panel = null;
511
486
  let panelOpen = false;
512
- let loading = null;
513
- const content = editor.view.dom.parentElement;
514
- const body = document.createElement("div");
515
- body.className = "nova-body";
516
- content.parentElement.insertBefore(body, content);
517
- body.append(content);
487
+ editor.ui.registry.addSidebar("comments", {
488
+ title: labels.panel,
489
+ button: false,
490
+ header: false,
491
+ render: async (container) => {
492
+ const { createCommentsPanel } = await import("./comments-panel-HXMWSRAW.js");
493
+ panel = createCommentsPanel(controller);
494
+ container.append(panel.el);
495
+ return () => panel?.destroy();
496
+ },
497
+ onShow: () => {
498
+ panelOpen = true;
499
+ if (panel) panel.el.hidden = false;
500
+ editor.root.classList.add("nova-comments-open");
501
+ panel?.render();
502
+ },
503
+ onHide: () => {
504
+ panelOpen = false;
505
+ if (panel) panel.el.hidden = true;
506
+ editor.root.classList.remove("nova-comments-open");
507
+ if (pluginState().pending) dispatchMeta({ pending: null });
508
+ }
509
+ });
518
510
  const controller = {
519
511
  editor,
520
512
  store,
@@ -600,30 +592,10 @@ var comments_default = definePlugin({
600
592
  },
601
593
  canEdit: (comment) => options.canEdit ? options.canEdit(comment, author) : comment.author.id === author.id,
602
594
  isPanelOpen: () => panelOpen,
603
- async openPanel() {
604
- if (!panel) {
605
- loading ??= import("./comments-panel-FYJE3U64.js").then(({ createCommentsPanel }) => {
606
- if (editor.view.isDestroyed) return;
607
- panel = createCommentsPanel(controller);
608
- body.append(panel.el);
609
- });
610
- await loading;
611
- }
612
- if (!panel || panelOpen) return;
613
- editor.ui.closeOverlays();
614
- panelOpen = true;
615
- panel.el.hidden = false;
616
- editor.root.classList.add("nova-comments-open");
617
- panel.render();
618
- editor.updateUI();
619
- },
595
+ openPanel: () => editor.ui.sidebar.show("comments"),
620
596
  closePanel() {
621
- if (!panel || !panelOpen) return;
622
- panelOpen = false;
623
- panel.el.hidden = true;
624
- editor.root.classList.remove("nova-comments-open");
625
- if (pluginState().pending) dispatchMeta({ pending: null });
626
- editor.updateUI();
597
+ if (!panelOpen) return;
598
+ editor.ui.sidebar.hide({ restoreFocus: false });
627
599
  editor.focus();
628
600
  }
629
601
  };
@@ -664,12 +636,185 @@ var comments_default = definePlugin({
664
636
  });
665
637
  return () => {
666
638
  unsubscribe();
667
- panel?.destroy();
668
639
  controllers.delete(editor);
669
640
  };
670
641
  }
671
642
  });
672
643
 
644
+ // src/plugins/mergetags.ts
645
+ import { Plugin as PMPlugin } from "prosemirror-state";
646
+ var LABELS4 = {
647
+ en: {
648
+ insert: "Insert variable",
649
+ search: "Variables",
650
+ empty: "No variables found",
651
+ unknown: "Unknown variable"
652
+ }
653
+ };
654
+ var KEY_RE = /^[\w.:-]{1,100}$/;
655
+ var ATTR_RE = /^data-[a-z0-9-]{1,40}$/;
656
+ function optionsOf(editor) {
657
+ return editor.options.pluginOptions?.mergetags ?? {};
658
+ }
659
+ function attributeOf(editor) {
660
+ const attribute = optionsOf(editor).attribute ?? "data-mergetag";
661
+ if (ATTR_RE.test(attribute)) return attribute;
662
+ console.warn(
663
+ `[nova] mergetags: attribute "${attribute}" must look like data-name; using data-mergetag`
664
+ );
665
+ return "data-mergetag";
666
+ }
667
+ var isGroup = (entry) => Array.isArray(entry.items);
668
+ function flatList(editor) {
669
+ return (optionsOf(editor).list ?? []).flatMap(
670
+ (entry) => isGroup(entry) ? entry.items : [entry]
671
+ );
672
+ }
673
+ function labelFor(editor, key) {
674
+ return flatList(editor).find((tag) => tag.key === key)?.label;
675
+ }
676
+ function buildNodes(editor) {
677
+ const attribute = attributeOf(editor);
678
+ return {
679
+ mergetag: {
680
+ group: "inline",
681
+ inline: true,
682
+ atom: true,
683
+ selectable: true,
684
+ draggable: true,
685
+ // Свой style «фишки» (цвет, фон, жирность) — оформление, а не формат текста вокруг.
686
+ ignoreStyles: true,
687
+ attrs: { key: {}, label: { default: "" } },
688
+ parseDOM: [
689
+ {
690
+ tag: `span[${attribute}]`,
691
+ // Выше марок и стилей: переменная — целый узел, а не span с форматированием.
692
+ priority: 60,
693
+ getAttrs: (dom) => {
694
+ const el = dom;
695
+ const key = el.getAttribute(attribute) ?? "";
696
+ if (!KEY_RE.test(key)) return false;
697
+ return { key, label: labelFor(editor, key) ?? el.textContent?.trim() ?? key };
698
+ }
699
+ }
700
+ ],
701
+ // Документ мог прийти из JSON — ключ проверяем и на выходе.
702
+ toDOM: (node) => {
703
+ const key = KEY_RE.test(node.attrs.key) ? node.attrs.key : "";
704
+ const label = node.attrs.label == null || node.attrs.label === "" ? key : String(node.attrs.label);
705
+ return ["span", { [attribute]: key, contenteditable: "false" }, label];
706
+ }
707
+ }
708
+ };
709
+ }
710
+ var MergeTagView = class {
711
+ constructor(node, editor, unknownTitle) {
712
+ this.node = node;
713
+ this.editor = editor;
714
+ this.unknownTitle = unknownTitle;
715
+ this.dom = document.createElement("span");
716
+ this.dom.className = "nova-mergetag";
717
+ this.dom.contentEditable = "false";
718
+ this.render();
719
+ }
720
+ node;
721
+ editor;
722
+ unknownTitle;
723
+ dom;
724
+ render() {
725
+ const key = this.node.attrs.key;
726
+ const known = labelFor(this.editor, key);
727
+ this.dom.textContent = known ?? (this.node.attrs.label || key);
728
+ this.dom.dataset.key = key;
729
+ const list = optionsOf(this.editor).list;
730
+ const unknown = !!list?.length && known === void 0;
731
+ this.dom.classList.toggle("is-unknown", unknown);
732
+ this.dom.title = unknown ? `${this.unknownTitle}: ${key}` : key;
733
+ }
734
+ update(node) {
735
+ if (node.type !== this.node.type) return false;
736
+ this.node = node;
737
+ this.render();
738
+ return true;
739
+ }
740
+ selectNode() {
741
+ this.dom.classList.add("is-selected");
742
+ }
743
+ deselectNode() {
744
+ this.dom.classList.remove("is-selected");
745
+ }
746
+ stopEvent() {
747
+ return false;
748
+ }
749
+ ignoreMutation() {
750
+ return true;
751
+ }
752
+ };
753
+ function insertTag(editor, tag, range) {
754
+ const { state, dispatch } = editor.view;
755
+ const node = editor.schema.nodes.mergetag.create({ key: tag.key, label: tag.label });
756
+ const tr = range ? state.tr.replaceWith(range.from, range.to, node) : state.tr.replaceSelectionWith(node, false);
757
+ dispatch(tr.scrollIntoView());
758
+ editor.focus();
759
+ }
760
+ var mergetags_default = definePlugin({
761
+ name: "mergetags",
762
+ toolbar: "mergetags",
763
+ nodes: buildNodes,
764
+ prosemirrorPlugins: (editor) => {
765
+ const labels = pickLabels(editor, "mergetags", LABELS4);
766
+ return [
767
+ new PMPlugin({
768
+ props: {
769
+ nodeViews: {
770
+ mergetag: (node, _view) => new MergeTagView(node, editor, labels.unknown)
771
+ }
772
+ }
773
+ })
774
+ ];
775
+ },
776
+ setup(editor) {
777
+ const labels = pickLabels(editor, "mergetags", LABELS4);
778
+ editor.ui.registry.addMenuButton("mergetags", {
779
+ icon: icons.mergeTags,
780
+ tooltip: labels.insert,
781
+ isEnabled: (e) => e.isEditable() && flatList(e).length > 0,
782
+ items: (e) => {
783
+ const entries = [];
784
+ const item = (tag, id) => ({
785
+ id,
786
+ label: tag.label,
787
+ onSelect: () => insertTag(e, tag)
788
+ });
789
+ (optionsOf(e).list ?? []).forEach((entry, index) => {
790
+ if (isGroup(entry)) {
791
+ if (entries.length) entries.push({ type: "separator" });
792
+ entries.push({ type: "heading", label: entry.title });
793
+ entry.items.forEach((tag, i) => entries.push(item(tag, `mergetag-${index}-${i}`)));
794
+ } else {
795
+ entries.push(item(entry, `mergetag-${index}`));
796
+ }
797
+ });
798
+ return entries;
799
+ }
800
+ });
801
+ editor.ui.registry.addAutocompleter("mergetags", {
802
+ trigger: "{{",
803
+ label: labels.search,
804
+ emptyText: labels.empty,
805
+ maxResults: 12,
806
+ fetch: (query, e) => {
807
+ const q = query.toLowerCase();
808
+ return flatList(e).filter((tag) => tag.label.toLowerCase().includes(q) || tag.key.toLowerCase().includes(q)).map((tag) => ({ value: tag.key, label: tag.label, detail: tag.key }));
809
+ },
810
+ onSelect: (item, range, e) => {
811
+ const tag = flatList(e).find((t) => t.key === item.value);
812
+ if (tag) insertTag(e, tag, range);
813
+ }
814
+ });
815
+ }
816
+ });
817
+
673
818
  // src/plugins/suggestions.ts
674
819
  import {
675
820
  Fragment,
@@ -685,7 +830,7 @@ import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "pros
685
830
  import { keymap as keymap2 } from "prosemirror-keymap";
686
831
  var ID_RE2 = /^[A-Za-z0-9_-]{1,64}$/;
687
832
  var USER_ID_RE = /^[\w.@:+-]{1,128}$/;
688
- var LABELS4 = {
833
+ var LABELS5 = {
689
834
  en: {
690
835
  toggle: "Suggest edits",
691
836
  review: "Review suggestions",
@@ -700,21 +845,6 @@ var LABELS4 = {
700
845
  toolbar: "Suggestion",
701
846
  guest: "Guest",
702
847
  none: "No suggestions"
703
- },
704
- ru: {
705
- toggle: "\u041F\u0440\u0435\u0434\u043B\u0430\u0433\u0430\u0442\u044C \u043F\u0440\u0430\u0432\u043A\u0438",
706
- review: "\u041F\u0440\u0430\u0432\u043A\u0438",
707
- accept: "\u041F\u0440\u0438\u043D\u044F\u0442\u044C",
708
- reject: "\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C",
709
- acceptAll: "\u041F\u0440\u0438\u043D\u044F\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",
710
- rejectAll: "\u041E\u0442\u043A\u043B\u043E\u043D\u0438\u0442\u044C \u0432\u0441\u0435 \u043F\u0440\u0430\u0432\u043A\u0438",
711
- next: "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",
712
- previous: "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F \u043F\u0440\u0430\u0432\u043A\u0430",
713
- inserted: "\u0412\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u043E: {name}",
714
- deleted: "\u0423\u0434\u0430\u043B\u0435\u043D\u043E: {name}",
715
- toolbar: "\u041F\u0440\u0430\u0432\u043A\u0430",
716
- guest: "\u0413\u043E\u0441\u0442\u044C",
717
- none: "\u041F\u0440\u0430\u0432\u043E\u043A \u043D\u0435\u0442"
718
848
  }
719
849
  };
720
850
  var ICON_TOGGLE = icons.suggest;
@@ -726,7 +856,7 @@ var OWN = "nova-suggestions-own";
726
856
  var PALETTE = ["#1a7f37", "#8250df", "#bf3989", "#0969da", "#bc4c00", "#1b7c83"];
727
857
  function colorFor(key) {
728
858
  let hash = 0;
729
- for (const ch of key) hash = hash * 31 + ch.charCodeAt(0) | 0;
859
+ for (const ch of String(key ?? "")) hash = hash * 31 + ch.charCodeAt(0) | 0;
730
860
  return PALETTE[Math.abs(hash) % PALETTE.length];
731
861
  }
732
862
  function newId() {
@@ -970,7 +1100,7 @@ var suggestions_default = definePlugin({
970
1100
  attributes: (state) => suggestionsKey.getState(state)?.enabled ? { class: "nova-suggesting" } : {},
971
1101
  decorations(state) {
972
1102
  if (cache?.doc === state.doc) return cache.set;
973
- const labels = pickLabels(editor, LABELS4);
1103
+ const labels = pickLabels(editor, "suggestions", LABELS5);
974
1104
  const time = new Intl.DateTimeFormat(editor.options.language ?? "en", {
975
1105
  dateStyle: "medium",
976
1106
  timeStyle: "short"
@@ -1006,7 +1136,7 @@ var suggestions_default = definePlugin({
1006
1136
  transformTransaction(tr, state, editor) {
1007
1137
  if (!isSuggesting(state)) return tr;
1008
1138
  const options = editor.options.pluginOptions?.suggestions ?? {};
1009
- const labels = pickLabels(editor, LABELS4);
1139
+ const labels = pickLabels(editor, "suggestions", LABELS5);
1010
1140
  const author = {
1011
1141
  id: USER_ID_RE.test(options.author?.id ?? "") ? options.author.id : "guest",
1012
1142
  name: String(options.author?.name || labels.guest).slice(0, 80)
@@ -1015,7 +1145,7 @@ var suggestions_default = definePlugin({
1015
1145
  },
1016
1146
  setup(editor) {
1017
1147
  const options = editor.options.pluginOptions?.suggestions ?? {};
1018
- const labels = pickLabels(editor, LABELS4);
1148
+ const labels = pickLabels(editor, "suggestions", LABELS5);
1019
1149
  const canReview = options.canReview !== false;
1020
1150
  const dispatch = (tr) => editor.view.dispatch(tr);
1021
1151
  const current = () => suggestionAt(editor.view.state);
@@ -1107,6 +1237,7 @@ var YOUTUBE = /^https?:\/\/(?:www\.|m\.)?(?:youtube(?:-nocookie)?\.com\/(?:watch
1107
1237
  var VIMEO = /^https?:\/\/(?:www\.|player\.)?vimeo\.com\/(?:video\/)?(\d{1,12})(?:[/?#]|$)/i;
1108
1238
  var VIDEO_FILE = /^https:\/\/[^\s"'<>]+\.(?:mp4|webm|ogv|ogg)(?:\?[^\s"'<>#]*)?$/i;
1109
1239
  function parseMediaUrl(url) {
1240
+ if (typeof url !== "string") return null;
1110
1241
  const value = url.trim();
1111
1242
  const youtube = value.match(YOUTUBE);
1112
1243
  if (youtube)
@@ -1117,7 +1248,7 @@ function parseMediaUrl(url) {
1117
1248
  return null;
1118
1249
  }
1119
1250
  var ICON2 = icons.media;
1120
- var LABELS5 = {
1251
+ var LABELS6 = {
1121
1252
  en: {
1122
1253
  title: "Video",
1123
1254
  url: "Video URL",
@@ -1125,14 +1256,6 @@ var LABELS5 = {
1125
1256
  name: "Title (for screen readers)",
1126
1257
  invalid: "This video address is not supported",
1127
1258
  save: "Insert"
1128
- },
1129
- ru: {
1130
- title: "\u0412\u0438\u0434\u0435\u043E",
1131
- url: "\u0410\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E",
1132
- hint: "YouTube, Vimeo \u0438\u043B\u0438 \u0441\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0444\u0430\u0439\u043B .mp4 / .webm",
1133
- name: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 (\u0434\u043B\u044F \u044D\u043A\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0434\u0438\u043A\u0442\u043E\u0440\u0430)",
1134
- invalid: "\u042D\u0442\u043E\u0442 \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0434\u0435\u043E \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F",
1135
- save: "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044C"
1136
1259
  }
1137
1260
  };
1138
1261
  function mediaAttrs(dom, src) {
@@ -1237,7 +1360,7 @@ var media_default = definePlugin({
1237
1360
  })
1238
1361
  ],
1239
1362
  setup(editor) {
1240
- const labels = pickLabels(editor, LABELS5);
1363
+ const labels = pickLabels(editor, "media", LABELS6);
1241
1364
  const selected = () => {
1242
1365
  const { selection } = editor.view.state;
1243
1366
  return selection instanceof NodeSelection2 && selection.node.type.name === "media" ? selection : null;
@@ -1255,6 +1378,9 @@ var media_default = definePlugin({
1255
1378
  label: labels.name,
1256
1379
  value: current?.node.attrs.title ?? ""
1257
1380
  });
1381
+ attachFilePicker(editor, url, "media", (picked) => {
1382
+ if (picked.title) title.input.value = picked.title;
1383
+ });
1258
1384
  editor.ui.openDialog({
1259
1385
  title: labels.title,
1260
1386
  body: h("div", { className: "nova-form" }, url.el, title.el),
@@ -1288,7 +1414,7 @@ var media_default = definePlugin({
1288
1414
 
1289
1415
  // src/plugins/pagebreak.ts
1290
1416
  var ICON3 = icons.pageBreak;
1291
- var LABELS6 = { en: { title: "Page break" }, ru: { title: "\u0420\u0430\u0437\u0440\u044B\u0432 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B" } };
1417
+ var LABELS7 = { en: { title: "Page break" } };
1292
1418
  var pagebreak_default = definePlugin({
1293
1419
  name: "pagebreak",
1294
1420
  toolbar: "pagebreak",
@@ -1313,7 +1439,7 @@ var pagebreak_default = definePlugin({
1313
1439
  }
1314
1440
  },
1315
1441
  setup(editor) {
1316
- const { title } = pickLabels(editor, LABELS6);
1442
+ const { title } = pickLabels(editor, "pagebreak", LABELS7);
1317
1443
  const insert = () => {
1318
1444
  const { state, dispatch } = editor.view;
1319
1445
  const type = editor.schema.nodes.pagebreak;
@@ -1331,33 +1457,37 @@ var pagebreak_default = definePlugin({
1331
1457
  });
1332
1458
 
1333
1459
  // src/plugins/index.ts
1334
- registerPlugin("insertdatetime", () => import("./insertdatetime-X2T4ZY6R.js"));
1335
- registerPlugin("quickbars", () => import("./quickbars-3WKHLKAR.js"));
1336
- registerPlugin("charmap", () => import("./charmap-F7EVJ56K.js"));
1337
- registerPlugin("emoticons", () => import("./emoticons-SONBUCFV.js"));
1338
- registerPlugin("nonbreaking", () => import("./nonbreaking-PP4KIJSR.js"));
1339
- registerPlugin("autolink", () => import("./autolink-IDJWAL2V.js"));
1340
- registerPlugin("autosave", () => import("./autosave-DH7SO4UQ.js"));
1341
- registerPlugin("autoresize", () => import("./autoresize-4ZEPQCHP.js"));
1342
- registerPlugin("visualblocks", () => import("./visualblocks-NPTMWFXD.js"));
1460
+ registerPlugin("insertdatetime", () => import("./insertdatetime-CRO7TJAQ.js"));
1461
+ registerPlugin("quickbars", () => import("./quickbars-7E2QRS7J.js"));
1462
+ registerPlugin("charmap", () => import("./charmap-2GC7LF7G.js"));
1463
+ registerPlugin("emoticons", () => import("./emoticons-ZD6ZRIWG.js"));
1464
+ registerPlugin("nonbreaking", () => import("./nonbreaking-66LFZV2W.js"));
1465
+ registerPlugin("autolink", () => import("./autolink-45LTODWB.js"));
1466
+ registerPlugin("autosave", () => import("./autosave-GMWJ5BPE.js"));
1467
+ registerPlugin("autoresize", () => import("./autoresize-UB3GOA6D.js"));
1468
+ registerPlugin("visualblocks", () => import("./visualblocks-6DLBXYOA.js"));
1343
1469
  registerPlugin("anchor", anchor_default);
1344
1470
  registerPlugin("pagebreak", pagebreak_default);
1345
1471
  registerPlugin("media", media_default);
1346
1472
  registerPlugin("comments", comments_default);
1347
1473
  registerPlugin("mentions", mentions_default);
1474
+ registerPlugin("mergetags", mergetags_default);
1348
1475
  registerPlugin("suggestions", suggestions_default);
1349
- registerPlugin("directionality", () => import("./directionality-MF5HDXH3.js"));
1350
- registerPlugin("advlist", () => import("./advlist-FH3K3AAQ.js"));
1351
- registerPlugin("revisionhistory", () => import("./revisionhistory-FYRVDGRA.js"));
1476
+ registerPlugin("directionality", () => import("./directionality-5JLWQGP2.js"));
1477
+ registerPlugin("advlist", () => import("./advlist-5FNKPLUX.js"));
1478
+ registerPlugin("revisionhistory", () => import("./revisionhistory-DXE7KU4R.js"));
1352
1479
  export {
1480
+ API_CHANGE_META,
1353
1481
  ContentRules,
1354
1482
  DEFAULT_MENUBAR,
1355
1483
  DEFAULT_MENUS,
1356
1484
  Editor,
1485
+ Formatter,
1357
1486
  HTMLSerializer,
1358
1487
  KNOWN_STYLES,
1359
1488
  KNOWN_TAGS,
1360
1489
  MENTION_ID_RE,
1490
+ REMOTE_CHANGE_META,
1361
1491
  applyLink,
1362
1492
  clearSearch,
1363
1493
  commands,
@@ -1384,6 +1514,7 @@ export {
1384
1514
  getLineHeight,
1385
1515
  getLinkAt,
1386
1516
  getMentions,
1517
+ getPluginMessages,
1387
1518
  getSearchState,
1388
1519
  getSelectedImage,
1389
1520
  getStyle,
@@ -1418,13 +1549,13 @@ export {
1418
1549
  parserFor,
1419
1550
  printContent,
1420
1551
  rankSlashCommands,
1552
+ registerHtmlRules,
1421
1553
  registerLanguage,
1422
1554
  registerPlugin,
1423
1555
  removeLink,
1424
1556
  replaceAll,
1425
1557
  replaceCurrent,
1426
1558
  resolveSuggestions,
1427
- ru,
1428
1559
  sanitizeThread,
1429
1560
  schema,
1430
1561
  setCellBackground,