@fileverse-dev/ddoc 3.0.98-wasm-0 → 3.0.99

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.
@@ -1,4 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
+ import { IpfsImageFetchPayload } from '../../types';
2
3
 
3
4
  declare module '@tiptap/core' {
4
5
  interface Commands {
@@ -10,10 +11,20 @@ declare module '@tiptap/core' {
10
11
  }
11
12
  }
12
13
  /**
13
- * Convert markdown to ODT using pandoc-wasm.
14
- * Lazily imports pandoc-wasm to avoid loading the ~58 MB WASM binary
15
- * until the user actually triggers an ODT export.
14
+ * Preprocess TipTap HTML for odf-kit compatibility:
15
+ * - Convert task lists to standard lists with checkbox text prefixes
16
+ * - Replace <img> tags with warning text (odf-kit v1 skips images)
17
+ * - Convert callouts (<aside>) to blockquotes
18
+ * - Convert Twitter embeds to links
19
+ * - Convert iframes (YouTube, SoundCloud, etc.) to links
20
+ * - Strip TipTap-specific data attributes
21
+ * - Convert void elements to self-closing XHTML for the XML parser
16
22
  */
17
- export declare function markdownToOdt(markdown: string): Promise<Blob>;
18
- declare const OdtExportExtension: () => Extension<any, any>;
23
+ export declare function preprocessHtml(html: string): {
24
+ html: string;
25
+ };
26
+ declare const OdtExportExtension: (ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
27
+ url: string;
28
+ file: File;
29
+ }>, fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>) => Extension<any, any>;
19
30
  export default OdtExportExtension;
@@ -10,7 +10,7 @@ interface UseDdocExportArgs {
10
10
  exportOptions: (IEditorToolElement | null)[];
11
11
  }
12
12
  declare const useDdocExport: ({ editor, tabs, ydoc, exportOptions, }: UseDdocExportArgs) => {
13
- getOptionFormat: (title: string) => "" | "md" | "pdf" | "odt" | "html" | "txt";
13
+ getOptionFormat: (title: string) => "" | "md" | "pdf" | "html" | "txt" | "odt";
14
14
  formatSelectOptions: {
15
15
  id: string;
16
16
  label: string;
@@ -48,7 +48,7 @@ interface UseTabEditorArgs {
48
48
  theme?: 'dark' | 'light';
49
49
  editorRef?: MutableRefObject<Editor | null>;
50
50
  }
51
- export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
51
+ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
52
52
  editor: Editor | null;
53
53
  ref: import('react').RefObject<HTMLDivElement>;
54
54
  slides: string[];
@@ -14,6 +14,9 @@ export declare class SyncManager {
14
14
  private uncommittedUpdatesIdList;
15
15
  private contentTobeAppliedQueue;
16
16
  private isProcessing;
17
+ private flushTimer;
18
+ private readonly FLUSH_INTERVAL_MS;
19
+ private readonly MAX_QUEUE_SIZE;
17
20
  private _awarenessUpdateHandler;
18
21
  private ydoc;
19
22
  private servicesRef;
@@ -34,6 +37,15 @@ export declare class SyncManager {
34
37
  disconnect(): Promise<void>;
35
38
  terminateSession(): Promise<void>;
36
39
  enqueueLocalUpdate(update: Uint8Array): void;
40
+ private flushUpdates;
41
+ private awaitFlush;
42
+ /**
43
+ * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
44
+ * without awaiting the server ACK. The server broadcasts to peers immediately
45
+ * (before MongoDB write), so content reaches observers in near-real-time.
46
+ * ACK callback handles updateId tracking and auto-commit asynchronously.
47
+ */
48
+ private sendUpdateBatch;
37
49
  forceCleanup(): void;
38
50
  private handleConnectionError;
39
51
  private handleReconnection;
@@ -109,6 +109,10 @@ export interface SyncManagerConfig {
109
109
  services?: CollabServices;
110
110
  callbacks?: CollabCallbacks;
111
111
  onLocalUpdate?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
112
+ /** Origins to ignore in the ydoc update handler (e.g. IndexedDB provider) */
113
+ ignoredOrigins?: Array<{
114
+ current: unknown;
115
+ }>;
112
116
  }
113
117
  export declare enum ServerErrorCode {
114
118
  AUTH_TOKEN_MISSING = "AUTH_TOKEN_MISSING",