@enos5/enos-vue-default 1.8.6 → 1.8.7
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.
|
@@ -37,9 +37,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
37
37
|
type: StringConstructor;
|
|
38
38
|
default: string;
|
|
39
39
|
};
|
|
40
|
-
}>, {
|
|
40
|
+
}>, {
|
|
41
|
+
getEditor: () => any;
|
|
42
|
+
focus: () => any;
|
|
43
|
+
execCommand: (command: any, ui: boolean | undefined, value: any) => any;
|
|
44
|
+
getContent: (options: any) => any;
|
|
45
|
+
getBody: () => any;
|
|
46
|
+
selectNode: (node: any) => void;
|
|
47
|
+
getBookmark: () => any;
|
|
48
|
+
moveToBookmark: (bookmark: any) => void;
|
|
49
|
+
syncContent: () => any;
|
|
50
|
+
insertContent: (value: any, options?: {}) => Promise<any>;
|
|
51
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
52
|
"update:modelValue": (...args: any[]) => void;
|
|
42
53
|
blur: (...args: any[]) => void;
|
|
54
|
+
init: (...args: any[]) => void;
|
|
43
55
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
56
|
modelValue: {
|
|
45
57
|
type: StringConstructor;
|
|
@@ -80,6 +92,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
80
92
|
}>> & Readonly<{
|
|
81
93
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
82
94
|
onBlur?: ((...args: any[]) => any) | undefined;
|
|
95
|
+
onInit?: ((...args: any[]) => any) | undefined;
|
|
83
96
|
}>, {
|
|
84
97
|
modelValue: string;
|
|
85
98
|
readonly: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './styles.css';
|
|
2
|
-
import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-
|
|
2
|
+
import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-ev2fN9wO.js";
|
|
3
3
|
export {
|
|
4
4
|
_ as ActionCard,
|
|
5
5
|
a as ActionMessage,
|
package/dist/index.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-
|
|
1
|
+
import { _, a, b, c, d, e, f, g, h, i, C, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2, a3 } from "./plugin-ev2fN9wO.js";
|
|
2
2
|
export {
|
|
3
3
|
_ as ActionCard,
|
|
4
4
|
a as ActionMessage,
|
|
@@ -2190,13 +2190,32 @@ const _sfc_main$x = {
|
|
|
2190
2190
|
default: "html"
|
|
2191
2191
|
}
|
|
2192
2192
|
},
|
|
2193
|
-
emits: ["update:modelValue", "blur"],
|
|
2194
|
-
setup(__props, { emit: __emit }) {
|
|
2193
|
+
emits: ["update:modelValue", "blur", "init"],
|
|
2194
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2195
2195
|
const props = __props;
|
|
2196
2196
|
const emit = __emit;
|
|
2197
2197
|
const content = ref(props.modelValue ?? "");
|
|
2198
2198
|
const isEditorReady = ref(false);
|
|
2199
2199
|
const editorRevision = ref(0);
|
|
2200
|
+
const editorComponentRef = ref(null);
|
|
2201
|
+
const editorInstance = ref(null);
|
|
2202
|
+
const getEditor = () => editorInstance.value ?? editorComponentRef.value?.getEditor?.() ?? null;
|
|
2203
|
+
const syncContentFromEditor = (editor = getEditor()) => {
|
|
2204
|
+
if (!editor) {
|
|
2205
|
+
return "";
|
|
2206
|
+
}
|
|
2207
|
+
const nextValue = editor.getContent({ format: props.outputFormat });
|
|
2208
|
+
content.value = nextValue;
|
|
2209
|
+
emit("update:modelValue", nextValue);
|
|
2210
|
+
return nextValue;
|
|
2211
|
+
};
|
|
2212
|
+
const waitForFrames = async (frameCount = 1) => {
|
|
2213
|
+
for (let index = 0; index < frameCount; index += 1) {
|
|
2214
|
+
await new Promise((resolve) => {
|
|
2215
|
+
requestAnimationFrame(() => resolve());
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
};
|
|
2200
2219
|
const loadTinyMce = async () => {
|
|
2201
2220
|
const tinymceModule = await import("./tinymce-WPdeGquX.js").then((n) => n.t);
|
|
2202
2221
|
const tinymce = tinymceModule.default ?? tinymceModule;
|
|
@@ -2247,23 +2266,80 @@ const _sfc_main$x = {
|
|
|
2247
2266
|
onMounted(() => {
|
|
2248
2267
|
void loadTinyMce();
|
|
2249
2268
|
});
|
|
2269
|
+
onBeforeUnmount(() => {
|
|
2270
|
+
editorInstance.value = null;
|
|
2271
|
+
});
|
|
2272
|
+
const handleEditorInit = (_event, editor) => {
|
|
2273
|
+
editorInstance.value = editor;
|
|
2274
|
+
emit("init", editor);
|
|
2275
|
+
};
|
|
2250
2276
|
const handleEditorInput = (_event, editor) => {
|
|
2251
|
-
|
|
2252
|
-
content.value = nextValue;
|
|
2253
|
-
emit("update:modelValue", nextValue);
|
|
2277
|
+
syncContentFromEditor(editor);
|
|
2254
2278
|
};
|
|
2255
2279
|
const handleEditorBlur = (_event, editor) => {
|
|
2256
2280
|
emit("blur", editor.getContent({ format: props.outputFormat }));
|
|
2257
2281
|
};
|
|
2282
|
+
__expose({
|
|
2283
|
+
getEditor,
|
|
2284
|
+
focus: () => getEditor()?.focus(),
|
|
2285
|
+
execCommand: (command, ui = false, value) => getEditor()?.execCommand(command, ui, value),
|
|
2286
|
+
getContent: (options) => getEditor()?.getContent(options) ?? "",
|
|
2287
|
+
getBody: () => getEditor()?.getBody?.() ?? null,
|
|
2288
|
+
selectNode: (node) => {
|
|
2289
|
+
const editor = getEditor();
|
|
2290
|
+
if (!editor || !node) {
|
|
2291
|
+
return;
|
|
2292
|
+
}
|
|
2293
|
+
editor.selection.select(node);
|
|
2294
|
+
},
|
|
2295
|
+
getBookmark: () => getEditor()?.selection.getBookmark() ?? null,
|
|
2296
|
+
moveToBookmark: (bookmark) => {
|
|
2297
|
+
const editor = getEditor();
|
|
2298
|
+
if (!editor || !bookmark) {
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
editor.selection.moveToBookmark(bookmark);
|
|
2302
|
+
},
|
|
2303
|
+
syncContent: () => syncContentFromEditor(),
|
|
2304
|
+
insertContent: async (value, options = {}) => {
|
|
2305
|
+
const editor = getEditor();
|
|
2306
|
+
if (!editor) {
|
|
2307
|
+
return null;
|
|
2308
|
+
}
|
|
2309
|
+
editor.focus();
|
|
2310
|
+
editor.insertContent(value);
|
|
2311
|
+
if (options.selectLast) {
|
|
2312
|
+
await waitForFrames(options.frames ?? 2);
|
|
2313
|
+
const matchingNodes = Array.from(
|
|
2314
|
+
editor.getBody().querySelectorAll(options.selectLast)
|
|
2315
|
+
);
|
|
2316
|
+
const selectedNode = matchingNodes.at(-1);
|
|
2317
|
+
if (selectedNode) {
|
|
2318
|
+
editor.selection.select(selectedNode);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
if (options.command) {
|
|
2322
|
+
await waitForFrames(options.frames ?? 2);
|
|
2323
|
+
editor.execCommand(options.command, false, options.commandValue);
|
|
2324
|
+
}
|
|
2325
|
+
if (options.sync !== false) {
|
|
2326
|
+
syncContentFromEditor(editor);
|
|
2327
|
+
}
|
|
2328
|
+
return editor;
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2258
2331
|
return (_ctx, _cache) => {
|
|
2259
2332
|
return openBlock(), createElementBlock("div", { key: editorKey.value }, [
|
|
2260
2333
|
!isEditorReady.value ? (openBlock(), createElementBlock("div", _hoisted_1$l)) : (openBlock(), createBlock(unref(Editor), {
|
|
2261
2334
|
key: 1,
|
|
2335
|
+
ref_key: "editorComponentRef",
|
|
2336
|
+
ref: editorComponentRef,
|
|
2262
2337
|
"initial-value": content.value,
|
|
2263
2338
|
"license-key": __props.licenseKey,
|
|
2264
2339
|
readonly: __props.readonly,
|
|
2265
2340
|
"output-format": __props.outputFormat,
|
|
2266
2341
|
init: editorInit.value,
|
|
2342
|
+
onInit: handleEditorInit,
|
|
2267
2343
|
onInput: handleEditorInput,
|
|
2268
2344
|
onBlur: handleEditorBlur
|
|
2269
2345
|
}, null, 8, ["initial-value", "license-key", "readonly", "output-format", "init"]))
|
|
@@ -6119,4 +6195,4 @@ export {
|
|
|
6119
6195
|
_sfc_main$B as y,
|
|
6120
6196
|
_sfc_main$A as z
|
|
6121
6197
|
};
|
|
6122
|
-
//# sourceMappingURL=plugin-
|
|
6198
|
+
//# sourceMappingURL=plugin-ev2fN9wO.js.map
|