@duxweb/dvha-pro 1.1.13 → 1.1.14

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 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),g=require("@duxweb/dvha-core"),U=require("@vueuse/core"),x=require("aieditor"),$=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 E=require("../upload/config.cjs");require("@vue-flow/core");require("@vue-flow/background");;/* empty css */const L=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 V=u.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"},onUpdateValue:Function},setup(r,{emit:y,expose:k}){const o=u.ref();let a=null;k({get aiEditor(){return a}});let l=!1;const f=g.useTheme(),{config:v}=g.useManage(),M=g.useGetAuth(),{t:h}=g.useI18n(),C=$.useMessage(),b=L.useModal(),H=r.value??r.defaultValue??"",d=U.useVModel(r,"value",y),s=u.computed(()=>r.uploadPath||v.apiPath?.upload||"upload"),m=g.useUpload({path:s.value,autoUpload:!1}),{managePath:P,method:S}=E.useUploadConfig();u.watch(()=>r.value,e=>{!a||l||(r.editorType==="markdown"?a.setMarkdownContent(e||""):a.setContent(e||""))},{immediate:!0,flush:"post"});const q=e=>new Promise((t,n)=>{m.addFiles([e],"file").then(()=>{m.trigger().then(i=>{i.forEach(c=>{const p=c?.data?.data;t({errorCode:0,data:{src:p?.url,alt:c?.filename}})})}).catch(i=>{C.error(i.message),n(i)}).finally(()=>{m.clearFiles()})})}),T=e=>{const t=String(e?.filetype||""),n=String(e?.url||"");return/^image\//i.test(t)||/\.(?:png|jpe?g|gif|bmp|webp|svg)$/i.test(n)?"image":/^video\//i.test(t)||/\.(?:mp4|webm|ogg|mov|m4v)$/i.test(n)?"video":"attachment"};return u.onMounted(()=>{a=new x.AiEditor({theme:f.isDark.value?"dark":"light",element:o.value,placeholder:h("components.editor.placeholder"),content:H,contentIsMarkdown:r.editorType==="markdown",onChange:e=>{l=!0,d.value=r.editorType==="markdown"?e.getMarkdown():e.getHtml(),l=!1},onBlur:e=>{l=!0,d.value=r.editorType==="markdown"?e.getMarkdown():e.getHtml(),l=!1},image:{uploadUrl:s.value,uploadHeaders:r.uploadHeaders||{},uploader:q,defaultSize:"auto"},video:{uploadUrl:s.value,uploadHeaders:r.uploadHeaders||{},uploader:q},attachment:{uploadUrl:s.value,uploadHeaders:r.uploadHeaders||{},uploader:q},ai:{models:{custom:{url:r.aiPath||v.apiPath?.ai||"ai",headers:()=>({"Content-Type":"application/json",Authorization:M.token}),wrapPayload:e=>JSON.stringify({prompt:e}),parseMessage:e=>{const t=JSON.parse(e);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",...r.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:(e,t)=>{b.show({title:h("components.uploadManage.title")||h("components.upload.fileManager"),width:"800px",component:()=>Promise.resolve().then(()=>require("../upload/manager.cjs")),componentProps:{path:P.value,type:r.fileManagerType||"all",multiple:!0,uploadParams:{path:s.value,accept:"*/*",method:S.value}}}).then(n=>{n?.forEach?.(i=>{const c=T(i),p=i?.filename||"";if(c==="image")t.insert({type:"image",attrs:{src:i.url,alt:p,width:"auto"}});else if(c==="video")t.insert({type:"video",attrs:{src:i.url,controls:"true",width:350}});else{const w=i?.filename||i?.name||"file";r.editorType==="markdown"?t.insertMarkdown(`[${w}](${i.url})`):t.insert(`<a href="${i.url}" target="_blank">${w}</a>`)}})})}}]:[],"image","video","attachment","quote","container","code-block","table","divider","printer","fullscreen","ai"]}),d.value!=null&&(r.editorType==="markdown"?a.setMarkdownContent(d.value||""):a.setContent(d.value||""))}),u.onUnmounted(()=>{a?.destroy()}),u.watch(f.isDark,e=>{o.value&&(o.value.classList.remove("aie-theme-dark","aie-theme-light"),o.value.classList.add(e?"aie-theme-dark":"aie-theme-light"))},{immediate:!0}),()=>u.createVNode("div",{ref:o,style:`height: ${r.height}; width:100%`},null)}});exports.DuxAiEditor=V;
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,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-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-shadow-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-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;}}
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;}}
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 x, ref as U, computed as E, watch as w, onMounted as L, onUnmounted as V, createVNode as $ } from "vue";
2
- import { useTheme as A, useManage as j, useGetAuth as D, useI18n as F, useUpload as z } from "@duxweb/dvha-core";
3
- import { useVModel as B } from "@vueuse/core";
4
- import { AiEditor as N } from "aieditor";
5
- import { useMessage as O } from "naive-ui";
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";
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 Z } from "../upload/config.js";
53
+ import { useUploadConfig as G } from "../upload/config.js";
54
54
  import "@vue-flow/core";
55
55
  import "@vue-flow/background";
56
56
  /* empty css */
57
- import { useModal as I } from "../../hooks/modal.js";
57
+ import { useModal as K } from "../../hooks/modal.js";
58
58
  import "mime";
59
59
  import "@iconify-json/tabler/icons.json";
60
60
  import "../posterEditor/elements/index.js";
@@ -62,14 +62,13 @@ import "fabric";
62
62
  import "dayjs";
63
63
  import "@tanstack/vue-query";
64
64
  import "pinia";
65
- const et = /* @__PURE__ */ x({
65
+ const at = /* @__PURE__ */ $({
66
66
  name: "DuxAiEditor",
67
67
  props: {
68
68
  value: String,
69
69
  defaultValue: String,
70
70
  uploadPath: String,
71
71
  uploadHeaders: Object,
72
- // 编辑器类型:富文本 或 Markdown
73
72
  editorType: {
74
73
  type: String,
75
74
  default: "richtext"
@@ -86,103 +85,99 @@ const et = /* @__PURE__ */ x({
86
85
  height: {
87
86
  type: String,
88
87
  default: "500px"
89
- },
90
- onUpdateValue: Function
88
+ }
91
89
  },
92
- setup(t, {
93
- emit: y,
94
- expose: k
90
+ setup(e, {
91
+ emit: C,
92
+ expose: M
95
93
  }) {
96
- const n = U();
97
- let r = null;
98
- k({
99
- get aiEditor() {
100
- return r;
101
- }
102
- });
103
- let l = !1;
104
- const g = A(), {
105
- config: f
106
- } = j(), M = D(), {
107
- t: u
108
- } = F(), C = O(), H = I(), b = t.value ?? t.defaultValue ?? "", d = B(t, "value", y), m = E(() => t.uploadPath || f.apiPath?.upload || "upload"), s = z({
109
- path: m.value,
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, {
101
+ passive: !0
102
+ }), d = j(() => e.uploadPath || h.apiPath?.upload || "upload"), u = Z({
103
+ path: d.value,
110
104
  autoUpload: !1
111
105
  }), {
112
- managePath: P,
113
- method: S
114
- } = Z();
115
- w(() => t.value, (e) => {
116
- !r || l || (t.editorType === "markdown" ? r.setMarkdownContent(e || "") : r.setContent(e || ""));
117
- }, {
118
- immediate: !0,
119
- flush: "post"
120
- });
121
- const c = (e) => new Promise((o, a) => {
122
- s.addFiles([e], "file").then(() => {
123
- s.trigger().then((i) => {
124
- i.forEach((p) => {
125
- const h = p?.data?.data;
126
- o({
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;
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({
127
125
  errorCode: 0,
128
126
  data: {
129
- src: h?.url,
130
- alt: p?.filename
127
+ src: p?.url,
128
+ alt: r?.filename
131
129
  }
132
130
  });
133
131
  });
134
- }).catch((i) => {
135
- C.error(i.message), a(i);
132
+ }).catch((l) => {
133
+ b.error(l.message), o(l);
136
134
  }).finally(() => {
137
- s.clearFiles();
135
+ u.clearFiles();
138
136
  });
139
137
  });
140
- }), T = (e) => {
141
- const o = String(e?.filetype || ""), a = String(e?.url || "");
142
- return /^image\//i.test(o) || /\.(?:png|jpe?g|gif|bmp|webp|svg)$/i.test(a) ? "image" : /^video\//i.test(o) || /\.(?:mp4|webm|ogg|mov|m4v)$/i.test(a) ? "video" : "attachment";
143
- };
144
- return L(() => {
145
- r = new N({
146
- theme: g.isDark.value ? "dark" : "light",
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 _({
147
145
  element: n.value,
148
- placeholder: u("components.editor.placeholder"),
149
- content: b,
150
- contentIsMarkdown: t.editorType === "markdown",
151
- onChange: (e) => {
152
- l = !0, d.value = t.editorType === "markdown" ? e.getMarkdown() : e.getHtml(), l = !1;
153
- },
154
- onBlur: (e) => {
155
- l = !0, d.value = t.editorType === "markdown" ? e.getMarkdown() : e.getHtml(), l = !1;
156
- },
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,
157
152
  image: {
158
- uploadUrl: m.value,
159
- uploadHeaders: t.uploadHeaders || {},
153
+ uploadUrl: d.value,
154
+ uploadHeaders: e.uploadHeaders || {},
160
155
  uploader: c,
161
156
  defaultSize: "auto"
162
157
  },
163
158
  video: {
164
- uploadUrl: m.value,
165
- uploadHeaders: t.uploadHeaders || {},
159
+ uploadUrl: d.value,
160
+ uploadHeaders: e.uploadHeaders || {},
166
161
  uploader: c
167
162
  },
168
163
  attachment: {
169
- uploadUrl: m.value,
170
- uploadHeaders: t.uploadHeaders || {},
164
+ uploadUrl: d.value,
165
+ uploadHeaders: e.uploadHeaders || {},
171
166
  uploader: c
172
167
  },
173
168
  ai: {
174
169
  models: {
175
170
  custom: {
176
- url: t.aiPath || f.apiPath?.ai || "ai",
171
+ url: e.aiPath || h.apiPath?.ai || "ai",
177
172
  headers: () => ({
178
173
  "Content-Type": "application/json",
179
- Authorization: M.token
174
+ Authorization: H.token
180
175
  }),
181
- wrapPayload: (e) => JSON.stringify({
182
- prompt: e
176
+ wrapPayload: (a) => JSON.stringify({
177
+ prompt: a
183
178
  }),
184
- parseMessage: (e) => {
185
- const o = JSON.parse(e);
179
+ parseMessage: (a) => {
180
+ const o = JSON.parse(a);
186
181
  return {
187
182
  role: "assistant",
188
183
  content: o.message,
@@ -194,34 +189,34 @@ const et = /* @__PURE__ */ x({
194
189
  }
195
190
  }
196
191
  },
197
- 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 ? [{
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 ? [{
198
193
  id: "dux-file-manager-image",
199
- tip: u("components.upload.fileManager"),
194
+ tip: m("components.upload.fileManager"),
200
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>',
201
- onClick: (e, o) => {
202
- H.show({
203
- title: u("components.uploadManage.title") || u("components.upload.fileManager"),
196
+ onClick: (a, o) => {
197
+ P.show({
198
+ title: m("components.uploadManage.title") || m("components.upload.fileManager"),
204
199
  width: "800px",
205
200
  component: () => import("../upload/manager.js"),
206
201
  componentProps: {
207
- path: P.value,
208
- type: t.fileManagerType || "all",
202
+ path: S.value,
203
+ type: e.fileManagerType || "all",
209
204
  multiple: !0,
210
205
  uploadParams: {
211
- path: m.value,
206
+ path: d.value,
212
207
  accept: "*/*",
213
- method: S.value
208
+ method: x.value
214
209
  }
215
210
  }
216
- }).then((a) => {
217
- a?.forEach?.((i) => {
218
- const p = T(i), h = i?.filename || "";
211
+ }).then((l) => {
212
+ l?.forEach?.((r) => {
213
+ const p = E(r), V = r?.filename || "";
219
214
  if (p === "image")
220
215
  o.insert({
221
216
  type: "image",
222
217
  attrs: {
223
- src: i.url,
224
- alt: h,
218
+ src: r.url,
219
+ alt: V,
225
220
  width: "auto"
226
221
  }
227
222
  });
@@ -229,32 +224,46 @@ const et = /* @__PURE__ */ x({
229
224
  o.insert({
230
225
  type: "video",
231
226
  attrs: {
232
- src: i.url,
227
+ src: r.url,
233
228
  controls: "true",
234
229
  width: 350
235
230
  }
236
231
  });
237
232
  else {
238
- const v = i?.filename || i?.name || "file";
239
- t.editorType === "markdown" ? o.insertMarkdown(`[${v}](${i.url})`) : o.insert(`<a href="${i.url}" target="_blank">${v}</a>`);
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>`);
240
235
  }
241
236
  });
242
237
  });
243
238
  }
244
239
  }] : [], "image", "video", "attachment", "quote", "container", "code-block", "table", "divider", "printer", "fullscreen", "ai"]
245
- }), d.value != null && (t.editorType === "markdown" ? r.setMarkdownContent(d.value || "") : r.setContent(d.value || ""));
246
- }), V(() => {
247
- r?.destroy();
248
- }), w(g.isDark, (e) => {
249
- n.value && (n.value.classList.remove("aie-theme-dark", "aie-theme-light"), n.value.classList.add(e ? "aie-theme-dark" : "aie-theme-light"));
240
+ });
241
+ }, L = () => {
242
+ i && (i.destroy(), i = null);
243
+ };
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));
250
246
  }, {
251
247
  immediate: !0
252
- }), () => $("div", {
248
+ }), M({
249
+ get aiEditor() {
250
+ return i;
251
+ }
252
+ }), F(() => {
253
+ k(() => {
254
+ U();
255
+ });
256
+ }), z(() => {
257
+ L();
258
+ }), () => B("div", {
253
259
  ref: n,
254
- style: `height: ${t.height}; width:100%`
260
+ style: {
261
+ height: e.height,
262
+ width: "100%"
263
+ }
255
264
  }, null);
256
265
  }
257
266
  });
258
267
  export {
259
- et as DuxAiEditor
268
+ at as DuxAiEditor
260
269
  };
@@ -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-text-opacity:100%;--un-bg-opacity:100%;--un-from-opacity:100%;--un-shadow-opacity:100%;--un-divide-y-reverse:initial;--un-border-style:solid;--un-divide-x-reverse:initial;--un-divide-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;}}
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;}}
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%;}
@@ -21,7 +21,6 @@ export declare const DuxAiEditor: import("vue").DefineComponent<import("vue").Ex
21
21
  type: StringConstructor;
22
22
  default: string;
23
23
  };
24
- onUpdateValue: PropType<(value: string) => void>;
25
24
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
25
  value: StringConstructor;
27
26
  defaultValue: StringConstructor;
@@ -44,7 +43,6 @@ export declare const DuxAiEditor: import("vue").DefineComponent<import("vue").Ex
44
43
  type: StringConstructor;
45
44
  default: string;
46
45
  };
47
- onUpdateValue: PropType<(value: string) => void>;
48
46
  }>> & Readonly<{}>, {
49
47
  height: string;
50
48
  editorType: "markdown" | "richtext";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-pro",
3
3
  "type": "module",
4
- "version": "1.1.13",
4
+ "version": "1.1.14",
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.13",
37
- "@duxweb/dvha-naiveui": "^1.1.13",
36
+ "@duxweb/dvha-core": "^1.1.14",
37
+ "@duxweb/dvha-naiveui": "^1.1.14",
38
38
  "@iconify-json/tabler": "^1.2.23",
39
39
  "@overlastic/vue": "^0.8.3",
40
40
  "@tanstack/vue-query": "^5.90.7",