@fileverse-dev/ddoc 3.0.58-patch-15 → 3.0.58-tab-fix-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.d.ts +3 -0
- package/dist/index.es.js +11260 -11049
- package/dist/package/components/export-modal.d.ts +3 -4
- package/dist/package/hooks/use-ddoc-export.d.ts +6 -1
- package/dist/package/hooks/use-export-headless-editor-content.d.ts +31 -0
- package/dist/package/hooks/use-headless-editor.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
interface ExportFormatOption {
|
|
1
|
+
export interface ExportFormatOption {
|
|
2
2
|
id: string;
|
|
3
3
|
label: string;
|
|
4
4
|
}
|
|
5
|
-
interface ExportTabOption {
|
|
5
|
+
export interface ExportTabOption {
|
|
6
6
|
id: string;
|
|
7
7
|
label: string;
|
|
8
8
|
}
|
|
9
|
-
interface ExportAsModalProps {
|
|
9
|
+
export interface ExportAsModalProps {
|
|
10
10
|
open: boolean;
|
|
11
11
|
onOpenChange: (open: boolean) => void;
|
|
12
12
|
onExport?: (data: {
|
|
@@ -19,4 +19,3 @@ interface ExportAsModalProps {
|
|
|
19
19
|
initialTab?: string;
|
|
20
20
|
}
|
|
21
21
|
export declare const ExportAsModal: ({ open, onOpenChange, onExport, formatOptions, tabOptions, initialFormat, initialTab, }: ExportAsModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export {};
|
|
@@ -6,7 +6,7 @@ import * as Y from 'yjs';
|
|
|
6
6
|
interface UseDdocExportArgs {
|
|
7
7
|
editor: Editor | null;
|
|
8
8
|
tabs: Tab[];
|
|
9
|
-
ydoc: Y.Doc;
|
|
9
|
+
ydoc: Y.Doc | null;
|
|
10
10
|
exportOptions: (IEditorToolElement | null)[];
|
|
11
11
|
}
|
|
12
12
|
declare const useDdocExport: ({ editor, tabs, ydoc, exportOptions, }: UseDdocExportArgs) => {
|
|
@@ -20,5 +20,10 @@ declare const useDdocExport: ({ editor, tabs, ydoc, exportOptions, }: UseDdocExp
|
|
|
20
20
|
tab: string;
|
|
21
21
|
name?: string;
|
|
22
22
|
}) => void;
|
|
23
|
+
handleExportAsync: ({ format, tab, name, }: {
|
|
24
|
+
format: string;
|
|
25
|
+
tab: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
}) => Promise<void>;
|
|
23
28
|
};
|
|
24
29
|
export { useDdocExport };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Editor, JSONContent } from '@tiptap/react';
|
|
2
|
+
import { ExportAsModalProps } from '../components/export-modal';
|
|
3
|
+
import { UseHeadlessEditorProps } from './use-headless-editor';
|
|
4
|
+
|
|
5
|
+
import * as Y from 'yjs';
|
|
6
|
+
export type HeadlessEditorExportFormat = 'pdf' | 'md' | 'html' | 'txt';
|
|
7
|
+
export interface HeadlessEditorExportOption {
|
|
8
|
+
content: string;
|
|
9
|
+
fileName?: string;
|
|
10
|
+
initialFormat?: HeadlessEditorExportFormat;
|
|
11
|
+
}
|
|
12
|
+
export declare const useExportHeadlessEditorContent: (props?: UseHeadlessEditorProps) => {
|
|
13
|
+
exportContent: (option: HeadlessEditorExportOption) => void;
|
|
14
|
+
exportModalProps: ExportAsModalProps;
|
|
15
|
+
setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
|
|
16
|
+
getEditor: () => {
|
|
17
|
+
editor: Editor;
|
|
18
|
+
ydoc: Y.Doc;
|
|
19
|
+
};
|
|
20
|
+
getYjsConvertor: () => {
|
|
21
|
+
convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
|
|
22
|
+
cleanup: () => void;
|
|
23
|
+
};
|
|
24
|
+
downloadContentAsMd: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
|
25
|
+
downloadContentAsHtml: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
|
26
|
+
downloadContentAsTxt: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
|
27
|
+
mergeYjsUpdates: (contents: string[]) => string;
|
|
28
|
+
handleMarkdownContent: typeof import('../extensions/mardown-paste-handler').handleMarkdownContent;
|
|
29
|
+
getYjsContentFromMarkdown: (file: File, ipfsImageUploadFn: (file: File) => Promise<import('../types').IpfsImageUploadResponse>) => Promise<string | null>;
|
|
30
|
+
getYjsContentFromDocx: (file: File, ipfsImageUploadFn: (file: File) => Promise<import('../types').IpfsImageUploadResponse>) => Promise<string | null>;
|
|
31
|
+
};
|
|
@@ -3,9 +3,10 @@ import { handleMarkdownContent } from '../extensions/mardown-paste-handler';
|
|
|
3
3
|
import { IpfsImageUploadResponse } from '../types';
|
|
4
4
|
|
|
5
5
|
import * as Y from 'yjs';
|
|
6
|
-
export
|
|
6
|
+
export interface UseHeadlessEditorProps {
|
|
7
7
|
optionalExtensions?: string[];
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare const useHeadlessEditor: (props?: UseHeadlessEditorProps) => {
|
|
9
10
|
setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
|
|
10
11
|
getEditor: () => {
|
|
11
12
|
editor: Editor;
|