@fileverse-dev/ddoc 2.4.0 → 2.4.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/{ccip-6RfBwSKM.mjs → ccip-DxNSF_3h.mjs} +1 -1
- package/dist/{index-CT3AMJnE.mjs → index-LwbJ8ct6.mjs} +43919 -38739
- package/dist/index.es.js +1 -1
- package/dist/package/components/editor-toolbar.d.ts +3 -1
- package/dist/package/components/editor-utils.d.ts +6 -5
- package/dist/package/components/import-export-button.d.ts +10 -0
- package/dist/package/extensions/html-export/index.d.ts +17 -0
- package/dist/package/extensions/mardown-paste-handler/index.d.ts +5 -1
- package/dist/package/extensions/text-export/index.d.ts +13 -0
- package/dist/package/hooks/use-headless-editor.d.ts +2 -0
- package/dist/package/types.d.ts +2 -0
- package/dist/package/utils/extract-title-from-content.d.ts +9 -0
- package/dist/package/utils/prettify-html.d.ts +1 -0
- package/dist/package/utils/sanitize-html.d.ts +12 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
@@ -2,7 +2,7 @@ import { default as React } from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
3
3
|
import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
4
4
|
|
5
|
-
declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, isLoading, ipfsImageFetchFn, }: {
|
5
|
+
declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, isLoading, ipfsImageFetchFn, }: {
|
6
6
|
editor: Editor | null;
|
7
7
|
onError?: (errorString: string) => void;
|
8
8
|
zoomLevel: string;
|
@@ -13,6 +13,8 @@ declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavb
|
|
13
13
|
onMarkdownExport?: () => void;
|
14
14
|
onMarkdownImport?: () => void;
|
15
15
|
onPdfExport?: () => void;
|
16
|
+
onHtmlExport?: () => void;
|
17
|
+
onTxtExport?: () => void;
|
16
18
|
isLoading: boolean;
|
17
19
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
18
20
|
url: string;
|
@@ -3,7 +3,7 @@ import { IEditorTool } from '../hooks/use-visibility';
|
|
3
3
|
import { Editor } from '@tiptap/react';
|
4
4
|
import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
5
5
|
|
6
|
-
interface IEditorToolElement {
|
6
|
+
export interface IEditorToolElement {
|
7
7
|
icon: any;
|
8
8
|
title: string;
|
9
9
|
onClick: () => void;
|
@@ -37,13 +37,15 @@ export declare const IMG_UPLOAD_SETTINGS: {
|
|
37
37
|
errorMsg: string;
|
38
38
|
};
|
39
39
|
};
|
40
|
-
export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, ipfsImageFetchFn, }: {
|
40
|
+
export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, ipfsImageFetchFn, }: {
|
41
41
|
editor: Editor | null;
|
42
42
|
onError?: (errorString: string) => void;
|
43
43
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
44
44
|
onMarkdownExport?: () => void;
|
45
45
|
onMarkdownImport?: () => void;
|
46
46
|
onPdfExport?: () => void;
|
47
|
+
onHtmlExport?: () => void;
|
48
|
+
onTxtExport?: () => void;
|
47
49
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
48
50
|
url: string;
|
49
51
|
file: File;
|
@@ -51,8 +53,8 @@ export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, on
|
|
51
53
|
}) => {
|
52
54
|
undoRedoTools: (IEditorToolElement | null)[];
|
53
55
|
toolbar: (IEditorToolElement | null)[];
|
54
|
-
|
55
|
-
|
56
|
+
exportOptions: (IEditorToolElement | null)[];
|
57
|
+
importOptions: (IEditorToolElement | null)[];
|
56
58
|
bottomToolbar: (IEditorToolElement | null)[];
|
57
59
|
toolRef: React.RefObject<HTMLDivElement>;
|
58
60
|
toolVisibility: IEditorTool;
|
@@ -146,4 +148,3 @@ export declare const checkActiveListsAndDBlocks: (editor: Editor) => {
|
|
146
148
|
state: import('prosemirror-state').EditorState;
|
147
149
|
hasMultipleLists: boolean;
|
148
150
|
};
|
149
|
-
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { IEditorToolElement } from './editor-utils';
|
2
|
+
|
3
|
+
declare const ImportExportButton: ({ fileExportsOpen, setFileExportsOpen, exportOptions, importOptions, setDropdownOpen, }: {
|
4
|
+
fileExportsOpen: boolean;
|
5
|
+
setFileExportsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
6
|
+
exportOptions: (IEditorToolElement | null)[];
|
7
|
+
importOptions: (IEditorToolElement | null)[];
|
8
|
+
setDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
10
|
+
export { ImportExportButton };
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
2
|
+
import { IpfsImageFetchPayload } from '../../types';
|
3
|
+
|
4
|
+
declare module '@tiptap/core' {
|
5
|
+
interface Commands {
|
6
|
+
exportHtmlFile: {
|
7
|
+
exportHtmlFile: (props?: {
|
8
|
+
title?: string;
|
9
|
+
}) => any;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
}
|
13
|
+
declare const HtmlExportExtension: (ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
14
|
+
url: string;
|
15
|
+
file: File;
|
16
|
+
}>) => Extension<any, any>;
|
17
|
+
export default HtmlExportExtension;
|
@@ -10,7 +10,10 @@ declare module '@tiptap/core' {
|
|
10
10
|
uploadMarkdownFile: (ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>) => any;
|
11
11
|
};
|
12
12
|
exportMarkdownFile: {
|
13
|
-
exportMarkdownFile: (
|
13
|
+
exportMarkdownFile: (props?: {
|
14
|
+
title?: string;
|
15
|
+
returnMDFile?: boolean;
|
16
|
+
}) => any;
|
14
17
|
};
|
15
18
|
}
|
16
19
|
}
|
@@ -18,6 +21,7 @@ declare const MarkdownPasteHandler: (ipfsImageUploadFn?: (file: File) => Promise
|
|
18
21
|
url: string;
|
19
22
|
file: File;
|
20
23
|
}>) => Extension<any, any>;
|
24
|
+
export declare const stripFrontmatter: (markdown: string) => string;
|
21
25
|
export declare function handleMarkdownContent(view: any, content: string, ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>): Promise<void>;
|
22
26
|
export default MarkdownPasteHandler;
|
23
27
|
export declare function searchForSecureImageNodeAndEmbedImageContent(originalDoc: PMNode, ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
2
|
+
|
3
|
+
declare module '@tiptap/core' {
|
4
|
+
interface Commands {
|
5
|
+
exportTxtFile: {
|
6
|
+
exportTxtFile: (props?: {
|
7
|
+
title?: string;
|
8
|
+
}) => any;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
}
|
12
|
+
declare const TextExportExtension: () => Extension<any, any>;
|
13
|
+
export default TextExportExtension;
|
@@ -14,6 +14,8 @@ export declare const useHeadlessEditor: () => {
|
|
14
14
|
cleanup: () => void;
|
15
15
|
};
|
16
16
|
downloadContentAsMd: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
17
|
+
downloadContentAsHtml: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
18
|
+
downloadContentAsTxt: (content: string | string[] | JSONContent, title: string) => Promise<void>;
|
17
19
|
mergeYjsUpdates: (contents: string[]) => string;
|
18
20
|
handleMarkdownContent: typeof handleMarkdownContent;
|
19
21
|
getYjsContentFromMarkdown: (file: File, ipfsImageUploadFn: (file: File) => Promise<IpfsImageUploadResponse>) => Promise<string | null>;
|
package/dist/package/types.d.ts
CHANGED
@@ -131,6 +131,8 @@ export interface DdocProps extends CommentAccountProps {
|
|
131
131
|
onMarkdownExport?: () => void;
|
132
132
|
onMarkdownImport?: () => void;
|
133
133
|
onPdfExport?: () => void;
|
134
|
+
onHtmlExport?: () => void;
|
135
|
+
onTxtExport?: () => void;
|
134
136
|
sharedSlidesLink?: string;
|
135
137
|
documentName?: string;
|
136
138
|
onInvalidContentError?: (e: unknown) => void;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Extract title from document content (JSON structure from editor)
|
5
|
+
* Looks for H1 headings first, then any text content
|
6
|
+
*/
|
7
|
+
export declare const extractTitleFromContent: (changes: {
|
8
|
+
content: JSONContent;
|
9
|
+
}) => string | null;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const prettifyHtml: (html: string) => Promise<string>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Sanitizes HTML content by removing all classes, IDs, and other attributes
|
3
|
+
* @param html - The HTML string to sanitize
|
4
|
+
* @returns Clean HTML string without classes, IDs, or other attributes
|
5
|
+
*/
|
6
|
+
export declare const sanitizeHtml: (html: string) => string;
|
7
|
+
/**
|
8
|
+
* Formats HTML content with proper indentation
|
9
|
+
* @param html - The HTML string to format
|
10
|
+
* @returns Formatted HTML string with proper indentation
|
11
|
+
*/
|
12
|
+
export declare const formatHtml: (html: string) => string;
|