@gravity-ui/markdown-editor 14.8.0 → 14.10.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 (166) hide show
  1. package/README.md +16 -14
  2. package/build/cjs/bundle/Editor.d.ts +2 -0
  3. package/build/cjs/bundle/Editor.js +15 -4
  4. package/build/cjs/bundle/MarkdownEditorView.d.ts +27 -0
  5. package/build/cjs/bundle/MarkdownEditorView.js +19 -2
  6. package/build/cjs/bundle/config/action-names.d.ts +1 -1
  7. package/build/cjs/bundle/config/action-names.js +51 -27
  8. package/build/cjs/bundle/config/index.d.ts +3 -0
  9. package/build/cjs/bundle/config/index.js +3 -0
  10. package/build/cjs/bundle/config/markup.js +3 -0
  11. package/build/cjs/bundle/config/wysiwyg.d.ts +3 -0
  12. package/build/cjs/bundle/toolbar/utils/flattenPreset.d.ts +2 -0
  13. package/build/cjs/bundle/toolbar/utils/flattenPreset.js +14 -0
  14. package/build/cjs/bundle/toolbar/utils/toolbarsConfigs.d.ts +17 -0
  15. package/build/cjs/bundle/toolbar/utils/toolbarsConfigs.js +60 -0
  16. package/build/cjs/bundle/types.d.ts +6 -0
  17. package/build/cjs/bundle/useMarkdownEditor.js +8 -2
  18. package/build/cjs/bundle/wysiwyg-preset.d.ts +1 -0
  19. package/build/cjs/bundle/wysiwyg-preset.js +1 -1
  20. package/build/cjs/core/Editor.d.ts +3 -1
  21. package/build/cjs/core/Editor.js +2 -1
  22. package/build/cjs/core/ExtensionsManager.d.ts +2 -0
  23. package/build/cjs/core/ExtensionsManager.js +8 -4
  24. package/build/cjs/core/ParserTokensRegistry.d.ts +2 -1
  25. package/build/cjs/core/ParserTokensRegistry.js +2 -2
  26. package/build/cjs/core/markdown/MarkdownParser.d.ts +3 -1
  27. package/build/cjs/core/markdown/MarkdownParser.js +5 -2
  28. package/build/cjs/core/markdown/MarkdownSerializer.js +1 -1
  29. package/build/cjs/core/markdown/ProseMirrorTransformer/emptyRowTransformer.d.ts +2 -0
  30. package/build/cjs/core/markdown/ProseMirrorTransformer/emptyRowTransformer.js +15 -0
  31. package/build/cjs/core/markdown/ProseMirrorTransformer/getTransformers.d.ts +7 -0
  32. package/build/cjs/core/markdown/ProseMirrorTransformer/getTransformers.js +13 -0
  33. package/build/cjs/core/markdown/ProseMirrorTransformer/index.d.ts +15 -0
  34. package/build/cjs/core/markdown/ProseMirrorTransformer/index.js +25 -0
  35. package/build/cjs/extensions/additional/Math/MathSpecs/index.js +1 -0
  36. package/build/cjs/extensions/base/BaseSchema/BaseSchemaSpecs/index.d.ts +1 -0
  37. package/build/cjs/extensions/base/BaseSchema/BaseSchemaSpecs/index.js +23 -3
  38. package/build/cjs/extensions/behavior/Selection/selection.js +1 -5
  39. package/build/cjs/extensions/markdown/Blockquote/BlockquoteSpecs/index.js +1 -0
  40. package/build/cjs/extensions/markdown/CodeBlock/commands.js +1 -1
  41. package/build/cjs/extensions/markdown/HorizontalRule/HorizontalRuleSpecs/index.js +1 -0
  42. package/build/cjs/extensions/markdown/Link/paste-plugin.js +21 -5
  43. package/build/cjs/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.js +1 -0
  44. package/build/cjs/i18n/empty-row/en.json +3 -0
  45. package/build/cjs/i18n/empty-row/index.d.ts +5 -0
  46. package/build/cjs/i18n/empty-row/index.js +9 -0
  47. package/build/cjs/i18n/empty-row/ru.json +3 -0
  48. package/build/cjs/i18n/menubar/en.json +1 -0
  49. package/build/cjs/i18n/menubar/index.d.ts +2 -1
  50. package/build/cjs/i18n/menubar/ru.json +1 -0
  51. package/build/cjs/i18n/yfm-note/index.d.ts +1 -1
  52. package/build/cjs/index.d.ts +1 -0
  53. package/build/cjs/index.js +1 -0
  54. package/build/cjs/markup/codemirror/autocomplete/emptyRow.d.ts +9 -0
  55. package/build/cjs/markup/codemirror/autocomplete/emptyRow.js +26 -0
  56. package/build/cjs/markup/codemirror/autocomplete/index.d.ts +5 -0
  57. package/build/cjs/markup/codemirror/autocomplete/index.js +14 -0
  58. package/build/cjs/markup/codemirror/create.d.ts +1 -0
  59. package/build/cjs/markup/codemirror/create.js +30 -12
  60. package/build/cjs/markup/codemirror/smart-reindent/index.d.ts +4 -0
  61. package/build/cjs/markup/codemirror/smart-reindent/index.js +42 -0
  62. package/build/cjs/markup/codemirror/smart-reindent/utils.d.ts +15 -0
  63. package/build/cjs/markup/codemirror/smart-reindent/utils.js +59 -0
  64. package/build/cjs/markup/codemirror/yfm.d.ts +2 -1
  65. package/build/cjs/markup/codemirror/yfm.js +3 -3
  66. package/build/cjs/markup/commands/emptyRow.d.ts +2 -0
  67. package/build/cjs/markup/commands/emptyRow.js +43 -0
  68. package/build/cjs/markup/commands/index.d.ts +1 -0
  69. package/build/cjs/markup/commands/index.js +1 -0
  70. package/build/cjs/modules/toolbars/constants.d.ts +13 -0
  71. package/build/cjs/modules/toolbars/constants.js +18 -0
  72. package/build/cjs/modules/toolbars/items.d.ts +127 -0
  73. package/build/cjs/modules/toolbars/items.js +736 -0
  74. package/build/cjs/modules/toolbars/presets.d.ts +6 -0
  75. package/build/cjs/modules/toolbars/presets.js +465 -0
  76. package/build/cjs/modules/toolbars/types.d.ts +62 -0
  77. package/build/cjs/modules/toolbars/types.js +2 -0
  78. package/build/cjs/shortcuts/const.d.ts +1 -0
  79. package/build/cjs/shortcuts/const.js +1 -0
  80. package/build/cjs/shortcuts/default.js +1 -0
  81. package/build/cjs/toolbar/types.d.ts +8 -0
  82. package/build/cjs/toolbar/types.js +2 -0
  83. package/build/cjs/version.js +1 -1
  84. package/build/esm/bundle/Editor.d.ts +2 -0
  85. package/build/esm/bundle/Editor.js +15 -4
  86. package/build/esm/bundle/MarkdownEditorView.d.ts +27 -0
  87. package/build/esm/bundle/MarkdownEditorView.js +19 -2
  88. package/build/esm/bundle/config/action-names.d.ts +1 -1
  89. package/build/esm/bundle/config/action-names.js +51 -27
  90. package/build/esm/bundle/config/index.d.ts +3 -0
  91. package/build/esm/bundle/config/index.js +3 -0
  92. package/build/esm/bundle/config/markup.js +3 -0
  93. package/build/esm/bundle/config/wysiwyg.d.ts +3 -0
  94. package/build/esm/bundle/toolbar/utils/flattenPreset.d.ts +2 -0
  95. package/build/esm/bundle/toolbar/utils/flattenPreset.js +10 -0
  96. package/build/esm/bundle/toolbar/utils/toolbarsConfigs.d.ts +17 -0
  97. package/build/esm/bundle/toolbar/utils/toolbarsConfigs.js +55 -0
  98. package/build/esm/bundle/types.d.ts +6 -0
  99. package/build/esm/bundle/useMarkdownEditor.js +8 -2
  100. package/build/esm/bundle/wysiwyg-preset.d.ts +1 -0
  101. package/build/esm/bundle/wysiwyg-preset.js +1 -1
  102. package/build/esm/core/Editor.d.ts +3 -1
  103. package/build/esm/core/Editor.js +2 -1
  104. package/build/esm/core/ExtensionsManager.d.ts +2 -0
  105. package/build/esm/core/ExtensionsManager.js +8 -4
  106. package/build/esm/core/ParserTokensRegistry.d.ts +2 -1
  107. package/build/esm/core/ParserTokensRegistry.js +2 -2
  108. package/build/esm/core/markdown/MarkdownParser.d.ts +3 -1
  109. package/build/esm/core/markdown/MarkdownParser.js +5 -2
  110. package/build/esm/core/markdown/MarkdownSerializer.js +1 -1
  111. package/build/esm/core/markdown/ProseMirrorTransformer/emptyRowTransformer.d.ts +2 -0
  112. package/build/esm/core/markdown/ProseMirrorTransformer/emptyRowTransformer.js +11 -0
  113. package/build/esm/core/markdown/ProseMirrorTransformer/getTransformers.d.ts +7 -0
  114. package/build/esm/core/markdown/ProseMirrorTransformer/getTransformers.js +9 -0
  115. package/build/esm/core/markdown/ProseMirrorTransformer/index.d.ts +15 -0
  116. package/build/esm/core/markdown/ProseMirrorTransformer/index.js +21 -0
  117. package/build/esm/extensions/additional/Math/MathSpecs/index.js +1 -0
  118. package/build/esm/extensions/base/BaseSchema/BaseSchemaSpecs/index.d.ts +1 -0
  119. package/build/esm/extensions/base/BaseSchema/BaseSchemaSpecs/index.js +23 -3
  120. package/build/esm/extensions/behavior/Selection/selection.js +1 -5
  121. package/build/esm/extensions/markdown/Blockquote/BlockquoteSpecs/index.js +1 -0
  122. package/build/esm/extensions/markdown/CodeBlock/commands.js +1 -1
  123. package/build/esm/extensions/markdown/HorizontalRule/HorizontalRuleSpecs/index.js +1 -0
  124. package/build/esm/extensions/markdown/Link/paste-plugin.js +21 -5
  125. package/build/esm/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.js +1 -0
  126. package/build/esm/i18n/empty-row/en.json +3 -0
  127. package/build/esm/i18n/empty-row/index.d.ts +5 -0
  128. package/build/esm/i18n/empty-row/index.js +5 -0
  129. package/build/esm/i18n/empty-row/ru.json +3 -0
  130. package/build/esm/i18n/menubar/en.json +1 -0
  131. package/build/esm/i18n/menubar/index.d.ts +2 -1
  132. package/build/esm/i18n/menubar/ru.json +1 -0
  133. package/build/esm/i18n/yfm-note/index.d.ts +1 -1
  134. package/build/esm/index.d.ts +1 -0
  135. package/build/esm/index.js +1 -0
  136. package/build/esm/markup/codemirror/autocomplete/emptyRow.d.ts +9 -0
  137. package/build/esm/markup/codemirror/autocomplete/emptyRow.js +23 -0
  138. package/build/esm/markup/codemirror/autocomplete/index.d.ts +5 -0
  139. package/build/esm/markup/codemirror/autocomplete/index.js +10 -0
  140. package/build/esm/markup/codemirror/create.d.ts +1 -0
  141. package/build/esm/markup/codemirror/create.js +31 -13
  142. package/build/esm/markup/codemirror/smart-reindent/index.d.ts +4 -0
  143. package/build/esm/markup/codemirror/smart-reindent/index.js +38 -0
  144. package/build/esm/markup/codemirror/smart-reindent/utils.d.ts +15 -0
  145. package/build/esm/markup/codemirror/smart-reindent/utils.js +55 -0
  146. package/build/esm/markup/codemirror/yfm.d.ts +2 -1
  147. package/build/esm/markup/codemirror/yfm.js +1 -1
  148. package/build/esm/markup/commands/emptyRow.d.ts +2 -0
  149. package/build/esm/markup/commands/emptyRow.js +39 -0
  150. package/build/esm/markup/commands/index.d.ts +1 -0
  151. package/build/esm/markup/commands/index.js +1 -0
  152. package/build/esm/modules/toolbars/constants.d.ts +13 -0
  153. package/build/esm/modules/toolbars/constants.js +15 -0
  154. package/build/esm/modules/toolbars/items.d.ts +127 -0
  155. package/build/esm/modules/toolbars/items.js +730 -0
  156. package/build/esm/modules/toolbars/presets.d.ts +6 -0
  157. package/build/esm/modules/toolbars/presets.js +462 -0
  158. package/build/esm/modules/toolbars/types.d.ts +62 -0
  159. package/build/esm/modules/toolbars/types.js +1 -0
  160. package/build/esm/shortcuts/const.d.ts +1 -0
  161. package/build/esm/shortcuts/const.js +1 -0
  162. package/build/esm/shortcuts/default.js +1 -0
  163. package/build/esm/toolbar/types.d.ts +8 -0
  164. package/build/esm/toolbar/types.js +2 -0
  165. package/build/esm/version.js +1 -1
  166. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ import { ToolbarsPreset } from './types';
2
+ export declare const zero: ToolbarsPreset;
3
+ export declare const commonmark: ToolbarsPreset;
4
+ export declare const defaultPreset: ToolbarsPreset;
5
+ export declare const yfm: ToolbarsPreset;
6
+ export declare const full: ToolbarsPreset;
@@ -0,0 +1,462 @@
1
+ import { ActionName as Action } from '../../bundle/config/action-names';
2
+ import { ListName as List, ToolbarName as Toolbar } from './constants';
3
+ import { boldItemMarkup, boldItemView, boldItemWysiwyg, bulletListItemMarkup, bulletListItemView, bulletListItemWysiwyg, checkboxItemMarkup, checkboxItemView, checkboxItemWysiwyg, codeBlockItemMarkup, codeBlockItemView, codeBlockItemWysiwyg, codeBlocksListItemView, codeItemMarkup, codeItemView, codeItemWysiwyg, colorifyItemMarkup, colorifyItemView, colorifyItemWysiwyg, cutItemMarkup, cutItemView, cutItemWysiwyg, emojiItemMarkup, emojiItemView, emojiItemWysiwyg, fileItemMarkup, fileItemView, fileItemWysiwyg, filePopupItemView, heading1ItemMarkup, heading1ItemView, heading1ItemWysiwyg, heading2ItemMarkup, heading2ItemView, heading2ItemWysiwyg, heading3ItemMarkup, heading3ItemView, heading3ItemWysiwyg, heading4ItemMarkup, heading4ItemView, heading4ItemWysiwyg, heading5ItemMarkup, heading5ItemView, heading5ItemWysiwyg, heading6ItemMarkup, heading6ItemView, heading6ItemWysiwyg, headingListItemView, hruleItemMarkup, hruleItemView, hruleItemWysiwyg, imageItemMarkup, imageItemView, imageItemWysiwyg, imagePopupItemView, italicItemMarkup, italicItemView, italicItemWysiwyg, liftListItemMarkup, liftListItemView, liftListItemWysiwyg, linkItemMarkup, linkItemView, linkItemWysiwyg, listsListItemView, markedItemMarkup, markedItemView, markedItemWysiwyg, monospaceItemMarkup, monospaceItemView, monospaceItemWysiwyg, noteItemMarkup, noteItemView, noteItemWysiwyg, orderedListItemMarkup, orderedListItemView, orderedListItemWysiwyg, paragraphItemMarkup, paragraphItemView, paragraphItemWisywig, quoteItemMarkup, quoteItemView, quoteItemWysiwyg, redoItemMarkup, redoItemView, redoItemWysiwyg, sinkListItemMarkup, sinkListItemView, sinkListItemWysiwyg, strikethroughItemMarkup, strikethroughItemView, tableItemMarkup, tableItemView, tableItemWysiwyg, underlineItemMarkup, underlineItemView, underlineItemWysiwyg, undoItemMarkup, undoItemView, undoItemWysiwyg, } from './items';
4
+ // presets
5
+ export const zero = {
6
+ items: {
7
+ [Action.undo]: {
8
+ view: undoItemView,
9
+ wysiwyg: undoItemWysiwyg,
10
+ markup: undoItemMarkup,
11
+ },
12
+ [Action.redo]: {
13
+ view: redoItemView,
14
+ wysiwyg: redoItemWysiwyg,
15
+ markup: redoItemMarkup,
16
+ },
17
+ },
18
+ orders: {
19
+ [Toolbar.wysiwygMain]: [[Action.undo, Action.redo]],
20
+ [Toolbar.markupMain]: [[Action.undo, Action.redo]],
21
+ },
22
+ };
23
+ export const commonmark = {
24
+ items: Object.assign(Object.assign({}, zero.items), { [Action.bold]: {
25
+ view: boldItemView,
26
+ wysiwyg: boldItemWysiwyg,
27
+ markup: boldItemMarkup,
28
+ }, [Action.italic]: {
29
+ view: italicItemView,
30
+ wysiwyg: italicItemWysiwyg,
31
+ markup: italicItemMarkup,
32
+ }, [List.heading]: {
33
+ view: headingListItemView,
34
+ }, [Action.paragraph]: {
35
+ view: paragraphItemView,
36
+ wysiwyg: paragraphItemWisywig,
37
+ markup: paragraphItemMarkup,
38
+ }, [Action.heading1]: {
39
+ view: heading1ItemView,
40
+ wysiwyg: heading1ItemWysiwyg,
41
+ markup: heading1ItemMarkup,
42
+ }, [Action.heading2]: {
43
+ view: heading2ItemView,
44
+ wysiwyg: heading2ItemWysiwyg,
45
+ markup: heading2ItemMarkup,
46
+ }, [Action.heading3]: {
47
+ view: heading3ItemView,
48
+ wysiwyg: heading3ItemWysiwyg,
49
+ markup: heading3ItemMarkup,
50
+ }, [Action.heading4]: {
51
+ view: heading4ItemView,
52
+ wysiwyg: heading4ItemWysiwyg,
53
+ markup: heading4ItemMarkup,
54
+ }, [Action.heading5]: {
55
+ view: heading5ItemView,
56
+ wysiwyg: heading5ItemWysiwyg,
57
+ markup: heading5ItemMarkup,
58
+ }, [Action.heading6]: {
59
+ view: heading6ItemView,
60
+ wysiwyg: heading6ItemWysiwyg,
61
+ markup: heading6ItemMarkup,
62
+ }, [List.lists]: {
63
+ view: listsListItemView,
64
+ }, [Action.bulletList]: {
65
+ view: bulletListItemView,
66
+ wysiwyg: bulletListItemWysiwyg,
67
+ markup: bulletListItemMarkup,
68
+ }, [Action.orderedList]: {
69
+ view: orderedListItemView,
70
+ wysiwyg: orderedListItemWysiwyg,
71
+ markup: orderedListItemMarkup,
72
+ }, [Action.sinkListItem]: {
73
+ view: sinkListItemView,
74
+ wysiwyg: sinkListItemWysiwyg,
75
+ markup: sinkListItemMarkup,
76
+ }, [Action.liftListItem]: {
77
+ view: liftListItemView,
78
+ wysiwyg: liftListItemWysiwyg,
79
+ markup: liftListItemMarkup,
80
+ }, [Action.link]: {
81
+ view: linkItemView,
82
+ wysiwyg: linkItemWysiwyg,
83
+ markup: linkItemMarkup,
84
+ }, [Action.quote]: {
85
+ view: quoteItemView,
86
+ wysiwyg: quoteItemWysiwyg,
87
+ markup: quoteItemMarkup,
88
+ }, [List.code]: {
89
+ view: codeBlocksListItemView,
90
+ }, [Action.codeInline]: {
91
+ view: codeItemView,
92
+ wysiwyg: codeItemWysiwyg,
93
+ markup: codeItemMarkup,
94
+ }, [Action.codeBlock]: {
95
+ view: codeBlockItemView,
96
+ wysiwyg: codeBlockItemWysiwyg,
97
+ markup: codeBlockItemMarkup,
98
+ }, [Action.horizontalRule]: {
99
+ view: hruleItemView,
100
+ wysiwyg: hruleItemWysiwyg,
101
+ markup: hruleItemMarkup,
102
+ } }),
103
+ orders: {
104
+ [Toolbar.wysiwygMain]: [
105
+ [Action.undo, Action.redo],
106
+ [Action.bold, Action.italic],
107
+ [
108
+ {
109
+ id: List.heading,
110
+ items: [
111
+ Action.paragraph,
112
+ Action.heading1,
113
+ Action.heading2,
114
+ Action.heading3,
115
+ Action.heading4,
116
+ Action.heading5,
117
+ Action.heading6,
118
+ ],
119
+ },
120
+ {
121
+ id: List.lists,
122
+ items: [
123
+ Action.bulletList,
124
+ Action.orderedList,
125
+ Action.sinkListItem,
126
+ Action.liftListItem,
127
+ ],
128
+ },
129
+ Action.link,
130
+ Action.quote,
131
+ {
132
+ id: List.code,
133
+ items: [Action.codeInline, Action.codeBlock],
134
+ },
135
+ ],
136
+ ],
137
+ [Toolbar.markupMain]: [
138
+ [Action.undo, Action.redo],
139
+ [Action.bold, Action.italic],
140
+ [
141
+ {
142
+ id: List.heading,
143
+ items: [
144
+ Action.paragraph,
145
+ Action.heading1,
146
+ Action.heading2,
147
+ Action.heading3,
148
+ Action.heading4,
149
+ Action.heading5,
150
+ Action.heading6,
151
+ ],
152
+ },
153
+ {
154
+ id: List.lists,
155
+ items: [
156
+ Action.bulletList,
157
+ Action.orderedList,
158
+ Action.sinkListItem,
159
+ Action.liftListItem,
160
+ ],
161
+ },
162
+ Action.link,
163
+ Action.quote,
164
+ {
165
+ id: List.code,
166
+ items: [Action.codeInline, Action.codeBlock],
167
+ },
168
+ ],
169
+ ],
170
+ [Toolbar.wysiwygHidden]: [[Action.horizontalRule]],
171
+ [Toolbar.markupHidden]: [[Action.horizontalRule]],
172
+ },
173
+ };
174
+ export const defaultPreset = {
175
+ items: Object.assign(Object.assign({}, commonmark.items), { [Action.strike]: {
176
+ view: strikethroughItemView,
177
+ wysiwyg: sinkListItemWysiwyg,
178
+ markup: strikethroughItemMarkup,
179
+ } }),
180
+ orders: {
181
+ [Toolbar.wysiwygMain]: [
182
+ [Action.undo, Action.redo],
183
+ [Action.bold, Action.italic, Action.strike],
184
+ [
185
+ {
186
+ id: List.heading,
187
+ items: [
188
+ Action.paragraph,
189
+ Action.heading1,
190
+ Action.heading2,
191
+ Action.heading3,
192
+ Action.heading4,
193
+ Action.heading5,
194
+ Action.heading6,
195
+ ],
196
+ },
197
+ {
198
+ id: List.lists,
199
+ items: [
200
+ Action.bulletList,
201
+ Action.orderedList,
202
+ Action.sinkListItem,
203
+ Action.liftListItem,
204
+ ],
205
+ },
206
+ Action.link,
207
+ Action.quote,
208
+ {
209
+ id: List.code,
210
+ items: [Action.codeInline, Action.codeBlock],
211
+ },
212
+ ],
213
+ ],
214
+ [Toolbar.markupMain]: [
215
+ [Action.undo, Action.redo],
216
+ [Action.bold, Action.italic, Action.strike],
217
+ [
218
+ {
219
+ id: List.heading,
220
+ items: [
221
+ Action.paragraph,
222
+ Action.heading1,
223
+ Action.heading2,
224
+ Action.heading3,
225
+ Action.heading4,
226
+ Action.heading5,
227
+ Action.heading6,
228
+ ],
229
+ },
230
+ {
231
+ id: List.lists,
232
+ items: [
233
+ Action.bulletList,
234
+ Action.orderedList,
235
+ Action.sinkListItem,
236
+ Action.liftListItem,
237
+ ],
238
+ },
239
+ Action.link,
240
+ Action.quote,
241
+ {
242
+ id: List.code,
243
+ items: [Action.codeInline, Action.codeBlock],
244
+ },
245
+ ],
246
+ ],
247
+ [Toolbar.wysiwygHidden]: [[Action.horizontalRule]],
248
+ [Toolbar.markupHidden]: [[Action.horizontalRule]],
249
+ },
250
+ };
251
+ export const yfm = {
252
+ items: Object.assign(Object.assign({}, defaultPreset.items), { [Action.underline]: {
253
+ view: underlineItemView,
254
+ wysiwyg: underlineItemWysiwyg,
255
+ markup: underlineItemMarkup,
256
+ }, [Action.mono]: {
257
+ view: monospaceItemView,
258
+ wysiwyg: monospaceItemWysiwyg,
259
+ markup: monospaceItemMarkup,
260
+ }, [Action.note]: {
261
+ view: noteItemView,
262
+ wysiwyg: noteItemWysiwyg,
263
+ markup: noteItemMarkup,
264
+ }, [Action.cut]: {
265
+ view: cutItemView,
266
+ wysiwyg: cutItemWysiwyg,
267
+ markup: cutItemMarkup,
268
+ }, [Action.image]: {
269
+ view: imageItemView,
270
+ wysiwyg: imageItemWysiwyg,
271
+ }, [Action.imagePopup]: {
272
+ view: imagePopupItemView,
273
+ markup: imageItemMarkup,
274
+ }, [Action.file]: {
275
+ view: fileItemView,
276
+ wysiwyg: fileItemWysiwyg,
277
+ }, [Action.filePopup]: {
278
+ view: filePopupItemView,
279
+ markup: fileItemMarkup,
280
+ }, [Action.table]: {
281
+ view: tableItemView,
282
+ wysiwyg: tableItemWysiwyg,
283
+ markup: tableItemMarkup,
284
+ }, [Action.checkbox]: {
285
+ view: checkboxItemView,
286
+ wysiwyg: checkboxItemWysiwyg,
287
+ markup: checkboxItemMarkup,
288
+ }, [Action.tabs]: {
289
+ view: tableItemView,
290
+ wysiwyg: tableItemWysiwyg,
291
+ markup: tableItemMarkup,
292
+ } }),
293
+ orders: {
294
+ [Toolbar.wysiwygMain]: [
295
+ [Action.undo, Action.redo],
296
+ [Action.bold, Action.italic, Action.underline, Action.strike, Action.mono],
297
+ [
298
+ {
299
+ id: List.heading,
300
+ items: [
301
+ Action.paragraph,
302
+ Action.heading1,
303
+ Action.heading2,
304
+ Action.heading3,
305
+ Action.heading4,
306
+ Action.heading5,
307
+ Action.heading6,
308
+ ],
309
+ },
310
+ {
311
+ id: List.lists,
312
+ items: [
313
+ Action.bulletList,
314
+ Action.orderedList,
315
+ Action.sinkListItem,
316
+ Action.liftListItem,
317
+ ],
318
+ },
319
+ Action.link,
320
+ Action.note,
321
+ Action.cut,
322
+ Action.quote,
323
+ {
324
+ id: List.code,
325
+ items: [Action.codeInline, Action.codeBlock],
326
+ },
327
+ ],
328
+ [Action.image, Action.file, Action.table, Action.checkbox],
329
+ ],
330
+ [Toolbar.markupMain]: [
331
+ [Action.undo, Action.redo],
332
+ [Action.bold, Action.italic, Action.underline, Action.strike, Action.mono],
333
+ [
334
+ {
335
+ id: List.heading,
336
+ items: [
337
+ Action.paragraph,
338
+ Action.heading1,
339
+ Action.heading2,
340
+ Action.heading3,
341
+ Action.heading4,
342
+ Action.heading5,
343
+ Action.heading6,
344
+ ],
345
+ },
346
+ {
347
+ id: List.lists,
348
+ items: [
349
+ Action.bulletList,
350
+ Action.orderedList,
351
+ Action.sinkListItem,
352
+ Action.liftListItem,
353
+ ],
354
+ },
355
+ Action.link,
356
+ Action.note,
357
+ Action.cut,
358
+ Action.quote,
359
+ {
360
+ id: List.code,
361
+ items: [Action.codeInline, Action.codeBlock],
362
+ },
363
+ ],
364
+ [Action.imagePopup, Action.filePopup, Action.table, Action.checkbox],
365
+ ],
366
+ [Toolbar.wysiwygHidden]: [[Action.horizontalRule, Action.tabs]],
367
+ [Toolbar.markupHidden]: [[Action.horizontalRule, Action.tabs]],
368
+ },
369
+ };
370
+ export const full = {
371
+ items: Object.assign(Object.assign({}, yfm.items), { [Action.mark]: {
372
+ view: markedItemView,
373
+ wysiwyg: markedItemWysiwyg,
374
+ markup: markedItemMarkup,
375
+ }, [Action.colorify]: {
376
+ view: colorifyItemView,
377
+ wysiwyg: colorifyItemWysiwyg,
378
+ markup: colorifyItemMarkup,
379
+ }, [Action.emoji]: {
380
+ view: emojiItemView,
381
+ wysiwyg: emojiItemWysiwyg,
382
+ markup: emojiItemMarkup,
383
+ } }),
384
+ orders: {
385
+ [Toolbar.wysiwygMain]: [
386
+ [Action.undo, Action.redo],
387
+ [Action.bold, Action.italic, Action.underline, Action.strike, Action.mono, Action.mark],
388
+ [
389
+ {
390
+ id: List.heading,
391
+ items: [
392
+ Action.paragraph,
393
+ Action.heading1,
394
+ Action.heading2,
395
+ Action.heading3,
396
+ Action.heading4,
397
+ Action.heading5,
398
+ Action.heading6,
399
+ ],
400
+ },
401
+ {
402
+ id: List.lists,
403
+ items: [
404
+ Action.bulletList,
405
+ Action.orderedList,
406
+ Action.sinkListItem,
407
+ Action.liftListItem,
408
+ ],
409
+ },
410
+ Action.colorify,
411
+ Action.link,
412
+ Action.note,
413
+ Action.cut,
414
+ Action.quote,
415
+ {
416
+ id: List.code,
417
+ items: [Action.codeInline, Action.codeBlock],
418
+ },
419
+ ],
420
+ [Action.image, Action.file, Action.table, Action.checkbox],
421
+ ],
422
+ [Toolbar.markupMain]: [
423
+ [Action.undo, Action.redo],
424
+ [Action.bold, Action.italic, Action.underline, Action.strike, Action.mono, Action.mark],
425
+ [
426
+ {
427
+ id: List.heading,
428
+ items: [
429
+ Action.paragraph,
430
+ Action.heading1,
431
+ Action.heading2,
432
+ Action.heading3,
433
+ Action.heading4,
434
+ Action.heading5,
435
+ Action.heading6,
436
+ ],
437
+ },
438
+ {
439
+ id: List.lists,
440
+ items: [
441
+ Action.bulletList,
442
+ Action.orderedList,
443
+ Action.sinkListItem,
444
+ Action.liftListItem,
445
+ ],
446
+ },
447
+ Action.colorify,
448
+ Action.link,
449
+ Action.note,
450
+ Action.cut,
451
+ Action.quote,
452
+ {
453
+ id: List.code,
454
+ items: [Action.codeInline, Action.codeBlock],
455
+ },
456
+ ],
457
+ [Action.imagePopup, Action.filePopup, Action.table, Action.checkbox],
458
+ ],
459
+ [Toolbar.wysiwygHidden]: [[Action.horizontalRule, Action.emoji, Action.tabs]],
460
+ [Toolbar.markupHidden]: [[Action.horizontalRule, Action.emoji, Action.tabs]],
461
+ },
462
+ };
@@ -0,0 +1,62 @@
1
+ import type { RefObject } from 'react';
2
+ import type { HotkeyProps } from '@gravity-ui/uikit';
3
+ import type { EditorState } from 'prosemirror-state';
4
+ import type { ActionStorage } from '../../core';
5
+ import type { CodeEditor } from '../../markup';
6
+ import type { ToolbarBaseProps, ToolbarDataType, ToolbarIconData } from '../../toolbar';
7
+ export declare type ToolbarItemId = string & {};
8
+ export declare type ToolbarListId = string & {};
9
+ export interface ToolbarList {
10
+ id: ToolbarListId;
11
+ items: ToolbarItemId[];
12
+ }
13
+ /**
14
+ * The default value for the `type` property is `ToolbarDataType.SingleButton`.
15
+ */
16
+ export declare type ToolbarItemView<T extends ToolbarDataType = ToolbarDataType.SingleButton> = {
17
+ className?: string;
18
+ hint?: string | (() => string);
19
+ hotkey?: HotkeyProps['value'];
20
+ type?: ToolbarDataType;
21
+ doNotActivateList?: boolean;
22
+ } & (T extends ToolbarDataType.SingleButton ? {
23
+ icon: ToolbarIconData;
24
+ title: string | (() => string);
25
+ } : T extends ToolbarDataType.ListButton ? {
26
+ withArrow?: boolean;
27
+ icon: ToolbarIconData;
28
+ title: string | (() => string);
29
+ } : {});
30
+ export interface EditorActions<E> {
31
+ exec(editor: E): void;
32
+ isActive(editor: E): boolean;
33
+ isEnable(editor: E): boolean;
34
+ }
35
+ declare type ToolbarItemEditor<T, E> = Partial<EditorActions<E>> & {
36
+ hintWhenDisabled?: boolean | string | (() => string);
37
+ condition?: ((state: EditorState) => void) | 'enabled';
38
+ } & (T extends ToolbarDataType.ButtonPopup ? {
39
+ renderPopup: (props: ToolbarBaseProps<E> & {
40
+ hide: () => void;
41
+ anchorRef: RefObject<HTMLElement>;
42
+ }) => React.ReactNode;
43
+ } : T extends ToolbarDataType.ReactComponent ? {
44
+ width: number;
45
+ component: React.ComponentType<ToolbarBaseProps<E>>;
46
+ } : {});
47
+ export declare type ToolbarItemWysiwyg<T extends ToolbarDataType = ToolbarDataType.SingleButton> = ToolbarItemEditor<T, ActionStorage>;
48
+ export declare type ToolbarItemMarkup<T extends ToolbarDataType = ToolbarDataType.SingleButton> = ToolbarItemEditor<T, CodeEditor>;
49
+ export declare type ToolbarItem<T extends ToolbarDataType> = {
50
+ view: ToolbarItemView<T>;
51
+ wysiwyg?: ToolbarItemWysiwyg<T>;
52
+ markup?: ToolbarItemMarkup<T>;
53
+ };
54
+ export declare type ToolbarsItems = Record<ToolbarItemId, ToolbarItem<ToolbarDataType>>;
55
+ export declare type ToolbarId = string;
56
+ export declare type ToolbarOrders = (ToolbarList | ToolbarItemId)[][];
57
+ export declare type ToolbarsOrders = Record<ToolbarId, ToolbarOrders>;
58
+ export interface ToolbarsPreset {
59
+ items: ToolbarsItems;
60
+ orders: ToolbarsOrders;
61
+ }
62
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -31,6 +31,7 @@ export declare enum Action {
31
31
  Heading4 = "h4",
32
32
  Heading5 = "h5",
33
33
  Heading6 = "h6",
34
+ EmptyRow = "EmptyRow",
34
35
  BulletList = "ulist",
35
36
  OrderedList = "olist",
36
37
  LiftListItem = "list__action_lift",
@@ -34,6 +34,7 @@ export var Action;
34
34
  Action["Heading4"] = "h4";
35
35
  Action["Heading5"] = "h5";
36
36
  Action["Heading6"] = "h6";
37
+ Action["EmptyRow"] = "EmptyRow";
37
38
  Action["BulletList"] = "ulist";
38
39
  Action["OrderedList"] = "olist";
39
40
  Action["LiftListItem"] = "list__action_lift";
@@ -20,6 +20,7 @@ formatter
20
20
  .set(A.Heading4, { pc: [MK.Ctrl, MK.Shift, '4'], mac: [MK.Cmd, MK.Option, '4'] })
21
21
  .set(A.Heading5, { pc: [MK.Ctrl, MK.Shift, '5'], mac: [MK.Cmd, MK.Option, '5'] })
22
22
  .set(A.Heading6, { pc: [MK.Ctrl, MK.Shift, '6'], mac: [MK.Cmd, MK.Option, '6'] })
23
+ .set(A.EmptyRow, { pc: [MK.Ctrl, MK.Shift, K.Enter], mac: [MK.Cmd, MK.Shift, K.Enter] })
23
24
  .set(A.BulletList, [MK.Mod, MK.Shift, 'l'])
24
25
  .set(A.OrderedList, [MK.Mod, MK.Shift, 'm'])
25
26
  .set(A.SinkListItem, [MK.Tab])
@@ -38,7 +38,9 @@ export declare enum ToolbarDataType {
38
38
  SingleButton = "s-button",
39
39
  ListButton = "list-b",
40
40
  ButtonPopup = "b-popup",
41
+ /** @deprecated Use ReactComponent type instead */
41
42
  ReactNode = "r-node",
43
+ /** @deprecated Use ReactComponent type instead */
42
44
  ReactNodeFn = "r-node-fn",
43
45
  ReactComponent = "r-component"
44
46
  }
@@ -73,12 +75,18 @@ export declare type ToolbarButtonPopupData<E> = ToolbarItemData<E> & {
73
75
  export declare type ToolbarListButtonItemData<E> = ToolbarItemData<E> & {
74
76
  doNotActivateList?: boolean;
75
77
  };
78
+ /**
79
+ * @deprecated Use ReactComponent type instead
80
+ * */
76
81
  export declare type ToolbarReactNodeData = {
77
82
  id: string;
78
83
  type: ToolbarDataType.ReactNode;
79
84
  width: number;
80
85
  content: React.ReactNode;
81
86
  };
87
+ /**
88
+ * @deprecated Use ReactComponent type instead
89
+ * */
82
90
  export declare type ToolbarReactNodeFnData<E> = {
83
91
  id: string;
84
92
  type: ToolbarDataType.ReactNodeFn;
@@ -3,7 +3,9 @@ export var ToolbarDataType;
3
3
  ToolbarDataType["SingleButton"] = "s-button";
4
4
  ToolbarDataType["ListButton"] = "list-b";
5
5
  ToolbarDataType["ButtonPopup"] = "b-popup";
6
+ /** @deprecated Use ReactComponent type instead */
6
7
  ToolbarDataType["ReactNode"] = "r-node";
8
+ /** @deprecated Use ReactComponent type instead */
7
9
  ToolbarDataType["ReactNodeFn"] = "r-node-fn";
8
10
  ToolbarDataType["ReactComponent"] = "r-component";
9
11
  })(ToolbarDataType || (ToolbarDataType = {}));
@@ -1,2 +1,2 @@
1
1
  /** During build process, the current version will be injected here */
2
- export const VERSION = typeof '14.8.0' !== 'undefined' ? '14.8.0' : 'unknown';
2
+ export const VERSION = typeof '14.10.0' !== 'undefined' ? '14.10.0' : 'unknown';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/markdown-editor",
3
- "version": "14.8.0",
3
+ "version": "14.10.0",
4
4
  "description": "Markdown wysiwyg and markup editor",
5
5
  "license": "MIT",
6
6
  "repository": {