@fileverse-dev/ddoc 6.0.0-drop-in.3 → 6.0.1-dist-slim.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/README.md +18 -89
- package/dist/data-BCRDUrcS.mjs +59842 -0
- package/dist/ddoc-persistence-DLdSviUr.mjs +371 -0
- package/dist/headless-editor-utils.es.js +1 -1
- package/dist/index--ObnXdbg.mjs +14053 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +10734 -21551
- package/dist/markdown-source-pane-BJbpMXo2.mjs +143 -0
- package/dist/package/components/editor-toolbar.d.ts +1 -2
- package/dist/package/components/fullscreen-toolbar.d.ts +2 -2
- package/dist/package/components/mobile-toolbar.d.ts +1 -2
- package/dist/package/components/tabs/document-mobile-tab-panel.d.ts +1 -3
- package/dist/package/components/tabs/document-tabs-sidebar.d.ts +1 -2
- package/dist/package/components/toc/document-outline.d.ts +1 -1
- package/dist/package/components/toc/toc.d.ts +1 -1
- package/dist/package/components/toc/types.d.ts +0 -7
- package/dist/package/extensions/emoji/components/emoji-utils.d.ts +2 -2
- package/dist/package/hooks/use-export-headless-editor-content.d.ts +6 -2
- package/dist/package/hooks/use-focus-mode.d.ts +3 -1
- package/dist/package/hooks/use-headless-editor.d.ts +12 -4
- package/dist/package/hooks/use-tab-editor.d.ts +1 -4
- package/dist/package/hooks/use-tab-manager.d.ts +3 -1
- package/dist/package/hooks/use-yjs-setup.d.ts +7 -1
- package/dist/package/persistence/compaction.d.ts +27 -0
- package/dist/package/persistence/content-fingerprint.d.ts +27 -0
- package/dist/package/persistence/ddoc-persistence.d.ts +96 -0
- package/dist/package/persistence/index.d.ts +2 -0
- package/dist/package/persistence/provider-lifecycle.d.ts +37 -0
- package/dist/package/sync-local/SyncManager.d.ts +8 -1
- package/dist/package/sync-local/types/index.d.ts +2 -0
- package/dist/package/types.d.ts +25 -43
- package/dist/package/use-ddoc-editor.d.ts +1 -3
- package/dist/package/utils/responsive.d.ts +1 -3
- package/dist/persistence.d.ts +1 -0
- package/dist/persistence.es.js +10 -0
- package/dist/{split-view-toolbar-NTimkQK1.mjs → split-view-toolbar-6aBSjsO2.mjs} +47 -46
- package/dist/style.css +1 -1
- package/dist/tab-utils-BNFvrUAj.mjs +284 -0
- package/dist/use-headless-editor-fZCM6BjV.mjs +43828 -0
- package/package.json +11 -4
- package/tailwind.preset.cjs +0 -42
- package/dist/index-eP_xxZsk.mjs +0 -13126
- package/dist/markdown-source-pane-D-8OmL1r.mjs +0 -6069
- package/dist/package/components/editor-navbar.d.ts +0 -12
- package/dist/package/hooks/use-canvas-metrics.d.ts +0 -16
- package/dist/package/hooks/use-controllable-state.d.ts +0 -3
- package/dist/package/hooks/use-editor-media-query.d.ts +0 -4
- package/dist/package/utils/container-query-support.d.ts +0 -1
- package/dist/package/utils/editor-width-store.d.ts +0 -6
- package/dist/package/utils/stats-publisher.d.ts +0 -8
- package/dist/use-headless-editor-KdKS6vWp.mjs +0 -162186
package/dist/package/types.d.ts
CHANGED
|
@@ -116,13 +116,6 @@ export interface DocumentStyling {
|
|
|
116
116
|
*/
|
|
117
117
|
customCSS?: string;
|
|
118
118
|
}
|
|
119
|
-
export type DdocStats = {
|
|
120
|
-
words: number;
|
|
121
|
-
characters: number;
|
|
122
|
-
selectedWords: number;
|
|
123
|
-
/** null until the active tab has been measured. */
|
|
124
|
-
pages: number | null;
|
|
125
|
-
};
|
|
126
119
|
export interface DdocProps extends CommentAccountProps {
|
|
127
120
|
/**
|
|
128
121
|
* Optional catalog of fonts available to the editor in addition to the
|
|
@@ -159,8 +152,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
159
152
|
fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
|
|
160
153
|
disableInlineComment?: boolean;
|
|
161
154
|
commentDrawerOpen?: boolean;
|
|
162
|
-
onCommentDrawerOpenChange?: (open: boolean) => void;
|
|
163
|
-
/** @deprecated Use onCommentDrawerOpenChange. */
|
|
164
155
|
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
|
165
156
|
initialComments?: IComment[];
|
|
166
157
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
@@ -174,8 +165,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
174
165
|
onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
175
166
|
onDeleteReply?: (activeCommentId: string, replyId: string) => void;
|
|
176
167
|
showTOC?: boolean;
|
|
177
|
-
onShowTOCChange?: (show: boolean) => void;
|
|
178
|
-
/** @deprecated Use onShowTOCChange. */
|
|
179
168
|
setShowTOC?: React.Dispatch<SetStateAction<boolean>>;
|
|
180
169
|
extensions?: Record<string, Extension | any>;
|
|
181
170
|
selectedTags?: TagType[];
|
|
@@ -185,19 +174,13 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
185
174
|
inlineCommentData?: InlineCommentData;
|
|
186
175
|
setInlineCommentData?: React.Dispatch<React.SetStateAction<InlineCommentData>>;
|
|
187
176
|
theme?: ThemeKey;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
setZoomLevel?: React.Dispatch<SetStateAction<string>>;
|
|
193
|
-
/** Defaults to true when omitted. */
|
|
194
|
-
isNavbarVisible?: boolean;
|
|
195
|
-
onNavbarVisibleChange?: (visible: boolean) => void;
|
|
196
|
-
/** @deprecated Use onNavbarVisibleChange. */
|
|
197
|
-
setIsNavbarVisible?: React.Dispatch<SetStateAction<boolean>>;
|
|
177
|
+
zoomLevel: string;
|
|
178
|
+
setZoomLevel: React.Dispatch<SetStateAction<string>>;
|
|
179
|
+
isNavbarVisible: boolean;
|
|
180
|
+
setIsNavbarVisible: React.Dispatch<SetStateAction<boolean>>;
|
|
198
181
|
editorCanvasClassNames?: string;
|
|
199
182
|
isCommentSectionOpen?: boolean;
|
|
200
|
-
isPreviewMode
|
|
183
|
+
isPreviewMode: boolean;
|
|
201
184
|
viewerMode?: 'suggest' | 'view-only';
|
|
202
185
|
ensResolutionUrl?: string;
|
|
203
186
|
/**
|
|
@@ -222,13 +205,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
222
205
|
walletAddress?: string | null;
|
|
223
206
|
username?: string | null;
|
|
224
207
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
225
|
-
/**
|
|
226
|
-
* Host element to render the navbar into. Omit to render it as the editor's
|
|
227
|
-
* first row. Pass null while the element is not attached yet.
|
|
228
|
-
*/
|
|
229
|
-
navbarContainer?: HTMLElement | null;
|
|
230
|
-
/** Show the toolbar's navbar collapse chevron. Default true. */
|
|
231
|
-
showNavbarToggle?: boolean;
|
|
232
208
|
renderNavbar?: ({ editor, liveEditor, }: {
|
|
233
209
|
/** JSON snapshot — legacy field, unchanged. */
|
|
234
210
|
editor: JSONContent;
|
|
@@ -236,6 +212,24 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
236
212
|
liveEditor: Editor | null;
|
|
237
213
|
}) => JSX.Element;
|
|
238
214
|
onChange?: (updatedDocContent: string | JSONContent, updateChunk: string) => void;
|
|
215
|
+
/**
|
|
216
|
+
* Called when the document changes, from the same places as `onChange`
|
|
217
|
+
* (after typing pauses, on a flushed structural change, and when a
|
|
218
|
+
* collaborator's update arrives), but with no arguments. A host that passes
|
|
219
|
+
* this and not `onChange` never pays for encoding the whole document on
|
|
220
|
+
* every change. A host that keeps the content elsewhere (the package's
|
|
221
|
+
* y-indexeddb store) only needs to know that an edit happened.
|
|
222
|
+
*/
|
|
223
|
+
onLocalChange?: () => void;
|
|
224
|
+
/**
|
|
225
|
+
* Whether this is a brand-new document. When omitted the editor derives it
|
|
226
|
+
* as "owner, no collaboration, no `initialContent`". A host that loads an
|
|
227
|
+
* existing document from the package's y-indexeddb store passes no
|
|
228
|
+
* `initialContent`, so it must pass `false` here: a new document is stamped
|
|
229
|
+
* with the preferred schema version, which would relabel an existing older
|
|
230
|
+
* document.
|
|
231
|
+
*/
|
|
232
|
+
isNewDocument?: boolean;
|
|
239
233
|
onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
|
|
240
234
|
onTextSelection?: (data: IEditorSelectionData) => void;
|
|
241
235
|
onCommentInteraction?: (data: IEditorSelectionData) => void;
|
|
@@ -248,15 +242,9 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
248
242
|
*/
|
|
249
243
|
enableFanficTemplate?: boolean;
|
|
250
244
|
onError?: (error: string) => void;
|
|
251
|
-
/** Active-tab stats. Fires with all four fields whenever one changes. */
|
|
252
|
-
onStatsChange?: (stats: DdocStats) => void;
|
|
253
|
-
/** @deprecated Use onStatsChange. */
|
|
254
245
|
setCharacterCount?: React.Dispatch<SetStateAction<number>>;
|
|
255
|
-
/** @deprecated Use onStatsChange. */
|
|
256
246
|
setWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
257
|
-
/** @deprecated Use onStatsChange. */
|
|
258
247
|
setSelectedWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
259
|
-
/** @deprecated Use onStatsChange. */
|
|
260
248
|
setPageCount?: React.Dispatch<SetStateAction<number>>;
|
|
261
249
|
tags?: Array<{
|
|
262
250
|
name: string;
|
|
@@ -265,17 +253,12 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
265
253
|
className?: string;
|
|
266
254
|
unFocused?: boolean;
|
|
267
255
|
isPresentationMode?: boolean;
|
|
268
|
-
onPresentationModeChange?: (active: boolean) => void;
|
|
269
|
-
/** @deprecated Use onPresentationModeChange. */
|
|
270
256
|
setIsPresentationMode?: React.Dispatch<SetStateAction<boolean>>;
|
|
271
257
|
/** Split View: edit markdown on the left, see the read-only ddoc render on the right. */
|
|
272
258
|
isSplitView?: boolean;
|
|
273
|
-
onSplitViewChange?: (active: boolean) => void;
|
|
274
|
-
/** @deprecated Use onSplitViewChange. */
|
|
275
259
|
setIsSplitView?: React.Dispatch<SetStateAction<boolean>>;
|
|
276
260
|
onComment?: () => void;
|
|
277
261
|
onInlineComment?: () => void;
|
|
278
|
-
/** @deprecated Use onFocusModeChange. Still fires on every change. */
|
|
279
262
|
onFocusMode?: (isFocusMode: boolean) => void;
|
|
280
263
|
/** Controlled focus mode (D6). Omit for the legacy internal-state behavior. */
|
|
281
264
|
isFocusMode?: boolean;
|
|
@@ -301,7 +284,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
301
284
|
renderToolbarLeading?: () => React.ReactNode;
|
|
302
285
|
metadataProxyUrl?: string;
|
|
303
286
|
onCopyHeadingLink?: (link: string) => void;
|
|
304
|
-
/** @deprecated No effect. The host footer sits outside the editor. */
|
|
305
287
|
footerHeight?: string;
|
|
306
288
|
activeModel?: CustomModel;
|
|
307
289
|
maxTokens?: number;
|
|
@@ -312,8 +294,8 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
312
294
|
*/
|
|
313
295
|
documentStyling?: DocumentStyling;
|
|
314
296
|
/**
|
|
315
|
-
* Callback when IndexedDB
|
|
316
|
-
* @description Called when the IndexedDB persistence provider fails to initialize (e.g., private browsing, quota exceeded,
|
|
297
|
+
* Callback when local saving to IndexedDB has a problem
|
|
298
|
+
* @description Called when the IndexedDB persistence provider fails to initialize (e.g., private browsing, corrupted DB), when a save is rejected (e.g., quota exceeded), when the browser closes or another tab deletes the database (the editor detaches from it), and when a corrupt store was repaired on load. The editor keeps working in memory; `refreshYjsIndexedDbProvider` attaches again and saves what it holds.
|
|
317
299
|
*/
|
|
318
300
|
onIndexedDbError?: (error: Error) => void;
|
|
319
301
|
/**
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { DdocProps } from './types';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { DBlockRuntimeState } from './extensions/d-block/dblock-runtime';
|
|
4
|
-
import { EditorWidthStore } from './utils/editor-width-store';
|
|
5
4
|
|
|
6
|
-
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount,
|
|
5
|
+
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onLocalChange, isNewDocument, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors, isPreviewEditor, fonts, preferredSchemaVersion, onSchemaStampGuard, ...rest }: Partial<DdocProps> & {
|
|
7
6
|
isFocusMode?: boolean;
|
|
8
7
|
isPreviewEditor?: boolean;
|
|
9
|
-
editorWidthStore?: EditorWidthStore;
|
|
10
8
|
}) => {
|
|
11
9
|
ydoc: import('yjs').Doc;
|
|
12
10
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './package/persistence';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { D as n, a as o, d as D, g as a, m as r, r as d, b as C } from "./ddoc-persistence-DLdSviUr.mjs";
|
|
2
|
+
export {
|
|
3
|
+
n as DDOC_STORE_REPAIRED,
|
|
4
|
+
o as DEFAULT_DDOC_PERSISTENCE_TIMEOUT_MS,
|
|
5
|
+
D as deleteDdocContent,
|
|
6
|
+
a as getDdocContentFingerprint,
|
|
7
|
+
r as mergeDdocContent,
|
|
8
|
+
d as readDdocContent,
|
|
9
|
+
C as repairDdocContent
|
|
10
|
+
};
|
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
import { jsx as m, jsxs as L } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as D, useState as E, useEffect as A } from "react";
|
|
3
3
|
import { DynamicDropdown as P, Tooltip as O, IconButton as T } from "@fileverse/ui";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
t.
|
|
4
|
+
import { EditorSelection as R } from "@codemirror/state";
|
|
5
|
+
import { redo as _, undo as w } from "@codemirror/commands";
|
|
6
|
+
const p = (e, t, o = t) => {
|
|
7
|
+
const { state: i } = e, l = i.changeByRange((n) => {
|
|
8
|
+
const d = i.sliceDoc(n.from, n.to), r = i.sliceDoc(
|
|
9
|
+
Math.max(0, n.from - t.length),
|
|
10
|
+
n.from
|
|
10
11
|
), u = i.sliceDoc(
|
|
11
|
-
|
|
12
|
-
Math.min(i.doc.length,
|
|
12
|
+
n.to,
|
|
13
|
+
Math.min(i.doc.length, n.to + o.length)
|
|
13
14
|
);
|
|
14
|
-
if (r ===
|
|
15
|
+
if (r === t && u === o)
|
|
15
16
|
return {
|
|
16
17
|
changes: [
|
|
17
|
-
{ from:
|
|
18
|
-
{ from:
|
|
18
|
+
{ from: n.from - t.length, to: n.from, insert: "" },
|
|
19
|
+
{ from: n.to, to: n.to + o.length, insert: "" }
|
|
19
20
|
],
|
|
20
21
|
range: R.range(
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
n.from - t.length,
|
|
23
|
+
n.to - t.length
|
|
23
24
|
)
|
|
24
25
|
};
|
|
25
|
-
const b =
|
|
26
|
+
const b = t + d + o;
|
|
26
27
|
return {
|
|
27
|
-
changes: { from:
|
|
28
|
+
changes: { from: n.from, to: n.to, insert: b },
|
|
28
29
|
range: R.range(
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
n.from + t.length,
|
|
31
|
+
n.from + t.length + d.length
|
|
31
32
|
)
|
|
32
33
|
};
|
|
33
34
|
});
|
|
34
35
|
e.dispatch(i.update(l, { scrollIntoView: !0 })), e.focus();
|
|
35
|
-
}, B = (e,
|
|
36
|
+
}, B = (e, t) => {
|
|
36
37
|
const { state: o } = e, i = [], l = /* @__PURE__ */ new Set();
|
|
37
|
-
for (const
|
|
38
|
-
let d =
|
|
38
|
+
for (const n of o.selection.ranges) {
|
|
39
|
+
let d = n.from;
|
|
39
40
|
for (; ; ) {
|
|
40
41
|
const r = o.doc.lineAt(d);
|
|
41
42
|
if (!l.has(r.number)) {
|
|
42
43
|
l.add(r.number);
|
|
43
|
-
const u =
|
|
44
|
+
const u = t(r.text, r.from);
|
|
44
45
|
u && i.push(u);
|
|
45
46
|
}
|
|
46
|
-
if (r.to >=
|
|
47
|
+
if (r.to >= n.to) break;
|
|
47
48
|
d = r.to + 1;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
i.length && e.dispatch(o.update({ changes: i, scrollIntoView: !0 })), e.focus();
|
|
51
|
-
}, y = (e,
|
|
52
|
+
}, y = (e, t) => B(
|
|
52
53
|
e,
|
|
53
|
-
(o, i) => o.startsWith(
|
|
54
|
-
), z = (e,
|
|
55
|
-
const o = "#".repeat(
|
|
54
|
+
(o, i) => o.startsWith(t) ? { from: i, to: i + t.length, insert: "" } : { from: i, insert: t }
|
|
55
|
+
), z = (e, t) => {
|
|
56
|
+
const o = "#".repeat(t) + " ";
|
|
56
57
|
return B(e, (i, l) => {
|
|
57
|
-
const
|
|
58
|
-
return
|
|
58
|
+
const n = i.match(/^(#{1,6})\s/);
|
|
59
|
+
return n && n[1].length === t ? { from: l, to: l + n[0].length, insert: "" } : n ? { from: l, to: l + n[0].length, insert: o } : { from: l, insert: o };
|
|
59
60
|
});
|
|
60
|
-
}, f = (e,
|
|
61
|
+
}, f = (e, t) => {
|
|
61
62
|
const { state: o } = e, i = o.selection.main, r = `${o.doc.lineAt(i.from).text.trim() === "" ? "" : `
|
|
62
63
|
|
|
63
|
-
`}${
|
|
64
|
+
`}${t}
|
|
64
65
|
`;
|
|
65
66
|
e.dispatch(
|
|
66
67
|
o.update({
|
|
@@ -69,19 +70,19 @@ const p = (e, n, o = n) => {
|
|
|
69
70
|
scrollIntoView: !0
|
|
70
71
|
})
|
|
71
72
|
), e.focus();
|
|
72
|
-
}, G = (e,
|
|
73
|
+
}, G = (e, t) => {
|
|
73
74
|
const { state: o } = e, i = o.changeByRange((l) => {
|
|
74
|
-
const
|
|
75
|
+
const n = o.sliceDoc(l.from, l.to) || "text", d = t ?? "url", r = `[${n}](${d})`, u = l.from + 1 + n.length + 2;
|
|
75
76
|
return {
|
|
76
77
|
changes: { from: l.from, to: l.to, insert: r },
|
|
77
78
|
range: R.range(u, u + d.length)
|
|
78
79
|
};
|
|
79
80
|
});
|
|
80
81
|
e.dispatch(o.update(i, { scrollIntoView: !0 })), e.focus();
|
|
81
|
-
}, K = (e,
|
|
82
|
-
const o = `<img src="${
|
|
82
|
+
}, K = (e, t) => {
|
|
83
|
+
const o = `<img src="${t.src}" media-type="secure-img" encryptionKey="${t.encryptionKey}" nonce="${t.nonce}" ipfsUrl="${t.ipfsUrl}" ipfsHash="${t.ipfsHash}" version="2" authTag="${t.authTag}" mimeType="${t.mimeType}" />`;
|
|
83
84
|
f(e, o);
|
|
84
|
-
}, M = (e,
|
|
85
|
+
}, M = (e, t) => f(e, `<img src="${t}" media-type="img" />`), W = `| Column 1 | Column 2 |
|
|
85
86
|
| -------- | -------- |
|
|
86
87
|
| | |`, c = {
|
|
87
88
|
bold: (e) => p(e, "**"),
|
|
@@ -89,7 +90,7 @@ const p = (e, n, o = n) => {
|
|
|
89
90
|
strike: (e) => p(e, "~~"),
|
|
90
91
|
inlineCode: (e) => p(e, "`"),
|
|
91
92
|
underline: (e) => p(e, "<u>", "</u>"),
|
|
92
|
-
heading: (e,
|
|
93
|
+
heading: (e, t) => z(e, t),
|
|
93
94
|
bulletList: (e) => y(e, "- "),
|
|
94
95
|
orderedList: (e) => y(e, "1. "),
|
|
95
96
|
taskList: (e) => y(e, "- [ ] "),
|
|
@@ -97,7 +98,7 @@ const p = (e, n, o = n) => {
|
|
|
97
98
|
codeBlock: (e) => f(e, "```\n\n```"),
|
|
98
99
|
horizontalRule: (e) => f(e, "---"),
|
|
99
100
|
table: (e) => f(e, W),
|
|
100
|
-
link: (e,
|
|
101
|
+
link: (e, t) => G(e, t),
|
|
101
102
|
undo: (e) => {
|
|
102
103
|
w(e), e.focus();
|
|
103
104
|
},
|
|
@@ -105,7 +106,7 @@ const p = (e, n, o = n) => {
|
|
|
105
106
|
_(e), e.focus();
|
|
106
107
|
},
|
|
107
108
|
// Highlight → inline HTML (round-trips via our turndown/DOMPurify rules).
|
|
108
|
-
highlight: (e,
|
|
109
|
+
highlight: (e, t) => t ? p(e, `<mark style="background-color: ${t}">`, "</mark>") : p(e, "<mark>", "</mark>")
|
|
109
110
|
}, H = [
|
|
110
111
|
[
|
|
111
112
|
{ icon: "Undo", label: "Undo", run: (e) => c.undo(e) },
|
|
@@ -188,9 +189,9 @@ const p = (e, n, o = n) => {
|
|
|
188
189
|
}
|
|
189
190
|
]
|
|
190
191
|
], $ = 3, V = H.slice(0, $), U = H.slice($), S = "!h-6 !w-6 !min-w-0", j = 560, C = () => /* @__PURE__ */ m("div", { className: "w-[1px] h-4 vertical-divider mx-1" });
|
|
191
|
-
function
|
|
192
|
+
function J({
|
|
192
193
|
view: e,
|
|
193
|
-
ipfsImageUploadFn:
|
|
194
|
+
ipfsImageUploadFn: t,
|
|
194
195
|
onError: o
|
|
195
196
|
}) {
|
|
196
197
|
const i = (s) => {
|
|
@@ -200,8 +201,8 @@ function X({
|
|
|
200
201
|
const h = (x = a.files) == null ? void 0 : x[0];
|
|
201
202
|
if (!(!h || !h.type.includes("image/")))
|
|
202
203
|
try {
|
|
203
|
-
if (
|
|
204
|
-
const g = await
|
|
204
|
+
if (t) {
|
|
205
|
+
const g = await t(h);
|
|
205
206
|
K(s, {
|
|
206
207
|
src: URL.createObjectURL(h),
|
|
207
208
|
ipfsUrl: g.ipfsUrl,
|
|
@@ -228,9 +229,9 @@ function X({
|
|
|
228
229
|
return;
|
|
229
230
|
}
|
|
230
231
|
s.run(a);
|
|
231
|
-
},
|
|
232
|
+
}, n = D(null), [d, r] = E(!1);
|
|
232
233
|
A(() => {
|
|
233
|
-
const s =
|
|
234
|
+
const s = n.current;
|
|
234
235
|
if (!s || typeof ResizeObserver > "u") return;
|
|
235
236
|
const a = () => r(s.clientWidth < j);
|
|
236
237
|
a();
|
|
@@ -254,7 +255,7 @@ function X({
|
|
|
254
255
|
return /* @__PURE__ */ m("div", { className: "flex items-center px-2 py-2 border-b color-border-default shrink-0", children: /* @__PURE__ */ L(
|
|
255
256
|
"div",
|
|
256
257
|
{
|
|
257
|
-
ref:
|
|
258
|
+
ref: n,
|
|
258
259
|
className: "flex items-center gap-0.5 flex-1 min-w-0 overflow-hidden",
|
|
259
260
|
children: [
|
|
260
261
|
V.map((s, a) => b(s, a > 0)),
|
|
@@ -285,5 +286,5 @@ function X({
|
|
|
285
286
|
) });
|
|
286
287
|
}
|
|
287
288
|
export {
|
|
288
|
-
|
|
289
|
+
J as default
|
|
289
290
|
};
|