@bitrix24/b24ui-nuxt 2.1.10 → 2.1.12
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-AI.md +1 -1
- package/dist/meta.d.mts +98220 -780
- package/dist/meta.mjs +98220 -780
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +6 -2
- package/dist/runtime/components/ContextMenu.vue.d.ts +6 -2
- package/dist/runtime/components/ContextMenuContent.vue +2 -2
- package/dist/runtime/components/DropdownMenu.d.vue.ts +6 -2
- package/dist/runtime/components/DropdownMenu.vue.d.ts +6 -2
- package/dist/runtime/components/DropdownMenuContent.vue +2 -2
- package/dist/runtime/components/Editor.d.vue.ts +87 -0
- package/dist/runtime/components/Editor.vue +185 -0
- package/dist/runtime/components/Editor.vue.d.ts +87 -0
- package/dist/runtime/components/EditorDragHandle.d.vue.ts +60 -0
- package/dist/runtime/components/EditorDragHandle.vue +128 -0
- package/dist/runtime/components/EditorDragHandle.vue.d.ts +60 -0
- package/dist/runtime/components/EditorEmojiMenu.d.vue.ts +35 -0
- package/dist/runtime/components/EditorEmojiMenu.vue +70 -0
- package/dist/runtime/components/EditorEmojiMenu.vue.d.ts +35 -0
- package/dist/runtime/components/EditorMentionMenu.d.vue.ts +39 -0
- package/dist/runtime/components/EditorMentionMenu.vue +74 -0
- package/dist/runtime/components/EditorMentionMenu.vue.d.ts +39 -0
- package/dist/runtime/components/EditorSuggestionMenu.d.vue.ts +52 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue +79 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue.d.ts +52 -0
- package/dist/runtime/components/EditorToolbar.d.vue.ts +80 -0
- package/dist/runtime/components/EditorToolbar.vue +239 -0
- package/dist/runtime/components/EditorToolbar.vue.d.ts +80 -0
- package/dist/runtime/components/FormField.vue +2 -2
- package/dist/runtime/components/InputMenu.d.vue.ts +2 -0
- package/dist/runtime/components/InputMenu.vue +14 -1
- package/dist/runtime/components/InputMenu.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.d.vue.ts +0 -1
- package/dist/runtime/components/Pagination.vue.d.ts +0 -1
- package/dist/runtime/components/Select.d.vue.ts +2 -0
- package/dist/runtime/components/Select.vue +14 -1
- package/dist/runtime/components/Select.vue.d.ts +2 -0
- package/dist/runtime/components/SelectMenu.d.vue.ts +2 -0
- package/dist/runtime/components/SelectMenu.vue +14 -1
- package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/runtime/components/locale/LocaleSelect.vue +1 -0
- package/dist/runtime/components/prose/Accordion.vue +1 -1
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.js +60 -13
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useEditorMenu.d.ts +64 -0
- package/dist/runtime/composables/useEditorMenu.js +448 -0
- package/dist/runtime/composables/useSpeechRecognition.d.ts +122 -0
- package/dist/runtime/composables/useSpeechRecognition.js +166 -0
- package/dist/runtime/dictionary/icons.d.ts +1 -0
- package/dist/runtime/dictionary/icons.js +5 -3
- package/dist/runtime/types/editor.d.ts +69 -0
- package/dist/runtime/types/editor.js +0 -0
- package/dist/runtime/types/index.d.ts +7 -0
- package/dist/runtime/types/index.js +7 -0
- package/dist/runtime/utils/editor.d.ts +69 -0
- package/dist/runtime/utils/editor.js +364 -0
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/shared/{b24ui-nuxt.BCphUjPy.mjs → b24ui-nuxt.C8MyFqPm.mjs} +185 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +16 -3
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Ref, DeepReadonly } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Speech recognition Web API types
|
|
4
|
+
* @see /bitrix/js/im/v2/component/textarea/src/components/audio-input/classes/audio-manager.js
|
|
5
|
+
*/
|
|
6
|
+
export type SpeechRecognitionErrorCode = 'aborted' | 'audio-capture' | 'bad-grammar' | 'language-not-supported' | 'network' | 'no-speech' | 'not-allowed' | 'service-not-allowed';
|
|
7
|
+
interface SpeechGrammar {
|
|
8
|
+
src: string;
|
|
9
|
+
weight: number;
|
|
10
|
+
}
|
|
11
|
+
interface SpeechGrammarList {
|
|
12
|
+
readonly length: number;
|
|
13
|
+
addFromString: (string: string, weight?: number) => void;
|
|
14
|
+
addFromURI: (src: string, weight?: number) => void;
|
|
15
|
+
item: (index: number) => SpeechGrammar;
|
|
16
|
+
[index: number]: SpeechGrammar;
|
|
17
|
+
}
|
|
18
|
+
export interface SpeechRecognitionErrorEvent extends Event {
|
|
19
|
+
readonly error: SpeechRecognitionErrorCode;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
}
|
|
22
|
+
interface SpeechRecognitionEvent extends Event {
|
|
23
|
+
readonly resultIndex: number;
|
|
24
|
+
readonly results: SpeechRecognitionResultList;
|
|
25
|
+
}
|
|
26
|
+
interface SpeechRecognitionEventMap {
|
|
27
|
+
audioend: Event;
|
|
28
|
+
audiostart: Event;
|
|
29
|
+
end: Event;
|
|
30
|
+
error: SpeechRecognitionErrorEvent;
|
|
31
|
+
nomatch: SpeechRecognitionEvent;
|
|
32
|
+
result: SpeechRecognitionEvent;
|
|
33
|
+
soundend: Event;
|
|
34
|
+
soundstart: Event;
|
|
35
|
+
speechend: Event;
|
|
36
|
+
speechstart: Event;
|
|
37
|
+
start: Event;
|
|
38
|
+
}
|
|
39
|
+
export interface SpeechRecognition extends EventTarget {
|
|
40
|
+
continuous: boolean;
|
|
41
|
+
grammars: SpeechGrammarList;
|
|
42
|
+
interimResults: boolean;
|
|
43
|
+
lang: string;
|
|
44
|
+
maxAlternatives: number;
|
|
45
|
+
onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
46
|
+
onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
47
|
+
onend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
48
|
+
onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
|
|
49
|
+
onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
|
|
50
|
+
onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
|
|
51
|
+
onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
52
|
+
onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
53
|
+
onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
54
|
+
onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
55
|
+
onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
|
|
56
|
+
abort: () => void;
|
|
57
|
+
start: () => void;
|
|
58
|
+
stop: () => void;
|
|
59
|
+
addEventListener: (<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void);
|
|
60
|
+
removeEventListener: (<K extends keyof SpeechRecognitionEventMap>(type: K, listener: (this: SpeechRecognition, ev: SpeechRecognitionEventMap[K]) => any, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
|
|
61
|
+
}
|
|
62
|
+
export interface SpeechRecognitionOptions {
|
|
63
|
+
/** Recognition language (default: 'en-US') */
|
|
64
|
+
lang?: string;
|
|
65
|
+
/** Continuous recognition (default: true) */
|
|
66
|
+
continuous?: boolean;
|
|
67
|
+
/** Interim results (default: true) */
|
|
68
|
+
interimResults?: boolean;
|
|
69
|
+
/** Максимальное количество альтернатив (по умолчанию: 1) */
|
|
70
|
+
maxAlternatives?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface SpeechRecognitionResult {
|
|
73
|
+
/** Recognized text */
|
|
74
|
+
text: string;
|
|
75
|
+
}
|
|
76
|
+
export interface SpeechRecognitionState {
|
|
77
|
+
/** Whether speech recognition is available in the browser */
|
|
78
|
+
isAvailable: boolean;
|
|
79
|
+
/** Whether recognition is currently active */
|
|
80
|
+
isListening: boolean;
|
|
81
|
+
/** All recognized text (accumulated if continuous mode) */
|
|
82
|
+
lastRecognizedText: string;
|
|
83
|
+
}
|
|
84
|
+
export interface SpeechRecognitionControls {
|
|
85
|
+
/** Start recognition */
|
|
86
|
+
start: () => Promise<boolean>;
|
|
87
|
+
/** Stop recognition */
|
|
88
|
+
stop: () => Promise<boolean>;
|
|
89
|
+
/** Toggle recognition state */
|
|
90
|
+
toggle: () => Promise<boolean>;
|
|
91
|
+
/** Set recognition language */
|
|
92
|
+
setLanguage: (lang: string) => boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface SpeechRecognitionEvents {
|
|
95
|
+
/** Called when recognition starts */
|
|
96
|
+
onStart?: () => void;
|
|
97
|
+
/** Called when recognition ends */
|
|
98
|
+
onEnd?: () => void;
|
|
99
|
+
/** Called on error */
|
|
100
|
+
onError?: (error: string) => void;
|
|
101
|
+
/** Called when a result is received */
|
|
102
|
+
onResult?: (result: SpeechRecognitionResult) => void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Universal composable for speech recognition
|
|
106
|
+
* Can be used with any input components (Input, Textarea, etc.)
|
|
107
|
+
*/
|
|
108
|
+
export declare function useSpeechRecognition(options?: SpeechRecognitionOptions, events?: SpeechRecognitionEvents): {
|
|
109
|
+
state: DeepReadonly<Ref<SpeechRecognitionState>>;
|
|
110
|
+
isAvailable: import("vue").ComputedRef<boolean>;
|
|
111
|
+
isListening: import("vue").ComputedRef<boolean>;
|
|
112
|
+
start: () => Promise<boolean>;
|
|
113
|
+
stop: () => Promise<boolean>;
|
|
114
|
+
toggle: () => Promise<boolean>;
|
|
115
|
+
setLanguage: (lang: string) => boolean;
|
|
116
|
+
recognizer: SpeechRecognition | undefined;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Return type of useSpeechRecognition
|
|
120
|
+
*/
|
|
121
|
+
export type UseSpeechRecognitionReturn = ReturnType<typeof useSpeechRecognition>;
|
|
122
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { ref, computed, onMounted, onBeforeUnmount, readonly } from "vue";
|
|
2
|
+
export function useSpeechRecognition(options = {}, events = {}) {
|
|
3
|
+
const {
|
|
4
|
+
lang = "en-US",
|
|
5
|
+
continuous = true,
|
|
6
|
+
interimResults = true,
|
|
7
|
+
maxAlternatives = 1
|
|
8
|
+
} = options;
|
|
9
|
+
const {
|
|
10
|
+
onStart,
|
|
11
|
+
onEnd,
|
|
12
|
+
onError,
|
|
13
|
+
onResult
|
|
14
|
+
} = events;
|
|
15
|
+
const state = ref({
|
|
16
|
+
isAvailable: false,
|
|
17
|
+
isListening: false,
|
|
18
|
+
lastRecognizedText: ""
|
|
19
|
+
});
|
|
20
|
+
let recognizer;
|
|
21
|
+
const isAvailable = computed(() => state.value.isAvailable);
|
|
22
|
+
const isListening = computed(() => state.value.isListening);
|
|
23
|
+
const init = () => {
|
|
24
|
+
if (typeof window === "undefined") {
|
|
25
|
+
onError?.("Speech recognition is not available in this environment");
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const SpeechRecognition = window && (window.SpeechRecognition || window.webkitSpeechRecognition);
|
|
29
|
+
if (!SpeechRecognition) {
|
|
30
|
+
state.value.isAvailable = false;
|
|
31
|
+
onError?.("Speech recognition is not supported in this browser");
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
recognizer = new SpeechRecognition();
|
|
36
|
+
recognizer.lang = lang;
|
|
37
|
+
recognizer.continuous = continuous;
|
|
38
|
+
recognizer.interimResults = interimResults;
|
|
39
|
+
recognizer.maxAlternatives = maxAlternatives;
|
|
40
|
+
setupEventHandlers();
|
|
41
|
+
state.value.isAvailable = true;
|
|
42
|
+
return true;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
onError?.(error instanceof Error ? error.message : "Failed to initialize speech recognition");
|
|
45
|
+
state.value.isAvailable = false;
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const setupEventHandlers = () => {
|
|
50
|
+
if (!recognizer) return;
|
|
51
|
+
recognizer.onstart = () => {
|
|
52
|
+
state.value.isListening = true;
|
|
53
|
+
onStart?.();
|
|
54
|
+
};
|
|
55
|
+
recognizer.onerror = (event) => {
|
|
56
|
+
state.value.isListening = false;
|
|
57
|
+
onError?.(event.error);
|
|
58
|
+
};
|
|
59
|
+
recognizer.onend = () => {
|
|
60
|
+
state.value.isListening = false;
|
|
61
|
+
onEnd?.();
|
|
62
|
+
};
|
|
63
|
+
recognizer.onresult = (event) => {
|
|
64
|
+
const recognizedText = _getRecognizedText(event);
|
|
65
|
+
const nextText = _getNewText(recognizedText);
|
|
66
|
+
if (nextText !== "") {
|
|
67
|
+
onResult?.({ text: nextText });
|
|
68
|
+
}
|
|
69
|
+
state.value.lastRecognizedText = recognizedText;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const _getRecognizedText = (event) => {
|
|
73
|
+
let recognizedChunk = "";
|
|
74
|
+
Object.values(event.results).forEach((result) => {
|
|
75
|
+
if (result.isFinal) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const [alternative] = result;
|
|
79
|
+
const { transcript } = alternative;
|
|
80
|
+
recognizedChunk += transcript;
|
|
81
|
+
});
|
|
82
|
+
return recognizedChunk;
|
|
83
|
+
};
|
|
84
|
+
const _getNewText = (fullText) => {
|
|
85
|
+
let additionalText = "";
|
|
86
|
+
const lastChunkLength = state.value.lastRecognizedText.length;
|
|
87
|
+
if (fullText.length > lastChunkLength) {
|
|
88
|
+
additionalText = fullText.slice(lastChunkLength);
|
|
89
|
+
}
|
|
90
|
+
return additionalText;
|
|
91
|
+
};
|
|
92
|
+
const start = async () => {
|
|
93
|
+
if (!state.value.isAvailable) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (state.value.isListening) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (!recognizer) {
|
|
100
|
+
if (!init()) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
recognizer.start();
|
|
106
|
+
return true;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
onError?.(error instanceof Error ? error.message : "Failed to start speech recognition");
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const stop = async () => {
|
|
113
|
+
if (!state.value.isListening || !recognizer) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
recognizer.stop();
|
|
118
|
+
return true;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
onError?.(error instanceof Error ? error.message : "Failed to stop speech recognition");
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const toggle = async () => {
|
|
125
|
+
if (state.value.isListening) {
|
|
126
|
+
return stop();
|
|
127
|
+
} else {
|
|
128
|
+
return start();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const setLanguage = (lang2) => {
|
|
132
|
+
if (!recognizer) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
recognizer.lang = lang2;
|
|
137
|
+
return true;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
onError?.(error instanceof Error ? error.message : "Failed to set language");
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
onMounted(() => {
|
|
144
|
+
init();
|
|
145
|
+
});
|
|
146
|
+
onBeforeUnmount(() => {
|
|
147
|
+
if (state.value.isListening) {
|
|
148
|
+
stop();
|
|
149
|
+
}
|
|
150
|
+
recognizer = void 0;
|
|
151
|
+
});
|
|
152
|
+
return {
|
|
153
|
+
// State (readonly)
|
|
154
|
+
state: readonly(state),
|
|
155
|
+
// Computed properties
|
|
156
|
+
isAvailable,
|
|
157
|
+
isListening,
|
|
158
|
+
// Controls
|
|
159
|
+
start,
|
|
160
|
+
stop,
|
|
161
|
+
toggle,
|
|
162
|
+
setLanguage,
|
|
163
|
+
// Recognizer instance (for advanced usage)
|
|
164
|
+
recognizer
|
|
165
|
+
};
|
|
166
|
+
}
|
|
@@ -40,5 +40,6 @@ declare const _default: {
|
|
|
40
40
|
arrowUp: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
41
41
|
stop: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
42
42
|
reload: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
43
|
+
drag: import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}>;
|
|
43
44
|
};
|
|
44
45
|
export default _default;
|
|
@@ -8,7 +8,6 @@ import DoubleShevronsRightIcon from "@bitrix24/b24icons-vue/actions/DoubleShevro
|
|
|
8
8
|
import DoubleShevronsLeftIcon from "@bitrix24/b24icons-vue/actions/DoubleShevronsLeftIcon";
|
|
9
9
|
import CrossMIcon from "@bitrix24/b24icons-vue/outline/CrossMIcon";
|
|
10
10
|
import DotsIcon from "@bitrix24/b24icons-vue/button/DotsIcon";
|
|
11
|
-
import OpenIn50Icon from "@bitrix24/b24icons-vue/actions/OpenIn50Icon";
|
|
12
11
|
import Refresh6Icon from "@bitrix24/b24icons-vue/actions/Refresh6Icon";
|
|
13
12
|
import Minus30Icon from "@bitrix24/b24icons-vue/actions/Minus30Icon";
|
|
14
13
|
import Plus30Icon from "@bitrix24/b24icons-vue/actions/Plus30Icon";
|
|
@@ -32,6 +31,8 @@ import ArrowTopLIcon from "@bitrix24/b24icons-vue/outline/ArrowTopLIcon";
|
|
|
32
31
|
import StopLIcon from "@bitrix24/b24icons-vue/outline/StopLIcon";
|
|
33
32
|
import RefreshIcon from "@bitrix24/b24icons-vue/outline/RefreshIcon";
|
|
34
33
|
import SendIcon from "@bitrix24/b24icons-vue/main/SendIcon";
|
|
34
|
+
import DragLIcon from "@bitrix24/b24icons-vue/outline/DragLIcon";
|
|
35
|
+
import GoToLIcon from "@bitrix24/b24icons-vue/outline/GoToLIcon";
|
|
35
36
|
export default {
|
|
36
37
|
arrowLeft: ArrowToTheLeftIcon,
|
|
37
38
|
arrowRight: ArrowToTheRightIcon,
|
|
@@ -44,7 +45,7 @@ export default {
|
|
|
44
45
|
chevronUp: ChevronTopLIcon,
|
|
45
46
|
close: CrossMIcon,
|
|
46
47
|
ellipsis: DotsIcon,
|
|
47
|
-
external:
|
|
48
|
+
external: GoToLIcon,
|
|
48
49
|
file: FileIcon,
|
|
49
50
|
loading: LoaderWaitIcon,
|
|
50
51
|
refresh: Refresh6Icon,
|
|
@@ -67,5 +68,6 @@ export default {
|
|
|
67
68
|
arrowDown: ArrowDownLIcon,
|
|
68
69
|
arrowUp: ArrowTopLIcon,
|
|
69
70
|
stop: StopLIcon,
|
|
70
|
-
reload: RefreshIcon
|
|
71
|
+
reload: RefreshIcon,
|
|
72
|
+
drag: DragLIcon
|
|
71
73
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
import type { Strategy, Placement, OffsetOptions, FlipOptions, ShiftOptions, SizeOptions, AutoPlacementOptions, HideOptions, InlineOptions } from '@floating-ui/dom';
|
|
3
|
+
export interface FloatingUIOptions {
|
|
4
|
+
strategy?: Strategy;
|
|
5
|
+
placement?: Placement;
|
|
6
|
+
offset?: OffsetOptions | boolean;
|
|
7
|
+
flip?: FlipOptions | boolean;
|
|
8
|
+
shift?: ShiftOptions | boolean;
|
|
9
|
+
size?: SizeOptions | boolean;
|
|
10
|
+
autoPlacement?: AutoPlacementOptions | boolean;
|
|
11
|
+
hide?: HideOptions | boolean;
|
|
12
|
+
inline?: InlineOptions | boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface EditorHandler {
|
|
15
|
+
canExecute: (editor: Editor, cmd?: any) => boolean;
|
|
16
|
+
execute: (editor: Editor, cmd?: any) => any;
|
|
17
|
+
isActive: (editor: Editor, cmd?: any) => boolean;
|
|
18
|
+
isDisabled?: (editor: Editor, cmd?: any) => boolean;
|
|
19
|
+
}
|
|
20
|
+
export type EditorCustomHandlers = Record<string, EditorHandler>;
|
|
21
|
+
export type EditorHandlers<H extends EditorCustomHandlers = EditorCustomHandlers> = {
|
|
22
|
+
mark: EditorHandler;
|
|
23
|
+
textAlign: EditorHandler;
|
|
24
|
+
heading: EditorHandler;
|
|
25
|
+
link: EditorHandler;
|
|
26
|
+
image: EditorHandler;
|
|
27
|
+
blockquote: EditorHandler;
|
|
28
|
+
bulletList: EditorHandler;
|
|
29
|
+
orderedList: EditorHandler;
|
|
30
|
+
codeBlock: EditorHandler;
|
|
31
|
+
horizontalRule: EditorHandler;
|
|
32
|
+
paragraph: EditorHandler;
|
|
33
|
+
undo: EditorHandler;
|
|
34
|
+
redo: EditorHandler;
|
|
35
|
+
clearFormatting: EditorHandler;
|
|
36
|
+
duplicate: EditorHandler;
|
|
37
|
+
delete: EditorHandler;
|
|
38
|
+
moveUp: EditorHandler;
|
|
39
|
+
moveDown: EditorHandler;
|
|
40
|
+
suggestion: EditorHandler;
|
|
41
|
+
mention: EditorHandler;
|
|
42
|
+
emoji: EditorHandler;
|
|
43
|
+
} & H;
|
|
44
|
+
export type EditorItem<H extends EditorCustomHandlers = EditorCustomHandlers> = {
|
|
45
|
+
kind: 'mark';
|
|
46
|
+
mark: 'bold' | 'italic' | 'strike' | 'code' | 'underline';
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'textAlign';
|
|
49
|
+
align: 'left' | 'center' | 'right' | 'justify';
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'heading';
|
|
52
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'link';
|
|
55
|
+
href?: string;
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'image';
|
|
58
|
+
src?: string;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'duplicate' | 'delete' | 'moveUp' | 'moveDown';
|
|
61
|
+
pos: number;
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'clearFormatting' | 'suggestion';
|
|
64
|
+
pos?: number;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'blockquote' | 'bulletList' | 'orderedList' | 'codeBlock' | 'horizontalRule' | 'paragraph' | 'undo' | 'redo' | 'mention' | 'emoji';
|
|
67
|
+
} | {
|
|
68
|
+
kind: keyof H;
|
|
69
|
+
};
|
|
File without changes
|
|
@@ -29,6 +29,12 @@ export * from '../components/DashboardSearch.vue';
|
|
|
29
29
|
export * from '../components/DashboardSearchButton.vue';
|
|
30
30
|
export * from '../components/DescriptionList.vue';
|
|
31
31
|
export * from '../components/DropdownMenu.vue';
|
|
32
|
+
export * from '../components/Editor.vue';
|
|
33
|
+
export * from '../components/EditorDragHandle.vue';
|
|
34
|
+
export * from '../components/EditorEmojiMenu.vue';
|
|
35
|
+
export * from '../components/EditorMentionMenu.vue';
|
|
36
|
+
export * from '../components/EditorSuggestionMenu.vue';
|
|
37
|
+
export * from '../components/EditorToolbar.vue';
|
|
32
38
|
export * from '../components/Empty.vue';
|
|
33
39
|
export * from '../components/Error.vue';
|
|
34
40
|
export * from '../components/FieldGroup.vue';
|
|
@@ -92,6 +98,7 @@ export * from '../components/color-mode/ColorModeSelect.vue';
|
|
|
92
98
|
export * from '../components/color-mode/ColorModeSwitch.vue';
|
|
93
99
|
export * from '../components/locale/LocaleSelect.vue';
|
|
94
100
|
export * from './content';
|
|
101
|
+
export * from './editor';
|
|
95
102
|
export * from './form';
|
|
96
103
|
export * from './icons';
|
|
97
104
|
export * from './locale';
|
|
@@ -29,6 +29,12 @@ export * from "../components/DashboardSearch.vue";
|
|
|
29
29
|
export * from "../components/DashboardSearchButton.vue";
|
|
30
30
|
export * from "../components/DescriptionList.vue";
|
|
31
31
|
export * from "../components/DropdownMenu.vue";
|
|
32
|
+
export * from "../components/Editor.vue";
|
|
33
|
+
export * from "../components/EditorDragHandle.vue";
|
|
34
|
+
export * from "../components/EditorEmojiMenu.vue";
|
|
35
|
+
export * from "../components/EditorMentionMenu.vue";
|
|
36
|
+
export * from "../components/EditorSuggestionMenu.vue";
|
|
37
|
+
export * from "../components/EditorToolbar.vue";
|
|
32
38
|
export * from "../components/Empty.vue";
|
|
33
39
|
export * from "../components/Error.vue";
|
|
34
40
|
export * from "../components/FieldGroup.vue";
|
|
@@ -92,6 +98,7 @@ export * from "../components/color-mode/ColorModeSelect.vue";
|
|
|
92
98
|
export * from "../components/color-mode/ColorModeSwitch.vue";
|
|
93
99
|
export * from "../components/locale/LocaleSelect.vue";
|
|
94
100
|
export * from "./content.js";
|
|
101
|
+
export * from "./editor.js";
|
|
95
102
|
export * from "./form.js";
|
|
96
103
|
export * from "./icons.js";
|
|
97
104
|
export * from "./locale.js";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Editor, Mark } from '@tiptap/vue-3';
|
|
2
|
+
import type { Middleware } from '@floating-ui/dom';
|
|
3
|
+
import type { EditorHandlers, EditorCustomHandlers, EditorItem, FloatingUIOptions } from '../types/editor';
|
|
4
|
+
export declare function isMarkInSchema(mark: string | Mark, editor: Editor | null): boolean;
|
|
5
|
+
export declare function isNodeTypeSelected(editor: Editor | null, nodeTypes: string[]): boolean;
|
|
6
|
+
export declare function isExtensionAvailable(editor: Editor | null, extensionName: string): boolean;
|
|
7
|
+
export declare function createToggleHandler(name: string): {
|
|
8
|
+
canExecute: (editor: Editor) => any;
|
|
9
|
+
execute: (editor: Editor) => any;
|
|
10
|
+
isActive: (editor: Editor) => boolean;
|
|
11
|
+
isDisabled: (editor: Editor) => boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function createSetHandler(name: string): {
|
|
14
|
+
canExecute: (editor: Editor) => any;
|
|
15
|
+
execute: (editor: Editor) => any;
|
|
16
|
+
isActive: (editor: Editor) => boolean;
|
|
17
|
+
isDisabled: (editor: Editor) => boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function createSimpleHandler(name: string): {
|
|
20
|
+
canExecute: (editor: Editor) => any;
|
|
21
|
+
execute: (editor: Editor) => any;
|
|
22
|
+
isActive: () => boolean;
|
|
23
|
+
isDisabled: undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare function createMarkHandler(): {
|
|
26
|
+
canExecute: (editor: Editor, cmd: any) => any;
|
|
27
|
+
execute: (editor: Editor, cmd: any) => import("@tiptap/core").ChainedCommands;
|
|
28
|
+
isActive: (editor: Editor, cmd: any) => boolean;
|
|
29
|
+
isDisabled: (editor: Editor, cmd: any) => boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare function createTextAlignHandler(): {
|
|
32
|
+
canExecute: (editor: Editor, cmd: any) => any;
|
|
33
|
+
execute: (editor: Editor, cmd: any) => any;
|
|
34
|
+
isActive: (editor: Editor, cmd: any) => boolean;
|
|
35
|
+
isDisabled: (editor: Editor) => boolean;
|
|
36
|
+
};
|
|
37
|
+
export declare function createHeadingHandler(): {
|
|
38
|
+
canExecute: (editor: Editor, cmd: any) => any;
|
|
39
|
+
execute: (editor: Editor, cmd: any) => import("@tiptap/core").ChainedCommands;
|
|
40
|
+
isActive: (editor: Editor, cmd: any) => boolean;
|
|
41
|
+
isDisabled: (editor: Editor) => boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare function createLinkHandler(): {
|
|
44
|
+
canExecute: (editor: Editor) => any;
|
|
45
|
+
execute: (editor: Editor, cmd: any) => import("@tiptap/core").ChainedCommands;
|
|
46
|
+
isActive: (editor: Editor) => boolean;
|
|
47
|
+
isDisabled: (editor: Editor) => boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare function createImageHandler(): {
|
|
50
|
+
canExecute: (editor: Editor) => any;
|
|
51
|
+
execute: (editor: Editor, cmd: any) => import("@tiptap/core").ChainedCommands;
|
|
52
|
+
isActive: (editor: Editor) => boolean;
|
|
53
|
+
isDisabled: (editor: Editor) => boolean;
|
|
54
|
+
};
|
|
55
|
+
export declare function createListHandler(listType: 'bulletList' | 'orderedList'): {
|
|
56
|
+
canExecute: (editor: Editor) => any;
|
|
57
|
+
execute: (editor: Editor) => any;
|
|
58
|
+
isActive: (editor: Editor) => boolean;
|
|
59
|
+
isDisabled: (editor: Editor) => boolean;
|
|
60
|
+
};
|
|
61
|
+
export declare function createMoveHandler(direction: 'up' | 'down'): {
|
|
62
|
+
canExecute: (editor: Editor, cmd: any) => boolean;
|
|
63
|
+
execute: (editor: Editor, cmd: any) => import("@tiptap/core").ChainedCommands;
|
|
64
|
+
isActive: () => boolean;
|
|
65
|
+
isDisabled: undefined;
|
|
66
|
+
};
|
|
67
|
+
export declare function createHandlers(): EditorHandlers;
|
|
68
|
+
export declare function mapEditorItems(editor: Editor, items: (Partial<EditorItem> & Record<string, any>)[] | (Partial<EditorItem> & Record<string, any>)[][], customHandlers?: EditorCustomHandlers): any[] | any[][];
|
|
69
|
+
export declare function buildFloatingUIMiddleware(options: FloatingUIOptions): Middleware[];
|