@etrepum/lexical-builder-markdown 0.0.28-nightly.20240705.0 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +174 -174
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -5,39 +5,39 @@ import { $createCodeNode as xe, $isCodeNode as Te } from "@lexical/code";
|
|
5
5
|
import { $isListNode as L, $isListItemNode as Se } from "@lexical/list";
|
6
6
|
import { $isQuoteNode as Ce } from "@lexical/rich-text";
|
7
7
|
import { $findMatchingParent as Ne, IS_SAFARI as O, IS_IOS as A, IS_APPLE_WEBKIT as B } from "@lexical/utils";
|
8
|
-
function y(e,
|
9
|
-
const
|
8
|
+
function y(e, n) {
|
9
|
+
const o = {};
|
10
10
|
for (const r of e) {
|
11
|
-
const i =
|
12
|
-
|
11
|
+
const i = n(r), t = o[i];
|
12
|
+
t ? t.push(r) : o[i] = [r];
|
13
13
|
}
|
14
|
-
return
|
14
|
+
return o;
|
15
15
|
}
|
16
16
|
const $ = /[!-/:-@[-`{-~\s]/, Ee = /^\s{0,3}$/;
|
17
17
|
function _(e) {
|
18
18
|
if (!V(e))
|
19
19
|
return !1;
|
20
|
-
const
|
21
|
-
return
|
20
|
+
const n = e.getFirstChild();
|
21
|
+
return n == null || e.getChildrenSize() === 1 && x(n) && Ee.test(n.getTextContent());
|
22
22
|
}
|
23
23
|
function $e(e) {
|
24
|
-
return function(...
|
25
|
-
const r = C(), i = r ? r.clone() : null,
|
26
|
-
return c !== s && Q(s),
|
24
|
+
return function(...o) {
|
25
|
+
const r = C(), i = r ? r.clone() : null, t = e(...o), c = C(), s = i && i.is(r) && !Object.isFrozen(r) ? r : i;
|
26
|
+
return c !== s && Q(s), t;
|
27
27
|
};
|
28
28
|
}
|
29
|
-
function T(e,
|
29
|
+
function T(e, n, ...o) {
|
30
30
|
if (!e)
|
31
31
|
throw new Error(
|
32
|
-
|
32
|
+
o.reduce((r, i) => r.replace("%s", String(i)), n || "")
|
33
33
|
);
|
34
34
|
}
|
35
35
|
const D = /^[ \t]*```(\w{1,10})?\s?$/;
|
36
|
-
function we(e,
|
37
|
-
const
|
36
|
+
function we(e, n) {
|
37
|
+
const o = _e(
|
38
38
|
e.textFormat
|
39
39
|
);
|
40
|
-
return function(i, { shouldPreserveNewlines:
|
40
|
+
return function(i, { shouldPreserveNewlines: t } = n) {
|
41
41
|
const c = i.split(`
|
42
42
|
`), s = c.length, l = Y();
|
43
43
|
for (let f = 0; f < s; f++) {
|
@@ -50,7 +50,7 @@ function we(e, t) {
|
|
50
50
|
m,
|
51
51
|
l,
|
52
52
|
e.element,
|
53
|
-
|
53
|
+
o,
|
54
54
|
e.textMatch
|
55
55
|
);
|
56
56
|
}
|
@@ -60,14 +60,14 @@ function we(e, t) {
|
|
60
60
|
N(f),
|
61
61
|
"markdownImport: Expected child of type %s to be an ElementNode",
|
62
62
|
f.getType()
|
63
|
-
), (
|
63
|
+
), (t || !_(f)) && a.push(f);
|
64
64
|
return l.clear(), a;
|
65
65
|
};
|
66
66
|
}
|
67
|
-
function Re(e,
|
68
|
-
const
|
69
|
-
s.append(c),
|
70
|
-
for (const { regExp: l, replace: a } of
|
67
|
+
function Re(e, n, o, r, i) {
|
68
|
+
const t = e.trim(), c = J(t), s = Y();
|
69
|
+
s.append(c), n.append(s);
|
70
|
+
for (const { regExp: l, replace: a } of o) {
|
71
71
|
const f = e.match(l);
|
72
72
|
if (f) {
|
73
73
|
c.setTextContent(e.slice(f[0].length)), a(s, [c], f, !0);
|
@@ -78,7 +78,7 @@ function Re(e, t, n, r, i) {
|
|
78
78
|
c,
|
79
79
|
r,
|
80
80
|
i
|
81
|
-
), s.isAttached() &&
|
81
|
+
), s.isAttached() && t.length > 0) {
|
82
82
|
const l = s.getPreviousSibling();
|
83
83
|
if (V(l) || Ce(l) || L(l)) {
|
84
84
|
let a = l;
|
@@ -93,85 +93,85 @@ function Re(e, t, n, r, i) {
|
|
93
93
|
}
|
94
94
|
}
|
95
95
|
}
|
96
|
-
function Me(e,
|
97
|
-
const r = D.exec(e[
|
96
|
+
function Me(e, n, o) {
|
97
|
+
const r = D.exec(e[n]);
|
98
98
|
if (r) {
|
99
|
-
let i =
|
100
|
-
const
|
101
|
-
for (; ++i <
|
99
|
+
let i = n;
|
100
|
+
const t = e.length;
|
101
|
+
for (; ++i < t; )
|
102
102
|
if (D.exec(e[i])) {
|
103
103
|
const s = xe(r[1]), l = J(
|
104
|
-
e.slice(
|
104
|
+
e.slice(n + 1, i).join(`
|
105
105
|
`)
|
106
106
|
);
|
107
|
-
return s.append(l),
|
107
|
+
return s.append(l), o.append(s), [s, i];
|
108
108
|
}
|
109
109
|
}
|
110
|
-
return [null,
|
110
|
+
return [null, n];
|
111
111
|
}
|
112
|
-
function E(e,
|
113
|
-
const r = e.getTextContent(), i = Pe(r,
|
112
|
+
function E(e, n, o) {
|
113
|
+
const r = e.getTextContent(), i = Pe(r, n);
|
114
114
|
if (!i) {
|
115
|
-
ne(e,
|
115
|
+
ne(e, o);
|
116
116
|
return;
|
117
117
|
}
|
118
118
|
T(
|
119
119
|
i[1] !== void 0 && i[2] !== void 0,
|
120
120
|
"importTextMatchTransformers: expecting match with two groups"
|
121
121
|
);
|
122
|
-
let
|
122
|
+
let t, c, s;
|
123
123
|
if (i[0] === r)
|
124
|
-
|
124
|
+
t = e;
|
125
125
|
else {
|
126
126
|
const a = i.index || 0, f = a + i[0].length;
|
127
|
-
a === 0 ? [
|
127
|
+
a === 0 ? [t, c] = e.splitText(f) : [s, t, c] = e.splitText(
|
128
128
|
a,
|
129
129
|
f
|
130
130
|
);
|
131
131
|
}
|
132
132
|
T(
|
133
|
-
|
133
|
+
t !== void 0,
|
134
134
|
"importTextMatchTransformers: currentNode must be defined"
|
135
|
-
),
|
136
|
-
const l =
|
135
|
+
), t.setTextContent(i[2]);
|
136
|
+
const l = n.transformersByTag[i[1]];
|
137
137
|
if (l)
|
138
138
|
for (const a of l.format)
|
139
|
-
|
140
|
-
|
141
|
-
o,
|
139
|
+
t.hasFormat(a) || t.toggleFormat(a);
|
140
|
+
t.hasFormat("code") || E(
|
142
141
|
t,
|
143
|
-
n
|
142
|
+
n,
|
143
|
+
o
|
144
144
|
), s && E(
|
145
145
|
s,
|
146
|
-
|
147
|
-
|
146
|
+
n,
|
147
|
+
o
|
148
148
|
), c && E(
|
149
149
|
c,
|
150
|
-
|
151
|
-
|
150
|
+
n,
|
151
|
+
o
|
152
152
|
);
|
153
153
|
}
|
154
|
-
function ne(e,
|
155
|
-
let
|
156
|
-
e: for (;
|
157
|
-
for (const r of
|
158
|
-
const i =
|
154
|
+
function ne(e, n) {
|
155
|
+
let o = e;
|
156
|
+
e: for (; o; ) {
|
157
|
+
for (const r of n) {
|
158
|
+
const i = o.getTextContent().match(r.importRegExp);
|
159
159
|
if (!i)
|
160
160
|
continue;
|
161
|
-
const
|
161
|
+
const t = i.index || 0, c = t + i[0].length;
|
162
162
|
let s, l;
|
163
|
-
if (
|
164
|
-
const a =
|
163
|
+
if (t === 0) {
|
164
|
+
const a = o.splitText(c);
|
165
165
|
T(
|
166
166
|
a[0] !== void 0,
|
167
167
|
"importTextMatchTransformers: splitText expected at least one node"
|
168
|
-
), [s,
|
168
|
+
), [s, o] = a;
|
169
169
|
} else {
|
170
|
-
const a =
|
170
|
+
const a = o.splitText(t, c);
|
171
171
|
T(
|
172
172
|
a[1] !== void 0,
|
173
173
|
"importTextMatchTransformers: splitText expected at least two nodes"
|
174
|
-
), [, s, l] = a, l && ne(l,
|
174
|
+
), [, s, l] = a, l && ne(l, n);
|
175
175
|
}
|
176
176
|
r.replace(s, i);
|
177
177
|
continue e;
|
@@ -179,15 +179,15 @@ function ne(e, t) {
|
|
179
179
|
break;
|
180
180
|
}
|
181
181
|
}
|
182
|
-
function Pe(e,
|
183
|
-
const
|
184
|
-
if (
|
182
|
+
function Pe(e, n) {
|
183
|
+
const o = e.match(n.openTagsRegExp);
|
184
|
+
if (o == null)
|
185
185
|
return null;
|
186
|
-
for (const r of
|
187
|
-
const i = r.replace(/^\s/, ""),
|
188
|
-
if (
|
186
|
+
for (const r of o) {
|
187
|
+
const i = r.replace(/^\s/, ""), t = n.fullMatchRegExpByTag[i];
|
188
|
+
if (t == null)
|
189
189
|
continue;
|
190
|
-
const c = e.match(
|
190
|
+
const c = e.match(t), s = n.transformersByTag[i];
|
191
191
|
if (c != null && s != null) {
|
192
192
|
if (s.intraword !== !1)
|
193
193
|
return c;
|
@@ -199,34 +199,34 @@ function Pe(e, t) {
|
|
199
199
|
return null;
|
200
200
|
}
|
201
201
|
function _e(e) {
|
202
|
-
const
|
203
|
-
for (const
|
204
|
-
const { tag: c } =
|
205
|
-
|
202
|
+
const n = {}, o = {}, r = [], i = "(?<![\\\\])";
|
203
|
+
for (const t of e) {
|
204
|
+
const { tag: c } = t;
|
205
|
+
n[c] = t;
|
206
206
|
const s = c.replace(/(\*|\^|\+)/g, "\\$1");
|
207
|
-
r.push(s), O || A || B ?
|
207
|
+
r.push(s), O || A || B ? o[c] = new RegExp(
|
208
208
|
`(${s})(?![${s}\\s])(.*?[^${s}\\s])${s}(?!${s})`
|
209
|
-
) :
|
209
|
+
) : o[c] = new RegExp(
|
210
210
|
`(?<![\\\\${s}])(${s})((\\\\${s})?.*?[^${s}\\s](\\\\${s})?)((?<!\\\\)|(?<=\\\\\\\\))(${s})(?![\\\\${s}])`
|
211
211
|
);
|
212
212
|
}
|
213
213
|
return {
|
214
214
|
// Reg exp to find open tag + content + close tag
|
215
|
-
fullMatchRegExpByTag:
|
215
|
+
fullMatchRegExpByTag: o,
|
216
216
|
// Reg exp to find opening tags
|
217
217
|
openTagsRegExp: new RegExp(
|
218
218
|
`${O || A || B ? "" : i}(${r.join("|")})`,
|
219
219
|
"g"
|
220
220
|
),
|
221
|
-
transformersByTag:
|
221
|
+
transformersByTag: n
|
222
222
|
};
|
223
223
|
}
|
224
|
-
function ke(e, { shouldPreserveNewlines:
|
225
|
-
const
|
224
|
+
function ke(e, { shouldPreserveNewlines: n }) {
|
225
|
+
const o = !n, r = e.textFormat.filter(
|
226
226
|
(i) => i.format.length === 1
|
227
227
|
);
|
228
|
-
return function(
|
229
|
-
const c = [], s = Z(
|
228
|
+
return function(t = me()) {
|
229
|
+
const c = [], s = Z(t) ? t.getChildren() : [t];
|
230
230
|
for (let l = 0; l < s.length; l++) {
|
231
231
|
const a = s[l], f = Fe(
|
232
232
|
a,
|
@@ -236,7 +236,7 @@ function ke(e, { shouldPreserveNewlines: t }) {
|
|
236
236
|
);
|
237
237
|
f != null && c.push(
|
238
238
|
// separate consecutive group of texts with a line break: eg. ["hello", "world"] -> ["hello", "\nworld"]
|
239
|
-
|
239
|
+
o && l > 0 && !_(a) && !_(s[l - 1]) ? `
|
240
240
|
`.concat(f) : f
|
241
241
|
);
|
242
242
|
}
|
@@ -244,92 +244,92 @@ function ke(e, { shouldPreserveNewlines: t }) {
|
|
244
244
|
`);
|
245
245
|
};
|
246
246
|
}
|
247
|
-
function Fe(e,
|
248
|
-
for (const i of
|
249
|
-
const
|
247
|
+
function Fe(e, n, o, r) {
|
248
|
+
for (const i of n) {
|
249
|
+
const t = i.export(
|
250
250
|
e,
|
251
|
-
(c) => w(c,
|
251
|
+
(c) => w(c, o, r)
|
252
252
|
);
|
253
|
-
if (
|
254
|
-
return
|
253
|
+
if (t != null)
|
254
|
+
return t;
|
255
255
|
}
|
256
|
-
return N(e) ? w(e,
|
256
|
+
return N(e) ? w(e, o, r) : ee(e) ? e.getTextContent() : null;
|
257
257
|
}
|
258
|
-
function w(e,
|
258
|
+
function w(e, n, o) {
|
259
259
|
const r = [], i = e.getChildren();
|
260
|
-
e: for (const
|
261
|
-
for (const c of
|
260
|
+
e: for (const t of i) {
|
261
|
+
for (const c of o) {
|
262
262
|
const s = c.export(
|
263
|
-
|
263
|
+
t,
|
264
264
|
(l) => w(
|
265
265
|
l,
|
266
|
-
|
267
|
-
|
266
|
+
n,
|
267
|
+
o
|
268
268
|
),
|
269
|
-
(l, a) => K(l, a,
|
269
|
+
(l, a) => K(l, a, n)
|
270
270
|
);
|
271
271
|
if (s != null) {
|
272
272
|
r.push(s);
|
273
273
|
continue e;
|
274
274
|
}
|
275
275
|
}
|
276
|
-
te(
|
277
|
-
`) : x(
|
278
|
-
K(
|
279
|
-
) : N(
|
280
|
-
w(
|
281
|
-
) : ee(
|
276
|
+
te(t) ? r.push(`
|
277
|
+
`) : x(t) ? r.push(
|
278
|
+
K(t, t.getTextContent(), n)
|
279
|
+
) : N(t) ? r.push(
|
280
|
+
w(t, n, o)
|
281
|
+
) : ee(t) && r.push(t.getTextContent());
|
282
282
|
}
|
283
283
|
return r.join("");
|
284
284
|
}
|
285
|
-
function K(e,
|
286
|
-
const r =
|
285
|
+
function K(e, n, o) {
|
286
|
+
const r = n.trim();
|
287
287
|
let i = r;
|
288
|
-
const
|
289
|
-
for (const c of
|
288
|
+
const t = /* @__PURE__ */ new Set();
|
289
|
+
for (const c of o) {
|
290
290
|
const s = c.format[0], l = c.tag;
|
291
291
|
if (T(
|
292
292
|
s !== void 0,
|
293
293
|
"TextFormatTransformer for tag %s has empty format array",
|
294
294
|
l
|
295
|
-
), M(e, s) && !
|
296
|
-
|
295
|
+
), M(e, s) && !t.has(s)) {
|
296
|
+
t.add(s);
|
297
297
|
const a = j(e, !0);
|
298
298
|
M(a, s) || (i = l + i);
|
299
299
|
const f = j(e, !1);
|
300
300
|
M(f, s) || (i += l);
|
301
301
|
}
|
302
302
|
}
|
303
|
-
return
|
303
|
+
return n.replace(r, () => i);
|
304
304
|
}
|
305
|
-
function j(e,
|
306
|
-
let
|
307
|
-
if (!
|
305
|
+
function j(e, n) {
|
306
|
+
let o = n ? e.getPreviousSibling() : e.getNextSibling();
|
307
|
+
if (!o) {
|
308
308
|
const r = e.getParentOrThrow();
|
309
|
-
r.isInline() && (
|
309
|
+
r.isInline() && (o = n ? r.getPreviousSibling() : r.getNextSibling());
|
310
310
|
}
|
311
|
-
for (;
|
312
|
-
if (N(
|
313
|
-
if (!
|
311
|
+
for (; o; ) {
|
312
|
+
if (N(o)) {
|
313
|
+
if (!o.isInline())
|
314
314
|
break;
|
315
|
-
const r =
|
315
|
+
const r = n ? o.getLastDescendant() : o.getFirstDescendant();
|
316
316
|
if (x(r))
|
317
317
|
return r;
|
318
|
-
|
318
|
+
o = n ? o.getPreviousSibling() : o.getNextSibling();
|
319
319
|
}
|
320
|
-
if (x(
|
321
|
-
return
|
322
|
-
if (!N(
|
320
|
+
if (x(o))
|
321
|
+
return o;
|
322
|
+
if (!N(o))
|
323
323
|
return null;
|
324
324
|
}
|
325
325
|
return null;
|
326
326
|
}
|
327
|
-
function M(e,
|
328
|
-
return x(e) && e.hasFormat(
|
327
|
+
function M(e, n) {
|
328
|
+
return x(e) && e.hasFormat(n);
|
329
329
|
}
|
330
|
-
function z({ nodes: e },
|
331
|
-
const
|
332
|
-
return
|
330
|
+
function z({ nodes: e }, n) {
|
331
|
+
const o = e.has.bind(e);
|
332
|
+
return n.filter((r) => r.dependencies.every(o));
|
333
333
|
}
|
334
334
|
const U = "@etrepum/lexical-builder-list/CheckList", W = G({
|
335
335
|
name: "@etrepum/lexical-builder-markdown/MarkdownTransformers",
|
@@ -345,22 +345,22 @@ const U = "@etrepum/lexical-builder-list/CheckList", W = G({
|
|
345
345
|
}),
|
346
346
|
// For now we replace the transformer arrays with the default
|
347
347
|
// shallowMergeConfig. I think ideally these should be additive
|
348
|
-
init(e,
|
348
|
+
init(e, n, o) {
|
349
349
|
const r = ce(e), i = {
|
350
|
-
shouldPreserveNewlines:
|
351
|
-
},
|
350
|
+
shouldPreserveNewlines: n.shouldPreserveNewlines
|
351
|
+
}, t = z(
|
352
352
|
r,
|
353
|
-
|
353
|
+
n.elementTransformers
|
354
354
|
);
|
355
|
-
if (
|
356
|
-
const a =
|
357
|
-
a >= 0 &&
|
355
|
+
if (o.getPeer(U)) {
|
356
|
+
const a = t.indexOf(ge);
|
357
|
+
a >= 0 && t.splice(a, 0, de);
|
358
358
|
}
|
359
359
|
const c = {
|
360
360
|
// Only register transforms for nodes that are configured
|
361
|
-
element:
|
362
|
-
textMatch: z(r,
|
363
|
-
textFormat:
|
361
|
+
element: t,
|
362
|
+
textMatch: z(r, n.textMatchTransformers),
|
363
|
+
textFormat: n.textFormatTransformers
|
364
364
|
}, s = $e(
|
365
365
|
we(c, i)
|
366
366
|
), l = ke(
|
@@ -374,19 +374,19 @@ const U = "@etrepum/lexical-builder-list/CheckList", W = G({
|
|
374
374
|
$markdownImport: s
|
375
375
|
};
|
376
376
|
},
|
377
|
-
register: (e,
|
377
|
+
register: (e, n, o) => q(o.getInitResult())
|
378
378
|
});
|
379
|
-
function ve(e,
|
379
|
+
function ve(e, n, o, r) {
|
380
380
|
const i = e.getParent();
|
381
|
-
if (!Z(i) || e.getFirstChild() !==
|
381
|
+
if (!Z(i) || e.getFirstChild() !== n)
|
382
382
|
return !1;
|
383
|
-
const
|
384
|
-
if (o
|
383
|
+
const t = n.getTextContent();
|
384
|
+
if (t[o - 1] !== " ")
|
385
385
|
return !1;
|
386
386
|
for (const { regExp: c, replace: s } of r) {
|
387
|
-
const l =
|
388
|
-
if (l && l[0].length ===
|
389
|
-
const a =
|
387
|
+
const l = t.match(c);
|
388
|
+
if (l && l[0].length === o) {
|
389
|
+
const a = n.getNextSiblings(), [f, m] = n.splitText(o);
|
390
390
|
f.remove();
|
391
391
|
const g = m ? [m, ...a] : a;
|
392
392
|
return s(e, g, l, !1), !0;
|
@@ -394,13 +394,13 @@ function ve(e, t, n, r) {
|
|
394
394
|
}
|
395
395
|
return !1;
|
396
396
|
}
|
397
|
-
function be(e,
|
397
|
+
function be(e, n, o) {
|
398
398
|
let r = e.getTextContent();
|
399
|
-
const i = r[
|
400
|
-
if (
|
399
|
+
const i = r[n - 1], t = o[i];
|
400
|
+
if (t == null)
|
401
401
|
return !1;
|
402
|
-
|
403
|
-
for (const c of
|
402
|
+
n < r.length && (r = r.slice(0, n));
|
403
|
+
for (const c of t) {
|
404
404
|
const s = r.match(c.regExp);
|
405
405
|
if (s === null)
|
406
406
|
continue;
|
@@ -416,8 +416,8 @@ function be(e, t, n) {
|
|
416
416
|
}
|
417
417
|
return !1;
|
418
418
|
}
|
419
|
-
function Ie(e,
|
420
|
-
const r = e.getTextContent(), i =
|
419
|
+
function Ie(e, n, o) {
|
420
|
+
const r = e.getTextContent(), i = n - 1, t = r[i], c = o[t];
|
421
421
|
if (!c)
|
422
422
|
return !1;
|
423
423
|
for (const s of c) {
|
@@ -445,7 +445,7 @@ function Ie(e, t, n) {
|
|
445
445
|
if (d < 0 || u === g && d + a === f)
|
446
446
|
continue;
|
447
447
|
const R = u.getTextContent();
|
448
|
-
if (d > 0 && R[d - 1] ===
|
448
|
+
if (d > 0 && R[d - 1] === t)
|
449
449
|
continue;
|
450
450
|
const k = R[d - 1];
|
451
451
|
if (s.intraword === !1 && k && !$.test(k))
|
@@ -473,35 +473,35 @@ function Ie(e, t, n) {
|
|
473
473
|
}
|
474
474
|
return !1;
|
475
475
|
}
|
476
|
-
function X(e,
|
477
|
-
const r =
|
478
|
-
for (let i =
|
479
|
-
const
|
480
|
-
if (oe(e,
|
481
|
-
e[
|
482
|
-
return
|
476
|
+
function X(e, n, o) {
|
477
|
+
const r = o.length;
|
478
|
+
for (let i = n; i >= r; i--) {
|
479
|
+
const t = i - r;
|
480
|
+
if (oe(e, t, o, 0, r) && // Space after opening tag cancels transformation
|
481
|
+
e[t + r] !== " ")
|
482
|
+
return t;
|
483
483
|
}
|
484
484
|
return -1;
|
485
485
|
}
|
486
|
-
function oe(e,
|
487
|
-
for (let
|
488
|
-
if (e[
|
486
|
+
function oe(e, n, o, r, i) {
|
487
|
+
for (let t = 0; t < i; t++)
|
488
|
+
if (e[n + t] !== o[r + t])
|
489
489
|
return !1;
|
490
490
|
return !0;
|
491
491
|
}
|
492
|
-
function Le(e,
|
493
|
-
const
|
494
|
-
|
495
|
-
({ tag:
|
492
|
+
function Le(e, n) {
|
493
|
+
const o = y(
|
494
|
+
n.textFormat,
|
495
|
+
({ tag: t }) => t[t.length - 1]
|
496
496
|
), r = y(
|
497
|
-
|
498
|
-
({ trigger:
|
499
|
-
), i = (
|
497
|
+
n.textMatch,
|
498
|
+
({ trigger: t }) => t
|
499
|
+
), i = (t, c, s) => {
|
500
500
|
ve(
|
501
|
-
|
501
|
+
t,
|
502
502
|
c,
|
503
503
|
s,
|
504
|
-
|
504
|
+
n.element
|
505
505
|
) || be(
|
506
506
|
c,
|
507
507
|
s,
|
@@ -509,12 +509,12 @@ function Le(e, t) {
|
|
509
509
|
) || Ie(
|
510
510
|
c,
|
511
511
|
s,
|
512
|
-
|
512
|
+
o
|
513
513
|
);
|
514
514
|
};
|
515
515
|
return e.registerUpdateListener(
|
516
|
-
({ tags:
|
517
|
-
if (
|
516
|
+
({ tags: t, dirtyLeaves: c, editorState: s, prevEditorState: l }) => {
|
517
|
+
if (t.has("collaboration") || t.has("historic") || e.isComposing())
|
518
518
|
return;
|
519
519
|
const a = s.read(C), f = l.read(C);
|
520
520
|
if (!P(f) || !P(a) || !a.isCollapsed())
|
@@ -535,18 +535,18 @@ const ze = G({
|
|
535
535
|
config: H({
|
536
536
|
disabled: !1
|
537
537
|
}),
|
538
|
-
register(e,
|
538
|
+
register(e, n, o) {
|
539
539
|
return q(
|
540
540
|
...le({
|
541
|
-
disabled:
|
541
|
+
disabled: n.disabled,
|
542
542
|
register: () => Le(
|
543
543
|
e,
|
544
|
-
|
544
|
+
o.getDependency(W).output.transformersByType
|
545
545
|
)
|
546
546
|
})
|
547
547
|
);
|
548
548
|
}
|
549
|
-
}), Ue = "0.0.28
|
549
|
+
}), Ue = "0.0.28";
|
550
550
|
export {
|
551
551
|
ze as MarkdownShortcutsPlan,
|
552
552
|
W as MarkdownTransformersPlan,
|
package/dist/utils.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ParagraphNode, Spread, LexicalNode } from 'lexical';
|
2
2
|
|
3
|
-
export declare function indexBy<T>(list:
|
3
|
+
export declare function indexBy<T>(list: T[], callback: (arg0: T) => string): Readonly<Record<string, T[]>>;
|
4
4
|
export declare const PUNCTUATION_OR_SPACE: RegExp;
|
5
5
|
declare const EmptyParagraphNodeBrand: unique symbol;
|
6
6
|
export declare function $isEmptyParagraph(node: LexicalNode | undefined | null): node is Spread<{
|
@@ -13,7 +13,7 @@ export declare function $isEmptyParagraph(node: LexicalNode | undefined | null):
|
|
13
13
|
* update you're running includes selection modifications that you do not
|
14
14
|
* want.
|
15
15
|
*
|
16
|
-
* This is useful because the existing
|
16
|
+
* This is useful because the existing \@lexical/markdown importers
|
17
17
|
* mangle the selection because of legacy mistakes.
|
18
18
|
*/
|
19
19
|
export declare function $wrapWithIgnoreSelection<Parameters extends any[], Returns>($update: (...args: Parameters) => Returns): (...args: Parameters) => Returns;
|
package/dist/utils.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,WAAW,EAGjB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,OAAO,CAAC,CAAC,EACvB,IAAI,EAAE,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,WAAW,EAGjB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,OAAO,CAAC,CAAC,EACvB,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC5B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAc/B;AAED,eAAO,MAAM,oBAAoB,QAAqB,CAAC;AAIvD,QAAA,MAAM,uBAAuB,EAAE,OAAO,MAErC,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,GACnC,IAAI,IAAI,MAAM,CAAC;IAAE,CAAC,uBAAuB,CAAC,EAAE,KAAK,CAAA;CAAE,EAAE,aAAa,CAAC,CAYrE;AAED;;;;;;;;;GASG;AAEH,wBAAgB,wBAAwB,CAAC,UAAU,SAAS,GAAG,EAAE,EAAE,OAAO,EACxE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,KAAK,OAAO,GACxC,CAAC,GAAG,IAAI,EAAE,UAAU,KAAK,OAAO,CAqBlC"}
|