@etrepum/lexical-builder-markdown 0.0.36-nightly.20250714.0 → 0.0.37-nightly.20250715.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.
- package/dist/{MarkdownShortcutsPlan.d.ts → MarkdownShortcutsExtension.d.ts} +2 -2
- package/dist/MarkdownShortcutsExtension.d.ts.map +1 -0
- package/dist/{MarkdownTransformersPlan.d.ts → MarkdownTransformersExtension.d.ts} +2 -2
- package/dist/MarkdownTransformersExtension.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -28
- package/package.json +8 -8
- package/dist/MarkdownShortcutsPlan.d.ts.map +0 -1
- package/dist/MarkdownTransformersPlan.d.ts.map +0 -1
@@ -6,5 +6,5 @@ export interface MarkdownShortcutsConfig {
|
|
6
6
|
disabled: boolean;
|
7
7
|
}
|
8
8
|
export type MarkdownShortcutsOutput = DisabledToggleOutput;
|
9
|
-
export declare const
|
10
|
-
//# sourceMappingURL=
|
9
|
+
export declare const MarkdownShortcutsExtension: import('@etrepum/lexical-builder').LexicalExtension<MarkdownShortcutsConfig, "@etrepum/lexical-builder-markdown/MarkdownShortcuts", DisabledToggleOutput, unknown>;
|
10
|
+
//# sourceMappingURL=MarkdownShortcutsExtension.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MarkdownShortcutsExtension.d.ts","sourceRoot":"","sources":["../src/MarkdownShortcutsExtension.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAEL,KAAK,aAAa,EAUnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAGL,KAAK,oBAAoB,EAG1B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA0SlD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,kBAAkB,GACzB,MAAM,IAAI,CAkGZ;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB;AACD,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAE3D,eAAO,MAAM,0BAA0B,oKAmBrC,CAAC"}
|
@@ -10,5 +10,5 @@ export interface MarkdownTransformersOutput {
|
|
10
10
|
readonly $markdownImport: ReturnType<typeof createMarkdownImport>;
|
11
11
|
readonly $markdownExport: ReturnType<typeof createMarkdownExport>;
|
12
12
|
}
|
13
|
-
export declare const
|
14
|
-
//# sourceMappingURL=
|
13
|
+
export declare const MarkdownTransformersExtension: import('@etrepum/lexical-builder').LexicalExtension<MarkdownTransformersConfig, "@etrepum/lexical-builder-markdown/MarkdownTransformers", MarkdownTransformersOutput, MarkdownTransformersOutput>;
|
14
|
+
//# sourceMappingURL=MarkdownTransformersExtension.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MarkdownTransformersExtension.d.ts","sourceRoot":"","sources":["../src/MarkdownTransformersExtension.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,GAAG;KACnE,CAAC,IAAI,MAAM,kBAAkB,IAAI,GAAG,CAAC,cAAc,GAAG,kBAAkB,CAAC,CAAC,CAAC;CAC7E,CAAC;AAeF,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;IACxD,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;IAClE,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,6BAA6B,mMA2DxC,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
*
|
7
7
|
*/
|
8
8
|
export { type MarkdownTransformerOptions, type TransformersByType, type Filter, type KebabToCamel, } from './types';
|
9
|
-
export { type MarkdownTransformersConfig, type MarkdownTransformersOutput,
|
10
|
-
export { type MarkdownShortcutsConfig, type MarkdownShortcutsOutput,
|
9
|
+
export { type MarkdownTransformersConfig, type MarkdownTransformersOutput, MarkdownTransformersExtension, } from './MarkdownTransformersExtension';
|
10
|
+
export { type MarkdownShortcutsConfig, type MarkdownShortcutsOutput, MarkdownShortcutsExtension, } from './MarkdownShortcutsExtension';
|
11
11
|
export declare const PACKAGE_VERSION: string;
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,MAAM,EACX,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,MAAM,EACX,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,eAAO,MAAM,eAAe,EAAE,MAAwC,CAAC"}
|
package/dist/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { defineExtension as G, RichTextExtension as se, declarePeerDependency as ie, safeCast as H, getKnownTypesAndNodes as ce, provideOutput as q, disabledToggle as le } from "@etrepum/lexical-builder";
|
2
2
|
import { ELEMENT_TRANSFORMERS as ae, TEXT_FORMAT_TRANSFORMERS as fe, TEXT_MATCH_TRANSFORMERS as ue, MULTILINE_ELEMENT_TRANSFORMERS as ge, UNORDERED_LIST as de, CHECK_LIST as pe } from "@lexical/markdown";
|
3
|
-
import { $getSelection as S, $setSelection as Q, $isParagraphNode as V, $isTextNode as x, $createParagraphNode as Y, $isElementNode as N, $createTextNode as J, $createLineBreakNode as me, $isRootOrShadowRoot as Z, $getRoot as he, $isDecoratorNode as ee, $isLineBreakNode as te, $isRangeSelection as
|
3
|
+
import { $getSelection as S, $setSelection as Q, $isParagraphNode as V, $isTextNode as x, $createParagraphNode as Y, $isElementNode as N, $createTextNode as J, $createLineBreakNode as me, $isRootOrShadowRoot as Z, $getRoot as he, $isDecoratorNode as ee, $isLineBreakNode as te, $isRangeSelection as k, $createRangeSelection as xe } from "lexical";
|
4
4
|
import { $createCodeNode as Te, $isCodeNode as Ee } from "@lexical/code";
|
5
5
|
import { $isListNode as O, $isListItemNode as Se } from "@lexical/list";
|
6
6
|
import { $isQuoteNode as Ne } from "@lexical/rich-text";
|
@@ -14,7 +14,7 @@ function D(e, t) {
|
|
14
14
|
return o;
|
15
15
|
}
|
16
16
|
const $ = /[!-/:-@[-`{-~\s]/, $e = /^\s{0,3}$/;
|
17
|
-
function
|
17
|
+
function F(e) {
|
18
18
|
if (!V(e))
|
19
19
|
return !1;
|
20
20
|
const t = e.getFirstChild();
|
@@ -34,7 +34,7 @@ function T(e, t, ...o) {
|
|
34
34
|
}
|
35
35
|
const K = /^[ \t]*```(\w{1,10})?\s?$/;
|
36
36
|
function Re(e, t) {
|
37
|
-
const o =
|
37
|
+
const o = Fe(
|
38
38
|
e.textFormat
|
39
39
|
);
|
40
40
|
return function(c, { shouldPreserveNewlines: n } = t) {
|
@@ -60,7 +60,7 @@ function Re(e, t) {
|
|
60
60
|
N(f),
|
61
61
|
"markdownImport: Expected child of type %s to be an ElementNode",
|
62
62
|
f.getType()
|
63
|
-
), (n || !
|
63
|
+
), (n || !F(f)) && l.push(f);
|
64
64
|
return a.clear(), l;
|
65
65
|
};
|
66
66
|
}
|
@@ -110,7 +110,7 @@ function _e(e, t, o) {
|
|
110
110
|
return [null, t];
|
111
111
|
}
|
112
112
|
function C(e, t, o) {
|
113
|
-
const r = e.getTextContent(), c =
|
113
|
+
const r = e.getTextContent(), c = ke(r, t);
|
114
114
|
if (!c) {
|
115
115
|
ne(e, o);
|
116
116
|
return;
|
@@ -181,7 +181,7 @@ function ne(e, t) {
|
|
181
181
|
break;
|
182
182
|
}
|
183
183
|
}
|
184
|
-
function
|
184
|
+
function ke(e, t) {
|
185
185
|
const o = e.match(t.openTagsRegExp);
|
186
186
|
if (o == null)
|
187
187
|
return null;
|
@@ -200,7 +200,7 @@ function Pe(e, t) {
|
|
200
200
|
}
|
201
201
|
return null;
|
202
202
|
}
|
203
|
-
function
|
203
|
+
function Fe(e) {
|
204
204
|
const t = {}, o = {}, r = [], c = "(?<![\\\\])";
|
205
205
|
for (const n of e) {
|
206
206
|
const { tag: i } = n;
|
@@ -223,14 +223,14 @@ function ke(e) {
|
|
223
223
|
transformersByTag: t
|
224
224
|
};
|
225
225
|
}
|
226
|
-
function
|
226
|
+
function ve(e, { shouldPreserveNewlines: t }) {
|
227
227
|
const o = !t, r = e.textFormat.filter(
|
228
228
|
(c) => c.format.length === 1
|
229
229
|
);
|
230
230
|
return function(n = he()) {
|
231
231
|
const i = [], s = Z(n) ? n.getChildren() : [n];
|
232
232
|
for (let a = 0; a < s.length; a++) {
|
233
|
-
const l = s[a], f =
|
233
|
+
const l = s[a], f = Ie(
|
234
234
|
l,
|
235
235
|
e.element,
|
236
236
|
r,
|
@@ -238,7 +238,7 @@ function Fe(e, { shouldPreserveNewlines: t }) {
|
|
238
238
|
);
|
239
239
|
f != null && i.push(
|
240
240
|
// separate consecutive group of texts with a line break: eg. ["hello", "world"] -> ["hello", "\nworld"]
|
241
|
-
o && a > 0 && !
|
241
|
+
o && a > 0 && !F(l) && !F(s[a - 1]) ? `
|
242
242
|
`.concat(f) : f
|
243
243
|
);
|
244
244
|
}
|
@@ -246,7 +246,7 @@ function Fe(e, { shouldPreserveNewlines: t }) {
|
|
246
246
|
`);
|
247
247
|
};
|
248
248
|
}
|
249
|
-
function
|
249
|
+
function Ie(e, t, o, r) {
|
250
250
|
for (const c of t) {
|
251
251
|
const n = c.export(
|
252
252
|
e,
|
@@ -372,7 +372,7 @@ const U = "@etrepum/lexical-builder-list/CheckList", W = G({
|
|
372
372
|
textFormat: t.textFormatTransformers
|
373
373
|
}, s = we(
|
374
374
|
Re(i, c)
|
375
|
-
), a =
|
375
|
+
), a = ve(
|
376
376
|
i,
|
377
377
|
c
|
378
378
|
);
|
@@ -385,7 +385,7 @@ const U = "@etrepum/lexical-builder-list/CheckList", W = G({
|
|
385
385
|
},
|
386
386
|
register: (e, t, o) => q(o.getInitResult())
|
387
387
|
});
|
388
|
-
function
|
388
|
+
function be(e, t, o, r) {
|
389
389
|
const c = e.getParent();
|
390
390
|
if (!Z(c) || e.getFirstChild() !== t)
|
391
391
|
return !1;
|
@@ -403,7 +403,7 @@ function Ie(e, t, o, r) {
|
|
403
403
|
}
|
404
404
|
return !1;
|
405
405
|
}
|
406
|
-
function
|
406
|
+
function Pe(e, t, o) {
|
407
407
|
var i;
|
408
408
|
let r = e.getTextContent();
|
409
409
|
const c = r[t - 1], n = o[c];
|
@@ -457,14 +457,14 @@ function Le(e, t, o) {
|
|
457
457
|
const R = g.getTextContent();
|
458
458
|
if (p > 0 && R[p - 1] === n)
|
459
459
|
continue;
|
460
|
-
const
|
461
|
-
if (s.intraword === !1 &&
|
460
|
+
const v = R[p - 1];
|
461
|
+
if (s.intraword === !1 && v && !$.test(v))
|
462
462
|
continue;
|
463
|
-
const
|
464
|
-
d.setTextContent(
|
465
|
-
const
|
463
|
+
const I = d.getTextContent(), b = I.slice(0, f) + I.slice(c + 1);
|
464
|
+
d.setTextContent(b);
|
465
|
+
const P = g === d ? b : R;
|
466
466
|
g.setTextContent(
|
467
|
-
|
467
|
+
P.slice(0, p) + P.slice(p + l)
|
468
468
|
);
|
469
469
|
const L = S(), m = xe();
|
470
470
|
Q(m);
|
@@ -479,7 +479,7 @@ function Le(e, t, o) {
|
|
479
479
|
);
|
480
480
|
for (const h of s.format)
|
481
481
|
m.hasFormat(h) && m.toggleFormat(h);
|
482
|
-
return
|
482
|
+
return k(L) && (m.format = L.format), !0;
|
483
483
|
}
|
484
484
|
return !1;
|
485
485
|
}
|
@@ -509,12 +509,12 @@ function Oe(e, t) {
|
|
509
509
|
),
|
510
510
|
({ trigger: n }) => n
|
511
511
|
), c = (n, i, s) => {
|
512
|
-
|
512
|
+
be(
|
513
513
|
n,
|
514
514
|
i,
|
515
515
|
s,
|
516
516
|
t.element
|
517
|
-
) ||
|
517
|
+
) || Pe(
|
518
518
|
i,
|
519
519
|
s,
|
520
520
|
r
|
@@ -529,7 +529,7 @@ function Oe(e, t) {
|
|
529
529
|
if (n.has("collaboration") || n.has("historic") || e.isComposing())
|
530
530
|
return;
|
531
531
|
const l = s.read(S), f = a.read(S);
|
532
|
-
if (!
|
532
|
+
if (!k(f) || !k(l) || !l.isCollapsed())
|
533
533
|
return;
|
534
534
|
const u = l.anchor.key, d = l.anchor.offset, g = s._nodeMap.get(u);
|
535
535
|
!x(g) || !i.has(u) || d !== 1 && d > f.anchor.offset + 1 || e.update(() => {
|
@@ -558,9 +558,9 @@ const Ue = G({
|
|
558
558
|
})
|
559
559
|
);
|
560
560
|
}
|
561
|
-
}), We = "0.0.
|
561
|
+
}), We = "0.0.37-nightly.20250715.0";
|
562
562
|
export {
|
563
|
-
Ue as
|
564
|
-
W as
|
563
|
+
Ue as MarkdownShortcutsExtension,
|
564
|
+
W as MarkdownTransformersExtension,
|
565
565
|
We as PACKAGE_VERSION
|
566
566
|
};
|
package/package.json
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
"lexical",
|
7
7
|
"lexical-builder",
|
8
8
|
"plug-in",
|
9
|
-
"
|
9
|
+
"extension",
|
10
10
|
"markdown"
|
11
11
|
],
|
12
12
|
"scripts": {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"test": "vitest run",
|
17
17
|
"test:watch": "vitest"
|
18
18
|
},
|
19
|
-
"version": "0.0.
|
19
|
+
"version": "0.0.37-nightly.20250715.0",
|
20
20
|
"license": "MIT",
|
21
21
|
"repository": {
|
22
22
|
"type": "git",
|
@@ -32,12 +32,12 @@
|
|
32
32
|
"@etrepum/lexical-builder-list": "*"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
|
-
"@lexical/code": ">=0.
|
36
|
-
"@lexical/list": ">=0.
|
37
|
-
"@lexical/markdown": ">=0.
|
38
|
-
"@lexical/rich-text": ">=0.
|
39
|
-
"@lexical/utils": ">=0.
|
40
|
-
"lexical": ">=0.
|
35
|
+
"@lexical/code": ">=0.33.1 || >=0.33.2-nightly.0",
|
36
|
+
"@lexical/list": ">=0.33.1 || >=0.33.2-nightly.0",
|
37
|
+
"@lexical/markdown": ">=0.33.1 || >=0.33.2-nightly.0",
|
38
|
+
"@lexical/rich-text": ">=0.33.1 || >=0.33.2-nightly.0",
|
39
|
+
"@lexical/utils": ">=0.33.1 || >=0.33.2-nightly.0",
|
40
|
+
"lexical": ">=0.33.1 || >=0.33.2-nightly.0"
|
41
41
|
},
|
42
42
|
"sideEffects": false,
|
43
43
|
"devDependencies": {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MarkdownShortcutsPlan.d.ts","sourceRoot":"","sources":["../src/MarkdownShortcutsPlan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG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