@gravity-ui/markdown-editor 13.5.3 → 13.6.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 (122) hide show
  1. package/build/cjs/bundle/Editor.js +8 -5
  2. package/build/cjs/bundle/config/icons.d.ts +1 -1
  3. package/build/cjs/bundle/config/icons.js +1 -0
  4. package/build/cjs/bundle/config/wysiwyg.d.ts +2 -1
  5. package/build/cjs/bundle/config/wysiwyg.js +13 -2
  6. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeading.d.ts +12 -0
  7. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeading.js +22 -0
  8. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/FoldingHeadingSpecs.d.ts +2 -0
  9. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/FoldingHeadingSpecs.js +9 -0
  10. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/const.d.ts +11 -0
  11. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/const.js +5 -0
  12. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/index.d.ts +1 -0
  13. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/index.js +4 -0
  14. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/md/skip-heading-sections.d.ts +3 -0
  15. package/build/cjs/extensions/yfm/FoldingHeading/FoldingHeadingSpec/md/skip-heading-sections.js +17 -0
  16. package/build/cjs/extensions/yfm/FoldingHeading/actions.d.ts +2 -0
  17. package/build/cjs/extensions/yfm/FoldingHeading/actions.js +10 -0
  18. package/build/cjs/extensions/yfm/FoldingHeading/commands/index.d.ts +3 -0
  19. package/build/cjs/extensions/yfm/FoldingHeading/commands/index.js +6 -0
  20. package/build/cjs/extensions/yfm/FoldingHeading/commands/openHeadingAndCreateParagraphAfterIfCursorAtEndOfHeading.d.ts +2 -0
  21. package/build/cjs/extensions/yfm/FoldingHeading/commands/openHeadingAndCreateParagraphAfterIfCursorAtEndOfHeading.js +27 -0
  22. package/build/cjs/extensions/yfm/FoldingHeading/commands/removeFoldingIfCursorAtStartOfHeading.d.ts +2 -0
  23. package/build/cjs/extensions/yfm/FoldingHeading/commands/removeFoldingIfCursorAtStartOfHeading.js +17 -0
  24. package/build/cjs/extensions/yfm/FoldingHeading/commands/toggleFoldingOfHeading.d.ts +2 -0
  25. package/build/cjs/extensions/yfm/FoldingHeading/commands/toggleFoldingOfHeading.js +26 -0
  26. package/build/cjs/extensions/yfm/FoldingHeading/const.d.ts +1 -0
  27. package/build/cjs/extensions/yfm/FoldingHeading/const.js +6 -0
  28. package/build/cjs/extensions/yfm/FoldingHeading/index.d.ts +1 -0
  29. package/build/cjs/extensions/yfm/FoldingHeading/index.js +5 -0
  30. package/build/cjs/extensions/yfm/FoldingHeading/input-rules.d.ts +4 -0
  31. package/build/cjs/extensions/yfm/FoldingHeading/input-rules.js +31 -0
  32. package/build/cjs/extensions/yfm/FoldingHeading/plugins/Folding.d.ts +3 -0
  33. package/build/cjs/extensions/yfm/FoldingHeading/plugins/Folding.js +167 -0
  34. package/build/cjs/extensions/yfm/FoldingHeading/utils.d.ts +10 -0
  35. package/build/cjs/extensions/yfm/FoldingHeading/utils.js +30 -0
  36. package/build/cjs/extensions/yfm/YfmHeading/YfmHeadingSpecs/const.d.ts +1 -1
  37. package/build/cjs/extensions/yfm/YfmHeading/YfmHeadingSpecs/const.js +1 -1
  38. package/build/cjs/extensions/yfm/YfmHeading/YfmHeadingSpecs/index.js +4 -4
  39. package/build/cjs/extensions/yfm/YfmHeading/YfmHeadingSpecs/utils.js +9 -1
  40. package/build/cjs/i18n/menubar/en.json +2 -0
  41. package/build/cjs/i18n/menubar/index.d.ts +3 -1
  42. package/build/cjs/i18n/menubar/ru.json +2 -0
  43. package/build/cjs/icons/index.d.ts +1 -1
  44. package/build/cjs/icons/index.js +2 -1
  45. package/build/cjs/version.js +1 -1
  46. package/build/esm/bundle/Editor.js +8 -5
  47. package/build/esm/bundle/config/icons.d.ts +1 -1
  48. package/build/esm/bundle/config/icons.js +2 -1
  49. package/build/esm/bundle/config/wysiwyg.d.ts +2 -1
  50. package/build/esm/bundle/config/wysiwyg.js +12 -1
  51. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeading.d.ts +12 -0
  52. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeading.js +18 -0
  53. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/FoldingHeadingSpecs.d.ts +2 -0
  54. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/FoldingHeadingSpecs.js +5 -0
  55. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/const.d.ts +11 -0
  56. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/const.js +2 -0
  57. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/index.d.ts +1 -0
  58. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/index.js +1 -0
  59. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/md/skip-heading-sections.d.ts +3 -0
  60. package/build/esm/extensions/yfm/FoldingHeading/FoldingHeadingSpec/md/skip-heading-sections.js +13 -0
  61. package/build/esm/extensions/yfm/FoldingHeading/actions.d.ts +2 -0
  62. package/build/esm/extensions/yfm/FoldingHeading/actions.js +7 -0
  63. package/build/esm/extensions/yfm/FoldingHeading/commands/index.d.ts +3 -0
  64. package/build/esm/extensions/yfm/FoldingHeading/commands/index.js +3 -0
  65. package/build/esm/extensions/yfm/FoldingHeading/commands/openHeadingAndCreateParagraphAfterIfCursorAtEndOfHeading.d.ts +2 -0
  66. package/build/esm/extensions/yfm/FoldingHeading/commands/openHeadingAndCreateParagraphAfterIfCursorAtEndOfHeading.js +23 -0
  67. package/build/esm/extensions/yfm/FoldingHeading/commands/removeFoldingIfCursorAtStartOfHeading.d.ts +2 -0
  68. package/build/esm/extensions/yfm/FoldingHeading/commands/removeFoldingIfCursorAtStartOfHeading.js +13 -0
  69. package/build/esm/extensions/yfm/FoldingHeading/commands/toggleFoldingOfHeading.d.ts +2 -0
  70. package/build/esm/extensions/yfm/FoldingHeading/commands/toggleFoldingOfHeading.js +22 -0
  71. package/build/esm/extensions/yfm/FoldingHeading/const.d.ts +1 -0
  72. package/build/esm/extensions/yfm/FoldingHeading/const.js +1 -0
  73. package/build/esm/extensions/yfm/FoldingHeading/index.d.ts +1 -0
  74. package/build/esm/extensions/yfm/FoldingHeading/index.js +1 -0
  75. package/build/esm/extensions/yfm/FoldingHeading/input-rules.d.ts +4 -0
  76. package/build/esm/extensions/yfm/FoldingHeading/input-rules.js +27 -0
  77. package/build/esm/extensions/yfm/FoldingHeading/plugins/Folding.d.ts +4 -0
  78. package/build/esm/extensions/yfm/FoldingHeading/plugins/Folding.js +164 -0
  79. package/build/esm/extensions/yfm/FoldingHeading/utils.d.ts +10 -0
  80. package/build/esm/extensions/yfm/FoldingHeading/utils.js +19 -0
  81. package/build/esm/extensions/yfm/YfmHeading/YfmHeadingSpecs/const.d.ts +1 -1
  82. package/build/esm/extensions/yfm/YfmHeading/YfmHeadingSpecs/const.js +1 -1
  83. package/build/esm/extensions/yfm/YfmHeading/YfmHeadingSpecs/index.js +4 -4
  84. package/build/esm/extensions/yfm/YfmHeading/YfmHeadingSpecs/utils.js +9 -1
  85. package/build/esm/i18n/menubar/en.json +2 -0
  86. package/build/esm/i18n/menubar/index.d.ts +3 -1
  87. package/build/esm/i18n/menubar/ru.json +2 -0
  88. package/build/esm/icons/index.d.ts +1 -1
  89. package/build/esm/icons/index.js +1 -1
  90. package/build/esm/version.js +1 -1
  91. package/build/styles.css +0 -381
  92. package/package.json +10 -5
  93. package/build/cjs/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +0 -26
  94. package/build/cjs/extensions/markdown/Table/plugins/TableCellContextPlugin/floating.css +0 -11
  95. package/build/cjs/extensions/yfm/ImgSize/ImagePaste/skeleton.css +0 -8
  96. package/build/cjs/extensions/yfm/ImgSize/ImageWidget/view.css +0 -12
  97. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImageForm/ImageForm.css +0 -8
  98. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgNodeView.css +0 -4
  99. package/build/cjs/extensions/yfm/Mermaid/MermaidNodeView/Mermaid.css +0 -33
  100. package/build/cjs/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.css +0 -3
  101. package/build/cjs/extensions/yfm/YfmFile/YfmFilePaste/skeleton.css +0 -8
  102. package/build/cjs/extensions/yfm/YfmFile/YfmFileWidget/view.css +0 -7
  103. package/build/cjs/extensions/yfm/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlock.css +0 -66
  104. package/build/cjs/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.css +0 -66
  105. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/view.css +0 -83
  106. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.css +0 -37
  107. package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.css +0 -9
  108. package/build/esm/extensions/markdown/CodeBlock/CodeBlockHighlight/TooltipPlugin/TooltipView.css +0 -26
  109. package/build/esm/extensions/markdown/Table/plugins/TableCellContextPlugin/floating.css +0 -11
  110. package/build/esm/extensions/yfm/ImgSize/ImagePaste/skeleton.css +0 -8
  111. package/build/esm/extensions/yfm/ImgSize/ImageWidget/view.css +0 -12
  112. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImageForm/ImageForm.css +0 -8
  113. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgNodeView.css +0 -4
  114. package/build/esm/extensions/yfm/Mermaid/MermaidNodeView/Mermaid.css +0 -33
  115. package/build/esm/extensions/yfm/YfmCut/nodeviews/yfm-cut-title.css +0 -3
  116. package/build/esm/extensions/yfm/YfmFile/YfmFilePaste/skeleton.css +0 -8
  117. package/build/esm/extensions/yfm/YfmFile/YfmFileWidget/view.css +0 -7
  118. package/build/esm/extensions/yfm/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlock.css +0 -66
  119. package/build/esm/extensions/yfm/YfmNote/plugins/YfmNoteTooltipPlugin/index.css +0 -66
  120. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/view.css +0 -83
  121. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.css +0 -37
  122. package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.css +0 -9
@@ -0,0 +1,10 @@
1
+ import type { Node } from 'prosemirror-model';
2
+ import type { Selection } from 'prosemirror-state';
3
+ export { headingType } from '../../markdown/Heading/HeadingSpecs';
4
+ export declare const insideHeading: ({ $anchor, $head }: Selection) => boolean;
5
+ export declare const hasFolding: (sel: Selection) => boolean;
6
+ export declare function isHeading(node: Node): boolean;
7
+ export declare function isFoldingHeading(node: Node): boolean;
8
+ export declare function isFoldedHeading(node: Node): boolean;
9
+ export declare function isUnfoldedHeading(node: Node): boolean;
10
+ export declare function parseLevel(node: Node): number;
@@ -0,0 +1,19 @@
1
+ import { YfmHeadingAttr, headingNodeName } from './const';
2
+ export { headingType } from '../../markdown/Heading/HeadingSpecs';
3
+ export const insideHeading = ({ $anchor, $head }) => $anchor.sameParent($head) && isHeading($head.parent);
4
+ export const hasFolding = (sel) => insideHeading(sel) && sel.$head.parent.attrs[YfmHeadingAttr.Folding] !== null;
5
+ export function isHeading(node) {
6
+ return node.type.name === headingNodeName;
7
+ }
8
+ export function isFoldingHeading(node) {
9
+ return isHeading(node) && typeof node.attrs[YfmHeadingAttr.Folding] === 'boolean';
10
+ }
11
+ export function isFoldedHeading(node) {
12
+ return isHeading(node) && node.attrs[YfmHeadingAttr.Folding] === true;
13
+ }
14
+ export function isUnfoldedHeading(node) {
15
+ return isHeading(node) && node.attrs[YfmHeadingAttr.Folding] === false;
16
+ }
17
+ export function parseLevel(node) {
18
+ return Number.parseInt(node.attrs[YfmHeadingAttr.Level], 10);
19
+ }
@@ -4,5 +4,5 @@ export declare const YfmHeadingAttr: {
4
4
  readonly Level: "level";
5
5
  readonly Id: "id";
6
6
  readonly DataLine: "data-line";
7
- readonly Folding: "folding";
7
+ readonly Folding: "folded";
8
8
  };
@@ -4,5 +4,5 @@ export const YfmHeadingAttr = {
4
4
  Level: headingLevelAttr,
5
5
  Id: 'id',
6
6
  DataLine: 'data-line',
7
- Folding: 'folding',
7
+ Folding: 'folded',
8
8
  };
@@ -12,7 +12,7 @@ export const YfmHeadingSpecs = (builder, opts) => {
12
12
  [YfmHeadingAttr.Id]: { default: '' },
13
13
  [YfmHeadingAttr.Level]: { default: 1 },
14
14
  [YfmHeadingAttr.DataLine]: { default: null },
15
- [YfmHeadingAttr.Folding]: { default: false },
15
+ [YfmHeadingAttr.Folding]: { default: null },
16
16
  },
17
17
  content: '(text | inline)*',
18
18
  group: 'block',
@@ -35,7 +35,7 @@ export const YfmHeadingSpecs = (builder, opts) => {
35
35
  {
36
36
  id: id || null,
37
37
  [YfmHeadingAttr.DataLine]: lineNumber,
38
- [`data-${YfmHeadingAttr.Folding}`]: folding ? '' : null,
38
+ [`data-${YfmHeadingAttr.Folding}`]: folding,
39
39
  },
40
40
  0,
41
41
  // [
@@ -70,14 +70,14 @@ export const YfmHeadingSpecs = (builder, opts) => {
70
70
  // attrs[YfmHeadingAttr.Id] = slugify(tokens[index + 1].content);
71
71
  // }
72
72
  // attrs have id only if it explicitly specified manually
73
- return Object.assign({ [YfmHeadingAttr.Level]: Number(token.tag.slice(1)), [YfmHeadingAttr.Folding]: (_a = token.meta) === null || _a === void 0 ? void 0 : _a.folding }, attrs);
73
+ return Object.assign({ [YfmHeadingAttr.Level]: Number(token.tag.slice(1)), [YfmHeadingAttr.Folding]: ((_a = token.meta) === null || _a === void 0 ? void 0 : _a.folding) === true ? true : null }, attrs);
74
74
  },
75
75
  },
76
76
  },
77
77
  toMd: (state, node) => {
78
78
  const folding = node.attrs[YfmHeadingAttr.Folding];
79
79
  const level = node.attrs[YfmHeadingAttr.Level];
80
- state.write(state.repeat('#', level) + (folding ? '+' : '') + ' ');
80
+ state.write(state.repeat('#', level) + (typeof folding === 'boolean' ? '+' : '') + ' ');
81
81
  state.renderInline(node);
82
82
  const anchor = node.attrs[YfmHeadingAttr.Id];
83
83
  if (anchor /*&& anchor !== node.firstChild?.textContent*/) {
@@ -4,8 +4,16 @@ export { hType, hasParentHeading, headingRule } from '../../../markdown/Heading/
4
4
  export const getNodeAttrs = (level) => (node) => ({
5
5
  [YfmHeadingAttr.Level]: level,
6
6
  [YfmHeadingAttr.Id]: node.getAttribute('id') || '',
7
- [YfmHeadingAttr.Folding]: node.hasAttribute(`data-${YfmHeadingAttr.Folding}`),
7
+ [YfmHeadingAttr.Folding]: getFoldingAttr(node),
8
8
  });
9
+ function getFoldingAttr(node) {
10
+ const value = node.getAttribute(`data-${YfmHeadingAttr.Folding}`);
11
+ if (value === 'true')
12
+ return true;
13
+ if (value === 'false')
14
+ return false;
15
+ return null;
16
+ }
9
17
  // export const slugify = (str: string) =>
10
18
  // // same config as in yfm-transform
11
19
  // // https://github.com/yandex-cloud/yfm-transform/blob/master/lib/plugins/anchors/index.js#L97-L100
@@ -17,6 +17,8 @@
17
17
  "cut": "Cut",
18
18
  "emoji": "Emoji",
19
19
  "file": "File",
20
+ "folding-heading": "Collapsed section",
21
+ "folding-heading_hint": "The text under the heading can be collapsed or expanded",
20
22
  "heading": "Heading",
21
23
  "heading1": "Heading 1",
22
24
  "heading2": "Heading 2",
@@ -1,4 +1,4 @@
1
- export declare const i18n: <G extends "bold" | "code" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "colorify" | "mono" | "text" | "html" | "cut" | "table" | "image" | "code_inline" | "heading" | "note" | "file" | "codeblock" | "checkbox" | "emoji" | "list" | "tabs" | "math" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "undo" | "redo" | "math_inline" | "math_block" | "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" | "hrule" | "list__action_lift" | "list__action_sink" | "list_action_disabled" | "mermaid" | "more_action" | "olist" | "ulist", S extends string>(key: G | (string extends S ? S : never), params?: {
1
+ export declare const i18n: <G extends "bold" | "code" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "colorify" | "mono" | "text" | "html" | "cut" | "table" | "image" | "code_inline" | "heading" | "note" | "file" | "codeblock" | "checkbox" | "emoji" | "list" | "tabs" | "math" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "undo" | "redo" | "math_inline" | "math_block" | "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" | "mermaid" | "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;
@@ -19,6 +19,8 @@ export declare const i18n: <G extends "bold" | "code" | "link" | "italic" | "str
19
19
  cut: string;
20
20
  emoji: string;
21
21
  file: string;
22
+ "folding-heading": string;
23
+ "folding-heading_hint": string;
22
24
  heading: string;
23
25
  heading1: string;
24
26
  heading2: string;
@@ -17,6 +17,8 @@
17
17
  "cut": "Кат",
18
18
  "emoji": "Эмодзи",
19
19
  "file": "Файл",
20
+ "folding-heading": "Свёрнутый раздел",
21
+ "folding-heading_hint": "Текст под заголовком можно свернуть или раскрыть",
20
22
  "heading": "Заголовок",
21
23
  "heading1": "Заголовок 1",
22
24
  "heading2": "Заголовок 2",
@@ -2,4 +2,4 @@ import MermaidIcon from './Mermaid';
2
2
  import MonoIcon from './Mono';
3
3
  import TabsIcon from './Tabs';
4
4
  export { MermaidIcon, MonoIcon, TabsIcon };
5
- export { ArrowUturnCcwLeft as UndoIcon, ArrowUturnCwRight as RedoIcon, Bold as BoldIcon, Italic as ItalicIcon, Underline as UnderlineIcon, Strikethrough as StrikethroughIcon, FontCursor as MarkIcon, Text as TextIcon, Heading as HeadingIcon, Heading1 as Heading1Icon, Heading2 as Heading2Icon, Heading3 as Heading3Icon, Heading4 as Heading4Icon, Heading5 as Heading5Icon, Heading6 as Heading6Icon, ListUl as ListBlIcon, ListOl as ListOlIcon, TextOutdent as LiftIcon, TextIndent as SinkIcon, Font as TextColorIcon, Link as LinkIcon, QuoteClose as QuoteIcon, Scissors as CutIcon, Sticker as NoteIcon, Paperclip as FileIcon, Minus as HRuleIcon, LayoutList as TableIcon, ChevronsExpandHorizontal as IframeIcon, SquareCheck as CheckListIcon, Picture as ImageIcon, Person as UserIcon, FaceSmile as EmojiIcon, Code as CodeInlineIcon, FileCode as CodeBlockIcon, Function as FunctionInlineIcon, CurlyBracketsFunction as FunctionBlockIcon, Hashtag as AnchorIcon, SquareDashedText as BlockIcon, LayoutColumns3 as LayoutIcon, Pencil as DrawIoIcon, FolderCode as HtmlBlockIcon, } from '@gravity-ui/icons';
5
+ export { ArrowUturnCcwLeft as UndoIcon, ArrowUturnCwRight as RedoIcon, Bold as BoldIcon, Italic as ItalicIcon, Underline as UnderlineIcon, Strikethrough as StrikethroughIcon, FontCursor as MarkIcon, Text as TextIcon, Heading as HeadingIcon, Heading1 as Heading1Icon, Heading2 as Heading2Icon, Heading3 as Heading3Icon, Heading4 as Heading4Icon, Heading5 as Heading5Icon, Heading6 as Heading6Icon, ListUl as ListBlIcon, ListOl as ListOlIcon, TextOutdent as LiftIcon, TextIndent as SinkIcon, Font as TextColorIcon, Link as LinkIcon, QuoteClose as QuoteIcon, Scissors as CutIcon, Sticker as NoteIcon, Paperclip as FileIcon, Minus as HRuleIcon, LayoutList as TableIcon, ChevronsExpandHorizontal as IframeIcon, SquareCheck as CheckListIcon, Picture as ImageIcon, Person as UserIcon, FaceSmile as EmojiIcon, Code as CodeInlineIcon, FileCode as CodeBlockIcon, Function as FunctionInlineIcon, CurlyBracketsFunction as FunctionBlockIcon, Hashtag as AnchorIcon, SquareDashedText as BlockIcon, LayoutColumns3 as LayoutIcon, Pencil as DrawIoIcon, FolderCode as HtmlBlockIcon, ArrowChevronRight as FoldingHeadingIcon, } from '@gravity-ui/icons';
@@ -26,4 +26,4 @@ Function as FunctionInlineIcon, CurlyBracketsFunction as FunctionBlockIcon,
26
26
  //
27
27
  Hashtag as AnchorIcon, SquareDashedText as BlockIcon, LayoutColumns3 as LayoutIcon,
28
28
  //
29
- Pencil as DrawIoIcon, FolderCode as HtmlBlockIcon, } from '@gravity-ui/icons';
29
+ Pencil as DrawIoIcon, FolderCode as HtmlBlockIcon, ArrowChevronRight as FoldingHeadingIcon, } from '@gravity-ui/icons';
@@ -1,2 +1,2 @@
1
1
  /** During build process, the current version will be injected here */
2
- export const VERSION = typeof '13.5.3' !== 'undefined' ? '13.5.3' : 'unknown';
2
+ export const VERSION = typeof '13.6.0' !== 'undefined' ? '13.6.0' : 'unknown';
package/build/styles.css CHANGED
@@ -1152,385 +1152,4 @@ img.ProseMirror-separator {
1152
1152
  font-size: var(--g-text-code-inline-1-font-size);
1153
1153
  line-height: var(--g-text-code-inline-1-line-height);
1154
1154
  font-weight: var(--g-text-code-font-weight);
1155
- }
1156
- .g-md-image-skeleton {
1157
- vertical-align: middle;
1158
- }
1159
- .g-md-image-skeleton__skeleton {
1160
- width: min(var(--img-skeleton-width) * 1px, 100%);
1161
- height: min(var(--img-skeleton-height) * 1px, 700px);
1162
- margin-bottom: -5px;
1163
- }
1164
- .g-md-image-placeholder {
1165
- display: inline-flex;
1166
- align-items: center;
1167
- column-gap: 8px;
1168
- min-width: 300px;
1169
- padding: 12px 20px;
1170
- border-radius: 4px;
1171
- background-color: var(--g-color-base-simple-hover-solid);
1172
- font-size: var(--g-text-body-2-font-size);
1173
- line-height: var(--g-text-body-2-line-height);
1174
- font-weight: var(--g-text-body-font-weight);
1175
- }
1176
- .g-md-Mermaid {
1177
- display: flex;
1178
- justify-content: space-between;
1179
- margin-bottom: 15px;
1180
- padding: 2px;
1181
- border: 1px solid var(--g-color-line-generic);
1182
- border-radius: var(--g-border-radius-m);
1183
- }
1184
- .g-md-Mermaid_edit {
1185
- display: flex;
1186
- }
1187
- .g-md-Mermaid__Preview {
1188
- flex: 1;
1189
- }
1190
- .g-md-Mermaid__Error {
1191
- flex: 1;
1192
- font-family: var(--g-font-family-monospace);
1193
- color: var(--g-color-text-danger);
1194
- }
1195
- .g-md-Mermaid__Editor {
1196
- flex: 1;
1197
- white-space: nowrap;
1198
- caret-color: auto;
1199
- }
1200
- .g-md-Mermaid__EditorPopover {
1201
- z-index: 1;
1202
- float: right;
1203
- }
1204
- .g-md-Mermaid__Controls {
1205
- display: flex;
1206
- justify-content: end;
1207
- margin-top: 5px;
1208
- }
1209
- .yfm-cut-title .g-md-yfm-cut-title-inner {
1210
- cursor: text;
1211
- }
1212
- .g-md-file-skeleton {
1213
- display: inline-flex;
1214
- align-items: center;
1215
- }
1216
- .g-md-file-skeleton__skeleton {
1217
- width: 120px;
1218
- height: 20px;
1219
- }
1220
- .g-md-file-placeholder {
1221
- margin: 0 4px;
1222
- pointer-events: none;
1223
- }
1224
- .g-md-file-placeholder .yfm-file__icon {
1225
- margin-right: 8px;
1226
- }
1227
- .g-md-yfm-html-block {
1228
- position: relative;
1229
- display: flex;
1230
- justify-content: space-between;
1231
- margin-bottom: 15px;
1232
- padding-top: 28px;
1233
- border: 1px solid var(--g-color-line-generic);
1234
- border-radius: var(--g-border-radius-m);
1235
- }
1236
- .g-md-yfm-html-block_editing {
1237
- display: flex;
1238
- padding-top: 0;
1239
- border: 0;
1240
- }
1241
- .g-md-yfm-html-block__label {
1242
- position: absolute;
1243
- top: 8px;
1244
- left: 8px;
1245
- }
1246
- .g-md-yfm-html-block__menu {
1247
- position: absolute;
1248
- top: 0;
1249
- right: 0;
1250
- }
1251
- .g-md-yfm-html-block__preview {
1252
- flex: 1;
1253
- }
1254
- .g-md-yfm-html-block__error {
1255
- flex: 1;
1256
- font-family: var(--g-font-family-monospace);
1257
- color: var(--g-color-text-danger);
1258
- }
1259
- .g-md-yfm-html-block__editor {
1260
- flex: 1;
1261
- width: 50%;
1262
- white-space: nowrap;
1263
- caret-color: auto;
1264
- }
1265
- .g-md-yfm-html-block__editor .g-text-area__content {
1266
- font-size: 1em;
1267
- color: var(--yfm-color-hljs-subst);
1268
- border: 0;
1269
- border-radius: var(--g-border-radius-m);
1270
- background: var(--yfm-color-hljs-background);
1271
- font-feature-settings: normal;
1272
- }
1273
- .g-md-yfm-html-block__editor .g-text-area__control.g-md-YfmHtmlBlockHelper {
1274
- font-family: var(--yfm-font-family-monospace);
1275
- }
1276
- .g-md-yfm-html-block__editor-popover {
1277
- z-index: 1;
1278
- float: right;
1279
- }
1280
- .g-md-yfm-html-block__controls {
1281
- display: flex;
1282
- justify-content: end;
1283
- margin-top: 5px;
1284
- }
1285
- .g-md-yfm-html-block__content {
1286
- flex-grow: 1;
1287
- }
1288
-
1289
- .g-root_theme_dark-hc .g-md-yfm-html-block_editing .g-text-area__content,
1290
- .g-root_theme_dark .g-md-yfm-html-block_editing .g-text-area__content {
1291
- color: var(--g-color-text-primary);
1292
- }
1293
- .g-md-search-card {
1294
- padding: var(--g-spacing-2) var(--g-spacing-2) var(--g-spacing-3) var(--g-spacing-4);
1295
- }
1296
- .g-md-search-card__header {
1297
- display: flex;
1298
- justify-content: space-between;
1299
- align-items: center;
1300
- margin-bottom: var(--g-spacing-1);
1301
- }
1302
- .g-md-code-block-toolbar {
1303
- margin: 2px 8px;
1304
- }
1305
-
1306
- .g-md-code-tooltip-menu {
1307
- min-width: 150px;
1308
- border-radius: 4px;
1309
- }
1310
-
1311
- .g-md-code-block__select-popup {
1312
- width: 175px;
1313
- max-height: 200px;
1314
- }
1315
- .g-md-code-block__select-popup .g-select-filter {
1316
- border-bottom: 1px solid var(--g-color-line-generic);
1317
- }
1318
- .g-md-code-block__select-popup .g-select-filter .g-text-input__content {
1319
- border: none;
1320
- }
1321
- .g-md-code-block__select-popup .g-md-code-block__select-empty {
1322
- margin-left: 4px;
1323
- }
1324
-
1325
- .g-md-code-block__select-button {
1326
- margin: auto 0;
1327
- }
1328
- .table-cell-floating-button.g-button {
1329
- height: 28px;
1330
- line-height: 28px;
1331
- }
1332
- .table-cell-floating-button.g-button .g-button__icon {
1333
- width: 12px;
1334
- }
1335
-
1336
- .table-cell-floating-icon {
1337
- transform: rotate(90deg);
1338
- }
1339
- .g-md-img-size-node-view__wrapper {
1340
- position: relative;
1341
- display: inline-block;
1342
- }
1343
- .yfm .yfm-note {
1344
- max-width: 1296px;
1345
- margin: 20px 0;
1346
- padding: 20px 20px 20px 64px;
1347
- border-radius: 10px;
1348
- }
1349
- .yfm .yfm-note .yfm-note-title {
1350
- font-weight: 700;
1351
- }
1352
- .yfm .yfm-note > p {
1353
- margin: 0 0 10px 0;
1354
- }
1355
- .yfm .yfm-note > p:first-child::before {
1356
- box-sizing: content-box;
1357
- display: block;
1358
- width: 24px;
1359
- height: 24px;
1360
- margin-top: -2px;
1361
- margin-left: -44px;
1362
- padding-right: 20px;
1363
- float: left;
1364
- }
1365
- .yfm .yfm-note > p:last-child {
1366
- margin-bottom: 0;
1367
- }
1368
- .yfm .yfm-note.yfm-accent-info > p:first-child::before {
1369
- content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(2,123,243)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
1370
- }
1371
- .yfm .yfm-note.yfm-accent-tip > p:first-child::before {
1372
- content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(86,189,103)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
1373
- }
1374
- .yfm .yfm-note.yfm-accent-alert > p:first-child::before {
1375
- content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(255,70,69)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
1376
- }
1377
- .yfm .yfm-note.yfm-accent-warning > p:first-child::before {
1378
- content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 16 16"%3E%3Ccircle cx="8" cy="8" r="8" fill="rgb(241,149,24)"/%3E%3Crect width="1" height="5" x="7.5" y="6.5" stroke="%23fff" rx=".5"/%3E%3Ccircle cx="8" cy="4" r="1" fill="%23fff"/%3E%3C/svg%3E');
1379
- }
1380
- .yfm .yfm-note.yfm-accent-info {
1381
- background: rgba(2, 123, 243, 0.08);
1382
- }
1383
- .yfm .yfm-note.yfm-accent-tip {
1384
- background: rgba(63, 201, 46, 0.1);
1385
- }
1386
- .yfm .yfm-note.yfm-accent-alert {
1387
- background: rgba(235, 50, 38, 0.08);
1388
- }
1389
- .yfm .yfm-note.yfm-accent-warning {
1390
- background: rgba(255, 136, 0, 0.15);
1391
- }
1392
-
1393
- .g-md-yfm-note-toolbar {
1394
- margin: 2px 8px;
1395
- }
1396
-
1397
- .g-md-toolbar-group__s-button_id_note-type-tip {
1398
- color: #56bd67;
1399
- }
1400
- .g-md-toolbar-group__s-button_id_note-type-info {
1401
- color: #027bf3;
1402
- }
1403
- .g-md-toolbar-group__s-button_id_note-type-alert {
1404
- color: #ff4645;
1405
- }
1406
- .g-md-toolbar-group__s-button_id_note-type-warning {
1407
- color: #f19518;
1408
- }
1409
- .g-md-table-view__hack-strip {
1410
- position: absolute;
1411
- left: -13px;
1412
- display: block;
1413
- width: 13px;
1414
- height: 100%;
1415
- background: transparent;
1416
- }
1417
- .g-md-table-view__wrapper {
1418
- position: relative;
1419
- display: inline-block;
1420
- max-width: calc(100% - 18px);
1421
- margin-right: 18px;
1422
- /* stylelint-disable declaration-no-important */
1423
- margin-bottom: 18px !important;
1424
- }
1425
- .g-md-table-view__buttons-visible .g-md-table-view__plus-button-controls {
1426
- pointer-events: initial;
1427
- opacity: 1;
1428
- }
1429
- .g-md-table-view__plus-button-controls {
1430
- pointer-events: none;
1431
- opacity: 0;
1432
- transition: opacity 150ms ease 50ms;
1433
- }
1434
- .g-md-table-view__plus-button-controls_right {
1435
- position: absolute;
1436
- z-index: 100;
1437
- top: 0;
1438
- right: -18px;
1439
- display: flex;
1440
- align-items: center;
1441
- width: 16px;
1442
- height: 100%;
1443
- }
1444
- .g-md-table-view__plus-button-controls_bottom {
1445
- position: absolute;
1446
- z-index: 100;
1447
- bottom: -18px;
1448
- display: flex;
1449
- justify-content: center;
1450
- width: 100%;
1451
- height: 16px;
1452
- }
1453
- .g-md-table-view__plus-button {
1454
- display: flex;
1455
- justify-content: center;
1456
- align-items: center;
1457
- height: 100%;
1458
- }
1459
- .g-md-table-view__plus-button_right {
1460
- width: 16px;
1461
- height: 100%;
1462
- }
1463
- .g-md-table-view__plus-button_bottom {
1464
- width: 100%;
1465
- height: 16px;
1466
- }
1467
-
1468
- .g-md-table-view.g-md-table-view {
1469
- z-index: unset;
1470
- display: block;
1471
- overflow: auto;
1472
- box-sizing: content-box;
1473
- width: fit-content;
1474
- margin: -13px 0 0 -13px;
1475
- padding: 13px 0 0 13px;
1476
- border: none;
1477
- border-radius: 0;
1478
- background: transparent !important;
1479
- }
1480
- .g-md-table-view.g-md-table-view tbody {
1481
- display: block;
1482
- border-radius: 8px;
1483
- background: var(--g-color-base-background);
1484
- box-shadow: inset 0 0 0 1px var(--g-color-line-generic);
1485
- }
1486
-
1487
- .g-md-table-wrapper {
1488
- display: inline-block;
1489
- width: 100%;
1490
- margin-right: 2px;
1491
- }
1492
- .g-md-table-cell-view__left-button {
1493
- position: absolute;
1494
- z-index: 110;
1495
- top: calc(50% - 14px);
1496
- left: -13px;
1497
- pointer-events: none;
1498
- opacity: 0;
1499
- border-radius: var(--g-border-radius-s);
1500
- background: var(--g-color-base-background);
1501
- }
1502
- .g-md-table-cell-view__left-button:hover {
1503
- pointer-events: initial;
1504
- opacity: 1;
1505
- }
1506
- .g-md-table-cell-view__upper-button {
1507
- position: absolute;
1508
- z-index: 110;
1509
- top: -13px;
1510
- left: calc(50% - 14px);
1511
- pointer-events: none;
1512
- opacity: 0;
1513
- border-radius: var(--g-border-radius-s);
1514
- background: var(--g-color-base-background);
1515
- transform: rotate(90deg);
1516
- }
1517
- .g-md-table-cell-view__upper-button:hover {
1518
- pointer-events: initial;
1519
- opacity: 1;
1520
- }
1521
- .g-md-table-cell-view__upper-visible .g-md-table-cell-view__upper-button {
1522
- pointer-events: initial;
1523
- opacity: 1;
1524
- }
1525
- .g-md-table-cell-view__left-visible .g-md-table-cell-view__left-button {
1526
- pointer-events: initial;
1527
- opacity: 1;
1528
- }
1529
- .g-md-image-tooltip-form__input_type_width, .g-md-image-tooltip-form__input_type_height {
1530
- max-width: 112px;
1531
- }
1532
- .g-md-image-tooltip-form__size-controls {
1533
- display: flex;
1534
- align-items: center;
1535
- gap: 0 16px;
1536
1155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/markdown-editor",
3
- "version": "13.5.3",
3
+ "version": "13.6.0",
4
4
  "description": "Markdown wysiwyg and markup editor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -167,7 +167,7 @@
167
167
  "@codemirror/state": "6.4.1",
168
168
  "@codemirror/view": "6.26.3",
169
169
  "@gravity-ui/i18n": "^1.1.0",
170
- "@gravity-ui/icons": "^2.0.0",
170
+ "@gravity-ui/icons": "^2.10.0",
171
171
  "@lezer/highlight": "1.2.0",
172
172
  "@lezer/markdown": "1.3.0",
173
173
  "@types/is-number": "^7.0.1",
@@ -199,6 +199,7 @@
199
199
  "tslib": "^2.3.1"
200
200
  },
201
201
  "devDependencies": {
202
+ "@diplodoc/folding-headings-extension": "0.1.0",
202
203
  "@diplodoc/html-extension": "1.2.7",
203
204
  "@diplodoc/latex-extension": "1.0.3",
204
205
  "@diplodoc/mermaid-extension": "1.2.1",
@@ -252,13 +253,16 @@
252
253
  "typescript": "^4.5.2"
253
254
  },
254
255
  "peerDependenciesMeta": {
255
- "@diplodoc/latex-extension": {
256
+ "@diplodoc/folding-headings-extension": {
256
257
  "optional": true
257
258
  },
258
- "@diplodoc/mermaid-extension": {
259
+ "@diplodoc/html-extension": {
259
260
  "optional": true
260
261
  },
261
- "@diplodoc/html-extension": {
262
+ "@diplodoc/latex-extension": {
263
+ "optional": true
264
+ },
265
+ "@diplodoc/mermaid-extension": {
262
266
  "optional": true
263
267
  },
264
268
  "highlight.js": {
@@ -269,6 +273,7 @@
269
273
  }
270
274
  },
271
275
  "peerDependencies": {
276
+ "@diplodoc/folding-headings-extension": "^0.1.0",
272
277
  "@diplodoc/html-extension": "^1.2.7",
273
278
  "@diplodoc/latex-extension": "^1.0.3",
274
279
  "@diplodoc/mermaid-extension": "^1.0.0",
@@ -1,26 +0,0 @@
1
- .g-md-code-block-toolbar {
2
- margin: 2px 8px;
3
- }
4
-
5
- .g-md-code-tooltip-menu {
6
- min-width: 150px;
7
- border-radius: 4px;
8
- }
9
-
10
- .g-md-code-block__select-popup {
11
- width: 175px;
12
- max-height: 200px;
13
- }
14
- .g-md-code-block__select-popup .g-select-filter {
15
- border-bottom: 1px solid var(--g-color-line-generic);
16
- }
17
- .g-md-code-block__select-popup .g-select-filter .g-text-input__content {
18
- border: none;
19
- }
20
- .g-md-code-block__select-popup .g-md-code-block__select-empty {
21
- margin-left: 4px;
22
- }
23
-
24
- .g-md-code-block__select-button {
25
- margin: auto 0;
26
- }
@@ -1,11 +0,0 @@
1
- .table-cell-floating-button.g-button {
2
- height: 28px;
3
- line-height: 28px;
4
- }
5
- .table-cell-floating-button.g-button .g-button__icon {
6
- width: 12px;
7
- }
8
-
9
- .table-cell-floating-icon {
10
- transform: rotate(90deg);
11
- }
@@ -1,8 +0,0 @@
1
- .g-md-image-skeleton {
2
- vertical-align: middle;
3
- }
4
- .g-md-image-skeleton__skeleton {
5
- width: min(var(--img-skeleton-width) * 1px, 100%);
6
- height: min(var(--img-skeleton-height) * 1px, 700px);
7
- margin-bottom: -5px;
8
- }
@@ -1,12 +0,0 @@
1
- .g-md-image-placeholder {
2
- display: inline-flex;
3
- align-items: center;
4
- column-gap: 8px;
5
- min-width: 300px;
6
- padding: 12px 20px;
7
- border-radius: 4px;
8
- background-color: var(--g-color-base-simple-hover-solid);
9
- font-size: var(--g-text-body-2-font-size);
10
- line-height: var(--g-text-body-2-line-height);
11
- font-weight: var(--g-text-body-font-weight);
12
- }
@@ -1,8 +0,0 @@
1
- .g-md-image-tooltip-form__input_type_width, .g-md-image-tooltip-form__input_type_height {
2
- max-width: 112px;
3
- }
4
- .g-md-image-tooltip-form__size-controls {
5
- display: flex;
6
- align-items: center;
7
- gap: 0 16px;
8
- }
@@ -1,4 +0,0 @@
1
- .g-md-img-size-node-view__wrapper {
2
- position: relative;
3
- display: inline-block;
4
- }