@vipl520/dk-ui 1.0.68 → 1.0.70

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -1344,7 +1344,7 @@ const init = {
1344
1344
  editimage_cors_hosts: ["picsum.photos"],
1345
1345
  menubar: "file edit view insert format tools table help",
1346
1346
  toolbar: "showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |",
1347
- toolbar_sticky: true,
1347
+ toolbar_sticky: false,
1348
1348
  // content_css: 'document',
1349
1349
  height: 400,
1350
1350
  quickbars_selection_toolbar: "bold italic | quicklink h2 h3 blockquote showImage",
@@ -1477,13 +1477,16 @@ var _sfc_main$1f = /* @__PURE__ */ defineComponent({
1477
1477
  reject(err);
1478
1478
  });
1479
1479
  });
1480
+ const tinymceId = ref("vue-tinymce-" + +/* @__PURE__ */ new Date() + ((Math.random() * 1e3).toFixed(0) + ""));
1480
1481
  const init = ref({
1482
+ selector: "#" + tinymceId.value,
1481
1483
  ...config$1,
1482
1484
  height: props.height,
1483
1485
  content_css: props.document ? "document" : "",
1484
1486
  images_upload_handler: handleImageUpload,
1485
1487
  initialContent: "Loading editor..."
1486
1488
  });
1489
+ console.log("init", init);
1487
1490
  const tinymceSrc = ref("https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js");
1488
1491
  const attachmentRef = ref();
1489
1492
  const editorRef = ref();
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "dk",
5
- "version": "1.0.67",
5
+ "version": "1.0.69",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
@@ -9,7 +9,7 @@ const init = {
9
9
  editimage_cors_hosts: ["picsum.photos"],
10
10
  menubar: "file edit view insert format tools table help",
11
11
  toolbar: "showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |",
12
- toolbar_sticky: true,
12
+ toolbar_sticky: false,
13
13
  // content_css: 'document',
14
14
  height: 400,
15
15
  quickbars_selection_toolbar: "bold italic | quicklink h2 h3 blockquote showImage",
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../../src/tiny-editor/src/config.ts"],"sourcesContent":["// import { useStorage } from '@/package/hooks/web/useStorage'\n// let isDark = useStorage().getStorage('isDark')\n// TODO 这里还未实现动态切换黑色皮肤\n// window.addEventListener('setStorage', () => {\n// isDark = useStorage().getStorage('isDark')\n// })\n\nconst init = {\n language: 'zh-Hans',\n branding: false,\n skin: 'oxide',\n icons: 'jam',\n promotion: false, // 这是一个高级功能升级的促销按钮\n plugins:\n 'showImage preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image ' +\n 'link media codesample table pagebreak nonbreaking anchor insertdatetime advlist lists wordcount ' +\n ' quickbars emoticons imageSize',\n editimage_cors_hosts: ['picsum.photos'],\n menubar: 'file edit view insert format tools table help',\n toolbar:\n 'showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |',\n toolbar_sticky: true,\n // content_css: 'document',\n height: 400,\n quickbars_selection_toolbar:\n 'bold italic | quicklink h2 h3 blockquote showImage', // 快速工具栏\n quickbars_insert_toolbar: '',\n quickbars_image_toolbar: 'imageSize100 imageSize50 imageSize20 imageDel',\n toolbar_mode: '',\n convert_urls: false,\n // contextmenu: 'link image table'\n}\nexport default init\n"],"names":[],"mappings":"AAOA,MAAM,IAAO,GAAA;AAAA,EACX,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,KAAA;AAAA,EACV,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,KAAA;AAAA,EACP,SAAW,EAAA,KAAA;AAAA;AAAA,EACX,OACE,EAAA,kQAAA;AAAA,EAGF,oBAAA,EAAsB,CAAC,eAAe,CAAA;AAAA,EACtC,OAAS,EAAA,+CAAA;AAAA,EACT,OACE,EAAA,0OAAA;AAAA,EACF,cAAgB,EAAA,IAAA;AAAA;AAAA,EAEhB,MAAQ,EAAA,GAAA;AAAA,EACR,2BACE,EAAA,oDAAA;AAAA;AAAA,EACF,wBAA0B,EAAA,EAAA;AAAA,EAC1B,uBAAyB,EAAA,+CAAA;AAAA,EACzB,YAAc,EAAA,EAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA;AAEhB;;;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../../src/tiny-editor/src/config.ts"],"sourcesContent":["// import { useStorage } from '@/package/hooks/web/useStorage'\n// let isDark = useStorage().getStorage('isDark')\n// TODO 这里还未实现动态切换黑色皮肤\n// window.addEventListener('setStorage', () => {\n// isDark = useStorage().getStorage('isDark')\n// })\n\nconst init = {\n language: 'zh-Hans',\n branding: false,\n skin: 'oxide',\n icons: 'jam',\n promotion: false, // 这是一个高级功能升级的促销按钮\n plugins:\n 'showImage preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image ' +\n 'link media codesample table pagebreak nonbreaking anchor insertdatetime advlist lists wordcount ' +\n ' quickbars emoticons imageSize',\n editimage_cors_hosts: ['picsum.photos'],\n menubar: 'file edit view insert format tools table help',\n toolbar:\n 'showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |',\n toolbar_sticky: false,\n // content_css: 'document',\n height: 400,\n quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote showImage', // 快速工具栏\n quickbars_insert_toolbar: '',\n quickbars_image_toolbar: 'imageSize100 imageSize50 imageSize20 imageDel',\n toolbar_mode: '',\n convert_urls: false,\n // contextmenu: 'link image table'\n}\nexport default init\n"],"names":[],"mappings":"AAOA,MAAM,IAAO,GAAA;AAAA,EACX,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,KAAA;AAAA,EACV,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,KAAA;AAAA,EACP,SAAW,EAAA,KAAA;AAAA;AAAA,EACX,OACE,EAAA,kQAAA;AAAA,EAGF,oBAAA,EAAsB,CAAC,eAAe,CAAA;AAAA,EACtC,OAAS,EAAA,+CAAA;AAAA,EACT,OACE,EAAA,0OAAA;AAAA,EACF,cAAgB,EAAA,KAAA;AAAA;AAAA,EAEhB,MAAQ,EAAA,GAAA;AAAA,EACR,2BAA6B,EAAA,oDAAA;AAAA;AAAA,EAC7B,wBAA0B,EAAA,EAAA;AAAA,EAC1B,uBAAyB,EAAA,+CAAA;AAAA,EACzB,YAAc,EAAA,EAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA;AAEhB;;;;"}
@@ -30,13 +30,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
30
30
  reject(err);
31
31
  });
32
32
  });
33
+ const tinymceId = ref("vue-tinymce-" + +/* @__PURE__ */ new Date() + ((Math.random() * 1e3).toFixed(0) + ""));
33
34
  const init$1 = ref({
35
+ selector: "#" + tinymceId.value,
34
36
  ...init,
35
37
  height: props.height,
36
38
  content_css: props.document ? "document" : "",
37
39
  images_upload_handler: handleImageUpload,
38
40
  initialContent: "Loading editor..."
39
41
  });
42
+ console.log("init", init$1);
40
43
  const tinymceSrc = ref("https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js");
41
44
  const attachmentRef = ref();
42
45
  const editorRef = ref();
@@ -1 +1 @@
1
- {"version":3,"file":"tiny-editor.vue2.mjs","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst init = ref({\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\n\n// const tinymceSrc = ref('https://unpkg.com/dk-tinymce@latest/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.jsdelivr.net/npm/dk-tinymce/tinymce.min.js')\nconst tinymceSrc = ref('https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.staticfile.net/tinymce/6.8.2/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","init","config"],"mappings":";;;;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,cAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAU,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAa,IAAI,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,iBAAA,GAAoB,CAAC,QAAe,EAAA,QAAA,KACxC,IAAI,OAAQ,CAAA,CAAC,SAAS,MAAW,KAAA;AAC/B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A,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAM,MAAA,UAAA,GAAa,CAAC,MAAgB,KAAA;AAClC,MAAA,OAAA,CAAQ,IAAI,MAAM,CAAA,CAAA;AAAA,KACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiny-editor.vue2.mjs","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst tinymceId = ref('vue-tinymce-' + +new Date() + ((Math.random() * 1000).toFixed(0) + ''))\nconst init = ref({\n selector: '#' + tinymceId.value,\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\nconsole.log('init', init)\n// const tinymceSrc = ref('https://unpkg.com/dk-tinymce@latest/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.jsdelivr.net/npm/dk-tinymce/tinymce.min.js')\nconst tinymceSrc = ref('https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.staticfile.net/tinymce/6.8.2/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","init","config"],"mappings":";;;;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,cAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAU,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAa,IAAI,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,iBAAA,GAAoB,CAAC,QAAe,EAAA,QAAA,KACxC,IAAI,OAAQ,CAAA,CAAC,SAAS,MAAW,KAAA;AAC/B,MAAA,gBAAA,CAAiB,SAAS,IAAK,EAAC,CAC7B,CAAA,IAAA,CAAK,CAAC,GAAQ,KAAA;AACb,QAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AACZ,QAAQ,OAAA,CAAA,GAAA,CAAI,KAAK,GAAG,CAAA,CAAA;AAAA,OACrB,CAAA,CACA,KAAM,CAAA,CAAC,GAAQ,KAAA;AACd,QAAA,MAAA,CAAO,GAAG,CAAA,CAAA;AAAA,OACX,CAAA,CAAA;AAAA,KACJ,CAAA,CAAA;AAEH,IAAA,MAAM,SAAY,GAAA,GAAA,CAAI,cAAiB,GAAA,qBAAK,IAAK,EAAA,IAAA,CAAM,IAAK,CAAA,MAAA,EAAW,GAAA,GAAA,EAAM,OAAQ,CAAA,CAAC,IAAI,EAAG,CAAA,CAAA,CAAA;AAC7F,IAAA,MAAMC,SAAO,GAAI,CAAA;AAAA,MACf,QAAA,EAAU,MA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,7 @@ const init = {
13
13
  editimage_cors_hosts: ["picsum.photos"],
14
14
  menubar: "file edit view insert format tools table help",
15
15
  toolbar: "showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |",
16
- toolbar_sticky: true,
16
+ toolbar_sticky: false,
17
17
  // content_css: 'document',
18
18
  height: 400,
19
19
  quickbars_selection_toolbar: "bold italic | quicklink h2 h3 blockquote showImage",
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../src/tiny-editor/src/config.ts"],"sourcesContent":["// import { useStorage } from '@/package/hooks/web/useStorage'\n// let isDark = useStorage().getStorage('isDark')\n// TODO 这里还未实现动态切换黑色皮肤\n// window.addEventListener('setStorage', () => {\n// isDark = useStorage().getStorage('isDark')\n// })\n\nconst init = {\n language: 'zh-Hans',\n branding: false,\n skin: 'oxide',\n icons: 'jam',\n promotion: false, // 这是一个高级功能升级的促销按钮\n plugins:\n 'showImage preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image ' +\n 'link media codesample table pagebreak nonbreaking anchor insertdatetime advlist lists wordcount ' +\n ' quickbars emoticons imageSize',\n editimage_cors_hosts: ['picsum.photos'],\n menubar: 'file edit view insert format tools table help',\n toolbar:\n 'showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |',\n toolbar_sticky: true,\n // content_css: 'document',\n height: 400,\n quickbars_selection_toolbar:\n 'bold italic | quicklink h2 h3 blockquote showImage', // 快速工具栏\n quickbars_insert_toolbar: '',\n quickbars_image_toolbar: 'imageSize100 imageSize50 imageSize20 imageDel',\n toolbar_mode: '',\n convert_urls: false,\n // contextmenu: 'link image table'\n}\nexport default init\n"],"names":[],"mappings":";;;;AAOA,MAAM,IAAO,GAAA;AAAA,EACX,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,KAAA;AAAA,EACV,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,KAAA;AAAA,EACP,SAAW,EAAA,KAAA;AAAA;AAAA,EACX,OACE,EAAA,kQAAA;AAAA,EAGF,oBAAA,EAAsB,CAAC,eAAe,CAAA;AAAA,EACtC,OAAS,EAAA,+CAAA;AAAA,EACT,OACE,EAAA,0OAAA;AAAA,EACF,cAAgB,EAAA,IAAA;AAAA;AAAA,EAEhB,MAAQ,EAAA,GAAA;AAAA,EACR,2BACE,EAAA,oDAAA;AAAA;AAAA,EACF,wBAA0B,EAAA,EAAA;AAAA,EAC1B,uBAAyB,EAAA,+CAAA;AAAA,EACzB,YAAc,EAAA,EAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA;AAEhB;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../src/tiny-editor/src/config.ts"],"sourcesContent":["// import { useStorage } from '@/package/hooks/web/useStorage'\n// let isDark = useStorage().getStorage('isDark')\n// TODO 这里还未实现动态切换黑色皮肤\n// window.addEventListener('setStorage', () => {\n// isDark = useStorage().getStorage('isDark')\n// })\n\nconst init = {\n language: 'zh-Hans',\n branding: false,\n skin: 'oxide',\n icons: 'jam',\n promotion: false, // 这是一个高级功能升级的促销按钮\n plugins:\n 'showImage preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image ' +\n 'link media codesample table pagebreak nonbreaking anchor insertdatetime advlist lists wordcount ' +\n ' quickbars emoticons imageSize',\n editimage_cors_hosts: ['picsum.photos'],\n menubar: 'file edit view insert format tools table help',\n toolbar:\n 'showImage bold italic underline strikethrough fontfamily fontsize blocks alignleft aligncenter alignright alignjustify numlist bullist forecolor backcolor removeformat image media link emoticons code preview fullscreen |',\n toolbar_sticky: false,\n // content_css: 'document',\n height: 400,\n quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote showImage', // 快速工具栏\n quickbars_insert_toolbar: '',\n quickbars_image_toolbar: 'imageSize100 imageSize50 imageSize20 imageDel',\n toolbar_mode: '',\n convert_urls: false,\n // contextmenu: 'link image table'\n}\nexport default init\n"],"names":[],"mappings":";;;;AAOA,MAAM,IAAO,GAAA;AAAA,EACX,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,KAAA;AAAA,EACV,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,KAAA;AAAA,EACP,SAAW,EAAA,KAAA;AAAA;AAAA,EACX,OACE,EAAA,kQAAA;AAAA,EAGF,oBAAA,EAAsB,CAAC,eAAe,CAAA;AAAA,EACtC,OAAS,EAAA,+CAAA;AAAA,EACT,OACE,EAAA,0OAAA;AAAA,EACF,cAAgB,EAAA,KAAA;AAAA;AAAA,EAEhB,MAAQ,EAAA,GAAA;AAAA,EACR,2BAA6B,EAAA,oDAAA;AAAA;AAAA,EAC7B,wBAA0B,EAAA,EAAA;AAAA,EAC1B,uBAAyB,EAAA,+CAAA;AAAA,EACzB,YAAc,EAAA,EAAA;AAAA,EACd,YAAc,EAAA,KAAA;AAAA;AAEhB;;;;"}
@@ -34,13 +34,16 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
34
34
  reject(err);
35
35
  });
36
36
  });
37
+ const tinymceId = vue.ref("vue-tinymce-" + +/* @__PURE__ */ new Date() + ((Math.random() * 1e3).toFixed(0) + ""));
37
38
  const init = vue.ref({
39
+ selector: "#" + tinymceId.value,
38
40
  ...config.default,
39
41
  height: props.height,
40
42
  content_css: props.document ? "document" : "",
41
43
  images_upload_handler: handleImageUpload,
42
44
  initialContent: "Loading editor..."
43
45
  });
46
+ console.log("init", init);
44
47
  const tinymceSrc = vue.ref("https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js");
45
48
  const attachmentRef = vue.ref();
46
49
  const editorRef = vue.ref();
@@ -1 +1 @@
1
- {"version":3,"file":"tiny-editor.vue2.js","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst init = ref({\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\n\n// const tinymceSrc = ref('https://unpkg.com/dk-tinymce@latest/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.jsdelivr.net/npm/dk-tinymce/tinymce.min.js')\nconst tinymceSrc = ref('https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.staticfile.net/tinymce/6.8.2/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","ref","useElementSize","UploadAttachment","config","computed","watch","onMounted","nextTick"],"mappings":";;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAUC,QAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAAC,mBAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAA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ACzC,MAAA,IAAI,IAAO,GAAA,EAAA,CAAA;AACX,MAAe,cAAA,CAAA,OAAA,CAAQ,CAAC,IAAc,KAAA;AACpC,QAAQ,IAAA,IAAA,YAAA,GAAe,KAAK,GAAM,GAAA,wBAAA,CAAA;AAAA,OACnC,CAAA,CAAA;AACD,MAAA,MAAA,CAAO,cAAc,IAAI,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAM,MAAA,UAAA,GAAa,CAAC,MAAgB,KAAA;AAClC,MAAA,OAAA,CAAQ,IAAI,MAAM,CAAA,CAAA;AAAA,KACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"tiny-editor.vue2.js","sources":["../../../src/tiny-editor/src/tiny-editor.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkTinyEditor',\n});\n</script>\n<template>\n <div ref=\"el\" class=\"dk-tiny-editor\">\n <div v-if=\"showDialog\">\n <Editor ref=\"editorRef\" v-model=\"content\" :init=\"init\" :tinymce-script-src=\"tinymceSrc\" @dblclick=\"ondblclick\" />\n </div>\n <div v-else>\n <el-button type=\"primary\" plain style=\"width: 100%\" @click=\"showEditor = true\">{{ props.buttonText }}</el-button>\n <dk-dialog v-model=\"showEditor\" title=\"编辑\" width=\"900px\" :z-index=\"1298\">\n <Editor\n ref=\"editorRef\"\n v-model=\"content\"\n :init=\"init\"\n :tinymce-script-src=\"tinymceSrc\"\n @dblclick=\"ondblclick\"\n />\n <template #footer>\n <div class=\"text-center\">\n <el-button type=\"primary\" style=\"width: 200px\" @click=\"showEditor = false\">确定</el-button>\n </div>\n </template>\n </dk-dialog>\n </div>\n <dk-attachment-dialog ref=\"attachmentRef\" :type=\"1\" @confirm=\"onSubmit\" />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport config from './config'\nimport Editor from '@tinymce/tinymce-vue'\nimport { nextTick, onMounted, ref, watch, computed } from 'vue'\nimport { UploadAttachment } from '../../api'\nimport { tinyEditorProps } from './props'\nimport { useElementSize } from '@vueuse/core'\nconst el: any = ref(null)\nconst { width } = useElementSize(el) // 当前组件宽度\n\n\nconst props = defineProps(tinyEditorProps)\nconst content = ref(props.modelValue)\nconst showEditor = ref(false)\n// 上传的地址\nconst handleImageUpload = (blobInfo: any, progress: any) =>\n new Promise((resolve, reject) => {\n UploadAttachment(blobInfo.blob())\n .then((res) => {\n progress(100)\n resolve(res.data.url)\n })\n .catch((err) => {\n reject(err)\n })\n })\n\nconst tinymceId = ref('vue-tinymce-' + +new Date() + ((Math.random() * 1000).toFixed(0) + ''))\nconst init = ref({\n selector: '#' + tinymceId.value,\n ...config,\n height: props.height,\n content_css: props.document ? 'document' : '',\n images_upload_handler: handleImageUpload,\n initialContent: 'Loading editor...',\n})\nconsole.log('init', init)\n// const tinymceSrc = ref('https://unpkg.com/dk-tinymce@latest/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.jsdelivr.net/npm/dk-tinymce/tinymce.min.js')\nconst tinymceSrc = ref('https://cdn-1251560393.cos.ap-chengdu.myqcloud.com/lib/tinymce/tinymce.min.js')\n// const tinymceSrc = ref('https://cdn.staticfile.net/tinymce/6.8.2/tinymce.min.js')\nconst attachmentRef = ref()\nconst editorRef = ref()\nconst emit = defineEmits(['input', 'update:modelValue', 'change'])\n\nconst showDialog = computed(() => {\n return width.value >= props.showDialogWidth\n})\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n content.value = newValue\n }\n)\n\nwatch(\n () => content.value,\n (newValue) => {\n emit('update:modelValue', newValue)\n emit('input', newValue)\n emit('change', newValue)\n }\n)\n\nonMounted(() => {\n nextTick(() => {\n initShowImage()\n })\n})\n\nwatch(\n () => editorRef.value,\n () => {\n if (editorRef.value?.getEditor()) {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n }\n)\n\nconst initShowImage = () => {\n if (!editorRef.value?.getEditor()) {\n setTimeout(() => {\n initShowImage()\n }, 1000)\n } else {\n editorRef.value.getEditor().on('showImage', () => {\n attachmentRef.value.open()\n })\n }\n}\n\nconst onSubmit = (chooseFileList: any) => {\n const editor = editorRef.value.getEditor()\n let html = ''\n chooseFileList.forEach((item: any) => {\n html += '<img src=\"' + item.url + '\" alt=\"\" width=\"100%\">'\n })\n editor.insertContent(html)\n}\n\nconst ondblclick = (editor: any) => {\n console.log(editor)\n}\n</script>\n"],"names":["__MACROS_defineComponent","ref","useElementSize","UploadAttachment","config","computed","watch","onMounted","nextTick"],"mappings":";;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,cAAA;AACR,CAAC,CAAA,CAAA;;;;;;;AAmCD,IAAM,MAAA,EAAA,GAAUC,QAAI,IAAI,CAAA,CAAA;AACxB,IAAA,MAAM,EAAE,KAAA,EAAU,GAAAC,mBAAA,CAAe,EAAE,CAAA,CAAA;AAInC,IAAM,MAAA,OAAA,GAAUD,OAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACpC,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,iBAAA,GAAoB,CAAC,QAAe,EAAA,QAAA,KACxC,IAAI,OAAQ,CAAA,CAAC,SAAS,MAAW,KAAA;AAC/B,MAAAE,2BAAA,CAAiB,SAAS,IAAK,EAAC,CAC7B,CAAA,IAAA,CAAK,CAAC,GAAQ,KAAA;AACb,QAAA,QAAA,CAAS,GAAG,CAAA,CAAA;AACZ,QAAQ,OAAA,CAAA,GAAA,CAAI,KAAK,GAAG,CAAA,CAAA;AAAA,OACrB,CAAA,CACA,KAAM,CAAA,CAAC,GAAQ,KAAA;AACd,QAAA,MAAA,CAAO,GAAG,CAAA,CAAA;AAAA,OACX,CAA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AAI,CAAA,CAAA;AAAA,KAC3B,CAAA;AAEA,IAAM,MAAA,UAAA,GAAa,CAAC,MAAgB,KAAA;AAClC,MAAA,OAAA,CAAQ,IAAI,MAAM,CAAA,CAAA;AAAA,KACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vipl520/dk-ui",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "多客怪兽框架核心组件,支持diy、crud动态表格、上传组件等",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",