@duxweb/dvha-pro 1.1.14 → 1.1.15

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.
@@ -1 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),s=require("@duxweb/dvha-core"),L=require("@vueuse/core"),A=require("aieditor"),V=require("naive-ui");require("vue-router");require("@overlastic/vue");require("clsx");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("jinrishici");require("lodash-es");require("vue-draggable-plus");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");const j=require("../upload/config.cjs");require("@vue-flow/core");require("@vue-flow/background");;/* empty css */const D=require("../../hooks/modal.cjs");require("mime");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("dayjs");require("@tanstack/vue-query");require("pinia");const F=n.defineComponent({name:"DuxAiEditor",props:{value:String,defaultValue:String,uploadPath:String,uploadHeaders:Object,editorType:{type:String,default:"richtext"},aiPath:String,fileManager:{type:Boolean,default:!0},fileManagerType:{type:String,default:"all"},height:{type:String,default:"500px"}},setup(e,{emit:k,expose:C}){const u=n.ref();let i=null,h=!1;const m=s.useTheme(),{config:f}=s.useManage(),M=s.useGetAuth(),{t:c}=s.useI18n(),b=V.useMessage(),H=D.useModal(),v=L.useVModel(e,"value",k,{passive:!0}),d=n.computed(()=>e.uploadPath||f.apiPath?.upload||"upload"),q=s.useUpload({path:d.value,autoUpload:!1}),{managePath:P,method:S}=j.useUploadConfig(),T=()=>{if(!i||h)return;const r=v.value||"";e.editorType==="markdown"?i.setMarkdownContent(r):i.setContent(r)},y=()=>{if(!i)return;h=!0;const r=e.editorType==="markdown"?i.getMarkdown():i.getHtml();v.value=r,n.nextTick(()=>{h=!1})},p=r=>new Promise((o,t)=>{q.addFiles([r],"file").then(()=>{q.trigger().then(l=>{l.forEach(a=>{const g=a?.data?.data;o({errorCode:0,data:{src:g?.url,alt:a?.filename}})})}).catch(l=>{b.error(l.message),t(l)}).finally(()=>{q.clearFiles()})})}),x=r=>{const o=String(r?.filetype||""),t=String(r?.url||"");return/^image\//i.test(o)||/\.(?:png|jpe?g|gif|bmp|webp|svg)$/i.test(t)?"image":/^video\//i.test(o)||/\.(?:mp4|webm|ogg|mov|m4v)$/i.test(t)?"video":"attachment"},E=()=>{if(!u.value)return;const r=e.value||e.defaultValue||"";i=new A.AiEditor({element:u.value,theme:m.isDark.value?"dark":"light",placeholder:c("components.editor.placeholder"),content:r,contentIsMarkdown:e.editorType==="markdown",onChange:y,onBlur:y,image:{uploadUrl:d.value,uploadHeaders:e.uploadHeaders||{},uploader:p,defaultSize:"auto"},video:{uploadUrl:d.value,uploadHeaders:e.uploadHeaders||{},uploader:p},attachment:{uploadUrl:d.value,uploadHeaders:e.uploadHeaders||{},uploader:p},ai:{models:{custom:{url:e.aiPath||f.apiPath?.ai||"ai",headers:()=>({"Content-Type":"application/json",Authorization:M.token}),wrapPayload:o=>JSON.stringify({prompt:o}),parseMessage:o=>{const t=JSON.parse(o);return{role:"assistant",content:t.message,index:t.number,status:t.status}},protocol:"sse"}}},toolbarKeys:["undo","redo","brush","eraser","divider","heading","font-family","font-size","divider","bold","italic","underline","strike","link","code","subscript","superscript","hr","todo","emoji","divider","highlight","font-color","divider","align","line-height","divider","bullet-list","ordered-list","indent-decrease","indent-increase","break","divider",...e.fileManager?[{id:"dux-file-manager-image",tip:c("components.upload.fileManager"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3.08697 9H20.9134C21.4657 9 21.9134 9.44772 21.9134 10C21.9134 10.0277 21.9122 10.0554 21.9099 10.083L21.0766 20.083C21.0334 20.6013 20.6001 21 20.08 21H3.9203C3.40021 21 2.96695 20.6013 2.92376 20.083L2.09042 10.083C2.04456 9.53267 2.45355 9.04932 3.00392 9.00345C3.03155 9.00115 3.05925 9 3.08697 9ZM4.84044 19H19.1599L19.8266 11H4.17377L4.84044 19ZM13.4144 5H20.0002C20.5525 5 21.0002 5.44772 21.0002 6V7H3.00017V4C3.00017 3.44772 3.44789 3 4.00017 3H11.4144L13.4144 5Z"></path></svg>',onClick:(o,t)=>{H.show({title:c("components.uploadManage.title")||c("components.upload.fileManager"),width:"800px",component:()=>Promise.resolve().then(()=>require("../upload/manager.cjs")),componentProps:{path:P.value,type:e.fileManagerType||"all",multiple:!0,uploadParams:{path:d.value,accept:"*/*",method:S.value}}}).then(l=>{l?.forEach?.(a=>{const g=x(a),$=a?.filename||"";if(g==="image")t.insert({type:"image",attrs:{src:a.url,alt:$,width:"auto"}});else if(g==="video")t.insert({type:"video",attrs:{src:a.url,controls:"true",width:350}});else{const w=a?.filename||a?.name||"file";e.editorType==="markdown"?t.insertMarkdown(`[${w}](${a.url})`):t.insert(`<a href="${a.url}" target="_blank">${w}</a>`)}})})}}]:[],"image","video","attachment","quote","container","code-block","table","divider","printer","fullscreen","ai"]})},U=()=>{i&&(i.destroy(),i=null)};return n.watch(()=>e.value,T),n.watch(()=>m.isDark.value,r=>{u.value&&(u.value.classList.toggle("aie-theme-dark",r),u.value.classList.toggle("aie-theme-light",!r))},{immediate:!0}),C({get aiEditor(){return i}}),n.onMounted(()=>{n.nextTick(()=>{E()})}),n.onUnmounted(()=>{U()}),()=>n.createVNode("div",{ref:u,style:{height:e.height,width:"100%"}},null)}});exports.DuxAiEditor=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),p=require("@duxweb/dvha-core"),j=require("@vueuse/core"),V=require("aieditor"),D=require("naive-ui");require("vue-router");require("@overlastic/vue");require("clsx");require("vue-echarts");require("vue3-ace-editor");require("ace-builds/src-noconflict/mode-vue");require("ace-builds/src-noconflict/mode-javascript");require("ace-builds/src-noconflict/mode-html");require("ace-builds/src-noconflict/mode-json");require("ace-builds/src-noconflict/mode-json5");require("ace-builds/src-noconflict/theme-tomorrow_night");require("ace-builds/src-noconflict/theme-tomorrow");require("ace-builds/src-noconflict/ext-searchbox");require("ace-builds/src-noconflict/ext-language_tools");require("ace-builds/src-noconflict/mode-snippets");require("vue-cropper");require("jinrishici");require("lodash-es");require("vue-draggable-plus");require("@vee-validate/i18n");require("colorizr");require("echarts");require("highlight.js/lib/core");require("highlight.js/lib/languages/bash");require("highlight.js/lib/languages/css");require("highlight.js/lib/languages/go");require("highlight.js/lib/languages/java");require("highlight.js/lib/languages/javascript");require("highlight.js/lib/languages/json");require("highlight.js/lib/languages/markdown");require("highlight.js/lib/languages/php");require("highlight.js/lib/languages/python");require("highlight.js/lib/languages/shell");require("highlight.js/lib/languages/sql");require("highlight.js/lib/languages/typescript");require("highlight.js/lib/languages/xml");require("@ant-design/colors");require("@unocss/preset-icons/browser");require("@unocss/preset-typography");require("unocss/preset-wind4");require("@vee-validate/i18n/dist/locale/en.json");require("@vee-validate/i18n/dist/locale/zh_CN.json");require("vee-validate");require("vue-command-palette");require("@duxweb/dvha-naiveui");require("../../pages/page404.cjs");require("short-unique-id");const F=require("../upload/config.cjs");require("@vue-flow/core");require("@vue-flow/background");;/* empty css */const O=require("../../hooks/modal.cjs");require("mime");require("@iconify-json/tabler/icons.json");require("../posterEditor/elements/index.cjs");require("fabric");require("dayjs");require("@tanstack/vue-query");require("pinia");const z=o.defineComponent({name:"DuxAiEditor",props:{value:String,defaultValue:String,uploadPath:String,uploadHeaders:Object,editorType:{type:String,default:"richtext"},aiPath:String,fileManager:{type:Boolean,default:!0},fileManagerType:{type:String,default:"all"},height:{type:String,default:"500px"}},setup(e,{emit:b,expose:H}){const d=o.ref();let i=null,q=!1;const y=p.useTheme(),{config:k}=p.useManage(),S=p.useGetAuth(),{t:h}=p.useI18n(),x=D.useMessage(),P=O.useModal(),w=j.useVModel(e,"value",b,{passive:!0}),g=o.computed(()=>e.uploadPath||k.apiPath?.upload||"upload"),f=p.useUpload({path:g.value,autoUpload:!1}),{managePath:T,method:E}=F.useUploadConfig(),U=()=>{if(!i||q)return;const r=w.value||"";e.editorType==="markdown"?i.setMarkdownContent(r):i.setContent(r)},C=()=>{if(!i)return;q=!0;const r=e.editorType==="markdown"?i.getMarkdown():i.getHtml();w.value=r,o.nextTick(()=>{q=!1})},v=r=>new Promise((u,a)=>{f.addFiles([r],"file").then(()=>{f.trigger().then(l=>{l.forEach(s=>{const c=s?.data?.data;u({errorCode:0,data:{src:c?.url,alt:s?.filename}})})}).catch(l=>{x.error(l.message),a(l)}).finally(()=>{f.clearFiles()})})}),M=r=>{const u=String(r?.filetype||""),a=String(r?.url||"");return/^image\//i.test(u)||/\.(?:png|jpe?g|gif|bmp|webp|svg)$/i.test(a)?"image":/^video\//i.test(u)||/\.(?:mp4|webm|ogg|mov|m4v)$/i.test(a)?"video":"attachment"},A=()=>{if(!d.value)return;const r=e.value||e.defaultValue||"";i=new V.AiEditor({element:d.value,theme:y.isDark.value?"dark":"light",placeholder:h("components.editor.placeholder"),content:r,contentIsMarkdown:e.editorType==="markdown",onChange:C,onBlur:C,image:{uploadUrl:g.value,uploadHeaders:e.uploadHeaders||{},uploader:v,defaultSize:"auto"},video:{uploadUrl:g.value,uploadHeaders:e.uploadHeaders||{},uploader:v},attachment:{uploadUrl:g.value,uploadHeaders:e.uploadHeaders||{},uploader:v},ai:{models:{custom:{url:e.aiPath||k.apiPath?.ai||"ai",headers:()=>({"Content-Type":"application/json",Authorization:S.token}),wrapPayload:u=>JSON.stringify({prompt:u}),parseMessage:u=>{const a=JSON.parse(u);return{role:"assistant",content:a.message,index:a.number,status:a.status}},protocol:"sse"}}},toolbarKeys:["undo","redo","brush","eraser","divider","heading","font-family","font-size","divider","bold","italic","underline","strike","link","code","subscript","superscript","hr","todo","emoji","divider","highlight","font-color","divider","align","line-height","divider","bullet-list","ordered-list","indent-decrease","indent-increase","break","divider",...e.fileManager?[{id:"dux-file-manager-image",tip:h("components.upload.fileManager"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3.08697 9H20.9134C21.4657 9 21.9134 9.44772 21.9134 10C21.9134 10.0277 21.9122 10.0554 21.9099 10.083L21.0766 20.083C21.0334 20.6013 20.6001 21 20.08 21H3.9203C3.40021 21 2.96695 20.6013 2.92376 20.083L2.09042 10.083C2.04456 9.53267 2.45355 9.04932 3.00392 9.00345C3.03155 9.00115 3.05925 9 3.08697 9ZM4.84044 19H19.1599L19.8266 11H4.17377L4.84044 19ZM13.4144 5H20.0002C20.5525 5 21.0002 5.44772 21.0002 6V7H3.00017V4C3.00017 3.44772 3.44789 3 4.00017 3H11.4144L13.4144 5Z"></path></svg>',onClick:(u,a)=>{P.show({title:h("components.uploadManage.title")||h("components.upload.fileManager"),width:"800px",component:()=>Promise.resolve().then(()=>require("../upload/manager.cjs")),componentProps:{path:T.value,type:e.fileManagerType||"all",multiple:!0,uploadParams:{path:g.value,accept:"*/*",method:E.value}}}).then(l=>{const s=Array.isArray(l)?[...l]:l?[l]:[];if(!s.length)return;if(e.editorType==="markdown"){const t=s.filter(n=>n?.url).map(n=>{const m=n?.filename||n?.name||"file";return M(n)==="image"?`![${m}](${n.url})`:`[${m}](${n.url})`});t.length&&a.insertMarkdown(t.join(`
2
+
3
+ `));return}const c=s.filter(t=>t?.url).map(t=>{const n=M(t),m=t?.filename||"";return n==="image"?{type:"image",attrs:{src:t.url,alt:m,width:"auto"}}:n==="video"?{type:"video",attrs:{src:t.url,controls:"true",width:350}}:{type:"paragraph",content:[{type:"text",text:t?.filename||t?.name||"file",marks:[{type:"link",attrs:{href:t.url,target:"_blank"}}]}]}});c.length&&a.insert(c.length===1?c[0]:c)})}}]:[],"image","video","attachment","quote","container","code-block","table","divider","printer","fullscreen","ai"]})},$=()=>{i&&(i.destroy(),i=null)};return o.watch(()=>e.value,U),o.watch(()=>y.isDark.value,r=>{d.value&&(d.value.classList.toggle("aie-theme-dark",r),d.value.classList.toggle("aie-theme-light",!r))},{immediate:!0}),H({get aiEditor(){return i}}),o.onMounted(()=>{o.nextTick(()=>{A()})}),o.onUnmounted(()=>{$()}),()=>o.createVNode("div",{ref:d,style:{height:e.height,width:"100%"}},null)}});exports.DuxAiEditor=z;
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=`/* layer: properties */
2
- @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-from-opacity:100%;--un-text-opacity:100%;--un-bg-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-border-opacity:100%;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-ease:initial;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;--un-space-y-reverse:initial;}}
2
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-ease:initial;--un-border-opacity:100%;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;--un-space-y-reverse:initial;}}
3
3
  @property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
4
4
  @property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
5
5
  @property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
@@ -1,8 +1,8 @@
1
- import { defineComponent as $, ref as A, computed as j, watch as w, onMounted as F, nextTick as k, onUnmounted as z, createVNode as B } from "vue";
2
- import { useTheme as D, useManage as I, useGetAuth as N, useI18n as O, useUpload as Z } from "@duxweb/dvha-core";
3
- import { useVModel as J } from "@vueuse/core";
4
- import { AiEditor as _ } from "aieditor";
5
- import { useMessage as q } from "naive-ui";
1
+ import { defineComponent as j, ref as F, computed as z, watch as M, onMounted as B, nextTick as H, onUnmounted as D, createVNode as I } from "vue";
2
+ import { useTheme as N, useManage as O, useGetAuth as Z, useI18n as J, useUpload as _ } from "@duxweb/dvha-core";
3
+ import { useVModel as q } from "@vueuse/core";
4
+ import { AiEditor as G } from "aieditor";
5
+ import { useMessage as K } from "naive-ui";
6
6
  import "vue-router";
7
7
  import "@overlastic/vue";
8
8
  import "clsx";
@@ -50,11 +50,11 @@ import "vue-command-palette";
50
50
  import "@duxweb/dvha-naiveui";
51
51
  import "../../pages/page404.js";
52
52
  import "short-unique-id";
53
- import { useUploadConfig as G } from "../upload/config.js";
53
+ import { useUploadConfig as R } from "../upload/config.js";
54
54
  import "@vue-flow/core";
55
55
  import "@vue-flow/background";
56
56
  /* empty css */
57
- import { useModal as K } from "../../hooks/modal.js";
57
+ import { useModal as Q } from "../../hooks/modal.js";
58
58
  import "mime";
59
59
  import "@iconify-json/tabler/icons.json";
60
60
  import "../posterEditor/elements/index.js";
@@ -62,7 +62,7 @@ import "fabric";
62
62
  import "dayjs";
63
63
  import "@tanstack/vue-query";
64
64
  import "pinia";
65
- const at = /* @__PURE__ */ $({
65
+ const le = /* @__PURE__ */ j({
66
66
  name: "DuxAiEditor",
67
67
  props: {
68
68
  value: String,
@@ -87,183 +87,202 @@ const at = /* @__PURE__ */ $({
87
87
  default: "500px"
88
88
  }
89
89
  },
90
- setup(e, {
91
- emit: C,
92
- expose: M
90
+ setup(t, {
91
+ emit: b,
92
+ expose: x
93
93
  }) {
94
- const n = A();
95
- let i = null, s = !1;
96
- const g = D(), {
97
- config: h
98
- } = I(), H = N(), {
99
- t: m
100
- } = O(), b = q(), P = K(), f = J(e, "value", C, {
94
+ const d = F();
95
+ let o = null, g = !1;
96
+ const v = N(), {
97
+ config: y
98
+ } = O(), S = Z(), {
99
+ t: u
100
+ } = J(), P = K(), T = Q(), k = q(t, "value", b, {
101
101
  passive: !0
102
- }), d = j(() => e.uploadPath || h.apiPath?.upload || "upload"), u = Z({
103
- path: d.value,
102
+ }), s = z(() => t.uploadPath || y.apiPath?.upload || "upload"), f = _({
103
+ path: s.value,
104
104
  autoUpload: !1
105
105
  }), {
106
- managePath: S,
107
- method: x
108
- } = G(), T = () => {
109
- if (!i || s) return;
110
- const t = f.value || "";
111
- e.editorType === "markdown" ? i.setMarkdownContent(t) : i.setContent(t);
112
- }, v = () => {
113
- if (!i) return;
114
- s = !0;
115
- const t = e.editorType === "markdown" ? i.getMarkdown() : i.getHtml();
116
- f.value = t, k(() => {
117
- s = !1;
106
+ managePath: E,
107
+ method: U
108
+ } = R(), A = () => {
109
+ if (!o || g) return;
110
+ const e = k.value || "";
111
+ t.editorType === "markdown" ? o.setMarkdownContent(e) : o.setContent(e);
112
+ }, w = () => {
113
+ if (!o) return;
114
+ g = !0;
115
+ const e = t.editorType === "markdown" ? o.getMarkdown() : o.getHtml();
116
+ k.value = e, H(() => {
117
+ g = !1;
118
118
  });
119
- }, c = (t) => new Promise((a, o) => {
120
- u.addFiles([t], "file").then(() => {
121
- u.trigger().then((l) => {
122
- l.forEach((r) => {
123
- const p = r?.data?.data;
124
- a({
119
+ }, h = (e) => new Promise((n, i) => {
120
+ f.addFiles([e], "file").then(() => {
121
+ f.trigger().then((l) => {
122
+ l.forEach((p) => {
123
+ const m = p?.data?.data;
124
+ n({
125
125
  errorCode: 0,
126
126
  data: {
127
- src: p?.url,
128
- alt: r?.filename
127
+ src: m?.url,
128
+ alt: p?.filename
129
129
  }
130
130
  });
131
131
  });
132
132
  }).catch((l) => {
133
- b.error(l.message), o(l);
133
+ P.error(l.message), i(l);
134
134
  }).finally(() => {
135
- u.clearFiles();
135
+ f.clearFiles();
136
136
  });
137
137
  });
138
- }), E = (t) => {
139
- const a = String(t?.filetype || ""), o = String(t?.url || "");
140
- return /^image\//i.test(a) || /\.(?:png|jpe?g|gif|bmp|webp|svg)$/i.test(o) ? "image" : /^video\//i.test(a) || /\.(?:mp4|webm|ogg|mov|m4v)$/i.test(o) ? "video" : "attachment";
141
- }, U = () => {
142
- if (!n.value) return;
143
- const t = e.value || e.defaultValue || "";
144
- i = new _({
145
- element: n.value,
146
- theme: g.isDark.value ? "dark" : "light",
147
- placeholder: m("components.editor.placeholder"),
148
- content: t,
149
- contentIsMarkdown: e.editorType === "markdown",
150
- onChange: v,
151
- onBlur: v,
138
+ }), C = (e) => {
139
+ const n = String(e?.filetype || ""), i = String(e?.url || "");
140
+ return /^image\//i.test(n) || /\.(?:png|jpe?g|gif|bmp|webp|svg)$/i.test(i) ? "image" : /^video\//i.test(n) || /\.(?:mp4|webm|ogg|mov|m4v)$/i.test(i) ? "video" : "attachment";
141
+ }, L = () => {
142
+ if (!d.value) return;
143
+ const e = t.value || t.defaultValue || "";
144
+ o = new G({
145
+ element: d.value,
146
+ theme: v.isDark.value ? "dark" : "light",
147
+ placeholder: u("components.editor.placeholder"),
148
+ content: e,
149
+ contentIsMarkdown: t.editorType === "markdown",
150
+ onChange: w,
151
+ onBlur: w,
152
152
  image: {
153
- uploadUrl: d.value,
154
- uploadHeaders: e.uploadHeaders || {},
155
- uploader: c,
153
+ uploadUrl: s.value,
154
+ uploadHeaders: t.uploadHeaders || {},
155
+ uploader: h,
156
156
  defaultSize: "auto"
157
157
  },
158
158
  video: {
159
- uploadUrl: d.value,
160
- uploadHeaders: e.uploadHeaders || {},
161
- uploader: c
159
+ uploadUrl: s.value,
160
+ uploadHeaders: t.uploadHeaders || {},
161
+ uploader: h
162
162
  },
163
163
  attachment: {
164
- uploadUrl: d.value,
165
- uploadHeaders: e.uploadHeaders || {},
166
- uploader: c
164
+ uploadUrl: s.value,
165
+ uploadHeaders: t.uploadHeaders || {},
166
+ uploader: h
167
167
  },
168
168
  ai: {
169
169
  models: {
170
170
  custom: {
171
- url: e.aiPath || h.apiPath?.ai || "ai",
171
+ url: t.aiPath || y.apiPath?.ai || "ai",
172
172
  headers: () => ({
173
173
  "Content-Type": "application/json",
174
- Authorization: H.token
174
+ Authorization: S.token
175
175
  }),
176
- wrapPayload: (a) => JSON.stringify({
177
- prompt: a
176
+ wrapPayload: (n) => JSON.stringify({
177
+ prompt: n
178
178
  }),
179
- parseMessage: (a) => {
180
- const o = JSON.parse(a);
179
+ parseMessage: (n) => {
180
+ const i = JSON.parse(n);
181
181
  return {
182
182
  role: "assistant",
183
- content: o.message,
184
- index: o.number,
185
- status: o.status
183
+ content: i.message,
184
+ index: i.number,
185
+ status: i.status
186
186
  };
187
187
  },
188
188
  protocol: "sse"
189
189
  }
190
190
  }
191
191
  },
192
- toolbarKeys: ["undo", "redo", "brush", "eraser", "divider", "heading", "font-family", "font-size", "divider", "bold", "italic", "underline", "strike", "link", "code", "subscript", "superscript", "hr", "todo", "emoji", "divider", "highlight", "font-color", "divider", "align", "line-height", "divider", "bullet-list", "ordered-list", "indent-decrease", "indent-increase", "break", "divider", ...e.fileManager ? [{
192
+ toolbarKeys: ["undo", "redo", "brush", "eraser", "divider", "heading", "font-family", "font-size", "divider", "bold", "italic", "underline", "strike", "link", "code", "subscript", "superscript", "hr", "todo", "emoji", "divider", "highlight", "font-color", "divider", "align", "line-height", "divider", "bullet-list", "ordered-list", "indent-decrease", "indent-increase", "break", "divider", ...t.fileManager ? [{
193
193
  id: "dux-file-manager-image",
194
- tip: m("components.upload.fileManager"),
194
+ tip: u("components.upload.fileManager"),
195
195
  icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3.08697 9H20.9134C21.4657 9 21.9134 9.44772 21.9134 10C21.9134 10.0277 21.9122 10.0554 21.9099 10.083L21.0766 20.083C21.0334 20.6013 20.6001 21 20.08 21H3.9203C3.40021 21 2.96695 20.6013 2.92376 20.083L2.09042 10.083C2.04456 9.53267 2.45355 9.04932 3.00392 9.00345C3.03155 9.00115 3.05925 9 3.08697 9ZM4.84044 19H19.1599L19.8266 11H4.17377L4.84044 19ZM13.4144 5H20.0002C20.5525 5 21.0002 5.44772 21.0002 6V7H3.00017V4C3.00017 3.44772 3.44789 3 4.00017 3H11.4144L13.4144 5Z"></path></svg>',
196
- onClick: (a, o) => {
197
- P.show({
198
- title: m("components.uploadManage.title") || m("components.upload.fileManager"),
196
+ onClick: (n, i) => {
197
+ T.show({
198
+ title: u("components.uploadManage.title") || u("components.upload.fileManager"),
199
199
  width: "800px",
200
200
  component: () => import("../upload/manager.js"),
201
201
  componentProps: {
202
- path: S.value,
203
- type: e.fileManagerType || "all",
202
+ path: E.value,
203
+ type: t.fileManagerType || "all",
204
204
  multiple: !0,
205
205
  uploadParams: {
206
- path: d.value,
206
+ path: s.value,
207
207
  accept: "*/*",
208
- method: x.value
208
+ method: U.value
209
209
  }
210
210
  }
211
211
  }).then((l) => {
212
- l?.forEach?.((r) => {
213
- const p = E(r), V = r?.filename || "";
214
- if (p === "image")
215
- o.insert({
216
- type: "image",
217
- attrs: {
218
- src: r.url,
219
- alt: V,
220
- width: "auto"
221
- }
222
- });
223
- else if (p === "video")
224
- o.insert({
225
- type: "video",
226
- attrs: {
227
- src: r.url,
228
- controls: "true",
229
- width: 350
230
- }
231
- });
232
- else {
233
- const y = r?.filename || r?.name || "file";
234
- e.editorType === "markdown" ? o.insertMarkdown(`[${y}](${r.url})`) : o.insert(`<a href="${r.url}" target="_blank">${y}</a>`);
235
- }
212
+ const p = Array.isArray(l) ? [...l] : l ? [l] : [];
213
+ if (!p.length) return;
214
+ if (t.editorType === "markdown") {
215
+ const r = p.filter((a) => a?.url).map((a) => {
216
+ const c = a?.filename || a?.name || "file";
217
+ return C(a) === "image" ? `![${c}](${a.url})` : `[${c}](${a.url})`;
218
+ });
219
+ r.length && i.insertMarkdown(r.join(`
220
+
221
+ `));
222
+ return;
223
+ }
224
+ const m = p.filter((r) => r?.url).map((r) => {
225
+ const a = C(r), c = r?.filename || "";
226
+ return a === "image" ? {
227
+ type: "image",
228
+ attrs: {
229
+ src: r.url,
230
+ alt: c,
231
+ width: "auto"
232
+ }
233
+ } : a === "video" ? {
234
+ type: "video",
235
+ attrs: {
236
+ src: r.url,
237
+ controls: "true",
238
+ width: 350
239
+ }
240
+ } : {
241
+ type: "paragraph",
242
+ content: [{
243
+ type: "text",
244
+ text: r?.filename || r?.name || "file",
245
+ marks: [{
246
+ type: "link",
247
+ attrs: {
248
+ href: r.url,
249
+ target: "_blank"
250
+ }
251
+ }]
252
+ }]
253
+ };
236
254
  });
255
+ m.length && i.insert(m.length === 1 ? m[0] : m);
237
256
  });
238
257
  }
239
258
  }] : [], "image", "video", "attachment", "quote", "container", "code-block", "table", "divider", "printer", "fullscreen", "ai"]
240
259
  });
241
- }, L = () => {
242
- i && (i.destroy(), i = null);
260
+ }, V = () => {
261
+ o && (o.destroy(), o = null);
243
262
  };
244
- return w(() => e.value, T), w(() => g.isDark.value, (t) => {
245
- n.value && (n.value.classList.toggle("aie-theme-dark", t), n.value.classList.toggle("aie-theme-light", !t));
263
+ return M(() => t.value, A), M(() => v.isDark.value, (e) => {
264
+ d.value && (d.value.classList.toggle("aie-theme-dark", e), d.value.classList.toggle("aie-theme-light", !e));
246
265
  }, {
247
266
  immediate: !0
248
- }), M({
267
+ }), x({
249
268
  get aiEditor() {
250
- return i;
269
+ return o;
251
270
  }
252
- }), F(() => {
253
- k(() => {
254
- U();
271
+ }), B(() => {
272
+ H(() => {
273
+ L();
255
274
  });
256
- }), z(() => {
257
- L();
258
- }), () => B("div", {
259
- ref: n,
275
+ }), D(() => {
276
+ V();
277
+ }), () => I("div", {
278
+ ref: d,
260
279
  style: {
261
- height: e.height,
280
+ height: t.height,
262
281
  width: "100%"
263
282
  }
264
283
  }, null);
265
284
  }
266
285
  });
267
286
  export {
268
- at as DuxAiEditor
287
+ le as DuxAiEditor
269
288
  };
@@ -1,5 +1,5 @@
1
1
  const r = `/* layer: properties */
2
- @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-from-opacity:100%;--un-text-opacity:100%;--un-bg-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-border-opacity:100%;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-ease:initial;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;--un-space-y-reverse:initial;}}
2
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*, ::before, ::after, ::backdrop{--un-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-opacity:100%;--un-shadow-opacity:100%;--un-ease:initial;--un-border-opacity:100%;--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-to-opacity:100%;--un-outline-style:solid;--un-fill-opacity:100%;--un-space-y-reverse:initial;}}
3
3
  @property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
4
4
  @property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
5
5
  @property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-pro",
3
3
  "type": "module",
4
- "version": "1.1.14",
4
+ "version": "1.1.15",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ant-design/colors": "^7.2.1",
36
- "@duxweb/dvha-core": "^1.1.14",
37
- "@duxweb/dvha-naiveui": "^1.1.14",
36
+ "@duxweb/dvha-core": "^1.1.15",
37
+ "@duxweb/dvha-naiveui": "^1.1.15",
38
38
  "@iconify-json/tabler": "^1.2.23",
39
39
  "@overlastic/vue": "^0.8.3",
40
40
  "@tanstack/vue-query": "^5.90.7",