jky-component-lib 0.0.60 → 0.0.61

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.
Files changed (25) hide show
  1. package/dist/es/package.json.js +1 -1
  2. package/dist/es/page-header/PageHeader.vue.js +1 -1
  3. package/dist/es/page-header/PopoverMenu.vue.js +1 -1
  4. package/dist/es/page-table/PageTable.vue.js +3 -7
  5. package/dist/es/page-table/Toolbar.vue.js +2 -5
  6. package/dist/es/rich-editor/RichEditor.vue.js +1 -1
  7. package/dist/lib/package.json.js +1 -1
  8. package/dist/lib/page-header/PageHeader.vue.js +2 -2
  9. package/dist/lib/page-header/PopoverMenu.vue.js +1 -1
  10. package/dist/lib/page-table/PageTable.vue.js +2 -6
  11. package/dist/lib/page-table/Toolbar.vue.js +1 -4
  12. package/dist/lib/rich-editor/RichEditor.vue.js +2 -2
  13. package/package.json +1 -1
  14. package/dist/es/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/ScriptLoader.js +0 -52
  15. package/dist/es/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/TinyMCE.js +0 -10
  16. package/dist/es/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/Utils.js +0 -145
  17. package/dist/es/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/Editor.js +0 -160
  18. package/dist/es/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/EditorPropTypes.js +0 -26
  19. package/dist/es/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/index.js +0 -4
  20. package/dist/lib/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/ScriptLoader.js +0 -52
  21. package/dist/lib/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/TinyMCE.js +0 -10
  22. package/dist/lib/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/Utils.js +0 -145
  23. package/dist/lib/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/Editor.js +0 -160
  24. package/dist/lib/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/EditorPropTypes.js +0 -26
  25. package/dist/lib/node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/index.js +0 -4
@@ -1,4 +1,4 @@
1
- const version = "0.0.60";
1
+ const version = "0.0.61";
2
2
  export {
3
3
  version
4
4
  };
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createElementVNode, createBlock, normalizeProps, mergeProps, createCommentVNode, toDisplayString, renderSlot, Fragment, renderList, normalizeClass, withCtx, resolveDynamicComponent, createVNode, createTextVNode } from "vue";
20
+ import { defineComponent, openBlock, createElementBlock, normalizeStyle, unref, createElementVNode, createBlock, normalizeProps, mergeProps, createCommentVNode, toDisplayString, renderSlot, Fragment, renderList, normalizeClass, withCtx, resolveDynamicComponent, createVNode, createTextVNode } from "vue";
21
21
  import { ElIcon, ElDropdown, ElDropdownMenu, ElDropdownItem } from "element-plus";
22
22
  import _sfc_main$1 from "./PopoverMenu.vue.js";
23
23
  const _hoisted_1 = { class: "jky-page-header__container" };
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, normalizeClass, createCommentVNode, toDisplayString } from "vue";
1
+ import { defineComponent, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, normalizeClass, createCommentVNode, toDisplayString } from "vue";
2
2
  import { ElPopover, ElButton } from "element-plus";
3
3
  const _hoisted_1 = {
4
4
  key: 0,
@@ -37,11 +37,7 @@ var __async = (__this, __arguments, generator) => {
37
37
  step((generator = generator.apply(__this, __arguments)).next());
38
38
  });
39
39
  };
40
- import { ElButton, ElLoadingDirective } from "element-plus/es";
41
- import "element-plus/es/components/base/style/css";
42
- import "element-plus/es/components/loading/style/css";
43
- import "element-plus/es/components/button/style/css";
44
- import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, normalizeClass, createBlock, unref, withCtx, createVNode, mergeProps, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, renderSlot, resolveDynamicComponent } from "vue";
40
+ import { defineComponent, ref, computed, watch, onMounted, resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createBlock, unref, withCtx, createVNode, mergeProps, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, renderSlot, resolveDynamicComponent } from "vue";
45
41
  import { ElCard, ElTable, ElTableColumn, ElPagination } from "element-plus";
46
42
  import { JkyForm } from "../form/index.js";
47
43
  import _sfc_main$1 from "./Toolbar.vue.js";
@@ -238,8 +234,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
238
234
  }
239
235
  });
240
236
  return (_ctx, _cache) => {
241
- const _component_ElButton = ElButton;
242
- const _directive_loading = ElLoadingDirective;
237
+ const _component_ElButton = resolveComponent("ElButton");
238
+ const _directive_loading = resolveDirective("loading");
243
239
  return openBlock(), createElementBlock("div", {
244
240
  class: normalizeClass(["bg-transparent jky-page-table", [__props.className]])
245
241
  }, [
@@ -17,10 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { ElIcon } from "element-plus/es";
21
- import "element-plus/es/components/base/style/css";
22
- import "element-plus/es/components/icon/style/css";
23
- import { defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, createBlock, resolveDynamicComponent, unref, withCtx, createVNode, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, h } from "vue";
20
+ import { defineComponent, ref, computed, resolveComponent, openBlock, createElementBlock, createElementVNode, createBlock, resolveDynamicComponent, unref, withCtx, createVNode, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, h } from "vue";
24
21
  import { ArrowDown as arrow_down_default } from "../node_modules/@element-plus/icons-vue/dist/index.js";
25
22
  import { ElDropdown, ElButton, ElDropdownMenu, ElDropdownItem } from "element-plus";
26
23
  import { useResponsiveToolbar } from "../utils/responsive-toolbar.js";
@@ -189,7 +186,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
189
186
  handleRightCommand
190
187
  });
191
188
  return (_ctx, _cache) => {
192
- const _component_ElIcon = ElIcon;
189
+ const _component_ElIcon = resolveComponent("ElIcon");
193
190
  return openBlock(), createElementBlock("div", _hoisted_1, [
194
191
  createElementVNode("div", _hoisted_2, [
195
192
  (openBlock(), createBlock(resolveDynamicComponent(renderLeftButtons))),
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { defineComponent, useModel, ref, openBlock, createElementBlock, createVNode, unref, mergeModels } from "vue";
21
- import { Editor } from "../node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/Editor.js";
21
+ import Editor from "@tinymce/tinymce-vue";
22
22
  const _hoisted_1 = { class: "jky-rich-editor" };
23
23
  const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
24
24
  name: "JkyRichEditor"
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "0.0.60";
3
+ const version = "0.0.61";
4
4
  exports.version = version;
@@ -76,13 +76,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
76
76
  function handleCommand(command) {
77
77
  emit("command", command);
78
78
  }
79
- const heightValue = vue.computed(() => {
79
+ const heightValue = computed(() => {
80
80
  if (typeof props.height === "number") {
81
81
  return `${props.height}px`;
82
82
  }
83
83
  return props.height;
84
84
  });
85
- const backgroundStyle = vue.computed(() => {
85
+ const backgroundStyle = computed(() => {
86
86
  const style = {};
87
87
  if (props.backgroundImage) {
88
88
  style.backgroundImage = `url(${props.backgroundImage})`;
@@ -29,7 +29,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
29
29
  },
30
30
  setup(__props) {
31
31
  const props = __props;
32
- const popoverIndex = vue.ref("");
32
+ const popoverIndex = ref("");
33
33
  function onPopoverButtonClick(item) {
34
34
  var _a;
35
35
  if (props.highlightCurrent) {
@@ -39,10 +39,6 @@ var __async = (__this, __arguments, generator) => {
39
39
  });
40
40
  };
41
41
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
42
- const es = require("element-plus/es");
43
- require("element-plus/es/components/base/style/css");
44
- require("element-plus/es/components/loading/style/css");
45
- require("element-plus/es/components/button/style/css");
46
42
  const vue = require("vue");
47
43
  const ElementPlus = require("element-plus");
48
44
  const index = require("../form/index.js");
@@ -240,8 +236,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
240
236
  }
241
237
  });
242
238
  return (_ctx, _cache) => {
243
- const _component_ElButton = es.ElButton;
244
- const _directive_loading = es.ElLoadingDirective;
239
+ const _component_ElButton = vue.resolveComponent("ElButton");
240
+ const _directive_loading = vue.resolveDirective("loading");
245
241
  return vue.openBlock(), vue.createElementBlock("div", {
246
242
  class: vue.normalizeClass(["bg-transparent jky-page-table", [__props.className]])
247
243
  }, [
@@ -19,9 +19,6 @@ var __spreadValues = (a, b) => {
19
19
  };
20
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
21
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
22
- const es = require("element-plus/es");
23
- require("element-plus/es/components/base/style/css");
24
- require("element-plus/es/components/icon/style/css");
25
22
  const vue = require("vue");
26
23
  const index = require("../node_modules/@element-plus/icons-vue/dist/index.js");
27
24
  const ElementPlus = require("element-plus");
@@ -191,7 +188,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
191
188
  handleRightCommand
192
189
  });
193
190
  return (_ctx, _cache) => {
194
- const _component_ElIcon = es.ElIcon;
191
+ const _component_ElIcon = vue.resolveComponent("ElIcon");
195
192
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
196
193
  vue.createElementVNode("div", _hoisted_2, [
197
194
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderLeftButtons))),
@@ -20,7 +20,7 @@ var __spreadValues = (a, b) => {
20
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
21
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
22
22
  const vue = require("vue");
23
- const Editor = require("../node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/Editor.js");
23
+ const Editor = require("@tinymce/tinymce-vue");
24
24
  const _hoisted_1 = { class: "jky-rich-editor" };
25
25
  const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
26
26
  name: "JkyRichEditor"
@@ -85,7 +85,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
85
85
  });
86
86
  return (_ctx, _cache) => {
87
87
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
88
- vue.createVNode(vue.unref(Editor.Editor), {
88
+ vue.createVNode(vue.unref(Editor), {
89
89
  ref_key: "editorRef",
90
90
  ref: editorRef,
91
91
  modelValue: modelValue.value,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jky-component-lib",
3
3
  "type": "module",
4
- "version": "0.0.60",
4
+ "version": "0.0.61",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -1,52 +0,0 @@
1
- import { uuid } from "./Utils.js";
2
- var createState = function() {
3
- return {
4
- listeners: [],
5
- scriptId: uuid("tiny-script"),
6
- scriptLoaded: false
7
- };
8
- };
9
- var CreateScriptLoader = function() {
10
- var state = createState();
11
- var injectScriptTag = function(scriptId, doc, url, callback) {
12
- var scriptTag = doc.createElement("script");
13
- scriptTag.referrerPolicy = "origin";
14
- scriptTag.type = "application/javascript";
15
- scriptTag.id = scriptId;
16
- scriptTag.src = url;
17
- var handler = function() {
18
- scriptTag.removeEventListener("load", handler);
19
- callback();
20
- };
21
- scriptTag.addEventListener("load", handler);
22
- if (doc.head) {
23
- doc.head.appendChild(scriptTag);
24
- }
25
- };
26
- var load = function(doc, url, callback) {
27
- if (state.scriptLoaded) {
28
- callback();
29
- } else {
30
- state.listeners.push(callback);
31
- if (!doc.getElementById(state.scriptId)) {
32
- injectScriptTag(state.scriptId, doc, url, function() {
33
- state.listeners.forEach(function(fn) {
34
- return fn();
35
- });
36
- state.scriptLoaded = true;
37
- });
38
- }
39
- }
40
- };
41
- var reinitialize = function() {
42
- state = createState();
43
- };
44
- return {
45
- load,
46
- reinitialize
47
- };
48
- };
49
- var ScriptLoader = CreateScriptLoader();
50
- export {
51
- ScriptLoader
52
- };
@@ -1,10 +0,0 @@
1
- var getGlobal = function() {
2
- return typeof window !== "undefined" ? window : global;
3
- };
4
- var getTinymce = function() {
5
- var global2 = getGlobal();
6
- return global2 && global2.tinymce ? global2.tinymce : null;
7
- };
8
- export {
9
- getTinymce
10
- };
@@ -1,145 +0,0 @@
1
- import { watch } from "vue";
2
- var validEvents = [
3
- "onActivate",
4
- "onAddUndo",
5
- "onBeforeAddUndo",
6
- "onBeforeExecCommand",
7
- "onBeforeGetContent",
8
- "onBeforeRenderUI",
9
- "onBeforeSetContent",
10
- "onBeforePaste",
11
- "onBlur",
12
- "onChange",
13
- "onClearUndos",
14
- "onClick",
15
- "onContextMenu",
16
- "onCommentChange",
17
- "onCompositionEnd",
18
- "onCompositionStart",
19
- "onCompositionUpdate",
20
- "onCopy",
21
- "onCut",
22
- "onDblclick",
23
- "onDeactivate",
24
- "onDirty",
25
- "onDrag",
26
- "onDragDrop",
27
- "onDragEnd",
28
- "onDragGesture",
29
- "onDragOver",
30
- "onDrop",
31
- "onExecCommand",
32
- "onFocus",
33
- "onFocusIn",
34
- "onFocusOut",
35
- "onGetContent",
36
- "onHide",
37
- "onInit",
38
- "onInput",
39
- "onKeyDown",
40
- "onKeyPress",
41
- "onKeyUp",
42
- "onLoadContent",
43
- "onMouseDown",
44
- "onMouseEnter",
45
- "onMouseLeave",
46
- "onMouseMove",
47
- "onMouseOut",
48
- "onMouseOver",
49
- "onMouseUp",
50
- "onNodeChange",
51
- "onObjectResizeStart",
52
- "onObjectResized",
53
- "onObjectSelected",
54
- "onPaste",
55
- "onPostProcess",
56
- "onPostRender",
57
- "onPreProcess",
58
- "onProgressState",
59
- "onRedo",
60
- "onRemove",
61
- "onReset",
62
- "onSaveContent",
63
- "onSelectionChange",
64
- "onSetAttrib",
65
- "onSetContent",
66
- "onShow",
67
- "onSubmit",
68
- "onUndo",
69
- "onVisualAid"
70
- ];
71
- var isValidKey = function(key) {
72
- return validEvents.map(function(event) {
73
- return event.toLowerCase();
74
- }).indexOf(key.toLowerCase()) !== -1;
75
- };
76
- var bindHandlers = function(initEvent, listeners, editor) {
77
- Object.keys(listeners).filter(isValidKey).forEach(function(key) {
78
- var handler = listeners[key];
79
- if (typeof handler === "function") {
80
- if (key === "onInit") {
81
- handler(initEvent, editor);
82
- } else {
83
- editor.on(key.substring(2), function(e) {
84
- return handler(e, editor);
85
- });
86
- }
87
- }
88
- });
89
- };
90
- var bindModelHandlers = function(props, ctx, editor, modelValue) {
91
- var modelEvents = props.modelEvents ? props.modelEvents : null;
92
- var normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(" ") : modelEvents;
93
- watch(modelValue, function(val, prevVal) {
94
- if (editor && typeof val === "string" && val !== prevVal && val !== editor.getContent({ format: props.outputFormat })) {
95
- editor.setContent(val);
96
- }
97
- });
98
- editor.on(normalizedEvents ? normalizedEvents : "change input undo redo", function() {
99
- ctx.emit("update:modelValue", editor.getContent({ format: props.outputFormat }));
100
- });
101
- };
102
- var initEditor = function(initEvent, props, ctx, editor, modelValue, content) {
103
- editor.setContent(content());
104
- if (ctx.attrs["onUpdate:modelValue"]) {
105
- bindModelHandlers(props, ctx, editor, modelValue);
106
- }
107
- bindHandlers(initEvent, ctx.attrs, editor);
108
- };
109
- var unique = 0;
110
- var uuid = function(prefix) {
111
- var time = Date.now();
112
- var random = Math.floor(Math.random() * 1e9);
113
- unique++;
114
- return prefix + "_" + random + unique + String(time);
115
- };
116
- var isTextarea = function(element) {
117
- return element !== null && element.tagName.toLowerCase() === "textarea";
118
- };
119
- var normalizePluginArray = function(plugins) {
120
- if (typeof plugins === "undefined" || plugins === "") {
121
- return [];
122
- }
123
- return Array.isArray(plugins) ? plugins : plugins.split(" ");
124
- };
125
- var mergePlugins = function(initPlugins, inputPlugins) {
126
- return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
127
- };
128
- var isNullOrUndefined = function(value) {
129
- return value === null || value === void 0;
130
- };
131
- var isDisabledOptionSupported = function(editor) {
132
- var _a;
133
- return typeof ((_a = editor.options) === null || _a === void 0 ? void 0 : _a.set) === "function" && editor.options.isRegistered("disabled");
134
- };
135
- export {
136
- bindHandlers,
137
- bindModelHandlers,
138
- initEditor,
139
- isDisabledOptionSupported,
140
- isNullOrUndefined,
141
- isTextarea,
142
- isValidKey,
143
- mergePlugins,
144
- uuid
145
- };
@@ -1,160 +0,0 @@
1
- import { ScriptLoader } from "../ScriptLoader.js";
2
- import { getTinymce } from "../TinyMCE.js";
3
- import { uuid, isNullOrUndefined, isDisabledOptionSupported, initEditor, mergePlugins, isTextarea } from "../Utils.js";
4
- import { editorProps } from "./EditorPropTypes.js";
5
- import { defineComponent, toRefs, ref, watch, onMounted, onBeforeUnmount, onActivated, onDeactivated, h, nextTick } from "vue";
6
- var __assign = function() {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var renderInline = function(ce, id, elementRef, tagName) {
18
- return ce(tagName ? tagName : "div", {
19
- id,
20
- ref: elementRef
21
- });
22
- };
23
- var renderIframe = function(ce, id, elementRef) {
24
- return ce("textarea", {
25
- id,
26
- visibility: "hidden",
27
- ref: elementRef
28
- });
29
- };
30
- var defaultInitValues = { selector: void 0, target: void 0 };
31
- var setMode = function(editor, mode) {
32
- var _a;
33
- if (typeof ((_a = editor.mode) === null || _a === void 0 ? void 0 : _a.set) === "function") {
34
- editor.mode.set(mode);
35
- } else {
36
- editor.setMode(mode);
37
- }
38
- };
39
- var Editor = defineComponent({
40
- props: editorProps,
41
- setup: function(props, ctx) {
42
- var conf = props.init ? __assign(__assign({}, props.init), defaultInitValues) : __assign({}, defaultInitValues);
43
- var _a = toRefs(props), disabled = _a.disabled, readonly = _a.readonly, modelValue = _a.modelValue, tagName = _a.tagName;
44
- var element = ref(null);
45
- var vueEditor = null;
46
- var elementId = props.id || uuid("tiny-vue");
47
- var inlineEditor = props.init && props.init.inline || props.inline;
48
- var modelBind = !!ctx.attrs["onUpdate:modelValue"];
49
- var mounting = true;
50
- var initialValue = props.initialValue ? props.initialValue : "";
51
- var cache = "";
52
- var getContent = function(isMounting) {
53
- return modelBind ? function() {
54
- return (modelValue === null || modelValue === void 0 ? void 0 : modelValue.value) ? modelValue.value : "";
55
- } : function() {
56
- return isMounting ? initialValue : cache;
57
- };
58
- };
59
- var initWrapper = function() {
60
- var content = getContent(mounting);
61
- var finalInit = __assign(__assign({}, conf), { disabled: props.disabled, readonly: props.readonly, target: element.value, plugins: mergePlugins(conf.plugins, props.plugins), toolbar: props.toolbar || conf.toolbar, inline: inlineEditor, license_key: props.licenseKey, setup: function(editor) {
62
- vueEditor = editor;
63
- if (!isDisabledOptionSupported(vueEditor) && props.disabled === true) {
64
- setMode(vueEditor, "readonly");
65
- }
66
- editor.on("init", function(e) {
67
- return initEditor(e, props, ctx, editor, modelValue, content);
68
- });
69
- if (typeof conf.setup === "function") {
70
- conf.setup(editor);
71
- }
72
- } });
73
- if (isTextarea(element.value)) {
74
- element.value.style.visibility = "";
75
- }
76
- getTinymce().init(finalInit);
77
- mounting = false;
78
- };
79
- watch(readonly, function(isReadonly) {
80
- if (vueEditor !== null) {
81
- setMode(vueEditor, isReadonly ? "readonly" : "design");
82
- }
83
- });
84
- watch(disabled, function(isDisabled) {
85
- if (vueEditor !== null) {
86
- if (isDisabledOptionSupported(vueEditor)) {
87
- vueEditor.options.set("disabled", isDisabled);
88
- } else {
89
- setMode(vueEditor, isDisabled ? "readonly" : "design");
90
- }
91
- }
92
- });
93
- watch(tagName, function(_) {
94
- var _a2;
95
- if (vueEditor) {
96
- if (!modelBind) {
97
- cache = vueEditor.getContent();
98
- }
99
- (_a2 = getTinymce()) === null || _a2 === void 0 ? void 0 : _a2.remove(vueEditor);
100
- nextTick(function() {
101
- return initWrapper();
102
- });
103
- }
104
- });
105
- onMounted(function() {
106
- if (getTinymce() !== null) {
107
- initWrapper();
108
- } else if (element.value && element.value.ownerDocument) {
109
- var channel = props.cloudChannel ? props.cloudChannel : "8";
110
- var apiKey = props.apiKey ? props.apiKey : "no-api-key";
111
- var scriptSrc = isNullOrUndefined(props.tinymceScriptSrc) ? "https://cdn.tiny.cloud/1/".concat(apiKey, "/tinymce/").concat(channel, "/tinymce.min.js") : props.tinymceScriptSrc;
112
- ScriptLoader.load(element.value.ownerDocument, scriptSrc, initWrapper);
113
- }
114
- });
115
- onBeforeUnmount(function() {
116
- if (getTinymce() !== null) {
117
- getTinymce().remove(vueEditor);
118
- }
119
- });
120
- if (!inlineEditor) {
121
- onActivated(function() {
122
- if (!mounting) {
123
- initWrapper();
124
- }
125
- });
126
- onDeactivated(function() {
127
- var _a2;
128
- if (vueEditor) {
129
- if (!modelBind) {
130
- cache = vueEditor.getContent();
131
- }
132
- (_a2 = getTinymce()) === null || _a2 === void 0 ? void 0 : _a2.remove(vueEditor);
133
- }
134
- });
135
- }
136
- var rerender = function(init) {
137
- var _a2;
138
- if (vueEditor) {
139
- cache = vueEditor.getContent();
140
- (_a2 = getTinymce()) === null || _a2 === void 0 ? void 0 : _a2.remove(vueEditor);
141
- conf = __assign(__assign(__assign({}, conf), init), defaultInitValues);
142
- nextTick(function() {
143
- return initWrapper();
144
- });
145
- }
146
- };
147
- ctx.expose({
148
- rerender,
149
- getEditor: function() {
150
- return vueEditor;
151
- }
152
- });
153
- return function() {
154
- return inlineEditor ? renderInline(h, elementId, element, props.tagName) : renderIframe(h, elementId, element);
155
- };
156
- }
157
- });
158
- export {
159
- Editor
160
- };
@@ -1,26 +0,0 @@
1
- var editorProps = {
2
- apiKey: String,
3
- licenseKey: String,
4
- cloudChannel: String,
5
- id: String,
6
- init: Object,
7
- initialValue: String,
8
- inline: Boolean,
9
- modelEvents: [String, Array],
10
- plugins: [String, Array],
11
- tagName: String,
12
- toolbar: [String, Array],
13
- modelValue: String,
14
- disabled: Boolean,
15
- readonly: Boolean,
16
- tinymceScriptSrc: String,
17
- outputFormat: {
18
- type: String,
19
- validator: function(prop) {
20
- return prop === "html" || prop === "text";
21
- }
22
- }
23
- };
24
- export {
25
- editorProps
26
- };
@@ -1,4 +0,0 @@
1
- import { Editor } from "./components/Editor.js";
2
- export {
3
- Editor as default
4
- };
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Utils = require("./Utils.js");
4
- var createState = function() {
5
- return {
6
- listeners: [],
7
- scriptId: Utils.uuid("tiny-script"),
8
- scriptLoaded: false
9
- };
10
- };
11
- var CreateScriptLoader = function() {
12
- var state = createState();
13
- var injectScriptTag = function(scriptId, doc, url, callback) {
14
- var scriptTag = doc.createElement("script");
15
- scriptTag.referrerPolicy = "origin";
16
- scriptTag.type = "application/javascript";
17
- scriptTag.id = scriptId;
18
- scriptTag.src = url;
19
- var handler = function() {
20
- scriptTag.removeEventListener("load", handler);
21
- callback();
22
- };
23
- scriptTag.addEventListener("load", handler);
24
- if (doc.head) {
25
- doc.head.appendChild(scriptTag);
26
- }
27
- };
28
- var load = function(doc, url, callback) {
29
- if (state.scriptLoaded) {
30
- callback();
31
- } else {
32
- state.listeners.push(callback);
33
- if (!doc.getElementById(state.scriptId)) {
34
- injectScriptTag(state.scriptId, doc, url, function() {
35
- state.listeners.forEach(function(fn) {
36
- return fn();
37
- });
38
- state.scriptLoaded = true;
39
- });
40
- }
41
- }
42
- };
43
- var reinitialize = function() {
44
- state = createState();
45
- };
46
- return {
47
- load,
48
- reinitialize
49
- };
50
- };
51
- var ScriptLoader = CreateScriptLoader();
52
- exports.ScriptLoader = ScriptLoader;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var getGlobal = function() {
4
- return typeof window !== "undefined" ? window : global;
5
- };
6
- var getTinymce = function() {
7
- var global2 = getGlobal();
8
- return global2 && global2.tinymce ? global2.tinymce : null;
9
- };
10
- exports.getTinymce = getTinymce;
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
4
- var validEvents = [
5
- "onActivate",
6
- "onAddUndo",
7
- "onBeforeAddUndo",
8
- "onBeforeExecCommand",
9
- "onBeforeGetContent",
10
- "onBeforeRenderUI",
11
- "onBeforeSetContent",
12
- "onBeforePaste",
13
- "onBlur",
14
- "onChange",
15
- "onClearUndos",
16
- "onClick",
17
- "onContextMenu",
18
- "onCommentChange",
19
- "onCompositionEnd",
20
- "onCompositionStart",
21
- "onCompositionUpdate",
22
- "onCopy",
23
- "onCut",
24
- "onDblclick",
25
- "onDeactivate",
26
- "onDirty",
27
- "onDrag",
28
- "onDragDrop",
29
- "onDragEnd",
30
- "onDragGesture",
31
- "onDragOver",
32
- "onDrop",
33
- "onExecCommand",
34
- "onFocus",
35
- "onFocusIn",
36
- "onFocusOut",
37
- "onGetContent",
38
- "onHide",
39
- "onInit",
40
- "onInput",
41
- "onKeyDown",
42
- "onKeyPress",
43
- "onKeyUp",
44
- "onLoadContent",
45
- "onMouseDown",
46
- "onMouseEnter",
47
- "onMouseLeave",
48
- "onMouseMove",
49
- "onMouseOut",
50
- "onMouseOver",
51
- "onMouseUp",
52
- "onNodeChange",
53
- "onObjectResizeStart",
54
- "onObjectResized",
55
- "onObjectSelected",
56
- "onPaste",
57
- "onPostProcess",
58
- "onPostRender",
59
- "onPreProcess",
60
- "onProgressState",
61
- "onRedo",
62
- "onRemove",
63
- "onReset",
64
- "onSaveContent",
65
- "onSelectionChange",
66
- "onSetAttrib",
67
- "onSetContent",
68
- "onShow",
69
- "onSubmit",
70
- "onUndo",
71
- "onVisualAid"
72
- ];
73
- var isValidKey = function(key) {
74
- return validEvents.map(function(event) {
75
- return event.toLowerCase();
76
- }).indexOf(key.toLowerCase()) !== -1;
77
- };
78
- var bindHandlers = function(initEvent, listeners, editor) {
79
- Object.keys(listeners).filter(isValidKey).forEach(function(key) {
80
- var handler = listeners[key];
81
- if (typeof handler === "function") {
82
- if (key === "onInit") {
83
- handler(initEvent, editor);
84
- } else {
85
- editor.on(key.substring(2), function(e) {
86
- return handler(e, editor);
87
- });
88
- }
89
- }
90
- });
91
- };
92
- var bindModelHandlers = function(props, ctx, editor, modelValue) {
93
- var modelEvents = props.modelEvents ? props.modelEvents : null;
94
- var normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(" ") : modelEvents;
95
- vue.watch(modelValue, function(val, prevVal) {
96
- if (editor && typeof val === "string" && val !== prevVal && val !== editor.getContent({ format: props.outputFormat })) {
97
- editor.setContent(val);
98
- }
99
- });
100
- editor.on(normalizedEvents ? normalizedEvents : "change input undo redo", function() {
101
- ctx.emit("update:modelValue", editor.getContent({ format: props.outputFormat }));
102
- });
103
- };
104
- var initEditor = function(initEvent, props, ctx, editor, modelValue, content) {
105
- editor.setContent(content());
106
- if (ctx.attrs["onUpdate:modelValue"]) {
107
- bindModelHandlers(props, ctx, editor, modelValue);
108
- }
109
- bindHandlers(initEvent, ctx.attrs, editor);
110
- };
111
- var unique = 0;
112
- var uuid = function(prefix) {
113
- var time = Date.now();
114
- var random = Math.floor(Math.random() * 1e9);
115
- unique++;
116
- return prefix + "_" + random + unique + String(time);
117
- };
118
- var isTextarea = function(element) {
119
- return element !== null && element.tagName.toLowerCase() === "textarea";
120
- };
121
- var normalizePluginArray = function(plugins) {
122
- if (typeof plugins === "undefined" || plugins === "") {
123
- return [];
124
- }
125
- return Array.isArray(plugins) ? plugins : plugins.split(" ");
126
- };
127
- var mergePlugins = function(initPlugins, inputPlugins) {
128
- return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
129
- };
130
- var isNullOrUndefined = function(value) {
131
- return value === null || value === void 0;
132
- };
133
- var isDisabledOptionSupported = function(editor) {
134
- var _a;
135
- return typeof ((_a = editor.options) === null || _a === void 0 ? void 0 : _a.set) === "function" && editor.options.isRegistered("disabled");
136
- };
137
- exports.bindHandlers = bindHandlers;
138
- exports.bindModelHandlers = bindModelHandlers;
139
- exports.initEditor = initEditor;
140
- exports.isDisabledOptionSupported = isDisabledOptionSupported;
141
- exports.isNullOrUndefined = isNullOrUndefined;
142
- exports.isTextarea = isTextarea;
143
- exports.isValidKey = isValidKey;
144
- exports.mergePlugins = mergePlugins;
145
- exports.uuid = uuid;
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const ScriptLoader = require("../ScriptLoader.js");
4
- const TinyMCE = require("../TinyMCE.js");
5
- const Utils = require("../Utils.js");
6
- const EditorPropTypes = require("./EditorPropTypes.js");
7
- const vue = require("vue");
8
- var __assign = function() {
9
- __assign = Object.assign || function(t) {
10
- for (var s, i = 1, n = arguments.length; i < n; i++) {
11
- s = arguments[i];
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13
- t[p] = s[p];
14
- }
15
- return t;
16
- };
17
- return __assign.apply(this, arguments);
18
- };
19
- var renderInline = function(ce, id, elementRef, tagName) {
20
- return ce(tagName ? tagName : "div", {
21
- id,
22
- ref: elementRef
23
- });
24
- };
25
- var renderIframe = function(ce, id, elementRef) {
26
- return ce("textarea", {
27
- id,
28
- visibility: "hidden",
29
- ref: elementRef
30
- });
31
- };
32
- var defaultInitValues = { selector: void 0, target: void 0 };
33
- var setMode = function(editor, mode) {
34
- var _a;
35
- if (typeof ((_a = editor.mode) === null || _a === void 0 ? void 0 : _a.set) === "function") {
36
- editor.mode.set(mode);
37
- } else {
38
- editor.setMode(mode);
39
- }
40
- };
41
- var Editor = vue.defineComponent({
42
- props: EditorPropTypes.editorProps,
43
- setup: function(props, ctx) {
44
- var conf = props.init ? __assign(__assign({}, props.init), defaultInitValues) : __assign({}, defaultInitValues);
45
- var _a = vue.toRefs(props), disabled = _a.disabled, readonly = _a.readonly, modelValue = _a.modelValue, tagName = _a.tagName;
46
- var element = vue.ref(null);
47
- var vueEditor = null;
48
- var elementId = props.id || Utils.uuid("tiny-vue");
49
- var inlineEditor = props.init && props.init.inline || props.inline;
50
- var modelBind = !!ctx.attrs["onUpdate:modelValue"];
51
- var mounting = true;
52
- var initialValue = props.initialValue ? props.initialValue : "";
53
- var cache = "";
54
- var getContent = function(isMounting) {
55
- return modelBind ? function() {
56
- return (modelValue === null || modelValue === void 0 ? void 0 : modelValue.value) ? modelValue.value : "";
57
- } : function() {
58
- return isMounting ? initialValue : cache;
59
- };
60
- };
61
- var initWrapper = function() {
62
- var content = getContent(mounting);
63
- var finalInit = __assign(__assign({}, conf), { disabled: props.disabled, readonly: props.readonly, target: element.value, plugins: Utils.mergePlugins(conf.plugins, props.plugins), toolbar: props.toolbar || conf.toolbar, inline: inlineEditor, license_key: props.licenseKey, setup: function(editor) {
64
- vueEditor = editor;
65
- if (!Utils.isDisabledOptionSupported(vueEditor) && props.disabled === true) {
66
- setMode(vueEditor, "readonly");
67
- }
68
- editor.on("init", function(e) {
69
- return Utils.initEditor(e, props, ctx, editor, modelValue, content);
70
- });
71
- if (typeof conf.setup === "function") {
72
- conf.setup(editor);
73
- }
74
- } });
75
- if (Utils.isTextarea(element.value)) {
76
- element.value.style.visibility = "";
77
- }
78
- TinyMCE.getTinymce().init(finalInit);
79
- mounting = false;
80
- };
81
- vue.watch(readonly, function(isReadonly) {
82
- if (vueEditor !== null) {
83
- setMode(vueEditor, isReadonly ? "readonly" : "design");
84
- }
85
- });
86
- vue.watch(disabled, function(isDisabled) {
87
- if (vueEditor !== null) {
88
- if (Utils.isDisabledOptionSupported(vueEditor)) {
89
- vueEditor.options.set("disabled", isDisabled);
90
- } else {
91
- setMode(vueEditor, isDisabled ? "readonly" : "design");
92
- }
93
- }
94
- });
95
- vue.watch(tagName, function(_) {
96
- var _a2;
97
- if (vueEditor) {
98
- if (!modelBind) {
99
- cache = vueEditor.getContent();
100
- }
101
- (_a2 = TinyMCE.getTinymce()) === null || _a2 === void 0 ? void 0 : _a2.remove(vueEditor);
102
- vue.nextTick(function() {
103
- return initWrapper();
104
- });
105
- }
106
- });
107
- vue.onMounted(function() {
108
- if (TinyMCE.getTinymce() !== null) {
109
- initWrapper();
110
- } else if (element.value && element.value.ownerDocument) {
111
- var channel = props.cloudChannel ? props.cloudChannel : "8";
112
- var apiKey = props.apiKey ? props.apiKey : "no-api-key";
113
- var scriptSrc = Utils.isNullOrUndefined(props.tinymceScriptSrc) ? "https://cdn.tiny.cloud/1/".concat(apiKey, "/tinymce/").concat(channel, "/tinymce.min.js") : props.tinymceScriptSrc;
114
- ScriptLoader.ScriptLoader.load(element.value.ownerDocument, scriptSrc, initWrapper);
115
- }
116
- });
117
- vue.onBeforeUnmount(function() {
118
- if (TinyMCE.getTinymce() !== null) {
119
- TinyMCE.getTinymce().remove(vueEditor);
120
- }
121
- });
122
- if (!inlineEditor) {
123
- vue.onActivated(function() {
124
- if (!mounting) {
125
- initWrapper();
126
- }
127
- });
128
- vue.onDeactivated(function() {
129
- var _a2;
130
- if (vueEditor) {
131
- if (!modelBind) {
132
- cache = vueEditor.getContent();
133
- }
134
- (_a2 = TinyMCE.getTinymce()) === null || _a2 === void 0 ? void 0 : _a2.remove(vueEditor);
135
- }
136
- });
137
- }
138
- var rerender = function(init) {
139
- var _a2;
140
- if (vueEditor) {
141
- cache = vueEditor.getContent();
142
- (_a2 = TinyMCE.getTinymce()) === null || _a2 === void 0 ? void 0 : _a2.remove(vueEditor);
143
- conf = __assign(__assign(__assign({}, conf), init), defaultInitValues);
144
- vue.nextTick(function() {
145
- return initWrapper();
146
- });
147
- }
148
- };
149
- ctx.expose({
150
- rerender,
151
- getEditor: function() {
152
- return vueEditor;
153
- }
154
- });
155
- return function() {
156
- return inlineEditor ? renderInline(vue.h, elementId, element, props.tagName) : renderIframe(vue.h, elementId, element);
157
- };
158
- }
159
- });
160
- exports.Editor = Editor;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var editorProps = {
4
- apiKey: String,
5
- licenseKey: String,
6
- cloudChannel: String,
7
- id: String,
8
- init: Object,
9
- initialValue: String,
10
- inline: Boolean,
11
- modelEvents: [String, Array],
12
- plugins: [String, Array],
13
- tagName: String,
14
- toolbar: [String, Array],
15
- modelValue: String,
16
- disabled: Boolean,
17
- readonly: Boolean,
18
- tinymceScriptSrc: String,
19
- outputFormat: {
20
- type: String,
21
- validator: function(prop) {
22
- return prop === "html" || prop === "text";
23
- }
24
- }
25
- };
26
- exports.editorProps = editorProps;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const Editor = require("./components/Editor.js");
4
- exports.default = Editor.Editor;