markloom 0.6.0 → 0.7.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.
Files changed (59) hide show
  1. package/collab.md +25 -13
  2. package/dist/ai/index.cjs +5 -4
  3. package/dist/ai/index.d.cts +5 -5
  4. package/dist/ai/index.d.ts +5 -5
  5. package/dist/ai/index.js +4 -3
  6. package/dist/{chunk-KYZJIOOL.js → chunk-4Q7PAR2T.js} +3671 -904
  7. package/dist/chunk-75EJ4ARB.cjs +642 -0
  8. package/dist/{chunk-U3JZDFL4.cjs → chunk-BMPCVT3B.cjs} +2 -34
  9. package/dist/{chunk-VSBIMMI7.js → chunk-EFYT2223.js} +3 -35
  10. package/dist/chunk-HXABDVLZ.cjs +297 -0
  11. package/dist/{chunk-I5VK4U7J.cjs → chunk-I2LDEVLA.cjs} +434 -80
  12. package/dist/{chunk-YBAT343I.js → chunk-MQLRZQZL.js} +263 -119
  13. package/dist/chunk-OVHASRID.cjs +4279 -0
  14. package/dist/chunk-PCSVBPOR.cjs +40 -0
  15. package/dist/{chunk-TB2OY3D4.js → chunk-PSAXWBNM.js} +413 -59
  16. package/dist/{chunk-QEVME6ZU.cjs → chunk-PZRWTLLB.cjs} +260 -161
  17. package/dist/chunk-QO7JEZDB.js +4279 -0
  18. package/dist/{chunk-EJSFZHGT.js → chunk-WSJUXPAG.js} +18 -2
  19. package/dist/{chunk-ACFYBYZJ.cjs → chunk-Y4IXQFWL.cjs} +4212 -1445
  20. package/dist/{chunk-CGYCJORO.js → chunk-YLVSMDIO.js} +220 -121
  21. package/dist/chunk-ZL6WT6OY.js +297 -0
  22. package/dist/{client-CLYq17SW.d.ts → client-BvvyHjhh.d.ts} +57 -7
  23. package/dist/{client-DAth8pPq.d.cts → client-Ciy7Fa_k.d.cts} +57 -7
  24. package/dist/collab/index.cjs +5 -4
  25. package/dist/collab/index.d.cts +13 -15
  26. package/dist/collab/index.d.ts +13 -15
  27. package/dist/collab/index.js +4 -3
  28. package/dist/{controller-BIOO_XKJ.d.cts → controller-CHznEhAR.d.cts} +186 -27
  29. package/dist/{controller-6AJ36G52.d.ts → controller-DLqI8_jm.d.ts} +186 -27
  30. package/dist/index.cjs +69 -7
  31. package/dist/index.d.cts +127 -8
  32. package/dist/index.d.ts +127 -8
  33. package/dist/index.js +80 -18
  34. package/dist/io/index.cjs +58 -59
  35. package/dist/io/index.d.cts +1 -1
  36. package/dist/io/index.d.ts +1 -1
  37. package/dist/io/index.js +15 -16
  38. package/dist/react/index.cjs +9 -8
  39. package/dist/react/index.d.cts +5 -5
  40. package/dist/react/index.d.ts +5 -5
  41. package/dist/react/index.js +8 -7
  42. package/dist/{rebase-batch-DlerAcFN.d.ts → rebase-batch-CSnv8FKp.d.ts} +1 -1
  43. package/dist/{rebase-batch-PjENQ742.d.cts → rebase-batch-DO1ygkx9.d.cts} +1 -1
  44. package/dist/{types-COUweEav.d.cts → types-BkHlmUFL.d.cts} +5 -1
  45. package/dist/{types-COUweEav.d.ts → types-BkHlmUFL.d.ts} +5 -1
  46. package/dist/{versions-9mG1epfB.d.cts → versions-DNFf8zVz.d.cts} +1 -1
  47. package/dist/{versions-Bubyo4pt.d.ts → versions-DOkOyh2J.d.ts} +1 -1
  48. package/dist/view/index.cjs +215 -17
  49. package/dist/view/index.d.cts +82 -9
  50. package/dist/view/index.d.ts +82 -9
  51. package/dist/view/index.js +212 -14
  52. package/dist/view/theme.css +349 -75
  53. package/dist/{suggest-Bk4zLzuv.d.ts → word-count-BPw9G2Bg.d.ts} +15 -5
  54. package/dist/{suggest-BkGGiPKA.d.cts → word-count-DNLn1h_t.d.cts} +15 -5
  55. package/package.json +11 -6
  56. package/dist/chunk-EADZKEU4.cjs +0 -498
  57. package/dist/chunk-SNFF6X45.js +0 -2347
  58. package/dist/chunk-TWD5T4YC.cjs +0 -2347
  59. package/dist/chunk-ZKQSQSSM.cjs +0 -24
@@ -99,8 +99,6 @@
99
99
 
100
100
 
101
101
 
102
- var _chunkACFYBYZJcjs = require('../chunk-ACFYBYZJ.cjs');
103
- require('../chunk-QEVME6ZU.cjs');
104
102
 
105
103
 
106
104
 
@@ -113,11 +111,62 @@ require('../chunk-QEVME6ZU.cjs');
113
111
 
114
112
 
115
113
 
116
- var _chunkI5VK4U7Jcjs = require('../chunk-I5VK4U7J.cjs');
117
- require('../chunk-TWD5T4YC.cjs');
118
- require('../chunk-EADZKEU4.cjs');
119
- require('../chunk-U3JZDFL4.cjs');
120
- require('../chunk-ZKQSQSSM.cjs');
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ var _chunkY4IXQFWLcjs = require('../chunk-Y4IXQFWL.cjs');
130
+ require('../chunk-PZRWTLLB.cjs');
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+ var _chunkI2LDEVLAcjs = require('../chunk-I2LDEVLA.cjs');
156
+
157
+
158
+
159
+
160
+
161
+ var _chunkOVHASRIDcjs = require('../chunk-OVHASRID.cjs');
162
+ require('../chunk-75EJ4ARB.cjs');
163
+ require('../chunk-BMPCVT3B.cjs');
164
+
165
+
166
+ var _chunkHXABDVLZcjs = require('../chunk-HXABDVLZ.cjs');
167
+
168
+
169
+ var _chunkPCSVBPORcjs = require('../chunk-PCSVBPOR.cjs');
121
170
 
122
171
  // src/view/shiki-code-view.ts
123
172
  var _preact = require('preact');
@@ -133,9 +182,9 @@ function shikiCodeView(highlight, langs) {
133
182
  // 标记:此叶是多 text 节点拼接,selection 按全文 offset 走
134
183
  "dangerouslySetInnerHTML": { __html: anchorEmptyLines(highlight(ctx.text, lang)) }
135
184
  });
136
- const copy = _preact.h.call(void 0, "button", { "key": "copy", "data-copy": "", "type": "button", "contentEditable": "false", "tabIndex": -1, "aria-label": "\u590D\u5236\u4EE3\u7801" });
137
- const langBtn = ctx.editable === false ? null : _preact.h.call(void 0, "button", { "key": "lang", "data-code-lang": "", "type": "button", "contentEditable": "false", "tabIndex": -1 }, lang || "\u7EAF\u6587\u672C");
138
- return _preact.h.call(void 0, "div", { "key": ctx.key, "data-block-id": _nullishCoalesce(ctx.node.id, () => ( "")), "data-code-block": "" }, [langBtn, copy, leaf]);
185
+ const copy = _preact.h.call(void 0, "button", { "key": "copy", "data-copy": "", "type": "button", "contentEditable": "false", "tabIndex": -1, "aria-label": _chunkI2LDEVLAcjs.t.call(void 0, "copyCode") });
186
+ const langBtn = ctx.editable === false ? null : _preact.h.call(void 0, "button", { "key": "lang", "data-code-lang": "", "type": "button", "contentEditable": "false", "tabIndex": -1 }, lang || _chunkI2LDEVLAcjs.t.call(void 0, "plainText"));
187
+ return _preact.h.call(void 0, "div", { "key": ctx.key, "data-block-id": _nullishCoalesce(ctx.node.id, () => ( "")), "data-code-block": "", "spellcheck": "false" }, [langBtn, copy, leaf]);
139
188
  }
140
189
  };
141
190
  }
@@ -155,6 +204,63 @@ function anchorEmptyLines(html) {
155
204
  return pre.outerHTML;
156
205
  }
157
206
 
207
+ // src/view/open-async.ts
208
+ var ASYNC_MIN_BYTES = 48 * 1024;
209
+ async function openEditorAsync(root, md, opts = {}) {
210
+ const { budgetMs = 8, layoutMs = 25, headBlocks = 200, signal, ...eopts } = opts;
211
+ const source = _nullishCoalesce(eopts.source, () => ( md));
212
+ if (md.length < ASYNC_MIN_BYTES) {
213
+ const editor2 = new (0, _chunkY4IXQFWLcjs.Editor)(root, _chunkOVHASRIDcjs.mdToDoc.call(void 0, md), { ...eopts, source });
214
+ return { editor: editor2, loaded: Promise.resolve(editor2.doc) };
215
+ }
216
+ let onHead;
217
+ const headP = new Promise((r) => {
218
+ onHead = r;
219
+ });
220
+ const fullP = _chunkOVHASRIDcjs.mdToDocAsync.call(void 0, md, { budgetMs, headBlocks, onHead, signal });
221
+ const first = await Promise.race([headP, fullP]);
222
+ const wantEditable = eopts.editable !== false;
223
+ const editor = new (0, _chunkY4IXQFWLcjs.Editor)(root, first, { ...eopts, source, editable: false });
224
+ const loaded = (async () => {
225
+ try {
226
+ const doc = await fullP;
227
+ const total = doc.children.length;
228
+ let n = first.children.length;
229
+ let step = 128;
230
+ let perBlock = 0.05;
231
+ while (n < total) {
232
+ if (_optionalChain([signal, 'optionalAccess', _6 => _6.aborted]))
233
+ throw Object.assign(new Error("openEditorAsync aborted"), { name: "AbortError" });
234
+ await _chunkOVHASRIDcjs.yieldToMain.call(void 0, );
235
+ const t0 = performance.now();
236
+ const take = Math.min(total - n, step);
237
+ n += take;
238
+ editor.replaceDoc({ ...doc, children: doc.children.slice(0, n) }, { notify: false, quiet: true });
239
+ const dt = performance.now() - t0;
240
+ perBlock = perBlock * 0.7 + dt / take * 0.3;
241
+ step = Math.max(128, Math.min(4096, Math.round(layoutMs / perBlock)));
242
+ }
243
+ editor.replaceDoc(doc, { notify: false });
244
+ if (wantEditable)
245
+ editor.setEditable(true);
246
+ if (eopts.autofocus != null && eopts.autofocus !== false && wantEditable) {
247
+ const sel = _chunkY4IXQFWLcjs.autofocusSelection.call(void 0, editor.doc, eopts.autofocus);
248
+ if (sel) {
249
+ root.focus({ preventScroll: true });
250
+ _chunkI2LDEVLAcjs.writeSelection.call(void 0, editor.root, editor.doc, sel);
251
+ }
252
+ }
253
+ return editor.doc;
254
+ } catch (e) {
255
+ editor.destroy();
256
+ throw e;
257
+ }
258
+ })();
259
+ loaded.catch(() => {
260
+ });
261
+ return { editor, loaded };
262
+ }
263
+
158
264
  // src/view/extensions/typography.ts
159
265
  var SUBS = [
160
266
  { trigger: "-", from: "--", to: "\u2014" },
@@ -171,10 +277,31 @@ var SUBS = [
171
277
  { trigger: "4", from: "1/4", to: "\xBC" },
172
278
  { trigger: "4", from: "3/4", to: "\xBE" }
173
279
  ];
280
+ function inLiteral(ctx) {
281
+ const leaf = _chunkHXABDVLZcjs.nodeAt.call(void 0, ctx.doc, ctx.leafPath);
282
+ if (_chunkPCSVBPORcjs.isText.call(void 0, leaf) && _optionalChain([leaf, 'access', _7 => _7.marks, 'optionalAccess', _8 => _8.some, 'call', _9 => _9((m) => m.name === "code" || m.name === "link")]))
283
+ return true;
284
+ let ticks = 0;
285
+ for (const ch of ctx.marker) {
286
+ if (ch === "`")
287
+ ticks++;
288
+ }
289
+ if (ticks % 2 === 1)
290
+ return true;
291
+ let start = ctx.marker.length;
292
+ while (start > 0 && !/\s/.test(ctx.marker[start - 1]))
293
+ start--;
294
+ const word = ctx.marker.slice(start);
295
+ return word.includes("://") || word.startsWith("www.");
296
+ }
297
+ function isCjk(ch) {
298
+ const c = _nullishCoalesce(ch.codePointAt(0), () => ( 0));
299
+ return c >= 11904 && c <= 40959 || c >= 44032 && c <= 55215 || c >= 63744 && c <= 64255 || c >= 65280 && c <= 65519 || c >= 131072 && c <= 195103;
300
+ }
174
301
  function subRule() {
175
302
  return {
176
303
  match: (ctx) => {
177
- if (ctx.block.type === "code")
304
+ if (ctx.block.type === "code" || inLiteral(ctx))
178
305
  return null;
179
306
  const combined = ctx.marker + ctx.trigger;
180
307
  for (const s of SUBS) {
@@ -184,11 +311,13 @@ function subRule() {
184
311
  const at = ctx.offset - eaten;
185
312
  if (at < 0)
186
313
  return null;
314
+ if (s.from === "--" && ctx.leafIdx === 0 && ctx.block.type === "paragraph" && [...combined].every((ch) => ch === "-"))
315
+ return null;
187
316
  const steps = [
188
317
  { kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
189
318
  { kind: "insertText", path: ctx.leafPath, offset: at, text: s.to }
190
319
  ];
191
- return { steps, selection: _chunkACFYBYZJcjs.caret.call(void 0, ctx.leafPath.concat(at + s.to.length)) };
320
+ return { steps, selection: _chunkY4IXQFWLcjs.caret.call(void 0, ctx.leafPath.concat(at + s.to.length)) };
192
321
  }
193
322
  return null;
194
323
  }
@@ -197,12 +326,24 @@ function subRule() {
197
326
  function quoteRule(quote, open, close) {
198
327
  return {
199
328
  match: (ctx) => {
200
- if (ctx.block.type === "code" || ctx.trigger !== quote)
329
+ if (ctx.block.type === "code" || ctx.trigger !== quote || inLiteral(ctx))
201
330
  return null;
202
331
  const prev = ctx.marker.slice(-1);
203
- const to = prev === "" || prev === " " || prev === "\n" || prev === " " || prev === "(" || prev === "[" || prev === "{" ? open : close;
332
+ let to;
333
+ if (prev === "" || prev === " " || prev === "\n" || prev === " " || prev === "(" || prev === "[" || prev === "{") {
334
+ to = open;
335
+ } else {
336
+ let depth = 0;
337
+ for (const ch of ctx.marker) {
338
+ if (ch === open)
339
+ depth++;
340
+ else if (ch === close && depth > 0)
341
+ depth--;
342
+ }
343
+ to = depth > 0 ? close : isCjk(prev) ? open : close;
344
+ }
204
345
  const steps = [{ kind: "insertText", path: ctx.leafPath, offset: ctx.offset, text: to }];
205
- return { steps, selection: _chunkACFYBYZJcjs.caret.call(void 0, ctx.leafPath.concat(ctx.offset + to.length)) };
346
+ return { steps, selection: _chunkY4IXQFWLcjs.caret.call(void 0, ctx.leafPath.concat(ctx.offset + to.length)) };
206
347
  }
207
348
  };
208
349
  }
@@ -278,7 +419,7 @@ function emojiRule() {
278
419
  { kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
279
420
  { kind: "insertText", path: ctx.leafPath, offset: at, text: glyph }
280
421
  ];
281
- return { steps, selection: _chunkACFYBYZJcjs.caret.call(void 0, ctx.leafPath.concat(at + glyph.length)) };
422
+ return { steps, selection: _chunkY4IXQFWLcjs.caret.call(void 0, ctx.leafPath.concat(at + glyph.length)) };
282
423
  }
283
424
  };
284
425
  }
@@ -296,6 +437,63 @@ var comments = {
296
437
  marks: [{ name: "comment", tag: "span" }]
297
438
  };
298
439
 
440
+ // src/view/extensions/typora-keys.ts
441
+ var level = (depth) => (ctx) => ctx.sel ? _chunkY4IXQFWLcjs.setHeadingDepth.call(void 0, ctx.doc, ctx.sel, depth) : null;
442
+ var typoraKeys = {
443
+ name: "typoraKeys",
444
+ keymap: {
445
+ "Mod-0": level(0),
446
+ "Mod-1": level(1),
447
+ "Mod-2": level(2),
448
+ "Mod-3": level(3),
449
+ "Mod-4": level(4),
450
+ "Mod-5": level(5),
451
+ "Mod-6": level(6)
452
+ }
453
+ };
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
299
497
 
300
498
 
301
499
 
@@ -412,4 +610,4 @@ var comments = {
412
610
 
413
611
 
414
612
 
415
- exports.CALLOUT_VARIANTS = _chunkACFYBYZJcjs.CALLOUT_VARIANTS; exports.CommentPanel = _chunkACFYBYZJcjs.CommentPanel; exports.Editor = _chunkACFYBYZJcjs.Editor; exports.MentionMenu = _chunkACFYBYZJcjs.MentionMenu; exports.MentionPopovers = _chunkACFYBYZJcjs.MentionPopovers; exports.SearchBar = _chunkACFYBYZJcjs.SearchBar; exports.SuggestBar = _chunkACFYBYZJcjs.SuggestBar; exports.TocPanel = _chunkACFYBYZJcjs.TocPanel; exports.VersionsPanel = _chunkACFYBYZJcjs.VersionsPanel; exports.askInput = _chunkACFYBYZJcjs.askInput; exports.askLinkPopover = _chunkACFYBYZJcjs.askLinkPopover; exports.askPopover = _chunkACFYBYZJcjs.askPopover; exports.atomIsSelected = _chunkACFYBYZJcjs.atomIsSelected; exports.blockExtensions = _chunkACFYBYZJcjs.blockExtensions; exports.blockPlainText = _chunkI5VK4U7Jcjs.blockPlainText; exports.blockTransform = _chunkACFYBYZJcjs.blockTransform; exports.boldMark = _chunkACFYBYZJcjs.boldMark; exports.bubbleMenu = _chunkACFYBYZJcjs.bubbleMenu; exports.calloutVariantFromQuery = _chunkACFYBYZJcjs.calloutVariantFromQuery; exports.caret = _chunkACFYBYZJcjs.caret; exports.chord = _chunkACFYBYZJcjs.chord; exports.clipboardFromDataTransfer = _chunkACFYBYZJcjs.clipboardFromDataTransfer; exports.closeAskInput = _chunkACFYBYZJcjs.closeAskInput; exports.codeBlock = _chunkACFYBYZJcjs.codeBlock; exports.codeControls = _chunkACFYBYZJcjs.codeControls; exports.codeMark = _chunkACFYBYZJcjs.codeMark; exports.comments = comments; exports.cycleCalloutVariant = _chunkACFYBYZJcjs.cycleCalloutVariant; exports.decorationExtensions = _chunkACFYBYZJcjs.decorationExtensions; exports.defaultBlockRenderers = _chunkACFYBYZJcjs.defaultBlockRenderers; exports.defaultBlockTag = _chunkACFYBYZJcjs.defaultBlockTag; exports.defaultMarkTag = _chunkACFYBYZJcjs.defaultMarkTag; exports.diffSpan = _chunkACFYBYZJcjs.diffSpan; exports.docExtent = _chunkI5VK4U7Jcjs.docExtent; exports.domToPoint = _chunkI5VK4U7Jcjs.domToPoint; exports.dragHandle = _chunkACFYBYZJcjs.dragHandle; exports.elementChildren = _chunkI5VK4U7Jcjs.elementChildren; exports.embedBlock = _chunkACFYBYZJcjs.embedBlock; exports.emoji = emoji; exports.focusBlockId = _chunkI5VK4U7Jcjs.focusBlockId; exports.highlightMark = _chunkACFYBYZJcjs.highlightMark; exports.history = _chunkACFYBYZJcjs.history; exports.hrBlock = _chunkACFYBYZJcjs.hrBlock; exports.htmlToPlainText = _chunkACFYBYZJcjs.htmlToPlainText; exports.imageBlock = _chunkACFYBYZJcjs.imageBlock; exports.imageFileFrom = _chunkACFYBYZJcjs.imageFileFrom; exports.indentItem = _chunkACFYBYZJcjs.indentItem; exports.inputRules = _chunkACFYBYZJcjs.inputRules; exports.invisibleCharacters = invisibleCharacters; exports.isAtom = _chunkACFYBYZJcjs.isAtom; exports.isBareUrl = _chunkACFYBYZJcjs.isBareUrl; exports.isOpaque = _chunkACFYBYZJcjs.isOpaque; exports.italicMark = _chunkACFYBYZJcjs.italicMark; exports.leafText = _chunkACFYBYZJcjs.leafText; exports.lineBoundaryBack = _chunkACFYBYZJcjs.lineBoundaryBack; exports.lineBoundaryFwd = _chunkACFYBYZJcjs.lineBoundaryFwd; exports.linkMark = _chunkACFYBYZJcjs.linkMark; exports.mapInput = _chunkACFYBYZJcjs.mapInput; exports.mapPaste = _chunkACFYBYZJcjs.mapPaste; exports.mapPasteBlocks = _chunkACFYBYZJcjs.mapPasteBlocks; exports.markExtensions = _chunkACFYBYZJcjs.markExtensions; exports.markloomKit = _chunkACFYBYZJcjs.markloomKit; exports.marksAtCaret = _chunkACFYBYZJcjs.marksAtCaret; exports.mentionMenu = _chunkACFYBYZJcjs.mentionMenu; exports.mergeTextStyleAttrs = _chunkACFYBYZJcjs.mergeTextStyleAttrs; exports.normalizeLinkUrl = _chunkACFYBYZJcjs.normalizeLinkUrl; exports.outdentItem = _chunkACFYBYZJcjs.outdentItem; exports.pointToDom = _chunkI5VK4U7Jcjs.pointToDom; exports.projectDoc = _chunkACFYBYZJcjs.projectDoc; exports.readSelection = _chunkI5VK4U7Jcjs.readSelection; exports.renderCode = _chunkACFYBYZJcjs.renderCode; exports.renderDoc = _chunkACFYBYZJcjs.renderDoc; exports.renderEmbed = _chunkACFYBYZJcjs.renderEmbed; exports.renderHr = _chunkACFYBYZJcjs.renderHr; exports.renderImage = _chunkACFYBYZJcjs.renderImage; exports.renderTable = _chunkACFYBYZJcjs.renderTable; exports.renderToHtml = _chunkACFYBYZJcjs.renderToHtml; exports.resolve = _chunkACFYBYZJcjs.resolve; exports.resolvePaste = _chunkACFYBYZJcjs.resolvePaste; exports.rootEl = _chunkI5VK4U7Jcjs.rootEl; exports.safeCssValue = _chunkACFYBYZJcjs.safeCssValue; exports.selectionCovers = _chunkI5VK4U7Jcjs.selectionCovers; exports.serializeBlock = _chunkACFYBYZJcjs.serializeBlock; exports.serializeSelection = _chunkACFYBYZJcjs.serializeSelection; exports.setAlign = _chunkACFYBYZJcjs.setAlign; exports.setCalloutVariant = _chunkACFYBYZJcjs.setCalloutVariant; exports.setTextStyle = _chunkACFYBYZJcjs.setTextStyle; exports.shikiCodeView = shikiCodeView; exports.slashMenu = _chunkACFYBYZJcjs.slashMenu; exports.soloImgSrcFromHtml = _chunkACFYBYZJcjs.soloImgSrcFromHtml; exports.startAiWrite = _chunkI5VK4U7Jcjs.startAiWrite; exports.strikeMark = _chunkACFYBYZJcjs.strikeMark; exports.subscriptMark = _chunkACFYBYZJcjs.subscriptMark; exports.suggest = _chunkACFYBYZJcjs.suggest; exports.superscriptMark = _chunkACFYBYZJcjs.superscriptMark; exports.tableBlock = _chunkACFYBYZJcjs.tableBlock; exports.textAlign = _chunkACFYBYZJcjs.textAlign; exports.textStyleCss = _chunkACFYBYZJcjs.textStyleCss; exports.textStyleMark = _chunkACFYBYZJcjs.textStyleMark; exports.toggleMark = _chunkACFYBYZJcjs.toggleMark; exports.toggleMarkList = _chunkACFYBYZJcjs.toggleMarkList; exports.tryEmbed = _chunkACFYBYZJcjs.tryEmbed; exports.tryHtmlBlocks = _chunkACFYBYZJcjs.tryHtmlBlocks; exports.tryImageFile = _chunkACFYBYZJcjs.tryImageFile; exports.tryImageUrl = _chunkACFYBYZJcjs.tryImageUrl; exports.tryLinkMark = _chunkACFYBYZJcjs.tryLinkMark; exports.tryLiteral = _chunkACFYBYZJcjs.tryLiteral; exports.tryMarkdown = _chunkACFYBYZJcjs.tryMarkdown; exports.twitchChannel = _chunkACFYBYZJcjs.twitchChannel; exports.typography = typography; exports.underlineMark = _chunkACFYBYZJcjs.underlineMark; exports.wordBoundaryBack = _chunkACFYBYZJcjs.wordBoundaryBack; exports.wordBoundaryFwd = _chunkACFYBYZJcjs.wordBoundaryFwd; exports.wrapList = _chunkACFYBYZJcjs.wrapList; exports.writeSelection = _chunkI5VK4U7Jcjs.writeSelection; exports.youtubeId = _chunkACFYBYZJcjs.youtubeId;
613
+ exports.ASYNC_MIN_BYTES = ASYNC_MIN_BYTES; exports.CALLOUT_VARIANTS = _chunkY4IXQFWLcjs.CALLOUT_VARIANTS; exports.CommentPanel = _chunkY4IXQFWLcjs.CommentPanel; exports.Editor = _chunkY4IXQFWLcjs.Editor; exports.INLINE_PAIRS = _chunkY4IXQFWLcjs.INLINE_PAIRS; exports.MentionMenu = _chunkY4IXQFWLcjs.MentionMenu; exports.MentionPopovers = _chunkY4IXQFWLcjs.MentionPopovers; exports.SELECT_UNIT_TYPES = _chunkI2LDEVLAcjs.SELECT_UNIT_TYPES; exports.SearchBar = _chunkY4IXQFWLcjs.SearchBar; exports.SuggestBar = _chunkY4IXQFWLcjs.SuggestBar; exports.TocPanel = _chunkY4IXQFWLcjs.TocPanel; exports.VersionsPanel = _chunkY4IXQFWLcjs.VersionsPanel; exports.askInput = _chunkY4IXQFWLcjs.askInput; exports.askLinkPopover = _chunkY4IXQFWLcjs.askLinkPopover; exports.askPopover = _chunkY4IXQFWLcjs.askPopover; exports.atomIsSelected = _chunkY4IXQFWLcjs.atomIsSelected; exports.autofocusSelection = _chunkY4IXQFWLcjs.autofocusSelection; exports.blockExtensions = _chunkY4IXQFWLcjs.blockExtensions; exports.blockPlainText = _chunkI2LDEVLAcjs.blockPlainText; exports.blockTransform = _chunkY4IXQFWLcjs.blockTransform; exports.blockTransformRange = _chunkY4IXQFWLcjs.blockTransformRange; exports.boldMark = _chunkY4IXQFWLcjs.boldMark; exports.bubbleMenu = _chunkY4IXQFWLcjs.bubbleMenu; exports.calloutVariantFromQuery = _chunkY4IXQFWLcjs.calloutVariantFromQuery; exports.caret = _chunkY4IXQFWLcjs.caret; exports.chord = _chunkY4IXQFWLcjs.chord; exports.clearFormatting = _chunkY4IXQFWLcjs.clearFormatting; exports.clearMarks = _chunkY4IXQFWLcjs.clearMarks; exports.clipboardFromDataTransfer = _chunkY4IXQFWLcjs.clipboardFromDataTransfer; exports.closeAskInput = _chunkY4IXQFWLcjs.closeAskInput; exports.codeBlock = _chunkY4IXQFWLcjs.codeBlock; exports.codeControls = _chunkY4IXQFWLcjs.codeControls; exports.codeMark = _chunkY4IXQFWLcjs.codeMark; exports.comments = comments; exports.createDragHandle = _chunkY4IXQFWLcjs.createDragHandle; exports.cycleCalloutVariant = _chunkY4IXQFWLcjs.cycleCalloutVariant; exports.decorationExtensions = _chunkY4IXQFWLcjs.decorationExtensions; exports.defaultBlockRenderers = _chunkY4IXQFWLcjs.defaultBlockRenderers; exports.defaultBlockTag = _chunkY4IXQFWLcjs.defaultBlockTag; exports.defaultMarkTag = _chunkY4IXQFWLcjs.defaultMarkTag; exports.diffSpan = _chunkY4IXQFWLcjs.diffSpan; exports.docExtent = _chunkI2LDEVLAcjs.docExtent; exports.domToPoint = _chunkI2LDEVLAcjs.domToPoint; exports.dragHandle = _chunkY4IXQFWLcjs.dragHandle; exports.elementChildren = _chunkI2LDEVLAcjs.elementChildren; exports.embedBlock = _chunkY4IXQFWLcjs.embedBlock; exports.emoji = emoji; exports.emptyGapPara = _chunkY4IXQFWLcjs.emptyGapPara; exports.ensureGaps = _chunkY4IXQFWLcjs.ensureGaps; exports.expandSelectAll = _chunkI2LDEVLAcjs.expandSelectAll; exports.expandToLink = _chunkY4IXQFWLcjs.expandToLink; exports.focusBlockId = _chunkI2LDEVLAcjs.focusBlockId; exports.gapSteps = _chunkY4IXQFWLcjs.gapSteps; exports.getLocale = _chunkI2LDEVLAcjs.getLocale; exports.highlightMark = _chunkY4IXQFWLcjs.highlightMark; exports.history = _chunkY4IXQFWLcjs.history; exports.hrBlock = _chunkY4IXQFWLcjs.hrBlock; exports.htmlToPlainText = _chunkY4IXQFWLcjs.htmlToPlainText; exports.imageBlock = _chunkY4IXQFWLcjs.imageBlock; exports.imageFileFrom = _chunkY4IXQFWLcjs.imageFileFrom; exports.indentItem = _chunkY4IXQFWLcjs.indentItem; exports.inlinePairRule = _chunkY4IXQFWLcjs.inlinePairRule; exports.inputRules = _chunkY4IXQFWLcjs.inputRules; exports.invalidateStructure = _chunkI2LDEVLAcjs.invalidateStructure; exports.invisibleCharacters = invisibleCharacters; exports.isAtom = _chunkY4IXQFWLcjs.isAtom; exports.isBareUrl = _chunkY4IXQFWLcjs.isBareUrl; exports.isCellBlockKind = _chunkY4IXQFWLcjs.isCellBlockKind; exports.isOpaque = _chunkY4IXQFWLcjs.isOpaque; exports.isProgressiveSelectUnit = _chunkI2LDEVLAcjs.isProgressiveSelectUnit; exports.isSafeLinkUrl = _chunkY4IXQFWLcjs.isSafeLinkUrl; exports.isSelectUnit = _chunkI2LDEVLAcjs.isSelectUnit; exports.isSelectUnitType = _chunkI2LDEVLAcjs.isSelectUnitType; exports.italicMark = _chunkY4IXQFWLcjs.italicMark; exports.joinPrevList = _chunkY4IXQFWLcjs.joinPrevList; exports.keepsApart = _chunkY4IXQFWLcjs.keepsApart; exports.leafBlockPath = _chunkY4IXQFWLcjs.leafBlockPath; exports.leafText = _chunkY4IXQFWLcjs.leafText; exports.lineBoundaryBack = _chunkY4IXQFWLcjs.lineBoundaryBack; exports.lineBoundaryFwd = _chunkY4IXQFWLcjs.lineBoundaryFwd; exports.linkMark = _chunkY4IXQFWLcjs.linkMark; exports.linkTip = _chunkY4IXQFWLcjs.linkTip; exports.mapInput = _chunkY4IXQFWLcjs.mapInput; exports.mapPaste = _chunkY4IXQFWLcjs.mapPaste; exports.mapPasteBlocks = _chunkY4IXQFWLcjs.mapPasteBlocks; exports.markExtensions = _chunkY4IXQFWLcjs.markExtensions; exports.markdownLinkRule = _chunkY4IXQFWLcjs.markdownLinkRule; exports.markloomKit = _chunkY4IXQFWLcjs.markloomKit; exports.marksAtCaret = _chunkY4IXQFWLcjs.marksAtCaret; exports.matchInlinePair = _chunkY4IXQFWLcjs.matchInlinePair; exports.mentionMenu = _chunkY4IXQFWLcjs.mentionMenu; exports.mergeTextStyleAttrs = _chunkY4IXQFWLcjs.mergeTextStyleAttrs; exports.nearestListPath = _chunkY4IXQFWLcjs.nearestListPath; exports.nodeExtent = _chunkI2LDEVLAcjs.nodeExtent; exports.normalizeLinkUrl = _chunkY4IXQFWLcjs.normalizeLinkUrl; exports.openEditorAsync = openEditorAsync; exports.outdentItem = _chunkY4IXQFWLcjs.outdentItem; exports.parseTypedLink = _chunkY4IXQFWLcjs.parseTypedLink; exports.parseTypedUrl = _chunkY4IXQFWLcjs.parseTypedUrl; exports.pointToDom = _chunkI2LDEVLAcjs.pointToDom; exports.progressiveUnitPaths = _chunkI2LDEVLAcjs.progressiveUnitPaths; exports.projectDoc = _chunkY4IXQFWLcjs.projectDoc; exports.readSelection = _chunkI2LDEVLAcjs.readSelection; exports.renderCode = _chunkY4IXQFWLcjs.renderCode; exports.renderDoc = _chunkY4IXQFWLcjs.renderDoc; exports.renderEmbed = _chunkY4IXQFWLcjs.renderEmbed; exports.renderHr = _chunkY4IXQFWLcjs.renderHr; exports.renderImage = _chunkY4IXQFWLcjs.renderImage; exports.renderTable = _chunkY4IXQFWLcjs.renderTable; exports.renderToHtml = _chunkY4IXQFWLcjs.renderToHtml; exports.resolve = _chunkY4IXQFWLcjs.resolve; exports.resolvePaste = _chunkY4IXQFWLcjs.resolvePaste; exports.rootEl = _chunkI2LDEVLAcjs.rootEl; exports.safeCssValue = _chunkOVHASRIDcjs.safeCssValue; exports.selectUnitPath = _chunkI2LDEVLAcjs.selectUnitPath; exports.selectionCovers = _chunkI2LDEVLAcjs.selectionCovers; exports.serializeBlock = _chunkY4IXQFWLcjs.serializeBlock; exports.serializeSelection = _chunkY4IXQFWLcjs.serializeSelection; exports.setAlign = _chunkY4IXQFWLcjs.setAlign; exports.setCalloutVariant = _chunkY4IXQFWLcjs.setCalloutVariant; exports.setHeadingDepth = _chunkY4IXQFWLcjs.setHeadingDepth; exports.setListType = _chunkY4IXQFWLcjs.setListType; exports.setLocale = _chunkI2LDEVLAcjs.setLocale; exports.setTextStyle = _chunkY4IXQFWLcjs.setTextStyle; exports.shikiCodeView = shikiCodeView; exports.slashMenu = _chunkY4IXQFWLcjs.slashMenu; exports.soloImgFromHtml = _chunkY4IXQFWLcjs.soloImgFromHtml; exports.soloImgSrcFromHtml = _chunkY4IXQFWLcjs.soloImgSrcFromHtml; exports.startAiWrite = _chunkI2LDEVLAcjs.startAiWrite; exports.strikeMark = _chunkY4IXQFWLcjs.strikeMark; exports.subscriptMark = _chunkY4IXQFWLcjs.subscriptMark; exports.suggest = _chunkY4IXQFWLcjs.suggest; exports.superscriptMark = _chunkY4IXQFWLcjs.superscriptMark; exports.tableAbove = _chunkY4IXQFWLcjs.tableAbove; exports.tableBlock = _chunkY4IXQFWLcjs.tableBlock; exports.textAlign = _chunkY4IXQFWLcjs.textAlign; exports.textStyleCss = _chunkY4IXQFWLcjs.textStyleCss; exports.textStyleMark = _chunkY4IXQFWLcjs.textStyleMark; exports.toggleMark = _chunkY4IXQFWLcjs.toggleMark; exports.toggleMarkList = _chunkY4IXQFWLcjs.toggleMarkList; exports.tryEmbed = _chunkY4IXQFWLcjs.tryEmbed; exports.tryHtmlBlocks = _chunkY4IXQFWLcjs.tryHtmlBlocks; exports.tryImageFile = _chunkY4IXQFWLcjs.tryImageFile; exports.tryImageUrl = _chunkY4IXQFWLcjs.tryImageUrl; exports.tryLinkMark = _chunkY4IXQFWLcjs.tryLinkMark; exports.tryLiteral = _chunkY4IXQFWLcjs.tryLiteral; exports.tryMarkdown = _chunkY4IXQFWLcjs.tryMarkdown; exports.twitchChannel = _chunkY4IXQFWLcjs.twitchChannel; exports.typography = typography; exports.typoraKeys = typoraKeys; exports.underlineMark = _chunkY4IXQFWLcjs.underlineMark; exports.urlAutolink = _chunkY4IXQFWLcjs.urlAutolink; exports.urlAutolinkRule = _chunkY4IXQFWLcjs.urlAutolinkRule; exports.wordBoundaryBack = _chunkY4IXQFWLcjs.wordBoundaryBack; exports.wordBoundaryFwd = _chunkY4IXQFWLcjs.wordBoundaryFwd; exports.wrapList = _chunkY4IXQFWLcjs.wrapList; exports.writeSelection = _chunkI2LDEVLAcjs.writeSelection; exports.youtubeId = _chunkY4IXQFWLcjs.youtubeId;
@@ -1,16 +1,31 @@
1
- import { N as NodeView, l as Extension } from '../controller-BIOO_XKJ.cjs';
2
- export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as projectDoc, ad as renderCode, ae as renderDoc, af as renderEmbed, ag as renderHr, ah as renderImage, ai as renderTable, aj as renderToHtml, ak as resolve, al as safeCssValue, am as serializeBlock, an as serializeSelection, ao as setAlign, ap as setCalloutVariant, aq as setTextStyle, s as startAiWrite, ar as textStyleCss, as as toggleMark, at as toggleMarkList, au as twitchChannel, av as wordBoundaryBack, aw as wordBoundaryFwd, ax as wrapList, ay as youtubeId } from '../controller-BIOO_XKJ.cjs';
3
- import { E as ElementNode, S as Selection, a as Position, N as Node } from '../types-COUweEav.cjs';
4
- import { S as Step, a as DocVersion } from '../versions-9mG1epfB.cjs';
5
- import { C as CommentAuthor, c as CommentThread, b as CommentRenderState, T as TextMatch, e as SuggestAuthor, g as SuggestKind } from '../suggest-BkGGiPKA.cjs';
1
+ import { N as NodeView, E as EditorOptions, k as Editor, l as Extension } from '../controller-CHznEhAR.cjs';
2
+ export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, n as Autofocus, B as BlockInputRule, o as BlockKind, p as BlockRenderCtx, q as BlockRenderer, r as BlockVnodeCache, C as CALLOUT_VARIANTS, t as CalloutVariant, D as DecorationFactory, u as DecorationHost, v as DiagramResolver, w as DiagramState, I as INLINE_PAIRS, x as InlineDeco, y as InlinePairHit, z as InputResult, F as InputRuleCtx, G as Intent, K as KeymapCommand, H as KeymapCtx, J as KeymapResult, L as MentionCandidate, O as MentionHost, P as MentionMenu, Q as MentionPopovers, R as MentionPopoversHost, S as MentionProfile, T as NodeViewCtx, U as PasteRule, V as RenderOpts, W as Resolved, X as SlashCommand, Y as TextStylePatch, Z as TypedLink, _ as TypedUrl, $ as atomIsSelected, a0 as autofocusSelection, h as blockPlainText, a1 as blockTransform, a2 as blockTransformRange, a3 as calloutVariantFromQuery, a4 as caret, a5 as chord, a6 as clearMarks, a7 as cycleCalloutVariant, a8 as defaultBlockRenderers, a9 as defaultBlockTag, aa as defaultMarkTag, ab as diffSpan, ac as expandToLink, j as focusBlockId, ad as indentItem, ae as inlinePairRule, af as isAtom, ag as isCellBlockKind, ah as isOpaque, ai as joinPrevList, aj as keepsApart, ak as leafBlockPath, al as leafText, am as lineBoundaryBack, an as lineBoundaryFwd, ao as mapInput, ap as mapPaste, aq as mapPasteBlocks, ar as markdownLinkRule, as as marksAtCaret, at as matchInlinePair, au as mergeTextStyleAttrs, av as nearestListPath, aw as outdentItem, ax as parseTypedLink, ay as parseTypedUrl, az as projectDoc, aA as renderCode, aB as renderDoc, aC as renderEmbed, aD as renderHr, aE as renderImage, aF as renderTable, aG as renderToHtml, aH as resolve, aI as safeCssValue, aJ as serializeBlock, aK as serializeSelection, aL as setAlign, aM as setCalloutVariant, aN as setHeadingDepth, aO as setListType, aP as setTextStyle, s as startAiWrite, aQ as tableAbove, aR as textStyleCss, aS as toggleMark, aT as toggleMarkList, aU as twitchChannel, aV as urlAutolink, aW as urlAutolinkRule, aX as wordBoundaryBack, aY as wordBoundaryFwd, aZ as wrapList, a_ as youtubeId } from '../controller-CHznEhAR.cjs';
3
+ import { E as ElementNode, S as Selection, a as Position, N as Node, P as Path } from '../types-BkHlmUFL.cjs';
4
+ import { S as Step, a as DocVersion } from '../versions-DNFf8zVz.cjs';
5
+ import { C as CommentAuthor, c as CommentThread, b as CommentRenderState, T as TextMatch, e as SuggestAuthor, g as SuggestKind } from '../word-count-DNLn1h_t.cjs';
6
6
  import 'preact';
7
- import '../client-DAth8pPq.cjs';
7
+ import '../client-Ciy7Fa_k.cjs';
8
+
9
+ declare function isSafeLinkUrl(url: string): boolean;
10
+ declare function linkTip(mark: {
11
+ attrs?: Record<string, unknown>;
12
+ }, url: string): string;
8
13
 
9
14
  declare function shikiCodeView(highlight: (code: string, lang?: string) => string, langs?: () => string[]): NodeView;
10
15
 
11
16
  declare function rootEl(root: HTMLElement): HTMLElement;
17
+ declare function nodeExtent(doc: ElementNode, nodePath?: Path): Selection | null;
12
18
  declare function docExtent(doc: ElementNode): Selection | null;
19
+ declare const SELECT_UNIT_TYPES: readonly ["code", "quote"];
20
+ type SelectUnitType = (typeof SELECT_UNIT_TYPES)[number];
21
+ declare function isSelectUnitType(type: string): boolean;
22
+ declare function isSelectUnit(n: Node): boolean;
23
+ /** 渐进全选可停层:内容 unit + 表结构(cell/table)。 */
24
+ declare function isProgressiveSelectUnit(n: Node): boolean;
25
+ declare function progressiveUnitPaths(doc: ElementNode, caretPath: Path): Path[];
26
+ declare function selectUnitPath(doc: ElementNode, caretPath: Path): Path | null;
13
27
  declare function selectionCovers(sel: Selection, extent: Selection): boolean;
28
+ declare function expandSelectAll(doc: ElementNode, sel: Selection | null): Selection | null;
14
29
  declare function pointToDom(root: HTMLElement, doc: ElementNode, pos: Position): {
15
30
  node: Node;
16
31
  offset: number;
@@ -20,8 +35,19 @@ declare function readSelection(root: HTMLElement, doc: ElementNode): Selection |
20
35
  declare function writeSelection(root: HTMLElement, doc: ElementNode, selection: Selection, opts?: {
21
36
  scroll?: boolean;
22
37
  }): void;
38
+ declare function invalidateStructure(keep?: HTMLElement | null): void;
23
39
  declare function elementChildren(el: HTMLElement): HTMLElement[];
24
40
 
41
+ /**
42
+ * opaque 块四周补可落光标真空 paragraph(纯函数,无 DOM)。
43
+ * Editor 初始化 / 派批后调用;md 序列化剥合成段(见 md trimSynthGapPara)。
44
+ */
45
+
46
+ declare function emptyGapPara(id: string): ElementNode;
47
+ declare function ensureGaps(doc: ElementNode, newId: () => string): ElementNode;
48
+ /** 与 ensureGaps 同判据,产 spliceChildren 批(自高位到低位)。 */
49
+ declare function gapSteps(after: ElementNode, newId: () => string): Step[];
50
+
25
51
  type PasteContext = {
26
52
  inCode: boolean;
27
53
  selCollapsed: boolean;
@@ -77,6 +103,11 @@ declare const tryImageUrl: PasteFormat;
77
103
  * 带文字的富图文返 null,走 blocks。
78
104
  */
79
105
  declare function soloImgSrcFromHtml(html: string | undefined): string | null;
106
+ /** 同上,连 alt 一起返(落成 `![alt](url)`,alt 不丢)。 */
107
+ declare function soloImgFromHtml(html: string | undefined): {
108
+ src: string;
109
+ alt: string;
110
+ } | null;
80
111
 
81
112
  declare const tryLinkMark: PasteFormat;
82
113
  /** trim 后无空白,http(s):// 起头。词法扫。 */
@@ -90,6 +121,24 @@ declare const tryMarkdown: PasteFormat;
90
121
 
91
122
  declare function resolvePaste(ctx: PasteContext, clip: PasteClipboard): PastePlan;
92
123
 
124
+ declare const ASYNC_MIN_BYTES: number;
125
+ interface OpenAsyncOptions extends EditorOptions {
126
+ /** 每片解析/渲染最多占主线程多久(毫秒),默认 8。 */
127
+ budgetMs?: number;
128
+ /** 铺 DOM 每片的目标耗时(默认 25):片内是一次同步 layout,比解析片贵,放宽它换更短的总时间。 */
129
+ layoutMs?: number;
130
+ /** 先给出的开头预览有多少个块,默认 200(一屏多)。 */
131
+ headBlocks?: number;
132
+ signal?: AbortSignal;
133
+ }
134
+ interface OpenedEditor {
135
+ /** 立刻可用(只读预览),载完后变可编辑。 */
136
+ editor: Editor;
137
+ /** 整篇载入并可编辑后 resolve,值是整篇文档。被 signal 取消则 reject AbortError。 */
138
+ loaded: Promise<ElementNode>;
139
+ }
140
+ declare function openEditorAsync(root: HTMLElement, md: string, opts?: OpenAsyncOptions): Promise<OpenedEditor>;
141
+
93
142
  declare function markloomKit(): Extension[];
94
143
 
95
144
  declare const boldMark: Extension;
@@ -102,6 +151,7 @@ declare const superscriptMark: Extension;
102
151
  declare const subscriptMark: Extension;
103
152
  declare const linkMark: Extension;
104
153
  declare const textStyleMark: Extension;
154
+ declare const clearFormatting: Extension;
105
155
  declare const markExtensions: Extension[];
106
156
 
107
157
  declare const tableBlock: Extension;
@@ -125,6 +175,8 @@ declare const suggest: Extension;
125
175
 
126
176
  declare const textAlign: Extension;
127
177
 
178
+ declare const typoraKeys: Extension;
179
+
128
180
  interface CommentPanelHost {
129
181
  root: HTMLElement;
130
182
  doc: () => ElementNode;
@@ -203,7 +255,9 @@ interface AskPopoverOpts {
203
255
  /** @deprecated 用 AskPopoverOpts;保留别名 */
204
256
  type AskLinkPopoverOpts = Pick<AskPopoverOpts, 'anchor' | 'placeholder' | 'defaultValue' | 'confirmLabel'>;
205
257
  declare function askInput(opts: AskInputOpts): Promise<string | null>;
206
- /** 无协议时补 https://;空串原样返回 */
258
+ /** 无协议时补 https://;空串原样返回。
259
+ * 危险 scheme(javascript:/data:/vbscript:)原样返回、不补 https——避免「钉成 https://javascript:…」被当链接。
260
+ */
207
261
  declare function normalizeLinkUrl(raw: string): string;
208
262
  declare function askPopover(opts: AskPopoverOpts): Promise<string | null>;
209
263
  /** 链接专用:补协议 + 单行 */
@@ -213,10 +267,23 @@ declare function closeAskInput(): void;
213
267
 
214
268
  declare const history: Extension;
215
269
 
270
+ /** 浮条上哪些控件显示,缺省全开(逐字节同旧行为)。关掉的不渲染;一个都不剩的块不出浮条。 */
271
+ interface DragHandleOptions {
272
+ /** 普通块的「+」(下方插入内容) */
273
+ add?: boolean;
274
+ /** 六点拖柄 */
275
+ grip?: boolean;
276
+ /** 标题块的「H1…H6」标记(拖拽 + 悬停格式) */
277
+ kind?: boolean;
278
+ /** 标题块的折叠箭头 */
279
+ fold?: boolean;
280
+ }
281
+
216
282
  declare const codeControls: Extension;
217
283
  declare const bubbleMenu: Extension;
218
284
  declare const slashMenu: Extension;
219
285
  declare const mentionMenu: Extension;
286
+ declare const createDragHandle: (opts?: DragHandleOptions) => Extension;
220
287
  declare const dragHandle: Extension;
221
288
  declare const decorationExtensions: Extension[];
222
289
 
@@ -243,7 +310,7 @@ declare class TocPanel {
243
310
  private onRedraw;
244
311
  private onScroll;
245
312
  private onResize;
246
- private refresh;
313
+ refresh(): void;
247
314
  /** 留白挂在滚动容器上(在全部子节点之后),避免夹在正文与页脚/prev-next 之间 */
248
315
  private padTarget;
249
316
  /**
@@ -269,6 +336,8 @@ type SearchBarHost = {
269
336
  dispatch: (steps: Step[], selectionAfter?: Selection) => void;
270
337
  readonly: () => boolean;
271
338
  focusMatch: (m: TextMatch) => void;
339
+ /** 文档里标出每一处命中(current = 当前那一个的下标,没有 = -1;空数组 = 清掉) */
340
+ setHits: (hits: TextMatch[], current: number) => void;
272
341
  };
273
342
  declare class SearchBar {
274
343
  private host;
@@ -346,4 +415,8 @@ declare class SuggestBar {
346
415
  private paint;
347
416
  }
348
417
 
349
- export { type AskInputOpts, type AskLinkPopoverOpts, type AskPopoverOpts, CommentPanel, type CommentPanelHost, Extension, NodeView, type PasteClipboard, type PasteContext, type PasteFormat, type PastePlan, SearchBar, type SearchBarHost, SuggestBar, type SuggestBarHost, TocPanel, type TocPanelHost, VersionsPanel, type VersionsPanelHost, askInput, askLinkPopover, askPopover, blockExtensions, boldMark, bubbleMenu, clipboardFromDataTransfer, closeAskInput, codeBlock, codeControls, codeMark, comments, decorationExtensions, docExtent, domToPoint, dragHandle, elementChildren, embedBlock, emoji, highlightMark, history, hrBlock, htmlToPlainText, imageBlock, imageFileFrom, inputRules, invisibleCharacters, isBareUrl, italicMark, linkMark, markExtensions, markloomKit, mentionMenu, normalizeLinkUrl, pointToDom, readSelection, resolvePaste, rootEl, selectionCovers, shikiCodeView, slashMenu, soloImgSrcFromHtml, strikeMark, subscriptMark, suggest, superscriptMark, tableBlock, textAlign, textStyleMark, tryEmbed, tryHtmlBlocks, tryImageFile, tryImageUrl, tryLinkMark, tryLiteral, tryMarkdown, typography, underlineMark, writeSelection };
418
+ type Locale = 'zh' | 'en';
419
+ declare function setLocale(l: Locale): void;
420
+ declare function getLocale(): Locale;
421
+
422
+ export { ASYNC_MIN_BYTES, type AskInputOpts, type AskLinkPopoverOpts, type AskPopoverOpts, CommentPanel, type CommentPanelHost, type DragHandleOptions, Editor, EditorOptions, Extension, type Locale, NodeView, type OpenAsyncOptions, type OpenedEditor, type PasteClipboard, type PasteContext, type PasteFormat, type PastePlan, SELECT_UNIT_TYPES, SearchBar, type SearchBarHost, type SelectUnitType, SuggestBar, type SuggestBarHost, TocPanel, type TocPanelHost, VersionsPanel, type VersionsPanelHost, askInput, askLinkPopover, askPopover, blockExtensions, boldMark, bubbleMenu, clearFormatting, clipboardFromDataTransfer, closeAskInput, codeBlock, codeControls, codeMark, comments, createDragHandle, decorationExtensions, docExtent, domToPoint, dragHandle, elementChildren, embedBlock, emoji, emptyGapPara, ensureGaps, expandSelectAll, gapSteps, getLocale, highlightMark, history, hrBlock, htmlToPlainText, imageBlock, imageFileFrom, inputRules, invalidateStructure, invisibleCharacters, isBareUrl, isProgressiveSelectUnit, isSafeLinkUrl, isSelectUnit, isSelectUnitType, italicMark, linkMark, linkTip, markExtensions, markloomKit, mentionMenu, nodeExtent, normalizeLinkUrl, openEditorAsync, pointToDom, progressiveUnitPaths, readSelection, resolvePaste, rootEl, selectUnitPath, selectionCovers, setLocale, shikiCodeView, slashMenu, soloImgFromHtml, soloImgSrcFromHtml, strikeMark, subscriptMark, suggest, superscriptMark, tableBlock, textAlign, textStyleMark, tryEmbed, tryHtmlBlocks, tryImageFile, tryImageUrl, tryLinkMark, tryLiteral, tryMarkdown, typography, typoraKeys, underlineMark, writeSelection };