@fileverse-dev/ddoc 4.6.5 → 4.6.6-fanfic-2
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-cYPrdQNO.mjs → index-CmiE8H2k.mjs} +1 -1
- package/dist/{index-S8OhvrAi.mjs → index-DsczUtHy.mjs} +20530 -20175
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +11 -10
- package/dist/{markdown-source-pane-C9C86Ki_.mjs → markdown-source-pane-CBIJqve2.mjs} +1 -1
- package/dist/package/extensions/d-block/dblock-toolbar.d.ts +4 -1
- package/dist/package/hooks/use-export-headless-editor-content.d.ts +1 -0
- package/dist/package/hooks/use-headless-editor.d.ts +19 -0
- package/dist/package/types.d.ts +5 -0
- package/dist/package/utils/apply-tabbed-template.d.ts +11 -0
- package/dist/package/utils/fanfic-template.d.ts +3 -0
- package/dist/package/utils/template-utils.d.ts +4 -3
- package/dist/{split-view-toolbar-oNIzrpyR.mjs → split-view-toolbar-7X5pX0hW.mjs} +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { PreviewDdocEditor } from './package/preview-ddoc-editor';
|
|
|
3
3
|
export { handleContentPrint } from './package/utils/handle-print';
|
|
4
4
|
export { DdocExportModal } from './package/components/export-modal';
|
|
5
5
|
export { useHeadlessEditor } from './package/hooks/use-headless-editor';
|
|
6
|
+
export type { TabbedJSONContent, TabbedJSONContentTab, } from './package/hooks/use-headless-editor';
|
|
7
|
+
export { FANFIC_TEMPLATE } from './package/utils/fanfic-template';
|
|
6
8
|
export { useEditorCommands } from './package/hooks/use-editor-commands';
|
|
7
9
|
export type { EditorCommand, EditorCommandId, UseEditorCommandsOptions, } from './package/hooks/use-editor-commands';
|
|
8
10
|
export { useExportHeadlessEditorContent } from './package/hooks/use-export-headless-editor-content';
|
package/dist/index.es.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { D as
|
|
1
|
+
import { D as e, a as o, E as t, F as d, P as r, f as i, i as n, g as E, j as m, h as C, m as c, e as l, l as p, c as u, d as f, u as D, v as F } from "./index-DsczUtHy.mjs";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
e as DdocEditor,
|
|
4
4
|
o as DdocExportModal,
|
|
5
5
|
t as Editor,
|
|
6
|
-
d as
|
|
7
|
-
r as
|
|
8
|
-
i as
|
|
9
|
-
n as
|
|
6
|
+
d as FANFIC_TEMPLATE,
|
|
7
|
+
r as PreviewDdocEditor,
|
|
8
|
+
i as buildVersionDiffSnapshot,
|
|
9
|
+
n as decryptForRoomKey,
|
|
10
|
+
E as encryptForRoomKey,
|
|
10
11
|
m as fetchSessionState,
|
|
11
|
-
|
|
12
|
+
C as handleContentPrint,
|
|
12
13
|
c as mergeTabAwareYjsUpdates,
|
|
13
14
|
l as sanitizeCustomCss,
|
|
14
15
|
p as seedSession,
|
|
15
16
|
u as useEditorCommands,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
f as useExportHeadlessEditorContent,
|
|
18
|
+
D as useHeadlessEditor,
|
|
19
|
+
F as validateCustomCss
|
|
19
20
|
};
|
|
@@ -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-CmiE8H2k.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
4
|
+
import { TabbedJSONContent } from '../../hooks/use-headless-editor';
|
|
4
5
|
import { DBlockRuntimeState } from './dblock-runtime';
|
|
5
6
|
|
|
6
7
|
interface DBlockTemplateTarget {
|
|
@@ -8,11 +9,13 @@ interface DBlockTemplateTarget {
|
|
|
8
9
|
pos: number;
|
|
9
10
|
}
|
|
10
11
|
export declare const getTemplateTarget: (editor: Editor | null, runtimeState: DBlockRuntimeState) => DBlockTemplateTarget | null;
|
|
11
|
-
export declare const DBlockToolbarProvider: ({ children, editor, runtimeState, isPreviewEditor, onCopyHeadingLink, }: {
|
|
12
|
+
export declare const DBlockToolbarProvider: ({ children, editor, enableFanficTemplate, runtimeState, isPreviewEditor, onApplyTabbedTemplate, onCopyHeadingLink, }: {
|
|
12
13
|
children: React.ReactNode;
|
|
13
14
|
editor: Editor | null;
|
|
15
|
+
enableFanficTemplate?: boolean;
|
|
14
16
|
runtimeState?: DBlockRuntimeState;
|
|
15
17
|
onCopyHeadingLink?: (link: string) => void;
|
|
18
|
+
onApplyTabbedTemplate?: (template: TabbedJSONContent) => void;
|
|
16
19
|
isPreviewEditor?: boolean;
|
|
17
20
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
21
|
export {};
|
|
@@ -25,6 +25,7 @@ export declare const useExportHeadlessEditorContent: (props?: UseHeadlessEditorP
|
|
|
25
25
|
schemaVersion?: number;
|
|
26
26
|
}) => {
|
|
27
27
|
convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
|
|
28
|
+
convertTabbedJSONContentToYjsEncodedString: (template: import('./use-headless-editor').TabbedJSONContent) => string;
|
|
28
29
|
cleanup: () => void;
|
|
29
30
|
};
|
|
30
31
|
downloadContentAsMd: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
|
@@ -6,15 +6,33 @@ import * as Y from 'yjs';
|
|
|
6
6
|
export interface UseHeadlessEditorProps {
|
|
7
7
|
optionalExtensions?: string[];
|
|
8
8
|
}
|
|
9
|
+
export interface TabbedJSONContentTab {
|
|
10
|
+
name: string;
|
|
11
|
+
emoji: string | null;
|
|
12
|
+
content: JSONContent;
|
|
13
|
+
}
|
|
14
|
+
export interface TabbedJSONContent {
|
|
15
|
+
type: 'tabbed-doc';
|
|
16
|
+
title: string;
|
|
17
|
+
tabs: TabbedJSONContentTab[];
|
|
18
|
+
}
|
|
9
19
|
/**
|
|
10
20
|
* The exact extension set the headless editor runs with. Exported so tests
|
|
11
21
|
* can build an equivalent editor without the hook.
|
|
12
22
|
*/
|
|
13
23
|
export declare const getHeadlessExtensions: (options?: {
|
|
14
24
|
ydoc?: Y.Doc;
|
|
25
|
+
field?: string;
|
|
15
26
|
optionalExtensions?: string[];
|
|
16
27
|
schemaVersion?: number;
|
|
17
28
|
}) => AnyExtension[];
|
|
29
|
+
export declare const setJSONContent: (content: JSONContent, editor: Editor) => void;
|
|
30
|
+
export declare const writeJSONContentToYjsField: ({ content, field, schemaVersion, ydoc, }: {
|
|
31
|
+
content: JSONContent;
|
|
32
|
+
field: string;
|
|
33
|
+
schemaVersion?: number;
|
|
34
|
+
ydoc: Y.Doc;
|
|
35
|
+
}) => void;
|
|
18
36
|
export declare const useHeadlessEditor: (props?: UseHeadlessEditorProps) => {
|
|
19
37
|
setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
|
|
20
38
|
getEditor: (options?: {
|
|
@@ -27,6 +45,7 @@ export declare const useHeadlessEditor: (props?: UseHeadlessEditorProps) => {
|
|
|
27
45
|
schemaVersion?: number;
|
|
28
46
|
}) => {
|
|
29
47
|
convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
|
|
48
|
+
convertTabbedJSONContentToYjsEncodedString: (template: TabbedJSONContent) => string;
|
|
30
49
|
cleanup: () => void;
|
|
31
50
|
};
|
|
32
51
|
downloadContentAsMd: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
package/dist/package/types.d.ts
CHANGED
|
@@ -200,6 +200,11 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
200
200
|
handleCommentButtonClick?: (e: Editor) => void;
|
|
201
201
|
showCommentButton?: boolean;
|
|
202
202
|
disableBottomToolbar?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Replaces the default To-do quick template with the Fanfic template.
|
|
205
|
+
* Disabled by default so hosts must explicitly opt in where Fanfic is available.
|
|
206
|
+
*/
|
|
207
|
+
enableFanficTemplate?: boolean;
|
|
203
208
|
onError?: (error: string) => void;
|
|
204
209
|
setCharacterCount?: React.Dispatch<SetStateAction<number>>;
|
|
205
210
|
setWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { TabbedJSONContent } from '../hooks/use-headless-editor';
|
|
3
|
+
|
|
4
|
+
import type * as Y from 'yjs';
|
|
5
|
+
export declare const applyTabbedTemplate: ({ activeTabId, editor, flushPendingUpdate, template, ydoc, }: {
|
|
6
|
+
activeTabId: string;
|
|
7
|
+
editor: Editor;
|
|
8
|
+
flushPendingUpdate?: () => void;
|
|
9
|
+
template: TabbedJSONContent;
|
|
10
|
+
ydoc: Y.Doc;
|
|
11
|
+
}) => string[];
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { JSONContent } from '@tiptap/react';
|
|
2
2
|
import { LucideIconProps } from '@fileverse/ui';
|
|
3
|
+
import { TabbedJSONContent } from '../hooks/use-headless-editor';
|
|
3
4
|
|
|
4
5
|
type IconType = LucideIconProps['name'] | string;
|
|
5
6
|
type TemplateButtonProps = {
|
|
6
7
|
label: string;
|
|
7
8
|
icon: IconType;
|
|
8
9
|
onClick: () => void;
|
|
9
|
-
content: JSONContent | null;
|
|
10
|
+
content: JSONContent | TabbedJSONContent | null;
|
|
10
11
|
}[];
|
|
11
|
-
declare const createMoreTemplates: (addTemplate: (template: JSONContent) => void) => TemplateButtonProps;
|
|
12
|
-
declare const createTemplateButtons: (addTemplate: (template: JSONContent) => void) => TemplateButtonProps;
|
|
12
|
+
declare const createMoreTemplates: (addTemplate: (template: JSONContent) => void, enableFanficTemplate?: boolean) => TemplateButtonProps;
|
|
13
|
+
declare const createTemplateButtons: (addTemplate: (template: JSONContent) => void, addTabbedTemplate?: (template: TabbedJSONContent) => void, enableFanficTemplate?: boolean) => TemplateButtonProps;
|
|
13
14
|
declare const renderIcon: (icon: IconType, className?: string) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
15
|
declare const renderTemplateButtons: (templateButtons: TemplateButtonProps, moreTemplates: TemplateButtonProps, visibleTemplateCount: number, toggleAllTemplates: () => void, isExpanded: boolean, isCollaboratorsDoc: boolean, isPreviewMode: boolean, isFocusMode: boolean) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
16
|
export { renderIcon, createTemplateButtons, createMoreTemplates, renderTemplateButtons, };
|
|
@@ -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-CmiE8H2k.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(
|