@sveltia/ui 0.32.0 → 0.32.1
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.
|
@@ -54,11 +54,7 @@ import {
|
|
|
54
54
|
} from 'lexical';
|
|
55
55
|
import prismComponents from 'prismjs/components';
|
|
56
56
|
import { BLOCK_BUTTON_TYPES, TEXT_FORMAT_BUTTON_TYPES } from './constants.js';
|
|
57
|
-
import {
|
|
58
|
-
fixMarkdownFormatting,
|
|
59
|
-
increaseListIndentation,
|
|
60
|
-
splitMultilineFormatting,
|
|
61
|
-
} from './markdown.js';
|
|
57
|
+
import { increaseListIndentation, splitMultilineFormatting } from './markdown.js';
|
|
62
58
|
import { HR } from './transformers/hr.js';
|
|
63
59
|
import { TABLE } from './transformers/table.js';
|
|
64
60
|
|
|
@@ -420,9 +416,6 @@ export const convertMarkdownToLexical = async (editor, value) => {
|
|
|
420
416
|
// Split multiline formatting into separate lines to prevent Markdown parsing issues
|
|
421
417
|
value = splitMultilineFormatting(value);
|
|
422
418
|
|
|
423
|
-
// Fix unclosed formatting markers (work around Lexical bug)
|
|
424
|
-
value = fixMarkdownFormatting(value);
|
|
425
|
-
|
|
426
419
|
// Increase list indentation levels to prevent Markdown parsing issues
|
|
427
420
|
value = increaseListIndentation(value);
|
|
428
421
|
|
|
@@ -11,20 +11,6 @@ export const splitMultilineFormatting = (value) =>
|
|
|
11
11
|
.replace(/(\s+)~~([^~\n]+?)\n([^~\n]+?)~~(\s+)/gm, '$1~~$2~~\n~~$3~~$4')
|
|
12
12
|
.replace(/(\s+)`([^`\n]+?)\n([^`\n]+?)`(\s+)/gm, '$1`$2`\n`$3`$4');
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Fix malformed Markdown formatting markers.
|
|
16
|
-
* Converts unclosed formatting markers like `**foo **bar` to `**foo** bar`.
|
|
17
|
-
* This works around a Lexical bug with certain formatting patterns.
|
|
18
|
-
* @param {string} value Markdown string to fix.
|
|
19
|
-
* @returns {string} Fixed Markdown string.
|
|
20
|
-
* @see https://github.com/sveltia/sveltia-cms/issues/599
|
|
21
|
-
*/
|
|
22
|
-
export const fixMarkdownFormatting = (value) =>
|
|
23
|
-
value
|
|
24
|
-
.replace(/\*\*(\S+?) \*\*/gm, '**$1** ')
|
|
25
|
-
.replace(/_(\S+?) _/gm, '_$1_ ')
|
|
26
|
-
.replace(/~~(\S+?) ~~/gm, '~~$1~~ ');
|
|
27
|
-
|
|
28
14
|
/**
|
|
29
15
|
* Increase list indentation levels to prevent Markdown parsing issues.
|
|
30
16
|
* Slate uses 2 spaces per indentation level, whereas Lexical uses 4 spaces.
|