@halo-dev/richtext-editor 2.21.0 → 2.23.0
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/README.md +61 -0
- package/dist/components/Editor.vue.d.ts +6 -5
- package/dist/components/EditorHeader.vue.d.ts +4 -4
- package/dist/components/base/DropdownItem.vue.d.ts +29 -0
- package/dist/components/base/Input.vue.d.ts +29 -0
- package/dist/components/base/index.d.ts +2 -0
- package/dist/components/block/BlockActionButton.vue.d.ts +13 -8
- package/dist/{dev/App.vue.d.ts → components/block/BlockActionHorizontalSeparator.vue.d.ts} +1 -1
- package/dist/components/block/BlockActionSeparator.vue.d.ts +2 -1
- package/dist/components/block/index.d.ts +1 -2
- package/dist/components/bubble/BubbleButton.vue.d.ts +28 -0
- package/dist/components/bubble/BubbleItem.vue.d.ts +3 -37
- package/dist/components/{EditorBubbleMenu.vue.d.ts → bubble/EditorBubbleMenu.vue.d.ts} +3 -3
- package/dist/components/bubble/index.d.ts +2 -1
- package/dist/components/common/ColorPickerDropdown.vue.d.ts +7 -7
- package/dist/components/drag/EditorDragButtonItem.vue.d.ts +8 -0
- package/dist/components/drag/EditorDragHandle.vue.d.ts +14 -0
- package/dist/components/drag/EditorDragMenu.vue.d.ts +43 -0
- package/dist/components/drag/default-drag.d.ts +8 -0
- package/dist/components/drag/index.d.ts +4 -0
- package/dist/components/index.d.ts +4 -2
- package/dist/components/toolbar/ToolbarItem.vue.d.ts +2 -24
- package/dist/components/toolbar/ToolbarSubItem.vue.d.ts +2 -20
- package/dist/components/toolbox/ToolboxItem.vue.d.ts +2 -21
- package/dist/components/upload/EditorLinkObtain.vue.d.ts +51 -0
- package/dist/components/upload/ResourceReplaceButton.vue.d.ts +13 -0
- package/dist/components/upload/index.d.ts +2 -0
- package/dist/composables/use-attachment.d.ts +7 -0
- package/dist/extensions/align/index.d.ts +6 -0
- package/dist/extensions/audio/AudioView.vue.d.ts +106 -2
- package/dist/extensions/audio/BubbleItemAudioLink.vue.d.ts +2 -29
- package/dist/extensions/audio/BubbleItemAudioPosition.vue.d.ts +7 -0
- package/dist/extensions/audio/index.d.ts +9 -4
- package/dist/extensions/block-position/index.d.ts +48 -0
- package/dist/extensions/blockquote/index.d.ts +3 -3
- package/dist/extensions/bold/index.d.ts +3 -3
- package/dist/extensions/bullet-list/index.d.ts +3 -3
- package/dist/extensions/character-count/index.d.ts +1 -0
- package/dist/extensions/clear-format/index.d.ts +2 -2
- package/dist/extensions/code/index.d.ts +3 -3
- package/dist/extensions/code-block/CodeBlockSelect.vue.d.ts +7 -5
- package/dist/extensions/code-block/code-block.d.ts +7 -5
- package/dist/extensions/code-block/index.d.ts +0 -1
- package/dist/extensions/color/ColorBubbleItem.vue.d.ts +2 -29
- package/dist/extensions/color/ColorToolbarItem.vue.d.ts +2 -24
- package/dist/extensions/color/index.d.ts +3 -3
- package/dist/extensions/columns/column.d.ts +6 -2
- package/dist/extensions/columns/columns.d.ts +11 -4
- package/dist/extensions/columns/index.d.ts +2 -2
- package/dist/extensions/commands-menu/CommandsView.vue.d.ts +2 -2
- package/dist/extensions/commands-menu/commands.d.ts +2 -3
- package/dist/extensions/commands-menu/index.d.ts +1 -1
- package/dist/extensions/details/index.d.ts +6 -0
- package/dist/extensions/document/index.d.ts +2 -0
- package/dist/extensions/drop-cursor/index.d.ts +1 -0
- package/dist/extensions/extensions-kit.d.ts +96 -0
- package/dist/extensions/figure/FigureCaptionView.vue.d.ts +3 -0
- package/dist/extensions/figure/figure-caption.d.ts +2 -0
- package/dist/extensions/figure/index.d.ts +15 -0
- package/dist/extensions/font-size/index.d.ts +4 -14
- package/dist/extensions/format-brush/index.d.ts +4 -4
- package/dist/extensions/gallery/BubbleItemAddImage.vue.d.ts +7 -0
- package/dist/extensions/gallery/BubbleItemGap.vue.d.ts +493 -0
- package/dist/extensions/gallery/BubbleItemGroupSize.vue.d.ts +493 -0
- package/dist/extensions/gallery/BubbleItemLayout.vue.d.ts +493 -0
- package/dist/extensions/gallery/GalleryView.vue.d.ts +3 -0
- package/dist/extensions/gallery/gallery-bubble.d.ts +8 -0
- package/dist/extensions/gallery/index.d.ts +28 -0
- package/dist/extensions/gallery/useGalleryImages.d.ts +7 -0
- package/dist/extensions/gap-cursor/index.d.ts +1 -17
- package/dist/extensions/hard-break/index.d.ts +1 -0
- package/dist/extensions/heading/index.d.ts +3 -3
- package/dist/extensions/highlight/HighlightBubbleItem.vue.d.ts +2 -29
- package/dist/extensions/highlight/HighlightToolbarItem.vue.d.ts +2 -24
- package/dist/extensions/highlight/index.d.ts +3 -3
- package/dist/extensions/history/index.d.ts +1 -3
- package/dist/extensions/horizontal-rule/index.d.ts +1 -0
- package/dist/extensions/iframe/BubbleItemIframeAlign.vue.d.ts +7 -0
- package/dist/extensions/iframe/BubbleItemIframeLink.vue.d.ts +2 -29
- package/dist/extensions/iframe/BubbleItemIframeSize.vue.d.ts +2 -6
- package/dist/extensions/iframe/IframeView.vue.d.ts +54 -1
- package/dist/extensions/iframe/index.d.ts +4 -4
- package/dist/extensions/image/BubbleItemImageAlt.vue.d.ts +2 -29
- package/dist/extensions/image/BubbleItemImageHref.vue.d.ts +2 -29
- package/dist/extensions/image/BubbleItemImageLink.vue.d.ts +2 -29
- package/dist/extensions/image/BubbleItemImagePosition.vue.d.ts +7 -0
- package/dist/extensions/image/BubbleItemImageSize.vue.d.ts +2 -29
- package/dist/extensions/image/ImageView.vue.d.ts +108 -2
- package/dist/extensions/image/index.d.ts +9 -3
- package/dist/extensions/indent/index.d.ts +5 -5
- package/dist/extensions/index.d.ts +50 -47
- package/dist/extensions/italic/index.d.ts +3 -3
- package/dist/extensions/link/LinkBubbleButton.vue.d.ts +2 -29
- package/dist/extensions/link/index.d.ts +3 -3
- package/dist/extensions/list-extra/index.d.ts +6 -0
- package/dist/extensions/list-keymap/index.d.ts +4 -4
- package/dist/extensions/node-selected/index.d.ts +3 -4
- package/dist/extensions/ordered-list/index.d.ts +3 -3
- package/dist/extensions/paragraph/index.d.ts +3 -3
- package/dist/extensions/placeholder/index.d.ts +1 -0
- package/dist/extensions/range-selection/index.d.ts +2 -2
- package/dist/extensions/search-and-replace/IconButton.vue.d.ts +20 -0
- package/dist/extensions/search-and-replace/MatchToggleButton.vue.d.ts +20 -0
- package/dist/extensions/search-and-replace/SearchAndReplace.vue.d.ts +5 -2
- package/dist/extensions/search-and-replace/SearchAndReplacePlugin.d.ts +3 -2
- package/dist/extensions/search-and-replace/index.d.ts +2 -3
- package/dist/extensions/smart-scroll/index.d.ts +28 -0
- package/dist/extensions/strike/index.d.ts +3 -3
- package/dist/extensions/subscript/index.d.ts +3 -3
- package/dist/extensions/superscript/index.d.ts +3 -3
- package/dist/extensions/table/index.d.ts +5 -3
- package/dist/extensions/table/table-row.d.ts +1 -1
- package/dist/extensions/task-list/index.d.ts +3 -3
- package/dist/extensions/text/BubbleItemTextType.vue.d.ts +3 -0
- package/dist/extensions/text/index.d.ts +4 -2
- package/dist/extensions/text-align/index.d.ts +3 -3
- package/dist/extensions/text-style/index.d.ts +3 -3
- package/dist/extensions/trailing-node/index.d.ts +1 -2
- package/dist/extensions/underline/index.d.ts +3 -3
- package/dist/extensions/upload/index.d.ts +8 -0
- package/dist/extensions/video/BubbleItemVideoLink.vue.d.ts +2 -29
- package/dist/extensions/video/BubbleItemVideoPosition.vue.d.ts +7 -0
- package/dist/extensions/video/BubbleItemVideoSize.vue.d.ts +2 -29
- package/dist/extensions/video/VideoView.vue.d.ts +106 -2
- package/dist/extensions/video/index.d.ts +18 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.es.js +41115 -0
- package/dist/index.iife.js +176 -0
- package/dist/locales/en.json.d.ts +177 -0
- package/dist/locales/es.json.d.ts +177 -0
- package/dist/locales/index.d.ts +1044 -4
- package/dist/locales/zh-CN.json.d.ts +177 -0
- package/dist/style.css +2 -1
- package/dist/tiptap/index.d.ts +3 -3
- package/dist/tiptap/pm/index.d.ts +0 -1
- package/dist/types/index.d.ts +115 -59
- package/dist/utils/attachment.d.ts +3 -0
- package/dist/utils/clipboard.d.ts +9 -0
- package/dist/utils/delete-node.d.ts +1 -1
- package/dist/utils/filter-duplicate-extensions.d.ts +2 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/{isListActive.d.ts → is-list-active.d.ts} +2 -2
- package/dist/utils/is-node-empty.d.ts +6 -0
- package/dist/utils/keyboard.d.ts +37 -0
- package/dist/utils/upload.d.ts +78 -0
- package/package.json +52 -64
- package/dist/components/block/BlockActionInput.vue.d.ts +0 -15
- package/dist/components/block/BlockCard.vue.d.ts +0 -30
- package/dist/components/bubble/BubbleMenu.vue.d.ts +0 -84
- package/dist/components/bubble/BubbleMenuPlugin.d.ts +0 -52
- package/dist/dev/main.d.ts +0 -1
- package/dist/extensions/draggable/index.d.ts +0 -13
- package/dist/rich-text-editor.es.js +0 -41650
- package/dist/rich-text-editor.iife.js +0 -136
- package/dist/utils/isNodeEmpty.d.ts +0 -4
- /package/dist/components/icon/{MdiDeleteForeverOutline.vue.d.ts → MingcuteDelete2Line.vue.d.ts} +0 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -1,67 +1,139 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Editor, Range } from '../tiptap/vue-3';
|
|
1
|
+
import { arrow, autoPlacement, flip, hide, inline, offset, shift, size, VirtualElement } from '@floating-ui/dom';
|
|
3
2
|
import { Component } from 'vue';
|
|
3
|
+
import { Editor, EditorState, EditorView, PluginKey, PMNode, Range, ResolvedPos } from '../tiptap';
|
|
4
4
|
export interface ToolbarItemType {
|
|
5
5
|
priority: number;
|
|
6
6
|
component: Component;
|
|
7
|
-
props:
|
|
7
|
+
props: Omit<ToolbarItemComponentProps, "children"> & Record<string, unknown>;
|
|
8
|
+
children?: ToolbarItemType[];
|
|
9
|
+
}
|
|
10
|
+
export interface ToolbarItemComponentProps {
|
|
11
|
+
editor: Editor;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
icon?: Component;
|
|
15
|
+
title?: string;
|
|
16
|
+
action?: () => void;
|
|
17
|
+
children?: ToolbarItemType[];
|
|
18
|
+
}
|
|
19
|
+
export interface BubbleMenuOptions {
|
|
20
|
+
strategy?: "absolute" | "fixed";
|
|
21
|
+
placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
|
|
22
|
+
offset?: Parameters<typeof offset>[0] | boolean;
|
|
23
|
+
flip?: Parameters<typeof flip>[0] | boolean;
|
|
24
|
+
shift?: Parameters<typeof shift>[0] | boolean;
|
|
25
|
+
arrow?: Parameters<typeof arrow>[0] | false;
|
|
26
|
+
size?: Parameters<typeof size>[0] | boolean;
|
|
27
|
+
autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean;
|
|
28
|
+
hide?: Parameters<typeof hide>[0] | boolean;
|
|
29
|
+
inline?: Parameters<typeof inline>[0] | boolean;
|
|
30
|
+
onShow?: () => void;
|
|
31
|
+
onHide?: () => void;
|
|
32
|
+
onUpdate?: () => void;
|
|
33
|
+
onDestroy?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* The scrollable element that should be listened to when updating the position of the bubble menu.
|
|
36
|
+
* If not provided, the window will be used.
|
|
37
|
+
* @type {HTMLElement | Window}
|
|
38
|
+
*/
|
|
39
|
+
scrollTarget?: HTMLElement | Window;
|
|
40
|
+
}
|
|
41
|
+
export interface DragButtonItemProps {
|
|
42
|
+
extendsKey?: string;
|
|
43
|
+
priority?: number;
|
|
44
|
+
title?: string | (({ editor, node, pos, }: {
|
|
45
|
+
editor: Editor;
|
|
46
|
+
node: PMNode | null;
|
|
47
|
+
pos: number;
|
|
48
|
+
}) => string);
|
|
49
|
+
icon?: Component;
|
|
50
|
+
key?: string;
|
|
51
|
+
action?: ({ editor, node, pos, close, }: {
|
|
8
52
|
editor: Editor;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
53
|
+
node: PMNode | null;
|
|
54
|
+
pos: number;
|
|
55
|
+
close: () => void;
|
|
56
|
+
}) => Component | boolean | void | Promise<Component | boolean | void>;
|
|
57
|
+
iconStyle?: string;
|
|
58
|
+
class?: string;
|
|
59
|
+
visible?: ({ editor, node, pos, }: {
|
|
60
|
+
editor: Editor;
|
|
61
|
+
node: PMNode | null;
|
|
62
|
+
pos: number;
|
|
63
|
+
}) => boolean;
|
|
64
|
+
isActive?: ({ editor, node, pos, }: {
|
|
65
|
+
editor: Editor;
|
|
66
|
+
node: PMNode | null;
|
|
67
|
+
pos: number;
|
|
68
|
+
}) => boolean;
|
|
69
|
+
disabled?: ({ editor, node, pos, }: {
|
|
70
|
+
editor: Editor;
|
|
71
|
+
node: PMNode | null;
|
|
72
|
+
pos: number;
|
|
73
|
+
}) => boolean;
|
|
74
|
+
keyboard?: string;
|
|
75
|
+
component?: Component;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
export interface DragButtonType extends DragButtonItemProps {
|
|
79
|
+
children?: {
|
|
80
|
+
component?: Component;
|
|
81
|
+
items?: DragButtonItemProps[];
|
|
14
82
|
};
|
|
15
|
-
children?: ToolbarItemType[];
|
|
16
83
|
}
|
|
17
|
-
interface BubbleMenuProps {
|
|
18
|
-
pluginKey?: string;
|
|
84
|
+
export interface BubbleMenuProps {
|
|
85
|
+
pluginKey?: string | PluginKey;
|
|
19
86
|
editor?: Editor;
|
|
20
|
-
shouldShow
|
|
87
|
+
shouldShow?: (props: {
|
|
21
88
|
editor: Editor;
|
|
89
|
+
element: HTMLElement;
|
|
90
|
+
view: EditorView;
|
|
22
91
|
state: EditorState;
|
|
23
|
-
node?: HTMLElement;
|
|
24
|
-
view?: EditorView;
|
|
25
92
|
oldState?: EditorState;
|
|
26
|
-
from
|
|
27
|
-
to
|
|
93
|
+
from: number;
|
|
94
|
+
to: number;
|
|
28
95
|
}) => boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
96
|
+
appendTo?: HTMLElement | (() => HTMLElement) | undefined;
|
|
97
|
+
getReferencedVirtualElement?: () => VirtualElement | null;
|
|
98
|
+
options?: BubbleMenuOptions | null;
|
|
32
99
|
}
|
|
33
100
|
export interface NodeBubbleMenuType extends BubbleMenuProps {
|
|
34
101
|
component?: Component;
|
|
35
102
|
items?: BubbleItemType[];
|
|
103
|
+
extendsKey?: string | PluginKey;
|
|
36
104
|
}
|
|
37
105
|
export interface BubbleItemType {
|
|
38
106
|
priority: number;
|
|
39
107
|
component?: Component;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
108
|
+
key?: string;
|
|
109
|
+
props?: Omit<BubbleItemComponentProps, "editor"> & Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
export interface BubbleItemComponentProps {
|
|
112
|
+
editor: Editor;
|
|
113
|
+
isActive?: ({ editor }: {
|
|
114
|
+
editor: Editor;
|
|
115
|
+
}) => boolean;
|
|
116
|
+
visible?: ({ editor }: {
|
|
117
|
+
editor: Editor;
|
|
118
|
+
}) => boolean;
|
|
119
|
+
icon?: Component;
|
|
120
|
+
iconStyle?: string;
|
|
121
|
+
title?: string;
|
|
122
|
+
action?: ({ editor }: {
|
|
123
|
+
editor: Editor;
|
|
124
|
+
}) => Component | boolean | void;
|
|
54
125
|
}
|
|
55
126
|
export interface ToolboxItemType {
|
|
56
127
|
priority: number;
|
|
57
128
|
component: Component;
|
|
58
|
-
props:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
129
|
+
props: ToolboxItemComponentProps & Record<string, unknown>;
|
|
130
|
+
}
|
|
131
|
+
export interface ToolboxItemComponentProps {
|
|
132
|
+
editor: Editor;
|
|
133
|
+
icon?: Component;
|
|
134
|
+
title?: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
action?: () => void;
|
|
65
137
|
}
|
|
66
138
|
export interface ExtensionOptions {
|
|
67
139
|
getToolbarItems?: ({ editor, }: {
|
|
@@ -74,9 +146,9 @@ export interface ExtensionOptions {
|
|
|
74
146
|
getToolboxItems?: ({ editor, }: {
|
|
75
147
|
editor: Editor;
|
|
76
148
|
}) => ToolboxItemType | ToolboxItemType[];
|
|
77
|
-
|
|
149
|
+
getDraggableMenuItems?: ({ editor, }: {
|
|
78
150
|
editor: Editor;
|
|
79
|
-
}) =>
|
|
151
|
+
}) => DragButtonType | DragButtonType[];
|
|
80
152
|
}
|
|
81
153
|
export interface CommandMenuItemType {
|
|
82
154
|
priority: number;
|
|
@@ -90,7 +162,7 @@ export interface CommandMenuItemType {
|
|
|
90
162
|
}
|
|
91
163
|
export interface DragSelectionNodeType {
|
|
92
164
|
$pos?: ResolvedPos;
|
|
93
|
-
node?:
|
|
165
|
+
node?: PMNode;
|
|
94
166
|
el: HTMLElement;
|
|
95
167
|
nodeOffset?: number;
|
|
96
168
|
dragDomOffset?: {
|
|
@@ -98,19 +170,3 @@ export interface DragSelectionNodeType {
|
|
|
98
170
|
y?: number;
|
|
99
171
|
};
|
|
100
172
|
}
|
|
101
|
-
export interface DraggableItemType {
|
|
102
|
-
getRenderContainer?: ({ dom, view, }: {
|
|
103
|
-
dom: HTMLElement;
|
|
104
|
-
view: EditorView;
|
|
105
|
-
}) => DragSelectionNodeType;
|
|
106
|
-
handleDrop?: ({ view, event, slice, insertPos, node, selection, }: {
|
|
107
|
-
view: EditorView;
|
|
108
|
-
event: DragEvent;
|
|
109
|
-
slice: Slice;
|
|
110
|
-
insertPos: number;
|
|
111
|
-
node: Node;
|
|
112
|
-
selection: Selection;
|
|
113
|
-
}) => boolean | void;
|
|
114
|
-
allowPropagationDownward?: boolean;
|
|
115
|
-
}
|
|
116
|
-
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor, VueEditor } from '../tiptap';
|
|
2
|
+
/**
|
|
3
|
+
* Copy the selected content from the editor to the clipboard
|
|
4
|
+
* Supports both HTML and plain text formats
|
|
5
|
+
*
|
|
6
|
+
* @param editor - TipTap editor instance
|
|
7
|
+
* @returns Promise<boolean> - Whether the copy operation was successful
|
|
8
|
+
*/
|
|
9
|
+
export declare function copySelectionToClipboard(editor: Editor | VueEditor): Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { Editor } from '../tiptap';
|
|
1
2
|
import { Transaction, ResolvedPos } from '../tiptap/pm';
|
|
2
|
-
import { Editor } from '../tiptap/vue-3';
|
|
3
3
|
export declare const deleteNodeByPos: ($pos: ResolvedPos) => (tr: Transaction) => boolean;
|
|
4
4
|
export declare const deleteNode: (nodeType: string, editor: Editor) => boolean;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export * from './anchor';
|
|
2
|
+
export * from './attachment';
|
|
3
|
+
export * from './clipboard';
|
|
2
4
|
export * from './delete-node';
|
|
5
|
+
export * from './filter-duplicate-extensions';
|
|
6
|
+
export * from './is-allowed-uri';
|
|
7
|
+
export * from './is-list-active';
|
|
8
|
+
export * from './is-node-empty';
|
|
9
|
+
export * from './keyboard';
|
|
10
|
+
export * from './upload';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Editor } from '../tiptap';
|
|
2
2
|
/**
|
|
3
3
|
* Check if a list is active
|
|
4
4
|
*
|
|
@@ -9,4 +9,4 @@ import { CoreEditor } from '../tiptap';
|
|
|
9
9
|
* const isActive = isListActive(editor.state);
|
|
10
10
|
* ```
|
|
11
11
|
**/
|
|
12
|
-
export declare const isListActive: (editor:
|
|
12
|
+
export declare const isListActive: (editor: Editor) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Node } from '@tiptap/pm/model';
|
|
2
|
+
export declare const isEmpty: (node: Node) => boolean;
|
|
3
|
+
export declare const isNodeDefault: (node: Node) => boolean;
|
|
4
|
+
export declare const isNodeContentEmpty: (node: Node) => boolean;
|
|
5
|
+
export declare const isParagraphEmpty: (node: Node) => boolean;
|
|
6
|
+
export declare const isBlockEmpty: (node: Node) => boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard shortcut utilities
|
|
3
|
+
* Reference: tiptap keyboard shortcuts format https://tiptap.dev/docs/editor/core-concepts/keyboard-shortcuts
|
|
4
|
+
*/
|
|
5
|
+
interface ParsedShortcut {
|
|
6
|
+
key: string;
|
|
7
|
+
ctrlKey: boolean;
|
|
8
|
+
shiftKey: boolean;
|
|
9
|
+
altKey: boolean;
|
|
10
|
+
metaKey: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse shortcut string
|
|
14
|
+
* Supported formats:
|
|
15
|
+
* - Mod-l (Mac: Cmd+L, Others: Ctrl+L)
|
|
16
|
+
* - Control-Shift-Enter
|
|
17
|
+
* - Shift-Tab
|
|
18
|
+
* - Alt-1
|
|
19
|
+
*
|
|
20
|
+
* @param shortcut - Shortcut string
|
|
21
|
+
* @returns Parsed shortcut object
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseShortcut(shortcut: string): ParsedShortcut;
|
|
24
|
+
/**
|
|
25
|
+
* Check if a keyboard event matches a shortcut
|
|
26
|
+
* @param event - Keyboard event
|
|
27
|
+
* @param shortcut - Shortcut string
|
|
28
|
+
* @returns Whether the event matches the shortcut
|
|
29
|
+
*/
|
|
30
|
+
export declare function matchShortcut(event: KeyboardEvent, shortcut: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Format shortcut to display text
|
|
33
|
+
* @param shortcut - Shortcut string
|
|
34
|
+
* @returns Formatted display text
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatShortcut(shortcut: string): string;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Attachment } from '@halo-dev/api-client';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { Editor, PMNode } from '../tiptap';
|
|
4
|
+
export interface FileProps {
|
|
5
|
+
file: File;
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates an editor node from a file.
|
|
10
|
+
*
|
|
11
|
+
* @param editor - Editor instance
|
|
12
|
+
* @param file - File to be uploaded
|
|
13
|
+
* @returns - Editor node
|
|
14
|
+
*/
|
|
15
|
+
export declare const createEditorNodeFormFile: (editor: Editor, file: File) => PMNode | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Handles file events, determining if the file is an image and triggering the appropriate upload process.
|
|
18
|
+
*
|
|
19
|
+
* @param {FileProps} { file, editor } - File and editor instances
|
|
20
|
+
* @returns {boolean} - True if a file is handled, otherwise false
|
|
21
|
+
*/
|
|
22
|
+
export declare const handleFileEvent: (editor: Editor, files: File[]) => false | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Uploads an image file and inserts it into the editor.
|
|
25
|
+
*
|
|
26
|
+
* @param editor - Editor instance
|
|
27
|
+
* @param file - File to be uploaded
|
|
28
|
+
*/
|
|
29
|
+
export declare const uploadImage: (editor: Editor, file: File) => PMNode;
|
|
30
|
+
/**
|
|
31
|
+
* Uploads a video file and inserts it into the editor.
|
|
32
|
+
*
|
|
33
|
+
* @param editor - Editor instance
|
|
34
|
+
* @param file - File to be uploaded
|
|
35
|
+
*/
|
|
36
|
+
export declare const uploadVideo: (editor: Editor, file: File) => PMNode;
|
|
37
|
+
/**
|
|
38
|
+
* Uploads an audio file and inserts it into the editor.
|
|
39
|
+
*
|
|
40
|
+
* @param editor - Editor instance
|
|
41
|
+
* @param file - File to be uploaded
|
|
42
|
+
*/
|
|
43
|
+
export declare const uploadAudio: (editor: Editor, file: File) => PMNode;
|
|
44
|
+
export interface UploadFetchResponse {
|
|
45
|
+
controller: AbortController;
|
|
46
|
+
onUploadProgress: (progress: number) => void;
|
|
47
|
+
onFinish: (attachment?: Attachment) => void;
|
|
48
|
+
onError: (error: Error) => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Uploads a file with progress monitoring, cancellation support, and callbacks for completion and errors.
|
|
52
|
+
*
|
|
53
|
+
* @param {File} file - File to be uploaded
|
|
54
|
+
* @param {Function} upload - Function to handle the file upload, should return a Promise
|
|
55
|
+
* @returns {Promise<UploadFetchResponse>} - Returns an object with control and callback methods
|
|
56
|
+
*/
|
|
57
|
+
export declare const uploadFile: (file: File, upload: (file: File, options?: AxiosRequestConfig) => Promise<Attachment>, uploadResponse: UploadFetchResponse) => Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Converts a file to a Base64 string.
|
|
60
|
+
*
|
|
61
|
+
* @param {File} file - File to be converted
|
|
62
|
+
* @returns {Promise<string>} - A promise that resolves with the Base64 string
|
|
63
|
+
*/
|
|
64
|
+
export declare function fileToBase64(file: File): Promise<string>;
|
|
65
|
+
export declare function containsFileClipboardIdentifier(types: readonly string[]): boolean;
|
|
66
|
+
export declare function batchUploadExternalLink(editor: Editor, nodes: {
|
|
67
|
+
node: PMNode;
|
|
68
|
+
pos: number;
|
|
69
|
+
index: number;
|
|
70
|
+
parent: PMNode | null;
|
|
71
|
+
}[]): Promise<void>;
|
|
72
|
+
export declare function uploadExternalLink(editor: Editor, nodeWithPos: {
|
|
73
|
+
node: PMNode;
|
|
74
|
+
pos: number;
|
|
75
|
+
index: number;
|
|
76
|
+
parent: PMNode | null;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
export declare function isExternalAsset(src: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,95 +1,83 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halo-dev/richtext-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "Default editor for Halo",
|
|
5
5
|
"homepage": "https://github.com/halo-dev/halo/tree/main/ui/packages/editor#readme",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/halo-dev/halo/issues"
|
|
8
8
|
},
|
|
9
|
+
"license": "GPL-3.0",
|
|
10
|
+
"author": "@halo-dev",
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "https://github.com/halo-dev/halo.git",
|
|
12
14
|
"directory": "ui/packages/editor"
|
|
13
15
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.iife.js",
|
|
21
|
+
"module": "./dist/index.es.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"unpkg": "./dist/index.iife.js",
|
|
24
|
+
"jsdelivr": "./dist/index.iife.js",
|
|
16
25
|
"exports": {
|
|
17
26
|
".": {
|
|
18
27
|
"types": "./dist/index.d.ts",
|
|
19
|
-
"import": "./dist/
|
|
28
|
+
"import": "./dist/index.es.js"
|
|
20
29
|
},
|
|
21
30
|
"./dist/style.css": "./dist/style.css"
|
|
22
31
|
},
|
|
23
|
-
"main": "./dist/rich-text-editor.iife.js",
|
|
24
|
-
"jsdelivr": "./dist/rich-text-editor.iife.js",
|
|
25
|
-
"unpkg": "./dist/rich-text-editor.iife.js",
|
|
26
|
-
"module": "./dist/rich-text-editor.es.js",
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
28
|
-
"files": [
|
|
29
|
-
"dist"
|
|
30
|
-
],
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@tiptap/core": "^
|
|
34
|
-
"@tiptap/extension-blockquote": "^
|
|
35
|
-
"@tiptap/extension-bold": "^
|
|
36
|
-
"@tiptap/extension-
|
|
37
|
-
"@tiptap/extension-code": "^
|
|
38
|
-
"@tiptap/extension-
|
|
39
|
-
"@tiptap/extension-
|
|
40
|
-
"@tiptap/extension-document": "^
|
|
41
|
-
"@tiptap/extension-
|
|
42
|
-
"@tiptap/extension-
|
|
43
|
-
"@tiptap/extension-
|
|
44
|
-
"@tiptap/extension-
|
|
45
|
-
"@tiptap/extension-
|
|
46
|
-
"@tiptap/extension-horizontal-rule": "^
|
|
47
|
-
"@tiptap/extension-image": "^
|
|
48
|
-
"@tiptap/extension-italic": "^
|
|
49
|
-
"@tiptap/extension-link": "^
|
|
50
|
-
"@tiptap/extension-list
|
|
51
|
-
"@tiptap/extension-
|
|
52
|
-
"@tiptap/extension-
|
|
53
|
-
"@tiptap/extension-
|
|
54
|
-
"@tiptap/extension-
|
|
55
|
-
"@tiptap/extension-
|
|
56
|
-
"@tiptap/extension-
|
|
57
|
-
"@tiptap/extension-
|
|
58
|
-
"@tiptap/extension-
|
|
59
|
-
"@tiptap/extension-
|
|
60
|
-
"@tiptap/
|
|
61
|
-
"@tiptap/
|
|
62
|
-
"@tiptap/
|
|
63
|
-
"@tiptap/
|
|
64
|
-
"@tiptap/extension-text-style": "^2.11.2",
|
|
65
|
-
"@tiptap/extension-underline": "^2.11.2",
|
|
66
|
-
"@tiptap/pm": "^2.11.2",
|
|
67
|
-
"@tiptap/suggestion": "^2.11.2",
|
|
68
|
-
"@tiptap/vue-3": "^2.11.2",
|
|
69
|
-
"floating-vue": "^5.2.2",
|
|
33
|
+
"@floating-ui/dom": "^1.7.4",
|
|
34
|
+
"@tiptap/core": "^3.17.1",
|
|
35
|
+
"@tiptap/extension-blockquote": "^3.17.1",
|
|
36
|
+
"@tiptap/extension-bold": "^3.17.1",
|
|
37
|
+
"@tiptap/extension-code": "^3.17.1",
|
|
38
|
+
"@tiptap/extension-code-block": "^3.17.1",
|
|
39
|
+
"@tiptap/extension-color": "^3.17.1",
|
|
40
|
+
"@tiptap/extension-details": "^3.17.1",
|
|
41
|
+
"@tiptap/extension-document": "^3.17.1",
|
|
42
|
+
"@tiptap/extension-drag-handle": "^3.17.1",
|
|
43
|
+
"@tiptap/extension-drag-handle-vue-3": "^3.17.1",
|
|
44
|
+
"@tiptap/extension-hard-break": "^3.17.1",
|
|
45
|
+
"@tiptap/extension-heading": "^3.17.1",
|
|
46
|
+
"@tiptap/extension-highlight": "^3.17.1",
|
|
47
|
+
"@tiptap/extension-horizontal-rule": "^3.17.1",
|
|
48
|
+
"@tiptap/extension-image": "^3.17.1",
|
|
49
|
+
"@tiptap/extension-italic": "^3.17.1",
|
|
50
|
+
"@tiptap/extension-link": "^3.17.1",
|
|
51
|
+
"@tiptap/extension-list": "^3.17.1",
|
|
52
|
+
"@tiptap/extension-paragraph": "^3.17.1",
|
|
53
|
+
"@tiptap/extension-strike": "^3.17.1",
|
|
54
|
+
"@tiptap/extension-subscript": "^3.17.1",
|
|
55
|
+
"@tiptap/extension-superscript": "^3.17.1",
|
|
56
|
+
"@tiptap/extension-table": "^3.17.1",
|
|
57
|
+
"@tiptap/extension-text": "^3.17.1",
|
|
58
|
+
"@tiptap/extension-text-align": "^3.17.1",
|
|
59
|
+
"@tiptap/extension-text-style": "^3.17.1",
|
|
60
|
+
"@tiptap/extension-underline": "^3.17.1",
|
|
61
|
+
"@tiptap/extensions": "^3.17.1",
|
|
62
|
+
"@tiptap/pm": "^3.17.1",
|
|
63
|
+
"@tiptap/suggestion": "^3.17.1",
|
|
64
|
+
"@tiptap/vue-3": "^3.17.1",
|
|
70
65
|
"github-markdown-css": "^5.2.0",
|
|
71
66
|
"linkifyjs": "^4.1.3",
|
|
72
67
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
73
|
-
"
|
|
68
|
+
"@halo-dev/api-client": "2.23.0",
|
|
69
|
+
"@halo-dev/components": "2.23.0",
|
|
70
|
+
"@halo-dev/ui-shared": "2.23.0"
|
|
74
71
|
},
|
|
75
72
|
"devDependencies": {
|
|
76
|
-
"@
|
|
77
|
-
"@types/linkifyjs": "^2.1.7",
|
|
78
|
-
"release-it": "^16.1.5",
|
|
79
|
-
"vite-plugin-dts": "^4.2.2"
|
|
73
|
+
"@types/linkifyjs": "^2.1.7"
|
|
80
74
|
},
|
|
81
75
|
"peerDependencies": {
|
|
82
|
-
"vue": "^3.5.
|
|
76
|
+
"vue": "^3.5.x"
|
|
83
77
|
},
|
|
84
78
|
"scripts": {
|
|
85
|
-
"build": "vite build
|
|
86
|
-
"dev": "vite",
|
|
87
|
-
"lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
|
|
88
|
-
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}'",
|
|
89
|
-
"release": "release-it",
|
|
90
|
-
"test:unit:coverage": "vitest run --environment jsdom --coverage",
|
|
91
|
-
"test:unit:ui": "vitest --environment jsdom --watch --ui",
|
|
92
|
-
"test:unit:watch": "vitest --environment jsdom --watch",
|
|
79
|
+
"build": "vite build",
|
|
80
|
+
"dev": "vite build --watch --mode development",
|
|
93
81
|
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
|
|
94
82
|
}
|
|
95
83
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{
|
|
2
|
-
tooltip?: string;
|
|
3
|
-
modelValue?: string;
|
|
4
|
-
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
5
|
-
"update:modelValue": (value: string) => any;
|
|
6
|
-
}, string, import('vue').PublicProps, Readonly<{
|
|
7
|
-
tooltip?: string;
|
|
8
|
-
modelValue?: string;
|
|
9
|
-
}> & Readonly<{
|
|
10
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
tooltip: string;
|
|
13
|
-
modelValue: string;
|
|
14
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
15
|
-
export default _default;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Editor } from '../../tiptap/vue-3';
|
|
2
|
-
declare function __VLS_template(): {
|
|
3
|
-
slots: {
|
|
4
|
-
content?(_: {}): any;
|
|
5
|
-
actions?(_: {}): any;
|
|
6
|
-
};
|
|
7
|
-
refs: {};
|
|
8
|
-
attrs: Partial<{}>;
|
|
9
|
-
};
|
|
10
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<{
|
|
12
|
-
selected: boolean;
|
|
13
|
-
editor: Editor;
|
|
14
|
-
getPos: () => number;
|
|
15
|
-
deleteNode: () => void;
|
|
16
|
-
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
17
|
-
selected: boolean;
|
|
18
|
-
editor: Editor;
|
|
19
|
-
getPos: () => number;
|
|
20
|
-
deleteNode: () => void;
|
|
21
|
-
}> & Readonly<{}>, {
|
|
22
|
-
selected: boolean;
|
|
23
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
24
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
25
|
-
export default _default;
|
|
26
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
27
|
-
new (): {
|
|
28
|
-
$slots: S;
|
|
29
|
-
};
|
|
30
|
-
};
|