vdc-editor 0.1.313 → 0.1.315

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.
@@ -15,8 +15,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
15
15
  delete: () => void;
16
16
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>> & Readonly<{
17
17
  onClose?: (() => any) | undefined;
18
- onDelete?: (() => any) | undefined;
19
18
  onSave?: ((superText: string) => any) | undefined;
19
+ onDelete?: (() => any) | undefined;
20
20
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
21
21
  export default _default;
22
22
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -27,8 +27,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
27
27
  "onUpdate:pressed"?: ((value: boolean) => any) | undefined;
28
28
  }>, {
29
29
  disabled: boolean;
30
- size: "default" | "sm" | "lg" | null;
31
30
  variant: "default" | "outline" | null;
31
+ size: "default" | "sm" | "lg" | null;
32
32
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
33
33
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
34
34
  export default _default;
@@ -1,6 +1,13 @@
1
1
  import { Component } from 'vue';
2
2
  import { Node } from '@tiptap/core';
3
3
 
4
+ export declare const SKIP_SUPER_DELETE_GUARD_META = "skipSuperDeleteGuard";
5
+ export interface SuperDeleteItem {
6
+ id: string;
7
+ text: string;
8
+ elementId: string | null;
9
+ pos: number;
10
+ }
4
11
  declare module '@tiptap/core' {
5
12
  interface Commands<ReturnType> {
6
13
  superText: {
@@ -33,6 +40,20 @@ export interface SuperTextOptions {
33
40
  button: Component;
34
41
  };
35
42
  addToast?: (toast: any) => void;
43
+ /**
44
+ * 호스트 가드 콜백. 수퍼 노드가 삭제되는 트랜잭션이 발생하기 직전 호출되며,
45
+ * `true` (또는 `Promise<true>`) 반환 시 삭제가 진행되고, `false` 반환 시 트랜잭션이 취소된다.
46
+ *
47
+ * 모든 삭제 경로(키보드, NodeView 메뉴, 선택삭제, cut, paste replace, 프로그래밍 deleteRange)에서
48
+ * 동일하게 호출된다. 한 트랜잭션이 여러 수퍼를 동시에 지우면 배열로 모두 전달된다.
49
+ *
50
+ * 제약: 호스트는 **모달 확인 UI** 를 사용해야 한다. 콜백이 resolve 되는 사이에 doc 이 다른
51
+ * 입력으로 변경되면 step 재적용이 안전하지 않아 라이브러리가 재실행을 포기한다.
52
+ *
53
+ * 호스트가 이미 확인을 거친 프로그래밍 삭제는 `tr.setMeta('skipSuperDeleteGuard', true)` 로
54
+ * 가드를 우회할 수 있다 (`SKIP_SUPER_DELETE_GUARD_META` 상수 export).
55
+ */
56
+ onBeforeDelete?: (items: SuperDeleteItem[]) => boolean | Promise<boolean>;
36
57
  }
37
58
  declare const _default: Node<SuperTextOptions, any>;
38
59
  export default _default;
package/lib/src/type.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Editor as CoreEditor, Extension, JSONContent, AnyExtension, EditorEvents as CoreEditorEvents } from '@tiptap/core';
2
+ import { SuperDeleteItem } from './extensions/SuperText/SuperText';
2
3
  import { Editor, EditorOptions } from '@tiptap/vue-3';
3
4
  import { icons } from './components/icons';
4
5
  import { SplitContext } from './extensions/Page/computed';
@@ -6,6 +7,7 @@ import { EDITOR_NAME, EditorMode } from './constants';
6
7
  import { ExtensionName } from './utils/node-names';
7
8
  import { Component } from 'vue';
8
9
 
10
+ export type { SuperDeleteItem } from './extensions/SuperText/SuperText';
9
11
  export type { Editor, JSONContent } from '@tiptap/core';
10
12
  /**
11
13
  *
@@ -585,6 +587,20 @@ export interface EditorProps {
585
587
  * @default false
586
588
  */
587
589
  fixedSuperPreviewWidth?: boolean;
590
+ /**
591
+ * 수퍼(superText) 노드가 삭제되기 직전 호스트 가드 콜백.
592
+ * `true` (또는 `Promise<true>`) 반환 시 삭제 진행, `false` 반환 시 삭제 취소.
593
+ *
594
+ * 모든 삭제 경로(키보드 Backspace/Delete, NodeView 메뉴 Delete, 드래그 선택 삭제,
595
+ * cut, paste replace, 프로그래밍 deleteRange)에서 동일하게 호출된다.
596
+ * 한 트랜잭션에서 여러 수퍼가 동시에 지워지면 배열로 전달되며, 호스트가 일괄 확인을 표시한다.
597
+ *
598
+ * 제약: 호스트 확인은 **모달**이어야 한다. 콜백 resolve 사이 doc 이 다른 입력으로 바뀌면
599
+ * step 재적용이 안전하지 않아 라이브러리가 재실행을 포기한다.
600
+ *
601
+ * @default undefined (가드 비활성, 종전대로 동작)
602
+ */
603
+ onBeforeSuperDelete?: (items: SuperDeleteItem[]) => boolean | Promise<boolean>;
588
604
  }
589
605
  export interface EditorEmits {
590
606
  (event: 'enter'): void;
@@ -1,4 +1,4 @@
1
- import { A as i, b as o, a as t, D as r, c as E, E as d, R as p, S, g as u, d as n, S as C, j as H, i as L, k as l, n as T, u as _, e as f, h as g, f as m } from "./index-Dg1S_Vtg.mjs";
1
+ import { A as i, b as o, a as t, D as r, c as E, E as d, R as p, S, g as u, d as n, S as C, j as H, i as L, k as l, n as T, u as _, e as f, h as g, f as m } from "./index-B--AIdk1.mjs";
2
2
  import "@vueuse/core";
3
3
  export {
4
4
  i as ArticleCompareEditor,