@cloud-ru/ds-markdown 1.0.20-preview-9414fc09.0 → 1.0.20

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.0.20 (2026-09-11)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **FF-8978:** markdown link editor should edit text, fix italic texts ([4d3e80e](https://github.com/cloud-ru-tech/snack-v2/commit/4d3e80e8d2dcafed0531a49c04eb644c0b6139f3))
11
+
6
12
  ## 1.0.19 (2026-09-10)
7
13
 
8
14
  **Note:** Version bump only for package @ds/markdown
@@ -61,6 +61,10 @@
61
61
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
62
62
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
63
63
  }
64
+ .root em,
65
+ .root i{
66
+ font-synthesis-style:auto;
67
+ }
64
68
  .root ul,
65
69
  .root ol{
66
70
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -176,6 +176,10 @@
176
176
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
177
177
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
178
178
  }
179
+ .content :global(.ProseMirror) em,
180
+ .content :global(.ProseMirror) i{
181
+ font-synthesis-style:auto;
182
+ }
179
183
  .content :global(.ProseMirror) ul,
180
184
  .content :global(.ProseMirror) ol{
181
185
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -61,6 +61,10 @@
61
61
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
62
62
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
63
63
  }
64
+ .root em,
65
+ .root i{
66
+ font-synthesis-style:auto;
67
+ }
64
68
  .root ul,
65
69
  .root ol{
66
70
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -381,6 +385,10 @@
381
385
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
382
386
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
383
387
  }
388
+ .content :global(.ProseMirror) em,
389
+ .content :global(.ProseMirror) i{
390
+ font-synthesis-style:auto;
391
+ }
384
392
  .content :global(.ProseMirror) ul,
385
393
  .content :global(.ProseMirror) ol{
386
394
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createWysiwygApi = createWysiwygApi;
4
4
  exports.createRawApi = createRawApi;
5
+ const state_1 = require("@tiptap/pm/state");
5
6
  const constants_1 = require("./constants");
6
7
  const rawMarkdownCommands_1 = require("./rawMarkdownCommands");
7
8
  const WYSIWYG_MARK = {
@@ -47,14 +48,21 @@ function createWysiwygApi(editor) {
47
48
  editor.chain().focus().extendMarkRange('link').unsetLink().run();
48
49
  return;
49
50
  }
50
- const chain = editor.chain().focus().extendMarkRange('link');
51
- // Нет выделения, но задан текст — вставляем текст-ссылку. Иначе оборачиваем выделение.
52
- if (editor.state.selection.empty && title) {
53
- chain.insertContent({ type: 'text', text: title, marks: [{ type: 'link', attrs: { href } }] }).run();
54
- }
55
- else {
56
- chain.setLink({ href }).run();
57
- }
51
+ editor
52
+ .chain()
53
+ .focus()
54
+ .extendMarkRange('link')
55
+ // Текст из модалки отличается от текущего — заменяем его, иначе не трогаем (сохраняем вложенные марки).
56
+ .command(({ tr }) => {
57
+ const { from, to } = tr.selection;
58
+ if (title && title !== tr.doc.textBetween(from, to)) {
59
+ tr.insertText(title, from, to);
60
+ tr.setSelection(state_1.TextSelection.create(tr.doc, from, from + title.length));
61
+ }
62
+ return true;
63
+ })
64
+ .setLink({ href })
65
+ .run();
58
66
  },
59
67
  insertImage: (src, alt) => editor.chain().focus().setImage({ src, alt }).run(),
60
68
  insertTable: (rows, cols) => editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run(),
@@ -61,6 +61,10 @@
61
61
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
62
62
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
63
63
  }
64
+ .root em,
65
+ .root i{
66
+ font-synthesis-style:auto;
67
+ }
64
68
  .root ul,
65
69
  .root ol{
66
70
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -176,6 +176,10 @@
176
176
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
177
177
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
178
178
  }
179
+ .content :global(.ProseMirror) em,
180
+ .content :global(.ProseMirror) i{
181
+ font-synthesis-style:auto;
182
+ }
179
183
  .content :global(.ProseMirror) ul,
180
184
  .content :global(.ProseMirror) ol{
181
185
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -61,6 +61,10 @@
61
61
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
62
62
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
63
63
  }
64
+ .root em,
65
+ .root i{
66
+ font-synthesis-style:auto;
67
+ }
64
68
  .root ul,
65
69
  .root ol{
66
70
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -381,6 +385,10 @@
381
385
  letter-spacing:var(--sn-regular-title-m-letterSpacing, var(--sn-primitive-font-letterSpacing-l, 0.15px));
382
386
  paragraph-spacing:var(--sn-regular-title-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize16, 8px));
383
387
  }
388
+ .content :global(.ProseMirror) em,
389
+ .content :global(.ProseMirror) i{
390
+ font-synthesis-style:auto;
391
+ }
384
392
  .content :global(.ProseMirror) ul,
385
393
  .content :global(.ProseMirror) ol{
386
394
  padding-left:var(--sn-primitive-dimension-24, 24px);
@@ -1,3 +1,4 @@
1
+ import { TextSelection } from '@tiptap/pm/state';
1
2
  import { TOOLBAR_ITEM } from './constants.js';
2
3
  import { applyBlockToggle, applyHeading, applyImage, applyInlineToggle, applyLink, applyParagraph, applyTable, } from './rawMarkdownCommands.js';
3
4
  const WYSIWYG_MARK = {
@@ -43,14 +44,21 @@ export function createWysiwygApi(editor) {
43
44
  editor.chain().focus().extendMarkRange('link').unsetLink().run();
44
45
  return;
45
46
  }
46
- const chain = editor.chain().focus().extendMarkRange('link');
47
- // Нет выделения, но задан текст — вставляем текст-ссылку. Иначе оборачиваем выделение.
48
- if (editor.state.selection.empty && title) {
49
- chain.insertContent({ type: 'text', text: title, marks: [{ type: 'link', attrs: { href } }] }).run();
50
- }
51
- else {
52
- chain.setLink({ href }).run();
53
- }
47
+ editor
48
+ .chain()
49
+ .focus()
50
+ .extendMarkRange('link')
51
+ // Текст из модалки отличается от текущего — заменяем его, иначе не трогаем (сохраняем вложенные марки).
52
+ .command(({ tr }) => {
53
+ const { from, to } = tr.selection;
54
+ if (title && title !== tr.doc.textBetween(from, to)) {
55
+ tr.insertText(title, from, to);
56
+ tr.setSelection(TextSelection.create(tr.doc, from, from + title.length));
57
+ }
58
+ return true;
59
+ })
60
+ .setLink({ href })
61
+ .run();
54
62
  },
55
63
  insertImage: (src, alt) => editor.chain().focus().setImage({ src, alt }).run(),
56
64
  insertTable: (rows, cols) => editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run(),