@fileverse-dev/ddoc 3.5.4 → 3.5.6-font-1
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-BJnMlCW6.mjs → index-BIewJAlM.mjs} +1 -1
- package/dist/{index-in_xHbC2.mjs → index-CIm-Jqs5.mjs} +21952 -21207
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/{markdown-source-pane-CDXsYTEc.mjs → markdown-source-pane-AUeTkw0S.mjs} +2 -2
- package/dist/package/components/editor-toolbar.d.ts +3 -2
- package/dist/package/components/editor-utils.d.ts +9 -4
- package/dist/package/extensions/mardown-paste-handler/index.d.ts +7 -0
- package/dist/package/types.d.ts +25 -0
- package/dist/package/use-ddoc-editor.d.ts +1 -1
- package/dist/package/utils/font-loader.d.ts +24 -0
- package/dist/{split-view-toolbar-DxrpVEVB.mjs → split-view-toolbar-CYdC1mzK.mjs} +2 -2
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { Editor } from '@tiptap/react';
|
|
|
12
12
|
export type { CollaborationProps, CollabConnectionConfig, CollabSessionMeta, CollabServices, CollabCallbacks, CollabState, CollabError, CollabErrorCode, CollabStatus, } from './package/sync-local/types';
|
|
13
13
|
export type { CommentMutationMeta, SuggestionType } from './package/types';
|
|
14
14
|
export type { IComment } from './package/extensions/comment/comment.ts';
|
|
15
|
+
export type { FontDescriptor } from './package/types';
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as e, a as o, E as d, P as t, d as r, h as i, m as n, c as E, u as l } from "./index-
|
|
1
|
+
import { D as e, a as o, E as d, P as t, d as r, h as i, m as n, c as E, u as l } from "./index-CIm-Jqs5.mjs";
|
|
2
2
|
export {
|
|
3
3
|
e as DdocEditor,
|
|
4
4
|
o as DdocExportModal,
|
|
@@ -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-CIm-Jqs5.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-BIewJAlM.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
|
-
import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
3
|
+
import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
4
4
|
import { Tab } from './tabs/utils/tab-utils';
|
|
5
5
|
|
|
6
6
|
import * as Y from 'yjs';
|
|
7
|
-
declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, }: {
|
|
7
|
+
declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, }: {
|
|
8
8
|
editor: Editor | null;
|
|
9
9
|
onError?: (errorString: string) => void;
|
|
10
10
|
isPresentationMode?: boolean;
|
|
@@ -35,5 +35,6 @@ declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onErro
|
|
|
35
35
|
isSplitView?: boolean;
|
|
36
36
|
onToggleSplitView?: () => void;
|
|
37
37
|
onRegisterExportTrigger?: ((trigger: ((format?: string, name?: string) => void) | null) => void) | undefined;
|
|
38
|
+
fonts?: FontDescriptor[];
|
|
38
39
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
39
40
|
export default MemoizedTiptapToolBar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
2
3
|
import { IEditorTool } from '../hooks/use-visibility';
|
|
3
4
|
import { Editor } from '@tiptap/react';
|
|
4
|
-
import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
5
5
|
|
|
6
6
|
export interface IEditorToolElement {
|
|
7
7
|
icon: any;
|
|
@@ -14,11 +14,14 @@ export interface IEditorToolElement {
|
|
|
14
14
|
notVisible?: number;
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
type PickerEntry = {
|
|
18
18
|
title: string;
|
|
19
19
|
value: string;
|
|
20
20
|
command: (editor: Editor) => void;
|
|
21
|
-
|
|
21
|
+
preview?: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
export declare const baselineFonts: PickerEntry[];
|
|
24
|
+
export declare function buildPickerEntries(consumerFonts: FontDescriptor[]): PickerEntry[];
|
|
22
25
|
export declare const FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 32, 36, 48, 60, 72, 96];
|
|
23
26
|
export declare const getFontSizeOptions: (editor?: Editor) => {
|
|
24
27
|
title: string;
|
|
@@ -96,10 +99,11 @@ export declare const TextHighlighter: ({ editor, setVisibility, elementRef, }: {
|
|
|
96
99
|
elementRef: React.RefObject<HTMLDivElement>;
|
|
97
100
|
setVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
98
101
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
99
|
-
export declare const EditorFontFamily: ({ elementRef, editor, setToolVisibility, }: {
|
|
102
|
+
export declare const EditorFontFamily: ({ elementRef, editor, setToolVisibility, fonts: consumerFonts, }: {
|
|
100
103
|
elementRef: React.RefObject<HTMLDivElement>;
|
|
101
104
|
editor: Editor;
|
|
102
105
|
setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
106
|
+
fonts?: FontDescriptor[];
|
|
103
107
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
104
108
|
export declare const EditorAlignment: ({ elementRef, editor, setToolVisibility, }: {
|
|
105
109
|
elementRef: React.RefObject<HTMLDivElement>;
|
|
@@ -182,3 +186,4 @@ export declare const checkActiveListsAndDBlocks: (editor: Editor) => {
|
|
|
182
186
|
state: import('prosemirror-state').EditorState;
|
|
183
187
|
hasMultipleLists: boolean;
|
|
184
188
|
};
|
|
189
|
+
export {};
|
|
@@ -17,6 +17,12 @@ declare module '@tiptap/core' {
|
|
|
17
17
|
metadataFormat?: 'yaml' | 'reference-links';
|
|
18
18
|
metadata?: Record<string, string>;
|
|
19
19
|
includeStyles?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Embed secure images as base64 data URLs (default true — makes the
|
|
22
|
+
* downloaded .md self-contained). Split View seeds with false so
|
|
23
|
+
* images stay as attribute references and are never re-uploaded.
|
|
24
|
+
*/
|
|
25
|
+
embedImages?: boolean;
|
|
20
26
|
}) => any;
|
|
21
27
|
};
|
|
22
28
|
}
|
|
@@ -28,6 +34,7 @@ declare const MarkdownPasteHandler: (ipfsImageUploadFn?: (file: File) => Promise
|
|
|
28
34
|
export declare const stripFrontmatter: (markdown: string) => string;
|
|
29
35
|
export declare function handleMarkdownContent(view: any, content: string, ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, options?: {
|
|
30
36
|
breaks?: boolean;
|
|
37
|
+
replaceAll?: boolean;
|
|
31
38
|
}): Promise<void>;
|
|
32
39
|
export default MarkdownPasteHandler;
|
|
33
40
|
export declare function searchForSecureImageNodeAndEmbedImageContent(originalDoc: PMNode, ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
package/dist/package/types.d.ts
CHANGED
|
@@ -105,6 +105,13 @@ export interface DocumentStyling {
|
|
|
105
105
|
orientation?: 'portrait' | 'landscape';
|
|
106
106
|
}
|
|
107
107
|
export interface DdocProps extends CommentAccountProps {
|
|
108
|
+
/**
|
|
109
|
+
* Optional catalog of fonts available to the editor in addition to the
|
|
110
|
+
* package baseline (system fonts only). Each entry is loaded lazily via the
|
|
111
|
+
* CSS Font Loading API when first selected in the picker or when a document
|
|
112
|
+
* references its family.
|
|
113
|
+
*/
|
|
114
|
+
fonts?: FontDescriptor[];
|
|
108
115
|
tabConfig?: {
|
|
109
116
|
onCopyTabLink?: (tabId: string) => void;
|
|
110
117
|
defaultTabId?: string;
|
|
@@ -250,3 +257,21 @@ export interface IpfsImageFetchPayload {
|
|
|
250
257
|
mimeType: string;
|
|
251
258
|
authTag: string;
|
|
252
259
|
}
|
|
260
|
+
export type FontDescriptor = {
|
|
261
|
+
/** Display name in the picker, e.g. "Poppins" */
|
|
262
|
+
name: string;
|
|
263
|
+
/** CSS font-family stack stored in textStyle marks, e.g. "Poppins, sans-serif" */
|
|
264
|
+
family: string;
|
|
265
|
+
/**
|
|
266
|
+
* woff2 source(s).
|
|
267
|
+
* - string: single file covering all weights (variable font).
|
|
268
|
+
* - Record<number, string>: per-weight map, e.g. { 400: '/p-400.woff2', 700: '/p-700.woff2' }.
|
|
269
|
+
* - omitted: pure system font, no loading.
|
|
270
|
+
*/
|
|
271
|
+
url?: string | Record<number, string>;
|
|
272
|
+
/**
|
|
273
|
+
* SVG preview rendered in the picker. Any React node that renders an <svg>.
|
|
274
|
+
* Falls back to the font name in the default font when absent.
|
|
275
|
+
*/
|
|
276
|
+
preview?: React.ReactNode;
|
|
277
|
+
};
|
|
@@ -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, 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, ...rest }: Partial<DdocProps> & {
|
|
5
|
+
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, 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, ...rest }: Partial<DdocProps> & {
|
|
6
6
|
isFocusMode?: boolean;
|
|
7
7
|
isPreviewEditor?: boolean;
|
|
8
8
|
}) => {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FontDescriptor } from '../types';
|
|
2
|
+
|
|
3
|
+
/** "Poppins, sans-serif" -> "Poppins"; "'Times New Roman', serif" -> "Times New Roman" */
|
|
4
|
+
export declare function primaryToken(family: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Registers each catalog font with the browser without downloading it. A
|
|
7
|
+
* FontFace added to document.fonts but never `.load()`-ed behaves like a CSS
|
|
8
|
+
* `@font-face` rule: the UA fetches it lazily the first time rendered text
|
|
9
|
+
* (local edit, paste, undo, or a remote Yjs update) matches the family — which
|
|
10
|
+
* is why no document-scanning extension is needed.
|
|
11
|
+
*
|
|
12
|
+
* Merges into the existing catalog and never clears it, so a second editor
|
|
13
|
+
* mounting without a `fonts` prop can't wipe fonts other editors on the same
|
|
14
|
+
* page still need. The CSS face name is derived from the family stack, not the
|
|
15
|
+
* cosmetic `name`, so the registered face actually matches styled content.
|
|
16
|
+
*/
|
|
17
|
+
export declare function registerFonts(fonts: FontDescriptor[]): void;
|
|
18
|
+
export declare function getRegisteredFonts(): FontDescriptor[];
|
|
19
|
+
/**
|
|
20
|
+
* Forces a download and resolves once the face is ready. Used by the picker
|
|
21
|
+
* click so applying a font doesn't flash the fallback. `document.fonts.load`
|
|
22
|
+
* deduplicates internally, so no custom promise cache is needed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ensureLoaded(family: string): Promise<unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as r } from "./index-
|
|
1
|
+
import { j as r } from "./index-CIm-Jqs5.mjs";
|
|
2
2
|
import { useRef as I, useState as D, useEffect as E } from "react";
|
|
3
3
|
import { DynamicDropdown as P, Tooltip as y, IconButton as L } from "@fileverse/ui";
|
|
4
|
-
import { a3 as A, a4 as _, c as O } from "./index-
|
|
4
|
+
import { a3 as A, a4 as _, c as O } from "./index-BIewJAlM.mjs";
|
|
5
5
|
const p = (e, n, s = n) => {
|
|
6
6
|
const { state: o } = e, l = o.changeByRange((t) => {
|
|
7
7
|
const u = o.sliceDoc(t.from, t.to), a = o.sliceDoc(
|