vdc-editor 0.1.274 → 0.1.276

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.
@@ -4,8 +4,15 @@ interface Props {
4
4
  editor: Editor;
5
5
  editorComment?: Editor;
6
6
  isEnableSpellCheckRealTime: boolean;
7
+ align?: 'left' | 'right';
7
8
  }
8
- declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
9
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
10
+ align: string;
11
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
12
+ align: string;
13
+ }>>> & Readonly<{}>, {
14
+ align: "left" | "right";
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
9
16
  export default _default;
10
17
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
18
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -16,3 +23,11 @@ type __VLS_TypePropsToRuntimeProps<T> = {
16
23
  required: true;
17
24
  };
18
25
  };
26
+ type __VLS_WithDefaults<P, D> = {
27
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
28
+ default: D[K];
29
+ }> : P[K];
30
+ };
31
+ type __VLS_Prettify<T> = {
32
+ [K in keyof T]: T[K];
33
+ } & {};
@@ -1,7 +1,3 @@
1
- export declare const ERROR_TYPE: {
2
- SPACING: number;
3
- SPELLING: number;
4
- };
5
1
  export declare const SPELL_CHECK_CODE: {
6
2
  readonly NOTHING_TO_CHANGE: "NOTHING_TO_CHANGE";
7
3
  };
@@ -1,6 +1,7 @@
1
1
  export * from './bulkSpellChecker';
2
2
  export * from './actions-bridge';
3
3
  export * from './platform';
4
+ export * from './spellChecker';
4
5
  /** Default lang */
5
6
  export declare const DEFAULT_LANG_VALUE: "ko";
6
7
  /** Throttle time for editor input (milliseconds) */
@@ -0,0 +1,14 @@
1
+ export declare const ERROR_TYPE: {
2
+ SPACING: number;
3
+ SPELLING: number;
4
+ };
5
+ export declare const SPELLCHECK_HIGHLIGHT_MODE: {
6
+ readonly SINGLE: "single";
7
+ readonly ERROR_TYPE: "error_type";
8
+ };
9
+ export type SpellcheckHighlightMode = (typeof SPELLCHECK_HIGHLIGHT_MODE)[keyof typeof SPELLCHECK_HIGHLIGHT_MODE];
10
+ export declare const DEFAULT_SPELLCHECK_HIGHLIGHT_COLOR = "#ff4d4f";
11
+ /** Base Tailwind classes for each error type (shared by real-time and bulk spellchecker) */
12
+ export declare const SPELL_ERROR_COLOR_MAP: Record<number, string>;
13
+ /** Fallback class for unknown / integrated error types */
14
+ export declare const SPELL_ERROR_COLOR_MAP_FALLBACK = "text-green-500 border-b-2 border-green-500";
@@ -2,6 +2,7 @@ import { Extension } from '@tiptap/core';
2
2
  import { default as Spellchecker } from './spellchecker';
3
3
  import { Proofreader } from './proofreader';
4
4
  import { Component } from 'vue';
5
+ import { SpellcheckHighlightMode } from '../../constants';
5
6
 
6
7
  export declare const SPELLCHECKER_META_LIST: {
7
8
  readonly SPELLCHECKER_TRANSACTION: "spellcheckerTransaction";
@@ -25,6 +26,8 @@ export interface ISpellcheckerOptions {
25
26
  uiStrings?: IUiStrings;
26
27
  onShowSuggestionsEvent?: (word: string) => void;
27
28
  bulkSpellCheckerButton?: Component;
29
+ spellcheckHighlightMode?: SpellcheckHighlightMode;
30
+ spellcheckHighlightColor?: string;
28
31
  }
29
32
  export interface ISpellcheckerStorage {
30
33
  didPaste: boolean;
@@ -3,6 +3,7 @@ import { Transaction } from 'prosemirror-state';
3
3
  import { DecorationSet, EditorView } from 'prosemirror-view';
4
4
  import { IProofreaderInterface, IChangedNodes } from '../../type';
5
5
  import { IUiStrings, ISpellcheckerStorage } from './spellchecker-extension';
6
+ import { SpellcheckHighlightMode } from '../../constants';
6
7
 
7
8
  interface IGetMatchAndSetDecorationsList {
8
9
  text: string;
@@ -27,9 +28,11 @@ export default class Spellchecker {
27
28
  private isEnableSuggestion;
28
29
  private isMobile;
29
30
  private limit;
31
+ private spellcheckHighlightMode;
32
+ private spellcheckHighlightColor;
30
33
  private _debouncedProofreadDoc;
31
34
  private _debouncedHandleEnterKey;
32
- constructor(proofreader: IProofreaderInterface, uiStrings?: IUiStrings, showSuggestionsEvent?: (word: string) => void, limit?: number);
35
+ constructor(proofreader: IProofreaderInterface, uiStrings?: IUiStrings, showSuggestionsEvent?: (word: string) => void, limit?: number, spellcheckHighlightMode?: SpellcheckHighlightMode, spellcheckHighlightColor?: string);
33
36
  getProofreader(): IProofreaderInterface;
34
37
  toggleIsEnabledSpellCheck(): void;
35
38
  setEnabledProofreadText(isEnabled: boolean): void;
@@ -12,7 +12,7 @@ export { useConfigTiptap, useTiptapStore } from './hooks';
12
12
  export * as nodeNames from './utils/node-names';
13
13
  export type { ExtensionName } from './utils/node-names';
14
14
  export type * from './type';
15
- export { EditorMode } from './constants';
15
+ export { EditorMode, SPELLCHECK_HIGHLIGHT_MODE, DEFAULT_SPELLCHECK_HIGHLIGHT_COLOR } from './constants';
16
16
  export type { HistoryOptions } from '@tiptap/extension-history';
17
17
  export { useEditor } from '@tiptap/vue-3';
18
18
  export type { Editor as EditorInstance } from '@tiptap/core';
package/lib/src/type.d.ts CHANGED
@@ -160,6 +160,7 @@ export interface ITextWithPosition {
160
160
  startIndex: number;
161
161
  length: number;
162
162
  wrongWord: string;
163
+ errorType?: number;
163
164
  }
164
165
  export interface ITransferSpellData {
165
166
  errorText: ITextWithPosition;
@@ -171,6 +172,10 @@ export type SpellCheckDataType = {
171
172
  endIndex: number;
172
173
  wrongWordIndex: number;
173
174
  wrongWord: string;
175
+ errorHelpDtos?: {
176
+ errorType: number;
177
+ errorMessage: string;
178
+ }[];
174
179
  };
175
180
  type SingleEditorState = {
176
181
  editor: CoreEditor | null;
@@ -1,7 +1,16 @@
1
+ import { SpellcheckHighlightMode } from '../constants';
1
2
  import { WrongWordItem } from '../type';
2
3
  import { Editor } from '@tiptap/core';
3
4
 
4
- export declare function applyHighlights(editor: Editor, errors: WrongWordItem[]): void;
5
+ /**
6
+ * Returns the CSS class string and inline style for a bulk highlight decoration
7
+ * based on the configured spellcheck highlight mode.
8
+ */
9
+ export declare function getSpellcheckHighlightAttrs(mode: SpellcheckHighlightMode, color: string, errorType?: number): {
10
+ class: string;
11
+ style: string;
12
+ };
13
+ export declare function applyHighlights(editor: Editor, errors: WrongWordItem[], mode?: SpellcheckHighlightMode, color?: string): void;
5
14
  export declare function clearHighlights(editor: Editor): void;
6
15
  export declare function buildPlainIndexToDocPosMap(editor: Editor, blockSeparator?: string): (number | null)[];
7
16
  export declare function findDocPosFromOffset(editor: Editor, offset: number, blockSeparator?: string): number;