@fileverse-dev/ddoc 2.2.3 → 2.2.4-reminders-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 CHANGED
@@ -2,3 +2,6 @@ export { default as DdocEditor } from './package/ddoc-editor';
2
2
  export { PreviewDdocEditor } from './package/preview-ddoc-editor';
3
3
  export { handleContentPrint } from './package/utils/handle-print';
4
4
  export { useHeadlessEditor } from './package/hooks/use-headless-editor';
5
+ export { ReminderBlock } from './package/extensions/reminder-block/reminder-block';
6
+ export { type Reminder, type ReminderBlockOptions, } from './package/extensions/reminder-block/types';
7
+ export { Editor } from '@tiptap/react';
package/dist/index.es.js CHANGED
@@ -1,7 +1,9 @@
1
- import { D as d, P as r, h as s, u as t } from "./index-u7cmOfe6.mjs";
1
+ import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-CNUWzc9f.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
- r as PreviewDdocEditor,
5
- s as handleContentPrint,
6
- t as useHeadlessEditor
4
+ r as Editor,
5
+ s as PreviewDdocEditor,
6
+ a as ReminderBlock,
7
+ t as handleContentPrint,
8
+ i as useHeadlessEditor
7
9
  };
@@ -54,6 +54,8 @@ export declare const bubbleMenuProps: (props: EditorBubbleMenuProps) => {
54
54
  commentDrawerOpen?: boolean;
55
55
  setCommentDrawerOpen?: React.Dispatch<import('react').SetStateAction<boolean>>;
56
56
  isCollabDocumentPublished?: boolean | undefined;
57
+ onReminderCreate?: (reminder: import('../../..').Reminder) => void;
58
+ isConnected?: boolean;
57
59
  };
58
60
  export declare const shouldShow: ({ editor }: {
59
61
  editor: Editor;
@@ -1,6 +1,7 @@
1
1
  import { BubbleMenuProps, Editor } from '@tiptap/react';
2
2
  import { SetStateAction } from 'react';
3
3
  import { InlineCommentData } from '../../types';
4
+ import { Reminder } from '../../extensions/reminder-block/types';
4
5
 
5
6
  export interface BubbleMenuItem {
6
7
  name: string;
@@ -23,6 +24,8 @@ export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
23
24
  commentDrawerOpen?: boolean;
24
25
  setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
25
26
  isCollabDocumentPublished?: boolean | undefined;
27
+ onReminderCreate?: (reminder: Reminder) => void;
28
+ isConnected?: boolean;
26
29
  };
27
30
  export interface NodeSelectorProps {
28
31
  editor: Editor;
@@ -14,6 +14,15 @@ export declare const fonts: {
14
14
  value: string;
15
15
  command: (editor: Editor) => void;
16
16
  }[];
17
+ export declare const FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 32, 36, 48, 60, 72, 96];
18
+ export declare const getFontSizeOptions: (editor?: Editor) => {
19
+ title: string;
20
+ value: string;
21
+ label: string;
22
+ command: (editor: Editor) => void;
23
+ isActive: () => boolean | undefined;
24
+ }[];
25
+ export declare const getCurrentFontSize: (editor: Editor | null, currentSize: string) => string;
17
26
  export declare const ERR_MSG_MAP: {
18
27
  IMAGE_SIZE: string;
19
28
  };
@@ -107,6 +116,13 @@ export declare const TextHeading: ({ editor, setVisibility, elementRef, }: {
107
116
  elementRef: React.RefObject<HTMLDivElement>;
108
117
  setVisibility: Dispatch<SetStateAction<IEditorTool>>;
109
118
  }) => import("react/jsx-runtime").JSX.Element;
119
+ export declare const FontSizePicker: ({ editor, setVisibility, elementRef, currentSize, onSetFontSize, }: {
120
+ editor: Editor;
121
+ elementRef: React.RefObject<HTMLDivElement>;
122
+ setVisibility: Dispatch<SetStateAction<IEditorTool>>;
123
+ currentSize?: string;
124
+ onSetFontSize: (fontSize: string) => void;
125
+ }) => import("react/jsx-runtime").JSX.Element;
110
126
  export declare const TextFormatingPopup: ({ editor, isOpen, setIsOpen, setToolVisibility, }: {
111
127
  editor: Editor | null;
112
128
  isOpen: boolean;
@@ -0,0 +1,13 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ declare module '@tiptap/core' {
4
+ interface Commands<ReturnType> {
5
+ fontSize: {
6
+ setFontSize: (size: string) => ReturnType;
7
+ unsetFontSize: () => ReturnType;
8
+ increaseFontSize: () => ReturnType;
9
+ decreaseFontSize: () => ReturnType;
10
+ };
11
+ }
12
+ }
13
+ export declare const FontSize: Extension<any, any>;
@@ -0,0 +1 @@
1
+ export * from './font-size';
@@ -0,0 +1,14 @@
1
+ import { Node } from '@tiptap/core';
2
+ import { ReminderBlockOptions, Reminder } from './types';
3
+
4
+ declare module '@tiptap/core' {
5
+ interface Commands<ReturnType> {
6
+ reminderBlock: {
7
+ setReminderBlock: (attributes: {
8
+ id: string;
9
+ reminder: Reminder;
10
+ }) => ReturnType;
11
+ };
12
+ }
13
+ }
14
+ export declare const ReminderBlock: Node<ReminderBlockOptions, any>;
@@ -0,0 +1,4 @@
1
+ import { Editor, Range } from '@tiptap/core';
2
+ import { ReactRenderer } from '@tiptap/react';
3
+
4
+ export declare function showReminderMenu(editor: Editor, range: Range): ReactRenderer<HTMLDivElement, import('./types').ReminderMenuProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import { ReminderMenuProps } from './types';
2
+
3
+ export declare const ReminderMenu: import('react').ForwardRefExoticComponent<ReminderMenuProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import { NodeViewProps } from '@tiptap/react';
2
+
3
+ export declare const ReminderNodeView: import('react').MemoExoticComponent<({ node, editor, deleteNode }: NodeViewProps) => import("react/jsx-runtime").JSX.Element | null>;
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+
3
+ export interface Reminder {
4
+ id: string;
5
+ title: string;
6
+ timestamp: number;
7
+ createdAt: number;
8
+ status: 'pending' | 'completed' | 'cancelled';
9
+ walletAddress?: string;
10
+ }
11
+ export interface ReminderBlockOptions {
12
+ onReminderCreate?: (reminder: Reminder) => Promise<void>;
13
+ onReminderDelete?: (reminderId: string) => Promise<void>;
14
+ onReminderUpdate?: (reminder: Reminder) => Promise<void>;
15
+ reminders?: Reminder[];
16
+ }
17
+ export interface ReminderMenuProps {
18
+ isOpen: boolean;
19
+ onClose: () => void;
20
+ onCreateReminder: (reminder: Reminder) => void;
21
+ initialReminderTitle?: string;
22
+ setInitialReminderTitle: React.Dispatch<React.SetStateAction<string>>;
23
+ }
@@ -0,0 +1,4 @@
1
+ export declare const formatDate: (value: string) => string;
2
+ export declare const formatTime: (value: string) => string;
3
+ export declare const parseCustomDateTime: (dateStr: string, timeStr: string) => number | null;
4
+ export declare const formatDateForReminder: (timestamp: number) => string;
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
 
3
3
  export declare const Command: Extension<any, any>;
4
- declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string) => Extension<any, any>;
4
+ declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string, isConnected?: boolean) => Extension<any, any>;
5
5
  export default SlashCommand;
@@ -1,9 +1,10 @@
1
1
  import { CommandProps } from './types';
2
2
 
3
- export declare const getSuggestionItems: ({ query, onError, secureImageUploadUrl, }: {
3
+ export declare const getSuggestionItems: ({ query, onError, secureImageUploadUrl, isConnected, }: {
4
4
  query: string;
5
5
  onError?: (errorString: string) => void;
6
6
  secureImageUploadUrl?: string;
7
+ isConnected?: boolean;
7
8
  }) => {
8
9
  title: string;
9
10
  description: string;
@@ -0,0 +1,6 @@
1
+ import { Editor } from '@tiptap/react';
2
+
3
+ export declare const useEditorStates: (editor: Editor | null) => {
4
+ onSetFontSize: (size: string) => void;
5
+ currentSize: string | undefined;
6
+ };
@@ -10,7 +10,8 @@ export declare enum IEditorTool {
10
10
  TEXT_FORMATING = 8,
11
11
  TEXT_COLOR_PICKER = 9,
12
12
  LINK_POPUP = 10,
13
- SCRIPTS = 11
13
+ SCRIPTS = 11,
14
+ FONT_SIZE = 12
14
15
  }
15
16
  export default function useComponentVisibility(initialIsVisible: boolean): {
16
17
  ref: import('react').RefObject<HTMLDivElement>;
@@ -0,0 +1,16 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { Reminder } from '../extensions/reminder-block/types';
3
+
4
+ interface UseReminderProps {
5
+ editor: Editor;
6
+ onReminderCreate?: (reminder: Reminder) => Promise<void>;
7
+ onError?: (errorString: string) => void;
8
+ }
9
+ export declare const useReminder: ({ editor, onReminderCreate, onError, }: UseReminderProps) => {
10
+ reminderRef: import('react').RefObject<HTMLDivElement>;
11
+ handleReminderOnClose: () => void;
12
+ handleReminderCreate: (reminder: Reminder) => Promise<void>;
13
+ initialReminderTitle: string;
14
+ setInitialReminderTitle: import('react').Dispatch<import('react').SetStateAction<string>>;
15
+ };
16
+ export {};
@@ -38,6 +38,7 @@ export interface DdocProps extends CommentAccountProps {
38
38
  showTOC?: boolean;
39
39
  setShowTOC?: React.Dispatch<SetStateAction<boolean>>;
40
40
  proExtensions?: Record<string, Extension | any>;
41
+ extensions?: Record<string, Extension | any>;
41
42
  selectedTags?: TagType[];
42
43
  setSelectedTags?: React.Dispatch<SetStateAction<TagType[]>>;
43
44
  enableCollaboration?: boolean | undefined;
@@ -1,7 +1,7 @@
1
1
  import { DdocProps } from './types';
2
2
 
3
3
  import * as Y from 'yjs';
4
- export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, secureImageUploadUrl, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, onCopyHeadingLink, }: Partial<DdocProps>) => {
4
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, secureImageUploadUrl, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, isConnected, }: Partial<DdocProps>) => {
5
5
  editor: import('@tiptap/core').Editor | null;
6
6
  isContentLoading: boolean;
7
7
  ref: import('react').RefObject<HTMLDivElement>;