Skip to content

Commit 87951ca

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/mermaid-11.10.0
2 parents de4b49d + a724a86 commit 87951ca

File tree

303 files changed

+6159
-1364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+6159
-1364
lines changed

CHANGELOG.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,121 @@
11
# Changelog
22

3+
## [15.25.0](https://github.com/gravity-ui/markdown-editor/compare/v15.24.1...v15.25.0) (2025-11-14)
4+
5+
6+
### Features
7+
8+
* **bundle:** improve cursor movement to specified line in wysiwyg mode ([fd04b7f](https://github.com/gravity-ui/markdown-editor/commit/fd04b7f57f14fa1c2d282eaf0b7f00e13b81f5c6))
9+
* **Checkbox:** add data-line attribute to checkbox ([283c7d1](https://github.com/gravity-ui/markdown-editor/commit/283c7d1e9f6e2e31b8f8f23260062fa4d6ec120e))
10+
* **CodeBlock:** add data-line attribute to code block ([783f099](https://github.com/gravity-ui/markdown-editor/commit/783f0997d26158f655b034fec44b83be1db0c261))
11+
* **Deflist:** add data-line attribute to term ([86347bc](https://github.com/gravity-ui/markdown-editor/commit/86347bc656e99924ac18f6ce75dd8cd06d85a6ea))
12+
* **Lists:** add data-line attribute to list item ([1077ae9](https://github.com/gravity-ui/markdown-editor/commit/1077ae994827b5ab4b98db40d844b602ffd7e4ce))
13+
* **Table:** add data-line attribute to table row ([b956c55](https://github.com/gravity-ui/markdown-editor/commit/b956c5500b1a3c776130435ef4a869d960b20765))
14+
* **YfmCut:** add data-line attribute to cut title ([426bfcf](https://github.com/gravity-ui/markdown-editor/commit/426bfcf541ea021251fdb544670ab3ff09ac0f9a))
15+
* **YfmNote:** add data-line attribute to note title ([f55d176](https://github.com/gravity-ui/markdown-editor/commit/f55d176c13d25ec5b0240955900e7a981369941a))
16+
17+
## [15.24.1](https://github.com/gravity-ui/markdown-editor/compare/v15.24.0...v15.24.1) (2025-11-11)
18+
19+
20+
### Bug Fixes
21+
22+
* **BaseSchema:** get paragraph attributes from token attributes ([#875](https://github.com/gravity-ui/markdown-editor/issues/875)) ([17a58e5](https://github.com/gravity-ui/markdown-editor/commit/17a58e53a86fc863638badbfa46aad579c43ccd1))
23+
24+
## [15.24.0](https://github.com/gravity-ui/markdown-editor/compare/v15.23.0...v15.24.0) (2025-10-18)
25+
26+
27+
### Features
28+
29+
* **toolbar:** add dynamic z-index sync via useTargetZIndex hook ([#863](https://github.com/gravity-ui/markdown-editor/issues/863)) ([d03f6c9](https://github.com/gravity-ui/markdown-editor/commit/d03f6c905250bc610d5cc30f611ec86f4a6fa170))
30+
* **YfmCut:** support diplodoc/cut-extension v1.x.x ([#869](https://github.com/gravity-ui/markdown-editor/issues/869)) ([14bf513](https://github.com/gravity-ui/markdown-editor/commit/14bf513f085203f5ecfbb967d981a2905ce196ca))
31+
32+
33+
### Bug Fixes
34+
35+
* **imageSize:** fixed the insertion of the svg image ([#857](https://github.com/gravity-ui/markdown-editor/issues/857)) ([e70da1b](https://github.com/gravity-ui/markdown-editor/commit/e70da1be6deb09ef42041b0153c9522c747e3d97))
36+
* **Table:** go to next row when pressing Enter or Shift+Enter ([#871](https://github.com/gravity-ui/markdown-editor/issues/871)) ([5cbdf0a](https://github.com/gravity-ui/markdown-editor/commit/5cbdf0a338e6993b855daf00ccac8c886f1f4bc9))
37+
* **wysiwyg:** dont apply wrapping input rules within non-default textblocks ([#870](https://github.com/gravity-ui/markdown-editor/issues/870)) ([cd3cddd](https://github.com/gravity-ui/markdown-editor/commit/cd3cddd96944e4e70e4dc3454cb9aa7cfaed48e7))
38+
39+
## [15.23.0](https://github.com/gravity-ui/markdown-editor/compare/v15.22.2...v15.23.0) (2025-10-14)
40+
41+
42+
### Features
43+
44+
* add replace func to markup search ([#860](https://github.com/gravity-ui/markdown-editor/issues/860)) ([5c36b3d](https://github.com/gravity-ui/markdown-editor/commit/5c36b3df0c56db79c74715d537a9383c9131b03e))
45+
46+
47+
### Bug Fixes
48+
49+
* **YfmTable:** fix clearing table cells when pressing backspace ([#866](https://github.com/gravity-ui/markdown-editor/issues/866)) ([776de5c](https://github.com/gravity-ui/markdown-editor/commit/776de5ca649479874280875297177bd3c9cb6a53))
50+
51+
## [15.22.2](https://github.com/gravity-ui/markdown-editor/compare/v15.22.1...v15.22.2) (2025-10-09)
52+
53+
54+
### Bug Fixes
55+
56+
* **toolbar:** revert broken z-index logic for popups ([#861](https://github.com/gravity-ui/markdown-editor/issues/861)) ([2859f7c](https://github.com/gravity-ui/markdown-editor/commit/2859f7cbb09bd9d24332e0bbe74f6816af84767c))
57+
58+
## [15.22.1](https://github.com/gravity-ui/markdown-editor/compare/v15.22.0...v15.22.1) (2025-10-08)
59+
60+
61+
### Bug Fixes
62+
63+
* **Mermaid, YfmHtmlBlock:** improve autosave UI behavior ([#858](https://github.com/gravity-ui/markdown-editor/issues/858)) ([6da142b](https://github.com/gravity-ui/markdown-editor/commit/6da142bc6ac6b9c59b3c80363d9de134eb9f9bfe))
64+
* **toolbar:** use helper to adjust z-index for popups ([#544](https://github.com/gravity-ui/markdown-editor/issues/544)) ([d452b02](https://github.com/gravity-ui/markdown-editor/commit/d452b0225d10de319a7181731ac2ac0042a16e0c))
65+
66+
## [15.22.0](https://github.com/gravity-ui/markdown-editor/compare/v15.21.0...v15.22.0) (2025-10-02)
67+
68+
69+
### Features
70+
71+
* add autosave while editing Mermaid and YfmHtmlblock ([#852](https://github.com/gravity-ui/markdown-editor/issues/852)) ([5ddd9d5](https://github.com/gravity-ui/markdown-editor/commit/5ddd9d5ee8c56510a380b9841c5a9d5971f76045))
72+
* **YfmTable:** add ghost when dragging rows and columns ([#849](https://github.com/gravity-ui/markdown-editor/issues/849)) ([b1ca9c6](https://github.com/gravity-ui/markdown-editor/commit/b1ca9c64c7b4610c3d12b5611c880278db228468))
73+
* **YfmTable:** change border color for selected cells ([#850](https://github.com/gravity-ui/markdown-editor/issues/850)) ([46f5168](https://github.com/gravity-ui/markdown-editor/commit/46f516883a25b3b5bf8bcd0026ccbcd68d0d4ee4))
74+
* **YfmTableControls:** update plus button styles ([#848](https://github.com/gravity-ui/markdown-editor/issues/848)) ([2482d89](https://github.com/gravity-ui/markdown-editor/commit/2482d8931a88f5ab6a9ebfe4ca77051905fb686a))
75+
76+
77+
### Bug Fixes
78+
79+
* **BaseSchema:** fix serialization of empty paragraphs inside other blocks ([#846](https://github.com/gravity-ui/markdown-editor/issues/846)) ([196f9f6](https://github.com/gravity-ui/markdown-editor/commit/196f9f634a39b4b77d1be1d9f8b243abbc6052c7))
80+
* **FoldingHeading:** some blocks remained visible when heading was collapsed ([#845](https://github.com/gravity-ui/markdown-editor/issues/845)) ([1c0005d](https://github.com/gravity-ui/markdown-editor/commit/1c0005dd44edc4a480a8b6123ef2a428c50b2356))
81+
* **YfmTableControls:** fix drag-n-drop false positives ([#853](https://github.com/gravity-ui/markdown-editor/issues/853)) ([ea018a1](https://github.com/gravity-ui/markdown-editor/commit/ea018a1c9474ebf83c787532dd9128e78746805d))
82+
* **YfmTable:** fix button display while dragging ([#854](https://github.com/gravity-ui/markdown-editor/issues/854)) ([54bd192](https://github.com/gravity-ui/markdown-editor/commit/54bd1922dc1da8dfce74ec907776f5f50652c1b7))
83+
84+
## [15.21.0](https://github.com/gravity-ui/markdown-editor/compare/v15.20.0...v15.21.0) (2025-09-23)
85+
86+
87+
### Features
88+
89+
* **view:** support `no-stripe-table` modifier ([8f4cfb0](https://github.com/gravity-ui/markdown-editor/commit/8f4cfb048ccef957119f054a385c1f5f8f22032e))
90+
* **YfmConfigs:** support yfm modifiers ([26157cd](https://github.com/gravity-ui/markdown-editor/commit/26157cd73e7c44e20f0780a6c894ee71577b9759))
91+
92+
93+
### Bug Fixes
94+
95+
* **YfmTableControls:** fix row deletion when dnd is enabled ([#844](https://github.com/gravity-ui/markdown-editor/issues/844)) ([b696dd3](https://github.com/gravity-ui/markdown-editor/commit/b696dd3c6cbdc2da6c798f9470c0e2893d76c38e))
96+
97+
## [15.20.0](https://github.com/gravity-ui/markdown-editor/compare/v15.19.1...v15.20.0) (2025-09-15)
98+
99+
100+
### Features
101+
102+
* **icons:** update monospace, tabs, mermaid and drawio icons ([#837](https://github.com/gravity-ui/markdown-editor/issues/837)) ([1acf377](https://github.com/gravity-ui/markdown-editor/commit/1acf3772166665be6458682ee5e175b462ff85ce))
103+
* **YfmTable:** rework table controls – add drag-n-drop, rows and columns insertion ([#831](https://github.com/gravity-ui/markdown-editor/issues/831)) ([f8fd37f](https://github.com/gravity-ui/markdown-editor/commit/f8fd37ff59ea2e318513c670f144bb6c956559bc))
104+
105+
106+
### Bug Fixes
107+
108+
* **toolbar:** hide tooltip when menu open to prevent overlap ([#839](https://github.com/gravity-ui/markdown-editor/issues/839)) ([9c80b9d](https://github.com/gravity-ui/markdown-editor/commit/9c80b9d25ff24e500975e435e26edcaee9761b3f))
109+
110+
## [15.19.1](https://github.com/gravity-ui/markdown-editor/compare/v15.19.0...v15.19.1) (2025-08-28)
111+
112+
113+
### Bug Fixes
114+
115+
* **bundle:** dont pass invalid props to dom in ToolbarColors component ([#836](https://github.com/gravity-ui/markdown-editor/issues/836)) ([93a97b6](https://github.com/gravity-ui/markdown-editor/commit/93a97b645d1a1b1411b4b07804248302db620a07))
116+
* ellipsis rule in inline code ([#829](https://github.com/gravity-ui/markdown-editor/issues/829)) ([53cc46f](https://github.com/gravity-ui/markdown-editor/commit/53cc46f6b67b2667225d66453f4160dab304c8f6))
117+
* **Lists:** enable tight lists by default to eliminate unnecessary spacing ([#826](https://github.com/gravity-ui/markdown-editor/issues/826)) ([28b7368](https://github.com/gravity-ui/markdown-editor/commit/28b736899b9de7198a9d53e2fa6826cc7b6fdee8))
118+
3119
## [15.19.0](https://github.com/gravity-ui/markdown-editor/compare/v15.18.0...v15.19.0) (2025-08-12)
4120

5121

demo/components/MoveToLine.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {useState} from 'react';
2+
3+
import {Button, type DOMProps, Flex} from '@gravity-ui/uikit';
4+
5+
import {NumberInput} from 'src/index';
6+
7+
export type MoveToLineProps = DOMProps & {
8+
onClick: (value: number | undefined) => void;
9+
};
10+
11+
export const MoveToLine: React.FC<MoveToLineProps> = function MoveToLine({
12+
style,
13+
className,
14+
onClick,
15+
}) {
16+
const [line, setLine] = useState<number | undefined>(0);
17+
18+
return (
19+
<Flex gap="1" style={style} className={className}>
20+
<NumberInput size="s" value={line} onUpdate={setLine} min={0} style={{width: '56px'}} />
21+
<Button size="s" onClick={() => onClick(line)}>
22+
Move to line
23+
</Button>
24+
</Flex>
25+
);
26+
};

demo/components/Playground.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const wCommandMenuConfig = wysiwygToolbarConfigs.wCommandMenuConfig.concat(
5656
);
5757

5858
export type PlaygroundProps = {
59+
mobile?: boolean;
5960
initial?: MarkupString;
6061
allowHTML?: boolean;
6162
settingsVisible?: boolean | SettingItems[];
@@ -85,6 +86,7 @@ export type PlaygroundProps = {
8586
disableMarkdownItAttrs?: boolean;
8687
markupParseHtmlOnPaste?: boolean;
8788
style?: React.CSSProperties;
89+
storyAdditionalControls?: Record<string, any>;
8890
} & Pick<UseMarkdownEditorProps, 'experimental' | 'wysiwygConfig'> &
8991
Pick<
9092
MarkdownEditorViewProps,
@@ -107,6 +109,7 @@ logger.setLogger({
107109

108110
export const Playground = memo<PlaygroundProps>((props) => {
109111
const {
112+
mobile,
110113
initial,
111114
initialEditor,
112115
initialSplitModeEnabled,
@@ -139,6 +142,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
139142
disableMarkdownItAttrs,
140143
markupParseHtmlOnPaste,
141144
style,
145+
storyAdditionalControls,
142146
} = props;
143147
const [editorMode, setEditorMode] = useState<MarkdownEditorMode>(initialEditor ?? 'wysiwyg');
144148
const [mdRaw, setMdRaw] = useState<MarkupString>(initial || '');
@@ -174,6 +178,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
174178
const mdEditor = useMarkdownEditor(
175179
{
176180
logger,
181+
mobile,
177182
preset: 'full',
178183
wysiwygConfig: {
179184
placeholderOptions: placeholderOptions,
@@ -197,11 +202,20 @@ export const Playground = memo<PlaygroundProps>((props) => {
197202
/* webpackChunkName: "mermaid-runtime" */ '@diplodoc/mermaid-extension/runtime'
198203
);
199204
},
205+
autoSave: {
206+
enabled: storyAdditionalControls?.mermaidAutoSaveEnabled ?? true,
207+
delay: storyAdditionalControls?.mermaidAutoSaveDelay ?? 1000,
208+
},
200209
})
201210
.use(FoldingHeading)
202211
.use(YfmHtmlBlock, {
203212
useConfig: useYfmHtmlBlockStyles,
204213
sanitize: getSanitizeYfmHtmlBlock({options: defaultOptions}),
214+
autoSave: {
215+
enabled:
216+
storyAdditionalControls?.yfmHtmlBlockAutoSaveEnabled ?? true,
217+
delay: storyAdditionalControls?.yfmHtmlBlockAutoSaveDelay ?? 1000,
218+
},
205219
head: `
206220
<base target="_blank" />
207221
<style>
@@ -261,6 +275,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
261275
},
262276
},
263277
[
278+
mobile,
264279
allowHTML,
265280
linkify,
266281
linkifyTlds,

demo/components/PlaygroundMini.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Playground, type PlaygroundProps} from './Playground';
66

77
export type PlaygroundMiniProps = Pick<
88
PlaygroundProps,
9+
| 'mobile'
910
| 'initialEditor'
1011
| 'settingsVisible'
1112
| 'breaks'
@@ -27,6 +28,7 @@ export type PlaygroundMiniProps = Pick<
2728
| 'directiveSyntax'
2829
| 'disabledHTMLBlockModes'
2930
| 'disableMarkdownItAttrs'
31+
| 'storyAdditionalControls'
3032
> & {withDefaultInitialContent?: boolean};
3133

3234
export const PlaygroundMini = memo<PlaygroundMiniProps>(

demo/defaults/args.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {PlaygroundMiniProps} from '../components/PlaygroundMini';
55
export const args: Meta<PlaygroundMiniProps>['args'] = {
66
initialEditor: 'wysiwyg',
77
settingsVisible: true,
8+
mobile: false,
89
allowHTML: true,
910
breaks: true,
1011
linkify: true,
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import {memo} from 'react';
2+
3+
import {MarkdownEditorView, useMarkdownEditor} from 'src/index';
4+
5+
import {MoveToLine} from '../../../components/MoveToLine';
6+
import {PlaygroundLayout} from '../../../components/PlaygroundLayout';
7+
import {markup} from '../../../defaults/content';
8+
9+
import {lineNumbersPlugin} from './md-plugin';
10+
11+
export type EditorWithLineNumbersProps = {};
12+
13+
export const EditorWithLineNumbers = memo<EditorWithLineNumbersProps>(
14+
function EditorWithLineNumbers() {
15+
const editor = useMarkdownEditor(
16+
{
17+
initial: {
18+
mode: 'wysiwyg',
19+
markup,
20+
},
21+
wysiwygConfig: {
22+
extensions: (builder) =>
23+
builder.configureMd((md) => md.use(lineNumbersPlugin), {text: false}),
24+
},
25+
},
26+
[],
27+
);
28+
29+
return (
30+
<PlaygroundLayout
31+
title="Line numbers example"
32+
editor={editor}
33+
actions={({className}) => (
34+
<MoveToLine
35+
className={className}
36+
onClick={(line) => {
37+
if (typeof line !== 'number' || Number.isNaN(line)) return;
38+
editor.moveCursor({line});
39+
editor.focus();
40+
}}
41+
/>
42+
)}
43+
view={({className}) => (
44+
<MarkdownEditorView
45+
autofocus
46+
stickyToolbar
47+
settingsVisible
48+
editor={editor}
49+
className={className}
50+
/>
51+
)}
52+
/>
53+
);
54+
},
55+
);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type {StoryObj} from '@storybook/react';
2+
3+
import {EditorWithLineNumbers as component} from './Editor';
4+
5+
export const Story: StoryObj<typeof component> = {
6+
args: {},
7+
};
8+
Story.storyName = 'Line Numbers';
9+
10+
export default {
11+
title: 'Examples / Line Numbers',
12+
component,
13+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type {PluginSimple} from 'markdown-it';
2+
import type {RuleCore} from 'markdown-it/lib/parser_core';
3+
4+
const RULE_NAME = 'line_numbers';
5+
6+
const TOKENS: readonly string[] = [
7+
'paragraph_open',
8+
'heading_open',
9+
'code_block',
10+
'fence',
11+
'list_item_open',
12+
'tr_open',
13+
'dt_open',
14+
'checkbox_open',
15+
'yfm_note_open',
16+
'yfm_cut_open',
17+
];
18+
19+
export const lineNumbersPlugin: PluginSimple = (md) => {
20+
const rule: RuleCore = ({tokens}) => {
21+
for (let i = 0; i < tokens.length; i++) {
22+
const token = tokens[i];
23+
24+
if (token.map && TOKENS.includes(token.type)) {
25+
const line = token.map[0];
26+
token.attrPush(['data-line', String(line)]);
27+
}
28+
}
29+
};
30+
31+
md.core.ruler.push(RULE_NAME, rule);
32+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type {StoryObj} from '@storybook/react';
2+
3+
import {YfmTableDnDDemo as component} from './YfmTableDnD';
4+
5+
export const Story: StoryObj<typeof component> = {
6+
args: {
7+
mobile: false,
8+
dnd: true,
9+
},
10+
};
11+
Story.storyName = "YFM Table D'n'D";
12+
13+
export default {
14+
title: "Examples / YFM Table D'n'D",
15+
component,
16+
};

0 commit comments

Comments
 (0)