vdc-editor 0.1.89 → 0.1.90

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,6 +1,10 @@
1
1
  import { HistoryOptions as TiptapHistoryOptions } from '@tiptap/extension-history';
2
2
  import { GeneralOptions } from '../../type';
3
3
 
4
+ export declare const HISTORY_META_LIST: {
5
+ readonly HISTORY_TRANSACTION: "history$";
6
+ readonly ADD_TO_HISTORY_TRANSACTION: "addToHistory";
7
+ };
4
8
  export interface HistoryOptions extends TiptapHistoryOptions, GeneralOptions<HistoryOptions> {
5
9
  }
6
10
  export declare const History: import('@tiptap/core').Extension<HistoryOptions, any>;
@@ -18,6 +18,7 @@ export declare class Proofreader implements IProofreaderInterface {
18
18
  getApi(): string;
19
19
  normalizeTextForLanguage(text: string): string;
20
20
  proofreadText(sentence: string): Promise<ITextWithPosition[]>;
21
- setActiveSpellCheck(): void;
21
+ toggleIsEnabled(): void;
22
+ getIsEnabled(): boolean;
22
23
  }
23
24
  export type ProofreaderType = typeof Proofreader;
@@ -2,8 +2,14 @@ import { Extension } from '@tiptap/core';
2
2
  import { default as Spellchecker } from './spellchecker';
3
3
  import { Proofreader } from './proofreader';
4
4
 
5
- export declare const SPELLCHECKER_TRANSACTION = "spellchecker-transation";
6
- export declare const LOADING_TRANSACTION = "loading";
5
+ export declare const SPELLCHECKER_META_LIST: {
6
+ readonly SPELLCHECKER_TRANSACTION: "spellcheckerTransaction";
7
+ readonly IS_ACTIVE_SPELLCHECK: "isActiveSpellCheck";
8
+ readonly LOADING_TRANSACTION: "loading";
9
+ readonly PREVENT_UPDATE: "preventUpdate";
10
+ readonly APPENDED: "appended";
11
+ readonly APPENDED_TRANSACTION: "appendedTransaction";
12
+ };
7
13
  export interface IUiStrings {
8
14
  noSuggestions?: string;
9
15
  }
@@ -12,11 +18,12 @@ export interface ISpellcheckerOptions {
12
18
  uiStrings?: IUiStrings;
13
19
  onShowSuggestionsEvent?: (word: string) => void;
14
20
  }
15
- interface ISpellcheckerStorage {
21
+ export interface ISpellcheckerStorage {
16
22
  didPaste: boolean;
17
23
  spellchecker?: Spellchecker;
18
24
  isUndoRedoOperation: boolean;
19
25
  pendingSpellCheck: boolean;
26
+ enterKeyPressed: boolean;
20
27
  }
21
28
  declare module '@tiptap/core' {
22
29
  interface Commands<ReturnType> {
@@ -24,12 +31,14 @@ declare module '@tiptap/core' {
24
31
  checkSpelling: () => ReturnType;
25
32
  };
26
33
  handleActiveSpellCheck: {
27
- handleActiveSpellCheck: () => ReturnType;
34
+ handleActiveSpellCheck: (isSetStore?: boolean) => ReturnType;
28
35
  };
29
36
  setIsEnableSuggestion: {
30
37
  setIsEnableSuggestion: (isEnableSuggestion: boolean) => ReturnType;
31
38
  };
39
+ setIsMobile: {
40
+ setIsMobile: (isMobile: boolean) => ReturnType;
41
+ };
32
42
  }
33
43
  }
34
44
  export declare const SpellcheckerExtension: Extension<ISpellcheckerOptions, ISpellcheckerStorage>;
35
- export {};
@@ -2,7 +2,7 @@ import { Node } from 'prosemirror-model';
2
2
  import { Transaction } from 'prosemirror-state';
3
3
  import { DecorationSet, EditorView } from 'prosemirror-view';
4
4
  import { IProofreaderInterface, IChangedNodes } from '../../type';
5
- import { IUiStrings } from './spellchecker-extension';
5
+ import { IUiStrings, ISpellcheckerStorage } from './spellchecker-extension';
6
6
 
7
7
  interface IGetMatchAndSetDecorationsList {
8
8
  text: string;
@@ -10,7 +10,6 @@ interface IGetMatchAndSetDecorationsList {
10
10
  }
11
11
  export default class Spellchecker {
12
12
  get completeProofreadingDone(): boolean;
13
- debouncedProofreadDoc: import('lodash').DebouncedFunc<(doc: Node) => void>;
14
13
  debouncedGetMatchAndSetDecorations: import('lodash').DebouncedFunc<(text: string, originalFrom: number) => Promise<void>>;
15
14
  debouncedGetMatchAndSetDecorationsList: import('lodash').DebouncedFunc<(list: IGetMatchAndSetDecorationsList[]) => Promise<void>>;
16
15
  debouncedClickEventsListener: import('lodash').DebouncedFunc<(e: Event) => Promise<false | undefined>>;
@@ -24,10 +23,15 @@ export default class Spellchecker {
24
23
  private isInitialProofreadingDone;
25
24
  private lastOriginalFrom;
26
25
  private readonly suggestionBox;
27
- private isEnableSuggestion?;
26
+ private isEnableSuggestion;
27
+ private isMobile;
28
28
  private limit;
29
+ private _debouncedProofreadDoc;
30
+ private _debouncedHandleEnterKey;
29
31
  constructor(proofreader: IProofreaderInterface, uiStrings?: IUiStrings, showSuggestionsEvent?: (word: string) => void, limit?: number);
30
- setStatusSpellCheck(): void;
32
+ getProofreader(): IProofreaderInterface;
33
+ toggleIsEnabledSpellCheck(): void;
34
+ getIsEnabledSpellCheck(): boolean;
31
35
  setDecorationSet(decorationSet: DecorationSet): void;
32
36
  getDecorationSet(): DecorationSet;
33
37
  setEditorView(editorView: EditorView): void;
@@ -35,10 +39,13 @@ export default class Spellchecker {
35
39
  getSuggestionBox(): HTMLDivElement;
36
40
  hideSuggestionBox(): void;
37
41
  setIsEnableSuggestion(isEnableSuggestion: boolean): void;
38
- getChangedNodesFromTransaction(transaction: Transaction): {
42
+ setIsMobile(isMobile: boolean): void;
43
+ getChangedNodesFromTransaction(transaction: Transaction, isFilterStructureChanges?: boolean, isDeleteAction?: boolean): {
39
44
  changedNodes: IChangedNodes[];
40
45
  isChangedSuperText: boolean;
41
46
  };
47
+ debouncedProofreadDoc(doc: Node, callback?: () => void): void;
48
+ isSuperTextAlone(doc: Node, superText: Node): boolean;
42
49
  /**
43
50
  * This function is called on initial load of the editor and when content is pasted into the editor.
44
51
  * For manual modifications, only the changed nodes are spellchecked again.
@@ -57,5 +64,13 @@ export default class Spellchecker {
57
64
  private clickEventsListener;
58
65
  private acceptSuggestionListener;
59
66
  private addSuggestionsList;
67
+ isUndoRedo(transaction: Transaction, storage: ISpellcheckerStorage): boolean;
68
+ handleUndoRedo(transaction: Transaction, storage: ISpellcheckerStorage): DecorationSet;
69
+ isTextContentChangedOrDeleted(transaction: Transaction): {
70
+ isTextContentChanged: boolean;
71
+ isDeleteAction: boolean;
72
+ };
73
+ handleEnterKey(transaction: Transaction, pendingSpellCheck: boolean): DecorationSet;
74
+ handleEnterKeyDebounced(transaction: Transaction, pendingSpellCheck: boolean, callback?: () => void): void;
60
75
  }
61
76
  export {};
@@ -166,6 +166,7 @@ export declare const useTiptapStore: () => {
166
166
  toggleFindAndReplace: () => void;
167
167
  togglePreview: () => void;
168
168
  toggleSpellCheck: () => void;
169
+ setSpellCheck: (isSpellCheck: boolean) => void;
169
170
  togglePrinter: () => void;
170
171
  setEditorContextMenuRef: (contextMenuRef: any) => void;
171
172
  openSuperInput: () => void;
@@ -0,0 +1,3 @@
1
+ import { Editor } from '@tiptap/core';
2
+
3
+ export declare const useSyncSpellCheck: (editor: Editor) => void;
package/lib/src/type.d.ts CHANGED
@@ -173,7 +173,8 @@ export interface IProofreaderInterface {
173
173
  proofreadText(sentence: string): Promise<ITextWithPosition[]>;
174
174
  getSuggestions(word: string): Promise<string[]>;
175
175
  normalizeTextForLanguage(text: string): string;
176
- setActiveSpellCheck(): void;
176
+ toggleIsEnabled(): void;
177
+ getIsEnabled(): boolean;
177
178
  }
178
179
  export interface IChangedNodes {
179
180
  node: any;