markloom 0.5.1 → 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.
- package/PACKAGES.md +26 -0
- package/README.md +20 -2
- package/collab.md +60 -13
- package/dist/ai/index.cjs +5 -4
- package/dist/ai/index.d.cts +5 -4
- package/dist/ai/index.d.ts +5 -4
- package/dist/ai/index.js +4 -3
- package/dist/ai/theme.css +66 -102
- package/dist/{chunk-ZMTLSFLO.js → chunk-4Q7PAR2T.js} +5746 -1341
- package/dist/chunk-75EJ4ARB.cjs +642 -0
- package/dist/{chunk-JS527FDV.cjs → chunk-BMPCVT3B.cjs} +47 -39
- package/dist/{chunk-RLTHVQNQ.js → chunk-EFYT2223.js} +47 -39
- package/dist/chunk-HXABDVLZ.cjs +297 -0
- package/dist/{chunk-YIFOGP2D.cjs → chunk-I2LDEVLA.cjs} +499 -102
- package/dist/chunk-MQLRZQZL.js +642 -0
- package/dist/chunk-OVHASRID.cjs +4279 -0
- package/dist/chunk-PCSVBPOR.cjs +40 -0
- package/dist/{chunk-FCH7LZFI.js → chunk-PSAXWBNM.js} +450 -53
- package/dist/chunk-PZRWTLLB.cjs +858 -0
- package/dist/chunk-QO7JEZDB.js +4279 -0
- package/dist/chunk-WSJUXPAG.js +40 -0
- package/dist/{chunk-VXM7Q6P5.cjs → chunk-Y4IXQFWL.cjs} +6026 -1621
- package/dist/chunk-YLVSMDIO.js +858 -0
- package/dist/chunk-ZL6WT6OY.js +297 -0
- package/dist/client-BvvyHjhh.d.ts +250 -0
- package/dist/client-Ciy7Fa_k.d.cts +250 -0
- package/dist/collab/index.cjs +17 -4
- package/dist/collab/index.d.cts +18 -7
- package/dist/collab/index.d.ts +18 -7
- package/dist/collab/index.js +19 -6
- package/dist/{controller-DQITsFhy.d.cts → controller-CHznEhAR.d.cts} +277 -26
- package/dist/{controller-BNuuUM3E.d.ts → controller-DLqI8_jm.d.ts} +277 -26
- package/dist/index.cjs +119 -7
- package/dist/index.d.cts +138 -6
- package/dist/index.d.ts +138 -6
- package/dist/index.js +130 -18
- package/dist/io/index.cjs +1412 -0
- package/dist/io/index.d.cts +33 -0
- package/dist/io/index.d.ts +33 -0
- package/dist/io/index.js +1412 -0
- package/dist/react/index.cjs +9 -8
- package/dist/react/index.d.cts +5 -4
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +8 -7
- package/dist/{rebase-batch-8rL_aXEE.d.ts → rebase-batch-CSnv8FKp.d.ts} +11 -9
- package/dist/{rebase-batch-bYnBJpRO.d.cts → rebase-batch-DO1ygkx9.d.cts} +11 -9
- package/dist/types-BkHlmUFL.d.cts +34 -0
- package/dist/types-BkHlmUFL.d.ts +34 -0
- package/dist/versions-DNFf8zVz.d.cts +51 -0
- package/dist/versions-DOkOyh2J.d.ts +51 -0
- package/dist/view/index.cjs +259 -17
- package/dist/view/index.d.cts +277 -12
- package/dist/view/index.d.ts +277 -12
- package/dist/view/index.js +256 -14
- package/dist/view/theme.css +2093 -1577
- package/dist/word-count-BPw9G2Bg.d.ts +130 -0
- package/dist/word-count-DNLn1h_t.d.cts +130 -0
- package/io.md +38 -0
- package/package.json +25 -4
- package/dist/chunk-4JSJAHTB.js +0 -255
- package/dist/chunk-4TMHVNL6.cjs +0 -2297
- package/dist/chunk-ALZ3A5CS.cjs +0 -255
- package/dist/chunk-GQ2HHRGI.cjs +0 -16
- package/dist/chunk-LA5SBCGQ.js +0 -16
- package/dist/chunk-LEYAQNJA.js +0 -220
- package/dist/chunk-MFYF2A6U.js +0 -2297
- package/dist/chunk-YXQDCW4Y.cjs +0 -220
- package/dist/client-6KiH4kGK.d.ts +0 -144
- package/dist/client-ZRZj2nkq.d.cts +0 -144
- package/dist/comments-DlExS6f-.d.cts +0 -43
- package/dist/comments-PhnR7Gkn.d.ts +0 -43
- package/dist/step-BrvHIK7O.d.cts +0 -65
- package/dist/step-BrvHIK7O.d.ts +0 -65
package/dist/view/index.d.cts
CHANGED
|
@@ -1,22 +1,144 @@
|
|
|
1
|
-
import { N as NodeView, l as Extension } from '../controller-
|
|
2
|
-
export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule,
|
|
3
|
-
import { E as ElementNode,
|
|
4
|
-
import {
|
|
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';
|
|
5
6
|
import 'preact';
|
|
6
|
-
import '../client-
|
|
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;
|
|
7
13
|
|
|
8
14
|
declare function shikiCodeView(highlight: (code: string, lang?: string) => string, langs?: () => string[]): NodeView;
|
|
9
15
|
|
|
10
16
|
declare function rootEl(root: HTMLElement): HTMLElement;
|
|
17
|
+
declare function nodeExtent(doc: ElementNode, nodePath?: Path): Selection | null;
|
|
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;
|
|
27
|
+
declare function selectionCovers(sel: Selection, extent: Selection): boolean;
|
|
28
|
+
declare function expandSelectAll(doc: ElementNode, sel: Selection | null): Selection | null;
|
|
11
29
|
declare function pointToDom(root: HTMLElement, doc: ElementNode, pos: Position): {
|
|
12
30
|
node: Node;
|
|
13
31
|
offset: number;
|
|
14
32
|
} | null;
|
|
15
33
|
declare function domToPoint(root: HTMLElement, doc: ElementNode, container: globalThis.Node, domOffset: number): Position | null;
|
|
16
34
|
declare function readSelection(root: HTMLElement, doc: ElementNode): Selection | null;
|
|
17
|
-
declare function writeSelection(root: HTMLElement, doc: ElementNode, selection: Selection
|
|
35
|
+
declare function writeSelection(root: HTMLElement, doc: ElementNode, selection: Selection, opts?: {
|
|
36
|
+
scroll?: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
declare function invalidateStructure(keep?: HTMLElement | null): void;
|
|
18
39
|
declare function elementChildren(el: HTMLElement): HTMLElement[];
|
|
19
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
|
+
|
|
51
|
+
type PasteContext = {
|
|
52
|
+
inCode: boolean;
|
|
53
|
+
selCollapsed: boolean;
|
|
54
|
+
emptyTopPara: boolean;
|
|
55
|
+
};
|
|
56
|
+
type PasteClipboard = {
|
|
57
|
+
plain: string;
|
|
58
|
+
html: string;
|
|
59
|
+
imageFile: File | null;
|
|
60
|
+
};
|
|
61
|
+
/** 互斥 plan。resolve 产出其一,editor 只 apply。 */
|
|
62
|
+
type PastePlan = {
|
|
63
|
+
kind: 'noop';
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'literal';
|
|
66
|
+
text: string;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'image-file';
|
|
69
|
+
file: File;
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'image-url';
|
|
72
|
+
url: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'link-mark';
|
|
75
|
+
url: string;
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'embed';
|
|
78
|
+
embedKind: 'youtube' | 'twitch';
|
|
79
|
+
url: string;
|
|
80
|
+
} | {
|
|
81
|
+
kind: 'blocks';
|
|
82
|
+
blocks: ElementNode[];
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'markdown';
|
|
85
|
+
text: string;
|
|
86
|
+
};
|
|
87
|
+
/** 格式探测:命中返 Plan,未命中返 null(交给下一优先级)。 */
|
|
88
|
+
type PasteFormat = (ctx: PasteContext, clip: PasteClipboard) => PastePlan | null;
|
|
89
|
+
|
|
90
|
+
/** DataTransfer → 统一载荷。测试可直构造 PasteClipboard。 */
|
|
91
|
+
declare function clipboardFromDataTransfer(dt: DataTransfer | null | undefined): PasteClipboard;
|
|
92
|
+
/** 剪贴板第一个 image/* 文件。 */
|
|
93
|
+
declare function imageFileFrom(dt: DataTransfer | null | undefined): File | null;
|
|
94
|
+
|
|
95
|
+
declare const tryLiteral: PasteFormat;
|
|
96
|
+
/** 无 plain 时从 html 抽可见文本,不塞标签。 */
|
|
97
|
+
declare function htmlToPlainText(html: string): string;
|
|
98
|
+
|
|
99
|
+
declare const tryImageFile: PasteFormat;
|
|
100
|
+
declare const tryImageUrl: PasteFormat;
|
|
101
|
+
/**
|
|
102
|
+
* text/html 整体就是一个 <img>(无旁路文本)→ src。
|
|
103
|
+
* 带文字的富图文返 null,走 blocks。
|
|
104
|
+
*/
|
|
105
|
+
declare function soloImgSrcFromHtml(html: string | undefined): string | null;
|
|
106
|
+
/** 同上,连 alt 一起返(落成 ``,alt 不丢)。 */
|
|
107
|
+
declare function soloImgFromHtml(html: string | undefined): {
|
|
108
|
+
src: string;
|
|
109
|
+
alt: string;
|
|
110
|
+
} | null;
|
|
111
|
+
|
|
112
|
+
declare const tryLinkMark: PasteFormat;
|
|
113
|
+
/** trim 后无空白,http(s):// 起头。词法扫。 */
|
|
114
|
+
declare function isBareUrl(s: string): boolean;
|
|
115
|
+
|
|
116
|
+
declare const tryEmbed: PasteFormat;
|
|
117
|
+
|
|
118
|
+
declare const tryHtmlBlocks: PasteFormat;
|
|
119
|
+
|
|
120
|
+
declare const tryMarkdown: PasteFormat;
|
|
121
|
+
|
|
122
|
+
declare function resolvePaste(ctx: PasteContext, clip: PasteClipboard): PastePlan;
|
|
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
|
+
|
|
20
142
|
declare function markloomKit(): Extension[];
|
|
21
143
|
|
|
22
144
|
declare const boldMark: Extension;
|
|
@@ -29,6 +151,7 @@ declare const superscriptMark: Extension;
|
|
|
29
151
|
declare const subscriptMark: Extension;
|
|
30
152
|
declare const linkMark: Extension;
|
|
31
153
|
declare const textStyleMark: Extension;
|
|
154
|
+
declare const clearFormatting: Extension;
|
|
32
155
|
declare const markExtensions: Extension[];
|
|
33
156
|
|
|
34
157
|
declare const tableBlock: Extension;
|
|
@@ -48,8 +171,12 @@ declare const invisibleCharacters: Extension;
|
|
|
48
171
|
|
|
49
172
|
declare const comments: Extension;
|
|
50
173
|
|
|
174
|
+
declare const suggest: Extension;
|
|
175
|
+
|
|
51
176
|
declare const textAlign: Extension;
|
|
52
177
|
|
|
178
|
+
declare const typoraKeys: Extension;
|
|
179
|
+
|
|
53
180
|
interface CommentPanelHost {
|
|
54
181
|
root: HTMLElement;
|
|
55
182
|
doc: () => ElementNode;
|
|
@@ -106,26 +233,57 @@ interface AskInputOpts {
|
|
|
106
233
|
/** 返回错误文案则拦确认;返回 null 放行 */
|
|
107
234
|
validate?: (value: string) => string | null;
|
|
108
235
|
}
|
|
109
|
-
interface
|
|
236
|
+
interface AskPopoverOpts {
|
|
110
237
|
/** 锚点选区/按钮 rect;可传函数在定位时再取 */
|
|
111
238
|
anchor: DOMRect | (() => DOMRect);
|
|
112
239
|
placeholder?: string;
|
|
113
240
|
defaultValue?: string;
|
|
114
241
|
confirmLabel?: string;
|
|
242
|
+
ariaLabel?: string;
|
|
243
|
+
multiline?: boolean;
|
|
244
|
+
/** 等宽字体(公式) */
|
|
245
|
+
mono?: boolean;
|
|
246
|
+
/** 输入区宽(px),默认 280 / multiline 320 */
|
|
247
|
+
width?: number;
|
|
248
|
+
rows?: number;
|
|
249
|
+
validate?: (value: string) => string | null;
|
|
250
|
+
/** 确认前变换(链接补协议) */
|
|
251
|
+
normalize?: (value: string) => string;
|
|
252
|
+
/** 允许空串确认;默认 false */
|
|
253
|
+
allowEmpty?: boolean;
|
|
115
254
|
}
|
|
255
|
+
/** @deprecated 用 AskPopoverOpts;保留别名 */
|
|
256
|
+
type AskLinkPopoverOpts = Pick<AskPopoverOpts, 'anchor' | 'placeholder' | 'defaultValue' | 'confirmLabel'>;
|
|
116
257
|
declare function askInput(opts: AskInputOpts): Promise<string | null>;
|
|
117
|
-
/** 无协议时补 https
|
|
258
|
+
/** 无协议时补 https://;空串原样返回。
|
|
259
|
+
* 危险 scheme(javascript:/data:/vbscript:)原样返回、不补 https——避免「钉成 https://javascript:…」被当链接。
|
|
260
|
+
*/
|
|
118
261
|
declare function normalizeLinkUrl(raw: string): string;
|
|
262
|
+
declare function askPopover(opts: AskPopoverOpts): Promise<string | null>;
|
|
263
|
+
/** 链接专用:补协议 + 单行 */
|
|
119
264
|
declare function askLinkPopover(opts: AskLinkPopoverOpts): Promise<string | null>;
|
|
120
265
|
/** 测试/销毁:关掉当前弹层 */
|
|
121
266
|
declare function closeAskInput(): void;
|
|
122
267
|
|
|
123
268
|
declare const history: Extension;
|
|
124
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
|
+
|
|
125
282
|
declare const codeControls: Extension;
|
|
126
283
|
declare const bubbleMenu: Extension;
|
|
127
284
|
declare const slashMenu: Extension;
|
|
128
285
|
declare const mentionMenu: Extension;
|
|
286
|
+
declare const createDragHandle: (opts?: DragHandleOptions) => Extension;
|
|
129
287
|
declare const dragHandle: Extension;
|
|
130
288
|
declare const decorationExtensions: Extension[];
|
|
131
289
|
|
|
@@ -135,23 +293,130 @@ interface TocPanelHost {
|
|
|
135
293
|
}
|
|
136
294
|
declare class TocPanel {
|
|
137
295
|
private host;
|
|
296
|
+
private shell;
|
|
138
297
|
private rail;
|
|
139
298
|
private open;
|
|
140
299
|
private activeId;
|
|
141
300
|
private entries;
|
|
142
301
|
private scrollRoot;
|
|
302
|
+
private parentEl;
|
|
303
|
+
private fill;
|
|
304
|
+
private padEl;
|
|
305
|
+
/** 判定线:滚动容器顶 + 偏移;jump / sync 共用 */
|
|
306
|
+
private markOffset;
|
|
143
307
|
constructor(host: TocPanelHost);
|
|
144
308
|
destroy(): void;
|
|
145
309
|
setOpen(open: boolean): void;
|
|
146
|
-
private setPadOpen;
|
|
147
310
|
private onRedraw;
|
|
148
|
-
private refresh;
|
|
149
311
|
private onScroll;
|
|
150
|
-
|
|
312
|
+
private onResize;
|
|
313
|
+
refresh(): void;
|
|
314
|
+
/** 留白挂在滚动容器上(在全部子节点之后),避免夹在正文与页脚/prev-next 之间 */
|
|
315
|
+
private padTarget;
|
|
316
|
+
/**
|
|
317
|
+
* 文末可滚空间:让最后一个标题也能对齐顶线。
|
|
318
|
+
* 有了它,慢滚 / 点末项都走同一套「越过顶线」规则,无需触底特判。
|
|
319
|
+
*/
|
|
320
|
+
private ensureEndScrollRoom;
|
|
321
|
+
private clearEndScrollRoom;
|
|
151
322
|
private syncActive;
|
|
152
323
|
private headingEl;
|
|
153
324
|
private jump;
|
|
325
|
+
/**
|
|
326
|
+
* 长目录时 TOC 自身是滚轴:正文 scroll-spy 换了 active,
|
|
327
|
+
* 若该项在目录视口外则只滚 TOC 容器,不带动正文。
|
|
328
|
+
*/
|
|
329
|
+
private revealActiveInRail;
|
|
330
|
+
private paint;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
type SearchBarHost = {
|
|
334
|
+
root: HTMLElement;
|
|
335
|
+
doc: () => ElementNode;
|
|
336
|
+
dispatch: (steps: Step[], selectionAfter?: Selection) => void;
|
|
337
|
+
readonly: () => boolean;
|
|
338
|
+
focusMatch: (m: TextMatch) => void;
|
|
339
|
+
/** 文档里标出每一处命中(current = 当前那一个的下标,没有 = -1;空数组 = 清掉) */
|
|
340
|
+
setHits: (hits: TextMatch[], current: number) => void;
|
|
341
|
+
};
|
|
342
|
+
declare class SearchBar {
|
|
343
|
+
private host;
|
|
344
|
+
private el;
|
|
345
|
+
private open_;
|
|
346
|
+
private q;
|
|
347
|
+
private r;
|
|
348
|
+
private caseSensitive;
|
|
349
|
+
private hits;
|
|
350
|
+
private idx;
|
|
351
|
+
constructor(host: SearchBarHost);
|
|
352
|
+
open(): void;
|
|
353
|
+
close(): void;
|
|
354
|
+
get isOpen(): boolean;
|
|
355
|
+
destroy(): void;
|
|
356
|
+
rescan(): void;
|
|
357
|
+
private refresh;
|
|
358
|
+
private go;
|
|
359
|
+
private doReplaceOne;
|
|
360
|
+
private doReplaceAll;
|
|
361
|
+
private paint;
|
|
362
|
+
private onBarKey;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
type VersionsPanelHost = {
|
|
366
|
+
root: HTMLElement;
|
|
367
|
+
doc: () => ElementNode;
|
|
368
|
+
list: () => DocVersion[];
|
|
369
|
+
save: (name?: string) => DocVersion;
|
|
370
|
+
restore: (id: string) => boolean;
|
|
371
|
+
remove: (id: string) => boolean;
|
|
372
|
+
readonly: () => boolean;
|
|
373
|
+
};
|
|
374
|
+
declare class VersionsPanel {
|
|
375
|
+
private host;
|
|
376
|
+
private el;
|
|
377
|
+
private open;
|
|
378
|
+
private onRedraw;
|
|
379
|
+
constructor(host: VersionsPanelHost);
|
|
380
|
+
destroy(): void;
|
|
381
|
+
show(): void;
|
|
382
|
+
hide(): void;
|
|
383
|
+
toggle(): void;
|
|
384
|
+
private onKey;
|
|
154
385
|
private paint;
|
|
155
386
|
}
|
|
156
387
|
|
|
157
|
-
|
|
388
|
+
type SuggestBarHost = {
|
|
389
|
+
root: HTMLElement;
|
|
390
|
+
doc: () => ElementNode;
|
|
391
|
+
dispatch: (steps: Step[], selectionAfter?: Selection) => void;
|
|
392
|
+
markSel: () => Selection | null;
|
|
393
|
+
author: () => SuggestAuthor;
|
|
394
|
+
newId: () => string;
|
|
395
|
+
readonly: () => boolean;
|
|
396
|
+
tracking: () => boolean;
|
|
397
|
+
setTracking: (on: boolean) => void;
|
|
398
|
+
};
|
|
399
|
+
declare class SuggestBar {
|
|
400
|
+
private host;
|
|
401
|
+
private el;
|
|
402
|
+
private open;
|
|
403
|
+
private onRedraw;
|
|
404
|
+
constructor(host: SuggestBarHost);
|
|
405
|
+
destroy(): void;
|
|
406
|
+
show(): void;
|
|
407
|
+
hide(): void;
|
|
408
|
+
toggle(): void;
|
|
409
|
+
rescan(): void;
|
|
410
|
+
/** 选区标建议(insert|delete) */
|
|
411
|
+
markSelection(kind: SuggestKind): boolean;
|
|
412
|
+
accept(id: string): void;
|
|
413
|
+
reject(id: string): void;
|
|
414
|
+
private onKey;
|
|
415
|
+
private paint;
|
|
416
|
+
}
|
|
417
|
+
|
|
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 };
|