@fileverse-dev/ddoc 4.1.12-menubar-3 → 4.1.12-menubar-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-DwLAI_Ie.mjs → index-DWI3-T75.mjs} +41885 -41602
- package/dist/{index-BWdjUdQy.mjs → index-DvBqPqhC.mjs} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +8 -6
- package/dist/{markdown-source-pane-D6jRN_JD.mjs → markdown-source-pane-BywaJO6j.mjs} +2 -2
- package/dist/package/components/split-view/split-view-css-accordion.d.ts +13 -0
- package/dist/package/components/split-view/split-view-markdown-pane.d.ts +3 -1
- package/dist/package/extensions/mardown-paste-handler/index.d.ts +5 -0
- package/dist/package/hooks/use-editor-commands.d.ts +1 -1
- package/dist/package/stores/comment-store-provider.d.ts +3 -1
- package/dist/package/stores/comment-store.d.ts +15 -0
- package/dist/package/types.d.ts +11 -0
- package/dist/package/utils/make-editor.d.ts +9 -0
- package/dist/package/utils/sanitize-css.d.ts +45 -0
- package/dist/package/utils/selection-utils.d.ts +35 -0
- package/dist/{split-view-toolbar-D4bIgxWm.mjs → split-view-toolbar-Ikwoly83.mjs} +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as Ql, b as Zl, s as eh } from "./index-
|
|
1
|
+
import { k as Ql, b as Zl, s as eh } from "./index-DWI3-T75.mjs";
|
|
2
2
|
let An = [], Xr = [];
|
|
3
3
|
(() => {
|
|
4
4
|
let s = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e) => e ? parseInt(e, 36) : 1);
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { useEditorCommands } from './package/hooks/use-editor-commands';
|
|
|
7
7
|
export type { EditorCommand, EditorCommandId, UseEditorCommandsOptions, } from './package/hooks/use-editor-commands';
|
|
8
8
|
export { useExportHeadlessEditorContent } from './package/hooks/use-export-headless-editor-content';
|
|
9
9
|
export { mergeTabAwareYjsUpdates } from './package/components/tabs/utils/tab-utils';
|
|
10
|
+
export { validateCustomCss, sanitizeCustomCss, } from './package/utils/sanitize-css';
|
|
11
|
+
export type { CssDiagnostic, CssValidationResult, } from './package/utils/sanitize-css';
|
|
10
12
|
export { buildVersionDiffSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
|
|
11
13
|
export type { DdocExportModalProps, ExportFormatOption, ExportTabOption, } from './package/components/export-modal';
|
|
12
14
|
export type { VersionTabSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
|
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { D as e, a as o, E as
|
|
1
|
+
import { D as e, a as o, E as t, P as d, f as r, h as i, m as n, e as E, c as m, d as u, u as C, v as l } from "./index-DWI3-T75.mjs";
|
|
2
2
|
export {
|
|
3
3
|
e as DdocEditor,
|
|
4
4
|
o as DdocExportModal,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
t as Editor,
|
|
6
|
+
d as PreviewDdocEditor,
|
|
7
7
|
r as buildVersionDiffSnapshot,
|
|
8
8
|
i as handleContentPrint,
|
|
9
9
|
n as mergeTabAwareYjsUpdates,
|
|
10
|
-
E as
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
E as sanitizeCustomCss,
|
|
11
|
+
m as useEditorCommands,
|
|
12
|
+
u as useExportHeadlessEditorContent,
|
|
13
|
+
C as useHeadlessEditor,
|
|
14
|
+
l as validateCustomCss
|
|
13
15
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Vr = Object.defineProperty;
|
|
2
2
|
var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: O }) : t[e] = O;
|
|
3
3
|
var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
|
|
4
|
-
import { j as Cr } from "./index-
|
|
4
|
+
import { j as Cr } from "./index-DWI3-T75.mjs";
|
|
5
5
|
import { useRef as pe, useEffect as St } from "react";
|
|
6
|
-
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-
|
|
6
|
+
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-DvBqPqhC.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface SplitViewCssAccordionProps {
|
|
2
|
+
/** The document's custom CSS (raw author selectors). */
|
|
3
|
+
customCSS?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Split View LEFT pane: a collapsible, READ-ONLY view of the document's custom
|
|
7
|
+
* CSS, shown above the markdown source. Custom CSS is edited in the styling
|
|
8
|
+
* palette (the single source of truth), not in the markdown pane — this is a
|
|
9
|
+
* transparency affordance so the author can see what CSS is applied while in
|
|
10
|
+
* markdown mode. Renders nothing when there is no custom CSS.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SplitViewCssAccordion: ({ customCSS, }: SplitViewCssAccordionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -6,6 +6,8 @@ interface SplitViewMarkdownPaneProps {
|
|
|
6
6
|
/** Same uploader the editor uses — for the markdown toolbar's Image button. */
|
|
7
7
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
8
8
|
onError?: (error: string) => void;
|
|
9
|
+
/** Document custom CSS — shown read-only in a collapsible accordion. */
|
|
10
|
+
customCSS?: string;
|
|
9
11
|
/** Sizing for the resizable split (flex-grow set by the draggable splitter). */
|
|
10
12
|
style?: React.CSSProperties;
|
|
11
13
|
}
|
|
@@ -15,5 +17,5 @@ interface SplitViewMarkdownPaneProps {
|
|
|
15
17
|
* real ddoc editor itself — see ddoc-editor.tsx, which keeps that editor mounted
|
|
16
18
|
* in place (never a second <EditorContent>) so its React node views survive.
|
|
17
19
|
*/
|
|
18
|
-
export declare const SplitViewMarkdownPane: ({ markdown, onMarkdownChange, ipfsImageUploadFn, onError, style, }: SplitViewMarkdownPaneProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const SplitViewMarkdownPane: ({ markdown, onMarkdownChange, ipfsImageUploadFn, onError, customCSS, style, }: SplitViewMarkdownPaneProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -7,6 +7,11 @@ export declare const turndownService: TurndownService;
|
|
|
7
7
|
export declare const setMarkdownInlineStyles: (enabled: boolean) => void;
|
|
8
8
|
export declare const setResolveColorVars: (enabled: boolean) => void;
|
|
9
9
|
declare module '@tiptap/core' {
|
|
10
|
+
interface Storage {
|
|
11
|
+
markdownPasteHandler: {
|
|
12
|
+
customCSS: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
10
15
|
interface Commands {
|
|
11
16
|
uploadMarkdownFile: {
|
|
12
17
|
uploadMarkdownFile: (ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, onError?: (error: string) => void) => any;
|
|
@@ -7,7 +7,7 @@ export type EditorCommand = {
|
|
|
7
7
|
isEnabled: boolean;
|
|
8
8
|
current?: string | null;
|
|
9
9
|
};
|
|
10
|
-
export type EditorCommandId = 'edit.undo' | 'edit.redo' | 'edit.selectAll' | 'edit.cut' | 'edit.copy' | 'edit.paste' | 'edit.pasteWithoutFormatting' | 'edit.delete' | 'edit.findReplace' | 'insert.image' | 'insert.table' | 'insert.link' | 'insert.callout' | 'insert.quote' | 'insert.code' | 'insert.codeBlock' | 'insert.video' | 'insert.mermaid' | 'insert.plainText' | 'insert.tweet' | 'insert.soundcloud' | 'insert.divider' | 'insert.pageBreak' | 'insert.columns2' | 'insert.columns3' | 'format.bold' | 'format.italic' | 'format.underline' | 'format.strike' | 'format.superscript' | 'format.subscript' | 'format.heading' | 'format.align' | 'format.direction' | 'format.lineHeight' | 'format.fontFamily' | 'format.fontSize.increase' | 'format.fontSize.decrease' | 'format.list.bullet' | 'format.list.numbered' | 'format.list.check' | 'format.clearFormatting' | 'table.addRowAbove' | 'table.addRowBelow' | 'table.mergeCells' | 'table.deleteRow' | 'table.addColumnLeft' | 'table.addColumnRight' | 'table.deleteColumn' | 'table.toggleHeaderRow' | 'table.toggleHeaderColumn' | 'table.toggleHeaderCell' | 'table.deleteTable';
|
|
10
|
+
export type EditorCommandId = 'edit.undo' | 'edit.redo' | 'edit.selectAll' | 'edit.cut' | 'edit.copy' | 'edit.paste' | 'edit.pasteWithoutFormatting' | 'edit.delete' | 'edit.findReplace' | 'insert.image' | 'insert.table' | 'insert.link' | 'insert.comment' | 'insert.callout' | 'insert.quote' | 'insert.code' | 'insert.codeBlock' | 'insert.video' | 'insert.mermaid' | 'insert.plainText' | 'insert.tweet' | 'insert.soundcloud' | 'insert.divider' | 'insert.pageBreak' | 'insert.columns2' | 'insert.columns3' | 'format.bold' | 'format.italic' | 'format.underline' | 'format.strike' | 'format.superscript' | 'format.subscript' | 'format.heading' | 'format.align' | 'format.direction' | 'format.lineHeight' | 'format.fontFamily' | 'format.fontSize.increase' | 'format.fontSize.decrease' | 'format.list.bullet' | 'format.list.numbered' | 'format.list.check' | 'format.clearFormatting' | 'table.addRowAbove' | 'table.addRowBelow' | 'table.mergeCells' | 'table.deleteRow' | 'table.addColumnLeft' | 'table.addColumnRight' | 'table.deleteColumn' | 'table.toggleHeaderRow' | 'table.toggleHeaderColumn' | 'table.toggleHeaderCell' | 'table.deleteTable';
|
|
11
11
|
export type UseEditorCommandsOptions = UploadImageOptions;
|
|
12
12
|
/**
|
|
13
13
|
* Reactive, editor-derived command registry (architecture doc §2 bucket 1).
|
|
@@ -44,9 +44,11 @@ export interface CommentStoreProviderProps {
|
|
|
44
44
|
isConnected?: boolean;
|
|
45
45
|
isLoading?: boolean;
|
|
46
46
|
isDDocOwner?: boolean;
|
|
47
|
+
/** Inline comments usable — see ddoc-editor.tsx's derivation. */
|
|
48
|
+
isInlineCommentAvailable?: boolean;
|
|
47
49
|
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
48
50
|
}
|
|
49
|
-
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onDeleteReply, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, draftAnchorsRef, storeApiRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onDeleteReply, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, draftAnchorsRef, storeApiRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, isInlineCommentAvailable, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
52
|
interface CommentRefsContextType {
|
|
51
53
|
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
52
54
|
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
@@ -108,6 +108,10 @@ export interface CommentStoreState {
|
|
|
108
108
|
isConnected: boolean;
|
|
109
109
|
isLoading: boolean;
|
|
110
110
|
isDDocOwner: boolean;
|
|
111
|
+
/** Inline comments usable at all (not RTC, published, not disabled) —
|
|
112
|
+
* synced from CommentStoreProvider's prop; drives insert.comment
|
|
113
|
+
* enablement in useEditorCommands. */
|
|
114
|
+
isInlineCommentAvailable: boolean;
|
|
111
115
|
onComment: (() => void) | null;
|
|
112
116
|
setCommentDrawerOpen: ((open: boolean) => void) | null;
|
|
113
117
|
connectViaWallet: (() => Promise<void>) | null;
|
|
@@ -146,6 +150,7 @@ export interface CommentStoreState {
|
|
|
146
150
|
setIsConnected: (connected: boolean) => void;
|
|
147
151
|
setIsLoading: (loading: boolean) => void;
|
|
148
152
|
setIsDDocOwner: (isOwner: boolean) => void;
|
|
153
|
+
setIsInlineCommentAvailable: (value: boolean) => void;
|
|
149
154
|
setOnComment: (fn: (() => void) | null) => void;
|
|
150
155
|
setCommentDrawerOpenFn: (fn: ((open: boolean) => void) | null) => void;
|
|
151
156
|
setConnectViaWallet: (fn: (() => Promise<void>) | null) => void;
|
|
@@ -284,4 +289,14 @@ export interface CommentStoreState {
|
|
|
284
289
|
export declare const createCommentStore: () => import('zustand').StoreApi<CommentStoreState>;
|
|
285
290
|
export declare const CommentStoreContext: React.Context<import('zustand').StoreApi<CommentStoreState> | null>;
|
|
286
291
|
export declare function useCommentStore<T>(selector: (state: CommentStoreState) => T): T;
|
|
292
|
+
/**
|
|
293
|
+
* Non-throwing variant of useCommentStore: returns undefined when no
|
|
294
|
+
* CommentStoreProvider is above the caller (e.g. useEditorCommands used
|
|
295
|
+
* outside DdocEditor). The selector's RETURN VALUE must be Object.is-stable
|
|
296
|
+
* for unchanged state (primitives or refs already held by the store) —
|
|
297
|
+
* useSyncExternalStore compares snapshots with Object.is, so a selector
|
|
298
|
+
* that constructs a fresh object/array per call would re-render forever.
|
|
299
|
+
* Selector function identity itself doesn't matter.
|
|
300
|
+
*/
|
|
301
|
+
export declare function useCommentStoreOptional<T>(selector: (state: CommentStoreState) => T): T | undefined;
|
|
287
302
|
export {};
|
package/dist/package/types.d.ts
CHANGED
|
@@ -103,6 +103,17 @@ export interface DocumentStyling {
|
|
|
103
103
|
* @example "portrait" | "landscape"
|
|
104
104
|
*/
|
|
105
105
|
orientation?: 'portrait' | 'landscape';
|
|
106
|
+
/**
|
|
107
|
+
* Custom CSS
|
|
108
|
+
* @description The author's escape hatch for styling the document beyond the
|
|
109
|
+
* structured options above. Write BARE selectors (`h1 { … }`, `p { … }`,
|
|
110
|
+
* `blockquote { … }`) — they are auto-scoped to the document content, so rules
|
|
111
|
+
* can't leak into the toolbar or the host app. Bare top-level declarations
|
|
112
|
+
* (e.g. `background`, `font-family`) style the document surface itself.
|
|
113
|
+
* Applies live in the editor, in preview, and in exports (Markdown/HTML).
|
|
114
|
+
* @example "h1 { letter-spacing: -0.02em } p { line-height: 1.8 }"
|
|
115
|
+
*/
|
|
116
|
+
customCSS?: string;
|
|
106
117
|
}
|
|
107
118
|
export interface DdocProps extends CommentAccountProps {
|
|
108
119
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared jsdom editor factory for unit tests (use-editor-commands.test.tsx,
|
|
5
|
+
* selection-utils.test.ts, ...). Collaboration owns the doc, so content must
|
|
6
|
+
* be set via `setContent` *after* construction — passing `content` to the
|
|
7
|
+
* `Editor` constructor is silently ignored once Collaboration is configured.
|
|
8
|
+
*/
|
|
9
|
+
export declare const makeEditor: (content?: string) => Editor;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitize + scope + validate author-supplied custom CSS before it is injected
|
|
3
|
+
* into the document.
|
|
4
|
+
*
|
|
5
|
+
* Authors write **normal, full-page CSS** — `body { … }`, `html body h1 { … }`,
|
|
6
|
+
* `h1 { … }`, `* { … }` — the way they'd style any web page. We transparently
|
|
7
|
+
* scope every rule to the document so it can't leak into the app, AND we map the
|
|
8
|
+
* page-root selectors (`html`, `body`, `:root`) onto the document root so that
|
|
9
|
+
* `body { background: … }` styles the doc surface and `html body h1 { … }`
|
|
10
|
+
* styles the doc's headings. No `.ProseMirror` prefix, no learning curve.
|
|
11
|
+
*
|
|
12
|
+
* Because the raw string reaches VIEWERS of a published doc, it is untrusted.
|
|
13
|
+
* Every selector is force-scoped (so a `}` breakout is neutralised — the escaped
|
|
14
|
+
* rule is simply scoped too), and dangerous declarations are stripped:
|
|
15
|
+
* - external resource loads / exfiltration: `url(…)`, `@import`;
|
|
16
|
+
* - clickjacking / UI redressing: `position: fixed | sticky`;
|
|
17
|
+
* - legacy script vectors: `expression()`, `-moz-binding`, `behavior:`.
|
|
18
|
+
*
|
|
19
|
+
* We parse with the browser's own CSS engine (no dependency), rewrite each
|
|
20
|
+
* selector, strip dangerous declarations at every nesting level, and let the
|
|
21
|
+
* engine re-serialise — so the output is always a valid, balanced stylesheet.
|
|
22
|
+
*
|
|
23
|
+
* The sanitizer knows exactly what it removed, so it returns non-blocking
|
|
24
|
+
* `diagnostics`; the editing UI surfaces them (CSS is forgiving — we warn,
|
|
25
|
+
* never block).
|
|
26
|
+
*/
|
|
27
|
+
export interface CssDiagnostic {
|
|
28
|
+
level: 'warning' | 'error';
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CssValidationResult {
|
|
32
|
+
/** Sanitized, scoped CSS, safe to inject. '' when nothing survives. */
|
|
33
|
+
css: string;
|
|
34
|
+
/** What was stripped/ignored, deduped. Empty when the CSS was fully clean. */
|
|
35
|
+
diagnostics: CssDiagnostic[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sanitize + scope AND report. Use this from the editing UI for diagnostics.
|
|
39
|
+
*/
|
|
40
|
+
export declare const validateCustomCss: (raw: string | undefined | null, scope?: string) => CssValidationResult;
|
|
41
|
+
/**
|
|
42
|
+
* Sanitized + scoped CSS only — used at injection/export sinks that just need
|
|
43
|
+
* the safe string. Diagnostics are surfaced separately via validateCustomCss.
|
|
44
|
+
*/
|
|
45
|
+
export declare const sanitizeCustomCss: (raw: string | undefined | null, scope?: string) => string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cursor-relative word range in the current textblock, or null when the
|
|
5
|
+
* cursor is not adjacent to a word character (whitespace runs, empty
|
|
6
|
+
* blocks). Position math is relative ($from.start() + parentOffset), so it
|
|
7
|
+
* is schema-agnostic (works under dBlock wrappers).
|
|
8
|
+
*/
|
|
9
|
+
export declare const findWordRangeAtCursor: (editor: Editor) => {
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
} | null;
|
|
13
|
+
/**
|
|
14
|
+
* Ensure a text target for anchored actions (inline comments): keep any
|
|
15
|
+
* existing non-empty TextSelection; otherwise select the word under the
|
|
16
|
+
* collapsed cursor. Shares findWordRangeAtCursor with enablement so
|
|
17
|
+
* "enabled" always implies "dispatch does something".
|
|
18
|
+
*
|
|
19
|
+
* Only a TextSelection passes through untouched — a non-empty NodeSelection
|
|
20
|
+
* (e.g. an image or horizontal rule selected as a node) looks "non-empty"
|
|
21
|
+
* but has no text content, so `textBetween` over it is '' and anything
|
|
22
|
+
* downstream that needs real text (e.g. createFloatingDraft) would silently
|
|
23
|
+
* no-op. Falling through to findWordRangeAtCursor for any other selection
|
|
24
|
+
* type gives either a legitimate adjacent word or null (schema-dependent —
|
|
25
|
+
* e.g. false for a NodeSelection whose dBlock wrapper has no text).
|
|
26
|
+
*/
|
|
27
|
+
export declare const selectWordAtCursor: (editor: Editor) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Single enablement predicate for anchored text actions (inline comments):
|
|
30
|
+
* true when there's already a non-empty TextSelection, or a word is
|
|
31
|
+
* reachable from a collapsed cursor via findWordRangeAtCursor. Mirrors the
|
|
32
|
+
* passthrough condition in selectWordAtCursor so "enabled" always implies
|
|
33
|
+
* selectWordAtCursor will produce a real text target.
|
|
34
|
+
*/
|
|
35
|
+
export declare const hasTextTargetAtSelection: (editor: Editor) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as d } from "./index-
|
|
1
|
+
import { j as d } from "./index-DWI3-T75.mjs";
|
|
2
2
|
import { useRef as I, useState as N, useEffect as D } from "react";
|
|
3
3
|
import { DynamicDropdown as E, Tooltip as R, IconButton as O } from "@fileverse/ui";
|
|
4
|
-
import { a3 as A, a4 as P, c as y } from "./index-
|
|
4
|
+
import { a3 as A, a4 as P, c as y } from "./index-DvBqPqhC.mjs";
|
|
5
5
|
const p = (e, t, o = t) => {
|
|
6
6
|
const { state: s } = e, l = s.changeByRange((n) => {
|
|
7
7
|
const u = s.sliceDoc(n.from, n.to), r = s.sliceDoc(
|