@gravity-ui/markdown-editor 14.2.2 → 14.3.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.
@@ -7,12 +7,14 @@
7
7
  .g-md-markup-editor__toolbar,
8
8
  .g-md-markup-preview__toolbar {
9
9
  flex-shrink: 0;
10
+ padding: var(--g-md-toolbar-padding);
10
11
  }
11
12
  .g-md-markup-editor__editor,
12
13
  .g-md-markup-preview__editor {
13
14
  flex-basis: 100%;
14
15
  min-height: 36px;
15
16
  max-height: 100%;
17
+ padding: var(--g-md-editor-padding);
16
18
  cursor: text;
17
19
  }
18
20
  .g-md-markup-editor__editor_toolbar-visible,
@@ -4,10 +4,12 @@
4
4
  }
5
5
  .g-md-wysiwyg-editor__toolbar {
6
6
  flex-shrink: 0;
7
+ padding: var(--g-md-toolbar-padding);
7
8
  }
8
9
  .g-md-wysiwyg-editor__editor {
9
10
  overflow-y: auto;
10
11
  flex-grow: 1;
12
+ padding: var(--g-md-editor-padding);
11
13
  }
12
14
  .g-root_theme_dark .g-md-wysiwyg-editor__editor .pm-iframe-container {
13
15
  background-color: var(--g-color-base-light);
@@ -41,6 +41,7 @@ export declare const mFilePopupData: MToolbarButtonPopupData;
41
41
  /** prepared markup toolbar config */
42
42
  export declare const mToolbarConfig: MToolbarData;
43
43
  export declare const mHruleItemData: MToolbarSingleItemData;
44
+ export declare const mEmojiItemData: MToolbarSingleItemData;
44
45
  export declare const mTabsItemData: MToolbarSingleItemData;
45
46
  export declare const mHiddenData: MToolbarSingleItemData[];
46
47
  export declare const mToolbarConfigByPreset: Record<MarkdownEditorPreset, MToolbarData>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mHiddenDataByPreset = exports.mToolbarConfigByPreset = exports.mHiddenData = exports.mTabsItemData = exports.mHruleItemData = exports.mToolbarConfig = exports.mFilePopupData = exports.mImagePopupData = exports.mYfmHtmlBlockButton = exports.mMermaidButton = exports.mMathListItem = exports.mMathListConfig = exports.mCodeListConfig = exports.mCodeblockItemData = exports.mTableButton = exports.mCutButton = exports.mQuoteButton = exports.mNoteButton = exports.mLinkButton = exports.mListMoveListConfig = exports.mCheckboxButton = exports.mListsListConfig = exports.mHeadingListConfig = exports.mBiusGroupConfig = exports.mMarkedItemData = exports.mMonospaceItemData = exports.mStrikethroughItemData = exports.mUnderlineItemData = exports.mItalicItemData = exports.mBoldItemData = exports.mHistoryGroupConfig = void 0;
3
+ exports.mHiddenDataByPreset = exports.mToolbarConfigByPreset = exports.mHiddenData = exports.mTabsItemData = exports.mEmojiItemData = exports.mHruleItemData = exports.mToolbarConfig = exports.mFilePopupData = exports.mImagePopupData = exports.mYfmHtmlBlockButton = exports.mMermaidButton = exports.mMathListItem = exports.mMathListConfig = exports.mCodeListConfig = exports.mCodeblockItemData = exports.mTableButton = exports.mCutButton = exports.mQuoteButton = exports.mNoteButton = exports.mLinkButton = exports.mListMoveListConfig = exports.mCheckboxButton = exports.mListsListConfig = exports.mHeadingListConfig = exports.mBiusGroupConfig = exports.mMarkedItemData = exports.mMonospaceItemData = exports.mStrikethroughItemData = exports.mUnderlineItemData = exports.mItalicItemData = exports.mBoldItemData = exports.mHistoryGroupConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const menubar_1 = require("../../i18n/menubar");
@@ -13,8 +13,9 @@ const MToolbarImagePopup_1 = require("../toolbar/markup/MToolbarImagePopup");
13
13
  const action_names_1 = require("./action-names");
14
14
  const icons_1 = require("./icons");
15
15
  const noop = () => { };
16
- const isActiveFn = () => false;
17
- const isEnableFn = () => true;
16
+ const inactive = () => false;
17
+ const enable = () => true;
18
+ const disable = () => false;
18
19
  exports.mHistoryGroupConfig = [
19
20
  {
20
21
  id: action_names_1.ActionName.undo,
@@ -23,7 +24,7 @@ exports.mHistoryGroupConfig = [
23
24
  icon: icons_1.icons.undo,
24
25
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Undo),
25
26
  exec: (e) => (0, commands_1.undo)(e.cm),
26
- isActive: isActiveFn,
27
+ isActive: inactive,
27
28
  isEnable: (e) => (0, commands_1.undoDepth)(e.cm.state) > 0,
28
29
  },
29
30
  {
@@ -33,7 +34,7 @@ exports.mHistoryGroupConfig = [
33
34
  icon: icons_1.icons.redo,
34
35
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Redo),
35
36
  exec: (e) => (0, commands_1.redo)(e.cm),
36
- isActive: isActiveFn,
37
+ isActive: inactive,
37
38
  isEnable: (e) => (0, commands_1.redoDepth)(e.cm.state) > 0,
38
39
  },
39
40
  ];
@@ -45,8 +46,8 @@ exports.mBoldItemData = {
45
46
  icon: icons_1.icons.bold,
46
47
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Bold),
47
48
  exec: (e) => (0, commands_1.toggleBold)(e.cm),
48
- isActive: isActiveFn,
49
- isEnable: isEnableFn,
49
+ isActive: inactive,
50
+ isEnable: enable,
50
51
  };
51
52
  exports.mItalicItemData = {
52
53
  id: action_names_1.ActionName.italic,
@@ -55,8 +56,8 @@ exports.mItalicItemData = {
55
56
  icon: icons_1.icons.italic,
56
57
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Italic),
57
58
  exec: (e) => (0, commands_1.toggleItalic)(e.cm),
58
- isActive: isActiveFn,
59
- isEnable: isEnableFn,
59
+ isActive: inactive,
60
+ isEnable: enable,
60
61
  };
61
62
  exports.mUnderlineItemData = {
62
63
  id: action_names_1.ActionName.underline,
@@ -65,8 +66,8 @@ exports.mUnderlineItemData = {
65
66
  icon: icons_1.icons.underline,
66
67
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Underline),
67
68
  exec: (e) => (0, commands_1.toggleUnderline)(e.cm),
68
- isActive: isActiveFn,
69
- isEnable: isEnableFn,
69
+ isActive: inactive,
70
+ isEnable: enable,
70
71
  };
71
72
  exports.mStrikethroughItemData = {
72
73
  id: action_names_1.ActionName.strike,
@@ -75,8 +76,8 @@ exports.mStrikethroughItemData = {
75
76
  icon: icons_1.icons.strikethrough,
76
77
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Strike),
77
78
  exec: (e) => (0, commands_1.toggleStrikethrough)(e.cm),
78
- isActive: isActiveFn,
79
- isEnable: isEnableFn,
79
+ isActive: inactive,
80
+ isEnable: enable,
80
81
  };
81
82
  exports.mMonospaceItemData = {
82
83
  id: action_names_1.ActionName.mono,
@@ -84,8 +85,8 @@ exports.mMonospaceItemData = {
84
85
  title: menubar_1.i18n.bind(null, 'mono'),
85
86
  icon: icons_1.icons.mono,
86
87
  exec: (e) => (0, commands_1.toggleMonospace)(e.cm),
87
- isActive: isActiveFn,
88
- isEnable: isEnableFn,
88
+ isActive: inactive,
89
+ isEnable: enable,
89
90
  };
90
91
  exports.mMarkedItemData = {
91
92
  id: action_names_1.ActionName.mark,
@@ -93,8 +94,8 @@ exports.mMarkedItemData = {
93
94
  title: menubar_1.i18n.bind(null, 'mark'),
94
95
  icon: icons_1.icons.mark,
95
96
  exec: (e) => (0, commands_1.toggleMarked)(e.cm),
96
- isActive: isActiveFn,
97
- isEnable: isEnableFn,
97
+ isActive: inactive,
98
+ isEnable: enable,
98
99
  };
99
100
  exports.mBiusGroupConfig = [
100
101
  exports.mBoldItemData,
@@ -106,8 +107,8 @@ exports.mBiusGroupConfig = [
106
107
  icon: icons_1.icons.underline,
107
108
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Underline),
108
109
  exec: (e) => (0, commands_1.toggleUnderline)(e.cm),
109
- isActive: isActiveFn,
110
- isEnable: isEnableFn,
110
+ isActive: inactive,
111
+ isEnable: enable,
111
112
  },
112
113
  {
113
114
  id: action_names_1.ActionName.strike,
@@ -116,8 +117,8 @@ exports.mBiusGroupConfig = [
116
117
  icon: icons_1.icons.strikethrough,
117
118
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Strike),
118
119
  exec: (e) => (0, commands_1.toggleStrikethrough)(e.cm),
119
- isActive: isActiveFn,
120
- isEnable: isEnableFn,
120
+ isActive: inactive,
121
+ isEnable: enable,
121
122
  },
122
123
  {
123
124
  id: action_names_1.ActionName.mono,
@@ -125,8 +126,8 @@ exports.mBiusGroupConfig = [
125
126
  title: menubar_1.i18n.bind(null, 'mono'),
126
127
  icon: icons_1.icons.mono,
127
128
  exec: (e) => (0, commands_1.toggleMonospace)(e.cm),
128
- isActive: isActiveFn,
129
- isEnable: isEnableFn,
129
+ isActive: inactive,
130
+ isEnable: enable,
130
131
  },
131
132
  {
132
133
  id: action_names_1.ActionName.mark,
@@ -134,8 +135,8 @@ exports.mBiusGroupConfig = [
134
135
  title: menubar_1.i18n.bind(null, 'mark'),
135
136
  icon: icons_1.icons.mark,
136
137
  exec: (e) => (0, commands_1.toggleMarked)(e.cm),
137
- isActive: isActiveFn,
138
- isEnable: isEnableFn,
138
+ isActive: inactive,
139
+ isEnable: enable,
139
140
  },
140
141
  ];
141
142
  exports.mHeadingListConfig = {
@@ -149,8 +150,8 @@ exports.mHeadingListConfig = {
149
150
  icon: icons_1.icons.h1,
150
151
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading1),
151
152
  exec: (e) => (0, commands_1.toH1)(e.cm),
152
- isActive: isActiveFn,
153
- isEnable: isEnableFn,
153
+ isActive: inactive,
154
+ isEnable: enable,
154
155
  },
155
156
  {
156
157
  id: action_names_1.ActionName.heading2,
@@ -158,8 +159,8 @@ exports.mHeadingListConfig = {
158
159
  icon: icons_1.icons.h2,
159
160
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading2),
160
161
  exec: (e) => (0, commands_1.toH2)(e.cm),
161
- isActive: isActiveFn,
162
- isEnable: isEnableFn,
162
+ isActive: inactive,
163
+ isEnable: enable,
163
164
  },
164
165
  {
165
166
  id: action_names_1.ActionName.heading3,
@@ -167,8 +168,8 @@ exports.mHeadingListConfig = {
167
168
  icon: icons_1.icons.h3,
168
169
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading3),
169
170
  exec: (e) => (0, commands_1.toH3)(e.cm),
170
- isActive: isActiveFn,
171
- isEnable: isEnableFn,
171
+ isActive: inactive,
172
+ isEnable: enable,
172
173
  },
173
174
  {
174
175
  id: action_names_1.ActionName.heading4,
@@ -176,8 +177,8 @@ exports.mHeadingListConfig = {
176
177
  icon: icons_1.icons.h4,
177
178
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading4),
178
179
  exec: (e) => (0, commands_1.toH4)(e.cm),
179
- isActive: isActiveFn,
180
- isEnable: isEnableFn,
180
+ isActive: inactive,
181
+ isEnable: enable,
181
182
  },
182
183
  {
183
184
  id: action_names_1.ActionName.heading5,
@@ -185,8 +186,8 @@ exports.mHeadingListConfig = {
185
186
  icon: icons_1.icons.h5,
186
187
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading5),
187
188
  exec: (e) => (0, commands_1.toH5)(e.cm),
188
- isActive: isActiveFn,
189
- isEnable: isEnableFn,
189
+ isActive: inactive,
190
+ isEnable: enable,
190
191
  },
191
192
  {
192
193
  id: action_names_1.ActionName.heading6,
@@ -194,8 +195,8 @@ exports.mHeadingListConfig = {
194
195
  icon: icons_1.icons.h6,
195
196
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Heading6),
196
197
  exec: (e) => (0, commands_1.toH6)(e.cm),
197
- isActive: isActiveFn,
198
- isEnable: isEnableFn,
198
+ isActive: inactive,
199
+ isEnable: enable,
199
200
  },
200
201
  ],
201
202
  };
@@ -209,16 +210,16 @@ exports.mListsListConfig = {
209
210
  title: menubar_1.i18n.bind(null, 'ulist'),
210
211
  icon: icons_1.icons.bulletList,
211
212
  exec: (e) => (0, commands_1.toBulletList)(e.cm),
212
- isActive: isActiveFn,
213
- isEnable: isEnableFn,
213
+ isActive: inactive,
214
+ isEnable: enable,
214
215
  },
215
216
  {
216
217
  id: action_names_1.ActionName.orderedList,
217
218
  title: menubar_1.i18n.bind(null, 'olist'),
218
219
  icon: icons_1.icons.orderedList,
219
220
  exec: (e) => (0, commands_1.toOrderedList)(e.cm),
220
- isActive: isActiveFn,
221
- isEnable: isEnableFn,
221
+ isActive: inactive,
222
+ isEnable: enable,
222
223
  },
223
224
  ],
224
225
  };
@@ -228,8 +229,8 @@ exports.mCheckboxButton = {
228
229
  title: menubar_1.i18n.bind(null, 'checkbox'),
229
230
  icon: icons_1.icons.checklist,
230
231
  exec: (e) => (0, commands_1.wrapToCheckbox)(e.cm),
231
- isActive: isActiveFn,
232
- isEnable: isEnableFn,
232
+ isActive: inactive,
233
+ isEnable: enable,
233
234
  };
234
235
  exports.mListMoveListConfig = {
235
236
  icon: icons_1.icons.lift,
@@ -241,16 +242,16 @@ exports.mListMoveListConfig = {
241
242
  title: menubar_1.i18n.bind(null, 'list__action_sink'),
242
243
  icon: icons_1.icons.sink,
243
244
  exec: (e) => (0, commands_1.sinkListItem)(e.cm),
244
- isActive: isActiveFn,
245
- isEnable: isEnableFn,
245
+ isActive: inactive,
246
+ isEnable: enable,
246
247
  },
247
248
  {
248
249
  id: action_names_1.ActionName.liftListItem,
249
250
  title: menubar_1.i18n.bind(null, 'list__action_lift'),
250
251
  icon: icons_1.icons.lift,
251
252
  exec: (e) => (0, commands_1.liftListItem)(e.cm),
252
- isActive: isActiveFn,
253
- isEnable: isEnableFn,
253
+ isActive: inactive,
254
+ isEnable: enable,
254
255
  },
255
256
  ],
256
257
  };
@@ -260,8 +261,8 @@ exports.mLinkButton = {
260
261
  icon: icons_1.icons.link,
261
262
  title: (0, menubar_1.i18n)('link'),
262
263
  exec: (e) => (0, commands_1.insertLink)(e.cm),
263
- isActive: isActiveFn,
264
- isEnable: isEnableFn,
264
+ isActive: inactive,
265
+ isEnable: enable,
265
266
  };
266
267
  exports.mNoteButton = {
267
268
  id: action_names_1.ActionName.yfm_note,
@@ -270,8 +271,8 @@ exports.mNoteButton = {
270
271
  icon: icons_1.icons.note,
271
272
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Note),
272
273
  exec: (e) => (0, commands_1.wrapToYfmNote)(e.cm),
273
- isActive: isActiveFn,
274
- isEnable: isEnableFn,
274
+ isActive: inactive,
275
+ isEnable: enable,
275
276
  };
276
277
  exports.mQuoteButton = {
277
278
  id: action_names_1.ActionName.quote,
@@ -279,8 +280,8 @@ exports.mQuoteButton = {
279
280
  title: menubar_1.i18n.bind(null, 'quote'),
280
281
  icon: icons_1.icons.quote,
281
282
  exec: (e) => (0, commands_1.wrapToBlockquote)(e.cm),
282
- isActive: isActiveFn,
283
- isEnable: isEnableFn,
283
+ isActive: inactive,
284
+ isEnable: enable,
284
285
  };
285
286
  exports.mCutButton = {
286
287
  id: action_names_1.ActionName.yfm_cut,
@@ -289,8 +290,8 @@ exports.mCutButton = {
289
290
  icon: icons_1.icons.cut,
290
291
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Cut),
291
292
  exec: (e) => (0, commands_1.wrapToYfmCut)(e.cm),
292
- isActive: isActiveFn,
293
- isEnable: isEnableFn,
293
+ isActive: inactive,
294
+ isEnable: enable,
294
295
  };
295
296
  exports.mTableButton = {
296
297
  id: action_names_1.ActionName.table,
@@ -298,8 +299,8 @@ exports.mTableButton = {
298
299
  title: menubar_1.i18n.bind(null, 'table'),
299
300
  icon: icons_1.icons.table,
300
301
  exec: (e) => (0, commands_1.insertYfmTable)(e.cm),
301
- isActive: isActiveFn,
302
- isEnable: isEnableFn,
302
+ isActive: inactive,
303
+ isEnable: enable,
303
304
  };
304
305
  exports.mCodeblockItemData = {
305
306
  id: action_names_1.ActionName.code_block,
@@ -307,8 +308,8 @@ exports.mCodeblockItemData = {
307
308
  icon: icons_1.icons.codeBlock,
308
309
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.CodeBlock),
309
310
  exec: (e) => (0, commands_1.wrapToCodeBlock)(e.cm),
310
- isActive: isActiveFn,
311
- isEnable: isEnableFn,
311
+ isActive: inactive,
312
+ isEnable: enable,
312
313
  };
313
314
  exports.mCodeListConfig = {
314
315
  icon: icons_1.icons.code,
@@ -321,8 +322,8 @@ exports.mCodeListConfig = {
321
322
  icon: icons_1.icons.code,
322
323
  hotkey: shortcuts_1.formatter.toView(shortcuts_1.Action.Code),
323
324
  exec: (e) => (0, commands_1.wrapToInlineCode)(e.cm),
324
- isActive: isActiveFn,
325
- isEnable: isEnableFn,
325
+ isActive: inactive,
326
+ isEnable: enable,
326
327
  },
327
328
  exports.mCodeblockItemData,
328
329
  ],
@@ -337,16 +338,16 @@ exports.mMathListConfig = {
337
338
  title: menubar_1.i18n.bind(null, 'math_inline'),
338
339
  icon: icons_1.icons.functionInline,
339
340
  exec: (e) => (0, commands_1.wrapToMathInline)(e.cm),
340
- isActive: isActiveFn,
341
- isEnable: isEnableFn,
341
+ isActive: inactive,
342
+ isEnable: enable,
342
343
  },
343
344
  {
344
345
  id: action_names_1.ActionName.math_block,
345
346
  title: menubar_1.i18n.bind(null, 'math_block'),
346
347
  icon: icons_1.icons.functionBlock,
347
348
  exec: (e) => (0, commands_1.wrapToMathBlock)(e.cm),
348
- isActive: isActiveFn,
349
- isEnable: isEnableFn,
349
+ isActive: inactive,
350
+ isEnable: enable,
350
351
  },
351
352
  ],
352
353
  };
@@ -357,8 +358,8 @@ exports.mMermaidButton = {
357
358
  title: menubar_1.i18n.bind(null, 'mermaid'),
358
359
  icon: icons_1.icons.mermaid,
359
360
  exec: (e) => (0, commands_1.insertMermaidDiagram)(e.cm),
360
- isActive: isActiveFn,
361
- isEnable: isEnableFn,
361
+ isActive: inactive,
362
+ isEnable: enable,
362
363
  };
363
364
  exports.mYfmHtmlBlockButton = {
364
365
  id: action_names_1.ActionName.yfm_html_block,
@@ -366,8 +367,8 @@ exports.mYfmHtmlBlockButton = {
366
367
  title: menubar_1.i18n.bind(null, 'html'),
367
368
  icon: icons_1.icons.html,
368
369
  exec: (e) => (0, commands_1.insertYfmHtmlBlock)(e.cm),
369
- isActive: isActiveFn,
370
- isEnable: isEnableFn,
370
+ isActive: inactive,
371
+ isEnable: enable,
371
372
  };
372
373
  exports.mImagePopupData = {
373
374
  id: 'image',
@@ -375,8 +376,8 @@ exports.mImagePopupData = {
375
376
  icon: icons_1.icons.image,
376
377
  title: (0, menubar_1.i18n)('image'),
377
378
  exec: noop,
378
- isActive: isActiveFn,
379
- isEnable: isEnableFn,
379
+ isActive: inactive,
380
+ isEnable: enable,
380
381
  renderPopup: (props) => react_1.default.createElement(MToolbarImagePopup_1.MToolbarImagePopup, Object.assign({}, props)),
381
382
  };
382
383
  exports.mFilePopupData = {
@@ -385,8 +386,8 @@ exports.mFilePopupData = {
385
386
  icon: icons_1.icons.file,
386
387
  title: (0, menubar_1.i18n)('file'),
387
388
  exec: noop,
388
- isActive: isActiveFn,
389
- isEnable: isEnableFn,
389
+ isActive: inactive,
390
+ isEnable: enable,
390
391
  renderPopup: (props) => react_1.default.createElement(MToolbarFilePopup_1.MToolbarFilePopup, Object.assign({}, props)),
391
392
  };
392
393
  /** prepared markup toolbar config */
@@ -416,8 +417,8 @@ exports.mToolbarConfig = [
416
417
  icon: icons_1.icons.file,
417
418
  title: (0, menubar_1.i18n)('file'),
418
419
  exec: noop,
419
- isActive: isActiveFn,
420
- isEnable: isEnableFn,
420
+ isActive: inactive,
421
+ isEnable: enable,
421
422
  renderPopup: (props) => react_1.default.createElement(MToolbarFilePopup_1.MToolbarFilePopup, Object.assign({}, props)),
422
423
  },
423
424
  exports.mTableButton,
@@ -430,8 +431,18 @@ exports.mHruleItemData = {
430
431
  icon: icons_1.icons.horizontalRule,
431
432
  type: types_1.ToolbarDataType.SingleButton,
432
433
  exec: (e) => (0, commands_1.insertHRule)(e.cm),
433
- isActive: isActiveFn,
434
- isEnable: isEnableFn,
434
+ isActive: inactive,
435
+ isEnable: enable,
436
+ };
437
+ exports.mEmojiItemData = {
438
+ id: 'emoji',
439
+ title: menubar_1.i18n.bind(null, 'emoji'),
440
+ icon: icons_1.icons.emoji,
441
+ type: types_1.ToolbarDataType.SingleButton,
442
+ exec: noop,
443
+ hintWhenDisabled: menubar_1.i18n.bind(null, 'emoji__hint'),
444
+ isActive: inactive,
445
+ isEnable: disable,
435
446
  };
436
447
  exports.mTabsItemData = {
437
448
  id: 'tabs',
@@ -439,10 +450,10 @@ exports.mTabsItemData = {
439
450
  icon: icons_1.icons.tabs,
440
451
  type: types_1.ToolbarDataType.SingleButton,
441
452
  exec: (e) => (0, commands_1.insertYfmTabs)(e.cm),
442
- isActive: isActiveFn,
443
- isEnable: isEnableFn,
453
+ isActive: inactive,
454
+ isEnable: enable,
444
455
  };
445
- exports.mHiddenData = [exports.mHruleItemData, exports.mTabsItemData];
456
+ exports.mHiddenData = [exports.mHruleItemData, exports.mEmojiItemData, exports.mTabsItemData];
446
457
  exports.mToolbarConfigByPreset = {
447
458
  zero: [exports.mHistoryGroupConfig],
448
459
  commonmark: [
@@ -534,6 +545,7 @@ exports.mHiddenDataByPreset = {
534
545
  exports.mTableButton,
535
546
  exports.mImagePopupData,
536
547
  exports.mHruleItemData,
548
+ exports.mEmojiItemData,
537
549
  exports.mFilePopupData,
538
550
  exports.mTabsItemData,
539
551
  ],
@@ -459,7 +459,7 @@ exports.wToggleHeadingFoldingItemData = {
459
459
  type: types_1.ToolbarDataType.SingleButton,
460
460
  icon: icons_1.icons.foldingHeading,
461
461
  title: () => (0, menubar_1.i18n)('folding-heading'),
462
- hint: () => (0, menubar_1.i18n)('folding-heading_hint'),
462
+ hint: () => (0, menubar_1.i18n)('folding-heading__hint'),
463
463
  isActive: (editor) => { var _a, _b; return (_b = (_a = editor.actions.toggleHeadingFolding) === null || _a === void 0 ? void 0 : _a.isActive()) !== null && _b !== void 0 ? _b : false; },
464
464
  isEnable: (editor) => { var _a, _b; return (_b = (_a = editor.actions.toggleHeadingFolding) === null || _a === void 0 ? void 0 : _a.isEnable()) !== null && _b !== void 0 ? _b : false; },
465
465
  exec: (editor) => editor.actions.toggleHeadingFolding.run(),
@@ -9,10 +9,11 @@
9
9
  }
10
10
  .g-md-editor-sticky_sticky-active:not(.g-md-editor-sticky_clear) {
11
11
  z-index: 2000;
12
+ padding: var(--g-md-toolbar-sticky-padding);
12
13
  }
13
14
  .g-md-editor-sticky_sticky-active:not(.g-md-editor-sticky_clear)::before {
14
15
  position: absolute;
15
- inset: -4px;
16
+ inset: var(--g-md-toolbar-sticky-inset, -4px);
16
17
  content: "";
17
18
  border: 1px solid var(--g-color-line-generic-solid);
18
19
  border-radius: 4px;
@@ -53,6 +53,13 @@ const VideoSpecs = (builder, opts) => {
53
53
  const service = node.attrs[const_1.VideoAttr.Service];
54
54
  const videoId = node.attrs[const_1.VideoAttr.VideoID];
55
55
  if (availableServices.has(service) || !videoId) {
56
+ // TODO: remove in next major
57
+ // see https://github.com/gravity-ui/markdown-editor/pull/478
58
+ let src = '';
59
+ if (typeof options.url === 'function')
60
+ src = options.url(service, videoId, options);
61
+ else if (typeof options.videoUrl === 'function')
62
+ src = options.videoUrl(service, videoId, options);
56
63
  return [
57
64
  'div',
58
65
  {
@@ -65,7 +72,7 @@ const VideoSpecs = (builder, opts) => {
65
72
  type: 'text/html',
66
73
  width: String(options[service].width),
67
74
  height: String(options[service].height),
68
- src: options.videoUrl(service, videoId, options),
75
+ src: src,
69
76
  frameborder: '0',
70
77
  webkitallowfullscreen: '',
71
78
  mozallowfullscreen: '',
@@ -16,9 +16,10 @@
16
16
  "colorify__group_text": "Text",
17
17
  "cut": "Cut",
18
18
  "emoji": "Emoji",
19
+ "emoji__hint": "Emojis can be added in WYSIWYG or manually with markup",
19
20
  "file": "File",
20
21
  "folding-heading": "Collapsed section",
21
- "folding-heading_hint": "The text under the heading can be collapsed or expanded",
22
+ "folding-heading__hint": "The text under the heading can be collapsed or expanded",
22
23
  "gpt": "GPT widget",
23
24
  "heading": "Heading",
24
25
  "heading1": "Heading 1",
@@ -1,4 +1,4 @@
1
- export declare const i18n: <G extends "bold" | "code" | "colorify" | "mono" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "text" | "html" | "cut" | "table" | "image" | "code_inline" | "list" | "heading" | "note" | "file" | "checkbox" | "emoji" | "undo" | "redo" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "math_inline" | "math_block" | "tabs" | "mermaid" | "gpt" | "codeblock" | "math" | "colorify__color_blue" | "colorify__color_default" | "colorify__color_gray" | "colorify__color_green" | "colorify__color_orange" | "colorify__color_red" | "colorify__color_violet" | "colorify__color_yellow" | "colorify__group_text" | "folding-heading" | "folding-heading_hint" | "hrule" | "list__action_lift" | "list__action_sink" | "list_action_disabled" | "more_action" | "olist" | "ulist", S extends string>(key: G | (string extends S ? S : never), params?: {
1
+ export declare const i18n: <G extends "bold" | "code" | "colorify" | "mono" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "text" | "html" | "cut" | "table" | "image" | "code_inline" | "list" | "heading" | "note" | "file" | "checkbox" | "emoji" | "undo" | "redo" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "math_inline" | "math_block" | "tabs" | "mermaid" | "gpt" | "codeblock" | "math" | "colorify__color_blue" | "colorify__color_default" | "colorify__color_gray" | "colorify__color_green" | "colorify__color_orange" | "colorify__color_red" | "colorify__color_violet" | "colorify__color_yellow" | "colorify__group_text" | "emoji__hint" | "folding-heading" | "folding-heading__hint" | "hrule" | "list__action_lift" | "list__action_sink" | "list_action_disabled" | "more_action" | "olist" | "ulist", S extends string>(key: G | (string extends S ? S : never), params?: {
2
2
  [key: string]: any;
3
3
  } | undefined) => S extends G ? {
4
4
  bold: string;
@@ -18,9 +18,10 @@ export declare const i18n: <G extends "bold" | "code" | "colorify" | "mono" | "l
18
18
  colorify__group_text: string;
19
19
  cut: string;
20
20
  emoji: string;
21
+ emoji__hint: string;
21
22
  file: string;
22
23
  "folding-heading": string;
23
- "folding-heading_hint": string;
24
+ "folding-heading__hint": string;
24
25
  gpt: string;
25
26
  heading: string;
26
27
  heading1: string;
@@ -16,9 +16,10 @@
16
16
  "colorify__group_text": "Текст",
17
17
  "cut": "Кат",
18
18
  "emoji": "Эмодзи",
19
+ "emoji__hint": "Эмодзи можно добавить в WYSIWYG режиме или вручную с помощью разметки",
19
20
  "file": "Файл",
20
21
  "folding-heading": "Свёрнутый раздел",
21
- "folding-heading_hint": "Текст под заголовком можно свернуть или раскрыть",
22
+ "folding-heading__hint": "Текст под заголовком можно свернуть или раскрыть",
22
23
  "gpt": "GPT-виджет",
23
24
  "heading": "Заголовок",
24
25
  "heading1": "Заголовок 1",
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** During build process, the current version will be injected here */
5
- exports.VERSION = typeof '14.2.2' !== 'undefined' ? '14.2.2' : 'unknown';
5
+ exports.VERSION = typeof '14.3.0' !== 'undefined' ? '14.3.0' : 'unknown';
@@ -7,12 +7,14 @@
7
7
  .g-md-markup-editor__toolbar,
8
8
  .g-md-markup-preview__toolbar {
9
9
  flex-shrink: 0;
10
+ padding: var(--g-md-toolbar-padding);
10
11
  }
11
12
  .g-md-markup-editor__editor,
12
13
  .g-md-markup-preview__editor {
13
14
  flex-basis: 100%;
14
15
  min-height: 36px;
15
16
  max-height: 100%;
17
+ padding: var(--g-md-editor-padding);
16
18
  cursor: text;
17
19
  }
18
20
  .g-md-markup-editor__editor_toolbar-visible,
@@ -4,10 +4,12 @@
4
4
  }
5
5
  .g-md-wysiwyg-editor__toolbar {
6
6
  flex-shrink: 0;
7
+ padding: var(--g-md-toolbar-padding);
7
8
  }
8
9
  .g-md-wysiwyg-editor__editor {
9
10
  overflow-y: auto;
10
11
  flex-grow: 1;
12
+ padding: var(--g-md-editor-padding);
11
13
  }
12
14
  .g-root_theme_dark .g-md-wysiwyg-editor__editor .pm-iframe-container {
13
15
  background-color: var(--g-color-base-light);
@@ -41,6 +41,7 @@ export declare const mFilePopupData: MToolbarButtonPopupData;
41
41
  /** prepared markup toolbar config */
42
42
  export declare const mToolbarConfig: MToolbarData;
43
43
  export declare const mHruleItemData: MToolbarSingleItemData;
44
+ export declare const mEmojiItemData: MToolbarSingleItemData;
44
45
  export declare const mTabsItemData: MToolbarSingleItemData;
45
46
  export declare const mHiddenData: MToolbarSingleItemData[];
46
47
  export declare const mToolbarConfigByPreset: Record<MarkdownEditorPreset, MToolbarData>;
@@ -9,8 +9,9 @@ import { MToolbarImagePopup } from '../toolbar/markup/MToolbarImagePopup';
9
9
  import { ActionName } from './action-names';
10
10
  import { icons } from './icons';
11
11
  const noop = () => { };
12
- const isActiveFn = () => false;
13
- const isEnableFn = () => true;
12
+ const inactive = () => false;
13
+ const enable = () => true;
14
+ const disable = () => false;
14
15
  export const mHistoryGroupConfig = [
15
16
  {
16
17
  id: ActionName.undo,
@@ -19,7 +20,7 @@ export const mHistoryGroupConfig = [
19
20
  icon: icons.undo,
20
21
  hotkey: f.toView(A.Undo),
21
22
  exec: (e) => undo(e.cm),
22
- isActive: isActiveFn,
23
+ isActive: inactive,
23
24
  isEnable: (e) => undoDepth(e.cm.state) > 0,
24
25
  },
25
26
  {
@@ -29,7 +30,7 @@ export const mHistoryGroupConfig = [
29
30
  icon: icons.redo,
30
31
  hotkey: f.toView(A.Redo),
31
32
  exec: (e) => redo(e.cm),
32
- isActive: isActiveFn,
33
+ isActive: inactive,
33
34
  isEnable: (e) => redoDepth(e.cm.state) > 0,
34
35
  },
35
36
  ];
@@ -41,8 +42,8 @@ export const mBoldItemData = {
41
42
  icon: icons.bold,
42
43
  hotkey: f.toView(A.Bold),
43
44
  exec: (e) => toggleBold(e.cm),
44
- isActive: isActiveFn,
45
- isEnable: isEnableFn,
45
+ isActive: inactive,
46
+ isEnable: enable,
46
47
  };
47
48
  export const mItalicItemData = {
48
49
  id: ActionName.italic,
@@ -51,8 +52,8 @@ export const mItalicItemData = {
51
52
  icon: icons.italic,
52
53
  hotkey: f.toView(A.Italic),
53
54
  exec: (e) => toggleItalic(e.cm),
54
- isActive: isActiveFn,
55
- isEnable: isEnableFn,
55
+ isActive: inactive,
56
+ isEnable: enable,
56
57
  };
57
58
  export const mUnderlineItemData = {
58
59
  id: ActionName.underline,
@@ -61,8 +62,8 @@ export const mUnderlineItemData = {
61
62
  icon: icons.underline,
62
63
  hotkey: f.toView(A.Underline),
63
64
  exec: (e) => toggleUnderline(e.cm),
64
- isActive: isActiveFn,
65
- isEnable: isEnableFn,
65
+ isActive: inactive,
66
+ isEnable: enable,
66
67
  };
67
68
  export const mStrikethroughItemData = {
68
69
  id: ActionName.strike,
@@ -71,8 +72,8 @@ export const mStrikethroughItemData = {
71
72
  icon: icons.strikethrough,
72
73
  hotkey: f.toView(A.Strike),
73
74
  exec: (e) => toggleStrikethrough(e.cm),
74
- isActive: isActiveFn,
75
- isEnable: isEnableFn,
75
+ isActive: inactive,
76
+ isEnable: enable,
76
77
  };
77
78
  export const mMonospaceItemData = {
78
79
  id: ActionName.mono,
@@ -80,8 +81,8 @@ export const mMonospaceItemData = {
80
81
  title: i18n.bind(null, 'mono'),
81
82
  icon: icons.mono,
82
83
  exec: (e) => toggleMonospace(e.cm),
83
- isActive: isActiveFn,
84
- isEnable: isEnableFn,
84
+ isActive: inactive,
85
+ isEnable: enable,
85
86
  };
86
87
  export const mMarkedItemData = {
87
88
  id: ActionName.mark,
@@ -89,8 +90,8 @@ export const mMarkedItemData = {
89
90
  title: i18n.bind(null, 'mark'),
90
91
  icon: icons.mark,
91
92
  exec: (e) => toggleMarked(e.cm),
92
- isActive: isActiveFn,
93
- isEnable: isEnableFn,
93
+ isActive: inactive,
94
+ isEnable: enable,
94
95
  };
95
96
  export const mBiusGroupConfig = [
96
97
  mBoldItemData,
@@ -102,8 +103,8 @@ export const mBiusGroupConfig = [
102
103
  icon: icons.underline,
103
104
  hotkey: f.toView(A.Underline),
104
105
  exec: (e) => toggleUnderline(e.cm),
105
- isActive: isActiveFn,
106
- isEnable: isEnableFn,
106
+ isActive: inactive,
107
+ isEnable: enable,
107
108
  },
108
109
  {
109
110
  id: ActionName.strike,
@@ -112,8 +113,8 @@ export const mBiusGroupConfig = [
112
113
  icon: icons.strikethrough,
113
114
  hotkey: f.toView(A.Strike),
114
115
  exec: (e) => toggleStrikethrough(e.cm),
115
- isActive: isActiveFn,
116
- isEnable: isEnableFn,
116
+ isActive: inactive,
117
+ isEnable: enable,
117
118
  },
118
119
  {
119
120
  id: ActionName.mono,
@@ -121,8 +122,8 @@ export const mBiusGroupConfig = [
121
122
  title: i18n.bind(null, 'mono'),
122
123
  icon: icons.mono,
123
124
  exec: (e) => toggleMonospace(e.cm),
124
- isActive: isActiveFn,
125
- isEnable: isEnableFn,
125
+ isActive: inactive,
126
+ isEnable: enable,
126
127
  },
127
128
  {
128
129
  id: ActionName.mark,
@@ -130,8 +131,8 @@ export const mBiusGroupConfig = [
130
131
  title: i18n.bind(null, 'mark'),
131
132
  icon: icons.mark,
132
133
  exec: (e) => toggleMarked(e.cm),
133
- isActive: isActiveFn,
134
- isEnable: isEnableFn,
134
+ isActive: inactive,
135
+ isEnable: enable,
135
136
  },
136
137
  ];
137
138
  export const mHeadingListConfig = {
@@ -145,8 +146,8 @@ export const mHeadingListConfig = {
145
146
  icon: icons.h1,
146
147
  hotkey: f.toView(A.Heading1),
147
148
  exec: (e) => toH1(e.cm),
148
- isActive: isActiveFn,
149
- isEnable: isEnableFn,
149
+ isActive: inactive,
150
+ isEnable: enable,
150
151
  },
151
152
  {
152
153
  id: ActionName.heading2,
@@ -154,8 +155,8 @@ export const mHeadingListConfig = {
154
155
  icon: icons.h2,
155
156
  hotkey: f.toView(A.Heading2),
156
157
  exec: (e) => toH2(e.cm),
157
- isActive: isActiveFn,
158
- isEnable: isEnableFn,
158
+ isActive: inactive,
159
+ isEnable: enable,
159
160
  },
160
161
  {
161
162
  id: ActionName.heading3,
@@ -163,8 +164,8 @@ export const mHeadingListConfig = {
163
164
  icon: icons.h3,
164
165
  hotkey: f.toView(A.Heading3),
165
166
  exec: (e) => toH3(e.cm),
166
- isActive: isActiveFn,
167
- isEnable: isEnableFn,
167
+ isActive: inactive,
168
+ isEnable: enable,
168
169
  },
169
170
  {
170
171
  id: ActionName.heading4,
@@ -172,8 +173,8 @@ export const mHeadingListConfig = {
172
173
  icon: icons.h4,
173
174
  hotkey: f.toView(A.Heading4),
174
175
  exec: (e) => toH4(e.cm),
175
- isActive: isActiveFn,
176
- isEnable: isEnableFn,
176
+ isActive: inactive,
177
+ isEnable: enable,
177
178
  },
178
179
  {
179
180
  id: ActionName.heading5,
@@ -181,8 +182,8 @@ export const mHeadingListConfig = {
181
182
  icon: icons.h5,
182
183
  hotkey: f.toView(A.Heading5),
183
184
  exec: (e) => toH5(e.cm),
184
- isActive: isActiveFn,
185
- isEnable: isEnableFn,
185
+ isActive: inactive,
186
+ isEnable: enable,
186
187
  },
187
188
  {
188
189
  id: ActionName.heading6,
@@ -190,8 +191,8 @@ export const mHeadingListConfig = {
190
191
  icon: icons.h6,
191
192
  hotkey: f.toView(A.Heading6),
192
193
  exec: (e) => toH6(e.cm),
193
- isActive: isActiveFn,
194
- isEnable: isEnableFn,
194
+ isActive: inactive,
195
+ isEnable: enable,
195
196
  },
196
197
  ],
197
198
  };
@@ -205,16 +206,16 @@ export const mListsListConfig = {
205
206
  title: i18n.bind(null, 'ulist'),
206
207
  icon: icons.bulletList,
207
208
  exec: (e) => toBulletList(e.cm),
208
- isActive: isActiveFn,
209
- isEnable: isEnableFn,
209
+ isActive: inactive,
210
+ isEnable: enable,
210
211
  },
211
212
  {
212
213
  id: ActionName.orderedList,
213
214
  title: i18n.bind(null, 'olist'),
214
215
  icon: icons.orderedList,
215
216
  exec: (e) => toOrderedList(e.cm),
216
- isActive: isActiveFn,
217
- isEnable: isEnableFn,
217
+ isActive: inactive,
218
+ isEnable: enable,
218
219
  },
219
220
  ],
220
221
  };
@@ -224,8 +225,8 @@ export const mCheckboxButton = {
224
225
  title: i18n.bind(null, 'checkbox'),
225
226
  icon: icons.checklist,
226
227
  exec: (e) => wrapToCheckbox(e.cm),
227
- isActive: isActiveFn,
228
- isEnable: isEnableFn,
228
+ isActive: inactive,
229
+ isEnable: enable,
229
230
  };
230
231
  export const mListMoveListConfig = {
231
232
  icon: icons.lift,
@@ -237,16 +238,16 @@ export const mListMoveListConfig = {
237
238
  title: i18n.bind(null, 'list__action_sink'),
238
239
  icon: icons.sink,
239
240
  exec: (e) => sinkListItem(e.cm),
240
- isActive: isActiveFn,
241
- isEnable: isEnableFn,
241
+ isActive: inactive,
242
+ isEnable: enable,
242
243
  },
243
244
  {
244
245
  id: ActionName.liftListItem,
245
246
  title: i18n.bind(null, 'list__action_lift'),
246
247
  icon: icons.lift,
247
248
  exec: (e) => liftListItem(e.cm),
248
- isActive: isActiveFn,
249
- isEnable: isEnableFn,
249
+ isActive: inactive,
250
+ isEnable: enable,
250
251
  },
251
252
  ],
252
253
  };
@@ -256,8 +257,8 @@ export const mLinkButton = {
256
257
  icon: icons.link,
257
258
  title: i18n('link'),
258
259
  exec: (e) => insertLink(e.cm),
259
- isActive: isActiveFn,
260
- isEnable: isEnableFn,
260
+ isActive: inactive,
261
+ isEnable: enable,
261
262
  };
262
263
  export const mNoteButton = {
263
264
  id: ActionName.yfm_note,
@@ -266,8 +267,8 @@ export const mNoteButton = {
266
267
  icon: icons.note,
267
268
  hotkey: f.toView(A.Note),
268
269
  exec: (e) => wrapToYfmNote(e.cm),
269
- isActive: isActiveFn,
270
- isEnable: isEnableFn,
270
+ isActive: inactive,
271
+ isEnable: enable,
271
272
  };
272
273
  export const mQuoteButton = {
273
274
  id: ActionName.quote,
@@ -275,8 +276,8 @@ export const mQuoteButton = {
275
276
  title: i18n.bind(null, 'quote'),
276
277
  icon: icons.quote,
277
278
  exec: (e) => wrapToBlockquote(e.cm),
278
- isActive: isActiveFn,
279
- isEnable: isEnableFn,
279
+ isActive: inactive,
280
+ isEnable: enable,
280
281
  };
281
282
  export const mCutButton = {
282
283
  id: ActionName.yfm_cut,
@@ -285,8 +286,8 @@ export const mCutButton = {
285
286
  icon: icons.cut,
286
287
  hotkey: f.toView(A.Cut),
287
288
  exec: (e) => wrapToYfmCut(e.cm),
288
- isActive: isActiveFn,
289
- isEnable: isEnableFn,
289
+ isActive: inactive,
290
+ isEnable: enable,
290
291
  };
291
292
  export const mTableButton = {
292
293
  id: ActionName.table,
@@ -294,8 +295,8 @@ export const mTableButton = {
294
295
  title: i18n.bind(null, 'table'),
295
296
  icon: icons.table,
296
297
  exec: (e) => insertYfmTable(e.cm),
297
- isActive: isActiveFn,
298
- isEnable: isEnableFn,
298
+ isActive: inactive,
299
+ isEnable: enable,
299
300
  };
300
301
  export const mCodeblockItemData = {
301
302
  id: ActionName.code_block,
@@ -303,8 +304,8 @@ export const mCodeblockItemData = {
303
304
  icon: icons.codeBlock,
304
305
  hotkey: f.toView(A.CodeBlock),
305
306
  exec: (e) => wrapToCodeBlock(e.cm),
306
- isActive: isActiveFn,
307
- isEnable: isEnableFn,
307
+ isActive: inactive,
308
+ isEnable: enable,
308
309
  };
309
310
  export const mCodeListConfig = {
310
311
  icon: icons.code,
@@ -317,8 +318,8 @@ export const mCodeListConfig = {
317
318
  icon: icons.code,
318
319
  hotkey: f.toView(A.Code),
319
320
  exec: (e) => wrapToInlineCode(e.cm),
320
- isActive: isActiveFn,
321
- isEnable: isEnableFn,
321
+ isActive: inactive,
322
+ isEnable: enable,
322
323
  },
323
324
  mCodeblockItemData,
324
325
  ],
@@ -333,16 +334,16 @@ export const mMathListConfig = {
333
334
  title: i18n.bind(null, 'math_inline'),
334
335
  icon: icons.functionInline,
335
336
  exec: (e) => wrapToMathInline(e.cm),
336
- isActive: isActiveFn,
337
- isEnable: isEnableFn,
337
+ isActive: inactive,
338
+ isEnable: enable,
338
339
  },
339
340
  {
340
341
  id: ActionName.math_block,
341
342
  title: i18n.bind(null, 'math_block'),
342
343
  icon: icons.functionBlock,
343
344
  exec: (e) => wrapToMathBlock(e.cm),
344
- isActive: isActiveFn,
345
- isEnable: isEnableFn,
345
+ isActive: inactive,
346
+ isEnable: enable,
346
347
  },
347
348
  ],
348
349
  };
@@ -353,8 +354,8 @@ export const mMermaidButton = {
353
354
  title: i18n.bind(null, 'mermaid'),
354
355
  icon: icons.mermaid,
355
356
  exec: (e) => insertMermaidDiagram(e.cm),
356
- isActive: isActiveFn,
357
- isEnable: isEnableFn,
357
+ isActive: inactive,
358
+ isEnable: enable,
358
359
  };
359
360
  export const mYfmHtmlBlockButton = {
360
361
  id: ActionName.yfm_html_block,
@@ -362,8 +363,8 @@ export const mYfmHtmlBlockButton = {
362
363
  title: i18n.bind(null, 'html'),
363
364
  icon: icons.html,
364
365
  exec: (e) => insertYfmHtmlBlock(e.cm),
365
- isActive: isActiveFn,
366
- isEnable: isEnableFn,
366
+ isActive: inactive,
367
+ isEnable: enable,
367
368
  };
368
369
  export const mImagePopupData = {
369
370
  id: 'image',
@@ -371,8 +372,8 @@ export const mImagePopupData = {
371
372
  icon: icons.image,
372
373
  title: i18n('image'),
373
374
  exec: noop,
374
- isActive: isActiveFn,
375
- isEnable: isEnableFn,
375
+ isActive: inactive,
376
+ isEnable: enable,
376
377
  renderPopup: (props) => React.createElement(MToolbarImagePopup, Object.assign({}, props)),
377
378
  };
378
379
  export const mFilePopupData = {
@@ -381,8 +382,8 @@ export const mFilePopupData = {
381
382
  icon: icons.file,
382
383
  title: i18n('file'),
383
384
  exec: noop,
384
- isActive: isActiveFn,
385
- isEnable: isEnableFn,
385
+ isActive: inactive,
386
+ isEnable: enable,
386
387
  renderPopup: (props) => React.createElement(MToolbarFilePopup, Object.assign({}, props)),
387
388
  };
388
389
  /** prepared markup toolbar config */
@@ -412,8 +413,8 @@ export const mToolbarConfig = [
412
413
  icon: icons.file,
413
414
  title: i18n('file'),
414
415
  exec: noop,
415
- isActive: isActiveFn,
416
- isEnable: isEnableFn,
416
+ isActive: inactive,
417
+ isEnable: enable,
417
418
  renderPopup: (props) => React.createElement(MToolbarFilePopup, Object.assign({}, props)),
418
419
  },
419
420
  mTableButton,
@@ -426,8 +427,18 @@ export const mHruleItemData = {
426
427
  icon: icons.horizontalRule,
427
428
  type: ToolbarDataType.SingleButton,
428
429
  exec: (e) => insertHRule(e.cm),
429
- isActive: isActiveFn,
430
- isEnable: isEnableFn,
430
+ isActive: inactive,
431
+ isEnable: enable,
432
+ };
433
+ export const mEmojiItemData = {
434
+ id: 'emoji',
435
+ title: i18n.bind(null, 'emoji'),
436
+ icon: icons.emoji,
437
+ type: ToolbarDataType.SingleButton,
438
+ exec: noop,
439
+ hintWhenDisabled: i18n.bind(null, 'emoji__hint'),
440
+ isActive: inactive,
441
+ isEnable: disable,
431
442
  };
432
443
  export const mTabsItemData = {
433
444
  id: 'tabs',
@@ -435,10 +446,10 @@ export const mTabsItemData = {
435
446
  icon: icons.tabs,
436
447
  type: ToolbarDataType.SingleButton,
437
448
  exec: (e) => insertYfmTabs(e.cm),
438
- isActive: isActiveFn,
439
- isEnable: isEnableFn,
449
+ isActive: inactive,
450
+ isEnable: enable,
440
451
  };
441
- export const mHiddenData = [mHruleItemData, mTabsItemData];
452
+ export const mHiddenData = [mHruleItemData, mEmojiItemData, mTabsItemData];
442
453
  export const mToolbarConfigByPreset = {
443
454
  zero: [mHistoryGroupConfig],
444
455
  commonmark: [
@@ -530,6 +541,7 @@ export const mHiddenDataByPreset = {
530
541
  mTableButton,
531
542
  mImagePopupData,
532
543
  mHruleItemData,
544
+ mEmojiItemData,
533
545
  mFilePopupData,
534
546
  mTabsItemData,
535
547
  ],
@@ -456,7 +456,7 @@ export const wToggleHeadingFoldingItemData = {
456
456
  type: ToolbarDataType.SingleButton,
457
457
  icon: icons.foldingHeading,
458
458
  title: () => i18n('folding-heading'),
459
- hint: () => i18n('folding-heading_hint'),
459
+ hint: () => i18n('folding-heading__hint'),
460
460
  isActive: (editor) => { var _a, _b; return (_b = (_a = editor.actions.toggleHeadingFolding) === null || _a === void 0 ? void 0 : _a.isActive()) !== null && _b !== void 0 ? _b : false; },
461
461
  isEnable: (editor) => { var _a, _b; return (_b = (_a = editor.actions.toggleHeadingFolding) === null || _a === void 0 ? void 0 : _a.isEnable()) !== null && _b !== void 0 ? _b : false; },
462
462
  exec: (editor) => editor.actions.toggleHeadingFolding.run(),
@@ -9,10 +9,11 @@
9
9
  }
10
10
  .g-md-editor-sticky_sticky-active:not(.g-md-editor-sticky_clear) {
11
11
  z-index: 2000;
12
+ padding: var(--g-md-toolbar-sticky-padding);
12
13
  }
13
14
  .g-md-editor-sticky_sticky-active:not(.g-md-editor-sticky_clear)::before {
14
15
  position: absolute;
15
- inset: -4px;
16
+ inset: var(--g-md-toolbar-sticky-inset, -4px);
16
17
  content: "";
17
18
  border: 1px solid var(--g-color-line-generic-solid);
18
19
  border-radius: 4px;
@@ -47,6 +47,13 @@ export const VideoSpecs = (builder, opts) => {
47
47
  const service = node.attrs[VideoAttr.Service];
48
48
  const videoId = node.attrs[VideoAttr.VideoID];
49
49
  if (availableServices.has(service) || !videoId) {
50
+ // TODO: remove in next major
51
+ // see https://github.com/gravity-ui/markdown-editor/pull/478
52
+ let src = '';
53
+ if (typeof options.url === 'function')
54
+ src = options.url(service, videoId, options);
55
+ else if (typeof options.videoUrl === 'function')
56
+ src = options.videoUrl(service, videoId, options);
50
57
  return [
51
58
  'div',
52
59
  {
@@ -59,7 +66,7 @@ export const VideoSpecs = (builder, opts) => {
59
66
  type: 'text/html',
60
67
  width: String(options[service].width),
61
68
  height: String(options[service].height),
62
- src: options.videoUrl(service, videoId, options),
69
+ src: src,
63
70
  frameborder: '0',
64
71
  webkitallowfullscreen: '',
65
72
  mozallowfullscreen: '',
@@ -16,9 +16,10 @@
16
16
  "colorify__group_text": "Text",
17
17
  "cut": "Cut",
18
18
  "emoji": "Emoji",
19
+ "emoji__hint": "Emojis can be added in WYSIWYG or manually with markup",
19
20
  "file": "File",
20
21
  "folding-heading": "Collapsed section",
21
- "folding-heading_hint": "The text under the heading can be collapsed or expanded",
22
+ "folding-heading__hint": "The text under the heading can be collapsed or expanded",
22
23
  "gpt": "GPT widget",
23
24
  "heading": "Heading",
24
25
  "heading1": "Heading 1",
@@ -1,4 +1,4 @@
1
- export declare const i18n: <G extends "bold" | "code" | "colorify" | "mono" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "text" | "html" | "cut" | "table" | "image" | "code_inline" | "list" | "heading" | "note" | "file" | "checkbox" | "emoji" | "undo" | "redo" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "math_inline" | "math_block" | "tabs" | "mermaid" | "gpt" | "codeblock" | "math" | "colorify__color_blue" | "colorify__color_default" | "colorify__color_gray" | "colorify__color_green" | "colorify__color_orange" | "colorify__color_red" | "colorify__color_violet" | "colorify__color_yellow" | "colorify__group_text" | "folding-heading" | "folding-heading_hint" | "hrule" | "list__action_lift" | "list__action_sink" | "list_action_disabled" | "more_action" | "olist" | "ulist", S extends string>(key: G | (string extends S ? S : never), params?: {
1
+ export declare const i18n: <G extends "bold" | "code" | "colorify" | "mono" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "text" | "html" | "cut" | "table" | "image" | "code_inline" | "list" | "heading" | "note" | "file" | "checkbox" | "emoji" | "undo" | "redo" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "math_inline" | "math_block" | "tabs" | "mermaid" | "gpt" | "codeblock" | "math" | "colorify__color_blue" | "colorify__color_default" | "colorify__color_gray" | "colorify__color_green" | "colorify__color_orange" | "colorify__color_red" | "colorify__color_violet" | "colorify__color_yellow" | "colorify__group_text" | "emoji__hint" | "folding-heading" | "folding-heading__hint" | "hrule" | "list__action_lift" | "list__action_sink" | "list_action_disabled" | "more_action" | "olist" | "ulist", S extends string>(key: G | (string extends S ? S : never), params?: {
2
2
  [key: string]: any;
3
3
  } | undefined) => S extends G ? {
4
4
  bold: string;
@@ -18,9 +18,10 @@ export declare const i18n: <G extends "bold" | "code" | "colorify" | "mono" | "l
18
18
  colorify__group_text: string;
19
19
  cut: string;
20
20
  emoji: string;
21
+ emoji__hint: string;
21
22
  file: string;
22
23
  "folding-heading": string;
23
- "folding-heading_hint": string;
24
+ "folding-heading__hint": string;
24
25
  gpt: string;
25
26
  heading: string;
26
27
  heading1: string;
@@ -16,9 +16,10 @@
16
16
  "colorify__group_text": "Текст",
17
17
  "cut": "Кат",
18
18
  "emoji": "Эмодзи",
19
+ "emoji__hint": "Эмодзи можно добавить в WYSIWYG режиме или вручную с помощью разметки",
19
20
  "file": "Файл",
20
21
  "folding-heading": "Свёрнутый раздел",
21
- "folding-heading_hint": "Текст под заголовком можно свернуть или раскрыть",
22
+ "folding-heading__hint": "Текст под заголовком можно свернуть или раскрыть",
22
23
  "gpt": "GPT-виджет",
23
24
  "heading": "Заголовок",
24
25
  "heading1": "Заголовок 1",
@@ -1,2 +1,2 @@
1
1
  /** During build process, the current version will be injected here */
2
- export const VERSION = typeof '14.2.2' !== 'undefined' ? '14.2.2' : 'unknown';
2
+ export const VERSION = typeof '14.3.0' !== 'undefined' ? '14.3.0' : 'unknown';
package/build/styles.css CHANGED
@@ -58,12 +58,14 @@
58
58
  .g-md-markup-editor__toolbar,
59
59
  .g-md-markup-preview__toolbar {
60
60
  flex-shrink: 0;
61
+ padding: var(--g-md-toolbar-padding);
61
62
  }
62
63
  .g-md-markup-editor__editor,
63
64
  .g-md-markup-preview__editor {
64
65
  flex-basis: 100%;
65
66
  min-height: 36px;
66
67
  max-height: 100%;
68
+ padding: var(--g-md-editor-padding);
67
69
  cursor: text;
68
70
  }
69
71
  .g-md-markup-editor__editor_toolbar-visible,
@@ -161,10 +163,12 @@
161
163
  }
162
164
  .g-md-wysiwyg-editor__toolbar {
163
165
  flex-shrink: 0;
166
+ padding: var(--g-md-toolbar-padding);
164
167
  }
165
168
  .g-md-wysiwyg-editor__editor {
166
169
  overflow-y: auto;
167
170
  flex-grow: 1;
171
+ padding: var(--g-md-editor-padding);
168
172
  }
169
173
  .g-root_theme_dark .g-md-wysiwyg-editor__editor .pm-iframe-container {
170
174
  background-color: var(--g-color-base-light);
@@ -445,10 +449,11 @@
445
449
  }
446
450
  .g-md-editor-sticky_sticky-active:not(.g-md-editor-sticky_clear) {
447
451
  z-index: 2000;
452
+ padding: var(--g-md-toolbar-sticky-padding);
448
453
  }
449
454
  .g-md-editor-sticky_sticky-active:not(.g-md-editor-sticky_clear)::before {
450
455
  position: absolute;
451
- inset: -4px;
456
+ inset: var(--g-md-toolbar-sticky-inset, -4px);
452
457
  content: "";
453
458
  border: 1px solid var(--g-color-line-generic-solid);
454
459
  border-radius: 4px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/markdown-editor",
3
- "version": "14.2.2",
3
+ "version": "14.3.0",
4
4
  "description": "Markdown wysiwyg and markup editor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -19,8 +19,8 @@
19
19
  "clean": "gulp clean",
20
20
  "build": "gulp",
21
21
  "typecheck": "tsc -p tsconfig.json --noEmit",
22
- "storybook:start": "TS_NODE_PROJECT=.storybook/tsconfig.json storybook dev -p 8888 -c .storybook",
23
- "storybook:build": "TS_NODE_PROJECT=.storybook/tsconfig.json storybook build -c .storybook -o storybook-static",
22
+ "storybook:start": "storybook dev -p 8888 -c .storybook",
23
+ "storybook:build": "storybook build -c .storybook -o storybook-static",
24
24
  "lint": "run-p -cs lint:*",
25
25
  "lint:js": "eslint \"{src,demo}/**/*.{js,jsx,ts,tsx}\"",
26
26
  "lint:styles": "stylelint \"{src,demo}/**/*.{css,scss}\"",