@fileverse-dev/ddoc 5.1.10 → 5.1.11
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/headless-editor-utils.es.js +3 -3
- package/dist/{index-DtE1zaH8.mjs → index-B5LQvloV.mjs} +1 -1
- package/dist/index.es.js +3792 -3783
- package/dist/{markdown-source-pane-CA4cDQyu.mjs → markdown-source-pane-C2Xep2As.mjs} +1 -1
- package/dist/package/hooks/use-doc-schema-version.d.ts +3 -1
- package/dist/package/types.d.ts +12 -0
- package/dist/package/use-ddoc-editor.d.ts +1 -1
- package/dist/package/utils/schema-version.d.ts +2 -0
- package/dist/{split-view-toolbar-8eYCwI8J.mjs → split-view-toolbar-BD6evA3F.mjs} +1 -1
- package/dist/{use-headless-editor-tZq6fxul.mjs → use-headless-editor-Q1TaFxVX.mjs} +6305 -6286
- package/package.json +2 -1
|
@@ -3,7 +3,7 @@ var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
|
|
4
4
|
import { jsx as Cr } from "react/jsx-runtime";
|
|
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-B5LQvloV.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { SchemaStampGuardEvent } from '../types';
|
|
1
2
|
import * as Y from 'yjs';
|
|
2
3
|
interface UseDocSchemaVersionArgs {
|
|
3
4
|
ydoc: Y.Doc;
|
|
4
5
|
isNewDdoc: boolean;
|
|
5
6
|
isContentResolved: boolean;
|
|
6
7
|
preferredSchemaVersion?: number;
|
|
8
|
+
onSchemaStampGuard?: (event: SchemaStampGuardEvent) => void;
|
|
7
9
|
}
|
|
8
|
-
export declare const useDocSchemaVersion: ({ ydoc, isNewDdoc, isContentResolved, preferredSchemaVersion, }: UseDocSchemaVersionArgs) => {
|
|
10
|
+
export declare const useDocSchemaVersion: ({ ydoc, isNewDdoc, isContentResolved, preferredSchemaVersion, onSchemaStampGuard, }: UseDocSchemaVersionArgs) => {
|
|
9
11
|
docSchemaVersion: number;
|
|
10
12
|
isSchemaUnsupported: boolean;
|
|
11
13
|
};
|
package/dist/package/types.d.ts
CHANGED
|
@@ -262,7 +262,19 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
262
262
|
* @description Called when the IndexedDB persistence provider fails to initialize (e.g., private browsing, quota exceeded, corrupted DB). The editor will continue to function without local persistence.
|
|
263
263
|
*/
|
|
264
264
|
onIndexedDbError?: (error: Error) => void;
|
|
265
|
+
/**
|
|
266
|
+
* Called when the schema-version stamp was refused or reverted
|
|
267
|
+
* @description The editor stamps brand-new docs with the preferred schema. If the host passed an empty body for a doc that turns out to hold v1 content, the stamp is blocked (or reverted when the content arrived late). Hosts report these to see how often an existing doc is mounted without its body.
|
|
268
|
+
*/
|
|
269
|
+
onSchemaStampGuard?: (event: SchemaStampGuardEvent) => void;
|
|
265
270
|
}
|
|
271
|
+
export type SchemaStampGuardEvent = {
|
|
272
|
+
kind: 'blocked';
|
|
273
|
+
preferredSchemaVersion: number;
|
|
274
|
+
} | {
|
|
275
|
+
kind: 'reverted';
|
|
276
|
+
preferredSchemaVersion: number;
|
|
277
|
+
};
|
|
266
278
|
export interface IEditorSelectionData {
|
|
267
279
|
from: number;
|
|
268
280
|
to: number;
|
|
@@ -2,7 +2,7 @@ import { DdocProps } from './types';
|
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { DBlockRuntimeState } from './extensions/d-block/dblock-runtime';
|
|
4
4
|
|
|
5
|
-
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, 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, ...rest }: Partial<DdocProps> & {
|
|
5
|
+
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, 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> & {
|
|
6
6
|
isFocusMode?: boolean;
|
|
7
7
|
isPreviewEditor?: boolean;
|
|
8
8
|
}) => {
|
|
@@ -4,3 +4,5 @@ export declare const SCHEMA_VERSION_META_KEY = "schemaVersion";
|
|
|
4
4
|
export declare const SUPPORTED_SCHEMA_VERSION = 2;
|
|
5
5
|
export declare const getDocSchemaVersion: (doc: Y.Doc) => number;
|
|
6
6
|
export declare const isDocSchemaSupported: (doc: Y.Doc) => boolean;
|
|
7
|
+
export declare const docHasBlockContent: (doc: Y.Doc) => boolean;
|
|
8
|
+
export declare const docHasV1Blocks: (doc: Y.Doc) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { a3 as _, a4 as w, c as R } from "./index-
|
|
4
|
+
import { a3 as _, a4 as w, c as R } from "./index-B5LQvloV.mjs";
|
|
5
5
|
const p = (e, n, o = n) => {
|
|
6
6
|
const { state: i } = e, l = i.changeByRange((t) => {
|
|
7
7
|
const d = i.sliceDoc(t.from, t.to), r = i.sliceDoc(
|