officialblock 2.1.1 → 2.1.2
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.
- package/dist/{index-esMFQfpR.js → index-BX3wo2uq.js} +1 -1
- package/dist/{index-DwAYwP3K.mjs → index-Btjp_XdI.mjs} +1 -1
- package/dist/index-CClVOzrU.js +20 -0
- package/dist/index-C_3-HeV5.js +1 -0
- package/dist/index-Chue7s0-.mjs +31274 -0
- package/dist/index-CmerRdhn.mjs +4 -0
- package/dist/{index-D3X7jHwZ.mjs → index-Cn6a6HhI.mjs} +104 -93
- package/dist/index-Cu03Azf6.js +1 -0
- package/dist/index-DCXncMaQ.mjs +4 -0
- package/dist/{index-qybMHiY-.js → index-DPl0MPya.js} +1 -1
- package/dist/index-DRMApk01.js +1 -0
- package/dist/index-rYdlY3SQ.mjs +361 -0
- package/dist/official-block.cjs.js +1 -1
- package/dist/official-block.es.js +106 -99
- package/dist/official-block.umd.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/index-BI82VZ91.js +0 -1
- package/dist/index-B_6DwUvb.js +0 -1
- package/dist/index-B__52Adx.mjs +0 -4
- package/dist/index-BjgdPzqR.mjs +0 -349
- package/dist/index-BsZbx0rW.js +0 -1
- package/dist/index-CEHf6M6x.js +0 -1
- package/dist/index-CroTuaW_.mjs +0 -162
- package/dist/index-CvCNRVPY.js +0 -20
- package/dist/index-DwPHbe8R.mjs +0 -216
- package/dist/index-NTd6BVQQ.js +0 -1
- package/dist/index-QpRJyZ_6.mjs +0 -29116
- package/dist/index-ahwJ0pbt.mjs +0 -143
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var K=(u,r,i)=>r in u?U(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i;var c=(u,r,i)=>K(u,typeof r!="symbol"?r+"":r,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),B=require("@wangeditor/editor-for-vue"),w=require("@wangeditor/editor"),q=require("./index-
|
|
1
|
+
"use strict";var U=Object.defineProperty;var K=(u,r,i)=>r in u?U(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i;var c=(u,r,i)=>K(u,typeof r!="symbol"?r+"":r,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),B=require("@wangeditor/editor-for-vue"),w=require("@wangeditor/editor"),q=require("./index-CClVOzrU.js"),E={class:"rich-text-editor"},$=t.defineComponent({__name:"index",props:{name:{default:""},modelValue:{default:""},placeholder:{default:"请输入内容..."},height:{default:"400px"},mode:{default:"default"},disabled:{type:Boolean,default:!1},maxLength:{default:1e4},excludeKeys:{default:()=>[]},includeKeys:{default:()=>[]}},emits:["update:modelValue","change","focus","blur","created","upload-image","upload-video"],setup(u,{expose:r,emit:i}){const a=u,m=i,o=t.shallowRef(),d=t.ref(""),I=t.computed(()=>typeof a.height=="number"?`${a.height}px`:a.height),p=t.inject("handleUpload",()=>{}),f=t.inject("fileUrl",null),C=t.inject("chooseName",null),h=t.ref(""),v=t.ref(null),b=e=>{if(!p){console.warn("Upload: handleUpload function not provided by ancestor");return}if(h.value=e,o.value)try{const n=o.value.selection;n&&(v.value={anchor:{path:[...n.anchor.path],offset:n.anchor.offset},focus:{path:[...n.focus.path],offset:n.focus.offset}})}catch(n){console.warn("保存光标位置失败:",n)}const l=a.name+"_"+e;p(!0,l)};t.watch(()=>a.name,()=>{f.value=null},{deep:!0,immediate:!0}),t.watch(()=>[f==null?void 0:f.value],([e])=>{const l=a.name+"_"+h.value;!e||!C.value||C.value!==l||o.value&&t.nextTick(()=>{var n,g;if(o.value){try{if(o.value.focus(),v.value)try{o.value.select(v.value)}catch(s){console.warn("恢复光标位置失败,使用默认位置:",s)}}catch(s){console.warn("聚焦编辑器失败:",s)}if(h.value==="img"){const y=`<img src="${e}" alt="图片" style="max-width: 100%;">`;(n=o.value)==null||n.dangerouslyInsertHtml(y)}else{const y=`<video src="${e}" controls style="max-width: 100%;"></video>`;(g=o.value)==null||g.dangerouslyInsertHtml(y)}v.value=null,h.value=""}})},{immediate:!1});function _(e){return class{constructor(){c(this,"title");c(this,"tag");c(this,"iconSvg");this.title="上传图片",this.tag="button",this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>'}isActive(){return!1}getValue(){return""}isDisabled(){return!1}exec(){t.nextTick(()=>{console.log("点击了自定义上传图片菜单"),e("img")})}}}function k(e){return class{constructor(){c(this,"title");c(this,"tag");c(this,"iconSvg");this.title="上传视频",this.tag="button",this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>'}getValue(){return""}isActive(){return!1}isDisabled(){return!1}exec(){t.nextTick(()=>{console.log("点击了自定义上传视频菜单"),e("video")})}}}const x={toolbarKeys:["headerSelect","bold","italic","through","underline","color","fontSize","lineHeight","delIndent","indent","divider","insertTable","justifyCenter","justifyJustify","justifyLeft","justifyRight","undo","redo","clearStyle","codeBlock"]},H={placeholder:a.placeholder,readOnly:a.disabled,maxLength:a.maxLength,MENU_CONF:{}},M=Math.random().toString(36).substring(2,9),V=`CustomImageMenu_${M}`,S=`CustomVideoMenu_${M}`,j=e=>{o.value=e;try{const l=_(b),n=k(b),g={key:V,factory(){return new l}},s={key:S,factory(){return new n}};w.Boot.registerMenu(g),w.Boot.registerMenu(s)}catch(l){console.warn("菜单注册失败:",l)}x.insertKeys={index:0,keys:[V,S]},m("created",e)};t.onBeforeUnmount(()=>{const e=o.value;e!=null&&e.destroy()}),t.watch(()=>a.modelValue,e=>{e!==d.value&&(d.value=e||"")},{immediate:!0});const z=e=>{m("update:modelValue",d.value),m("change",e)},N=()=>{o.value=void 0},O=e=>{m("focus",e)},T=e=>{m("blur",e)};return r({editor:o,getHtml:()=>d.value,getText:()=>{var e;return((e=o.value)==null?void 0:e.getText())||""},isEmpty:()=>{var e;return((e=o.value)==null?void 0:e.isEmpty())||!0},clear:()=>{var e;return(e=o.value)==null?void 0:e.clear()},focus:()=>{var e;return(e=o.value)==null?void 0:e.focus()},blur:()=>{var e;return(e=o.value)==null?void 0:e.blur()},disable:()=>{var e;return(e=o.value)==null?void 0:e.disable()},enable:()=>{var e;return(e=o.value)==null?void 0:e.enable()}}),(e,l)=>(t.openBlock(),t.createElementBlock("div",E,[t.createVNode(t.unref(B.Toolbar),{class:"editor-toolbar",editor:o.value,defaultConfig:x,mode:u.mode},null,8,["editor","mode"]),t.createVNode(t.unref(B.Editor),{class:"editor-content",style:t.normalizeStyle({height:I.value}),modelValue:d.value,"onUpdate:modelValue":l[0]||(l[0]=n=>d.value=n),defaultConfig:H,mode:u.mode,onOnCreated:j,onOnChange:z,onOnDestroyed:N,onOnFocus:O,onOnBlur:T},null,8,["style","modelValue","mode"])]))}}),D=q._($,[["__scopeId","data-v-e8d1a61b"]]);exports.default=D;
|
|
@@ -4,7 +4,7 @@ var r = (a, u, c) => L(a, typeof u != "symbol" ? u + "" : u, c);
|
|
|
4
4
|
import { defineComponent as A, shallowRef as R, ref as p, computed as F, inject as y, watch as C, nextTick as b, onBeforeUnmount as q, createElementBlock as J, openBlock as G, createVNode as I, unref as H, normalizeStyle as P } from "vue";
|
|
5
5
|
import { Toolbar as Q, Editor as W } from "@wangeditor/editor-for-vue";
|
|
6
6
|
import { Boot as z } from "@wangeditor/editor";
|
|
7
|
-
import { _ as X } from "./index-
|
|
7
|
+
import { _ as X } from "./index-Chue7s0-.mjs";
|
|
8
8
|
const Y = { class: "rich-text-editor" }, Z = /* @__PURE__ */ A({
|
|
9
9
|
__name: "index",
|
|
10
10
|
props: {
|