/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{ref as e,watch as t,openBlock as o,createElementBlock as i,normalizeClass as s,unref as a,createBlock as d,withCtx as r,renderSlot as n,createCommentVNode as l,createVNode as p,createElementVNode as u,toDisplayString as m}from"vue";import{useEditor as c,EditorContent as x}from"../../node_modules/@tiptap/vue-3/dist/index.js";import f from"../../node_modules/@tiptap/starter-kit/dist/index.js";import b from"../../node_modules/@tiptap/extension-text-align/dist/index.js";import v from"../../node_modules/@tiptap/extension-task-list/dist/index.js";import g from"../../node_modules/@tiptap/extension-task-item/dist/index.js";import h from"../../node_modules/@tiptap/extension-image/dist/index.js";import j from"../../node_modules/@tiptap/extension-highlight/dist/index.js";import{TableKit as _}from"../../node_modules/@tiptap/extension-table/dist/index.js";import{TextStyle as k,FontSize as y,Color as C}from"../../node_modules/@tiptap/extension-text-style/dist/index.js";import L from"../../node_modules/@tiptap/extension-character-count/dist/index.js";import T from"../../node_modules/@tiptap/extension-underline/dist/index.js";import V from"../../node_modules/@tiptap/extension-superscript/dist/index.js";import $ from"../../node_modules/@tiptap/extension-subscript/dist/index.js";import E from"./ToolbarPanel.vue.js";import{Video as M}from"./extensions/video.js";import{useNamespace as q}from"../../hooks/useNamespace.js";import{basicProps as B}from"./props.js";import './index2.css';import './index.css';/* empty css          *//* empty css          */import H from"../../_virtual/_plugin-vue_export-helper.js";const I={class:"gsc-flex-center gsc-rich-text-footer"},P=/* @__PURE__ */H(/* @__PURE__ */Object.assign({name:"GscRichTextEditor"},{__name:"index",props:B,emits:["update:modelValue","change","init","focus","blur"],setup(B,{expose:H,emit:P}){const R=B,S=P,{prefixCls:U}=q("ellipsis"),w=e(!1),z=e(!1),D=e(""),F=e(0);function G(e){if(!e)return;const{state:t}=e,{selection:o}=t,{$from:i}=o,s=[];for(let a=i.depth;a>=0;a--){const e=i.node(a),t=e.type.name;if("doc"!==t&&"text"!==t){let o=t;const i={paragraph:"p",blockquote:"blockquote",codeBlock:"code",bulletList:"ul",orderedList:"ol",taskList:"tasklist",listItem:"li",table:"table",tableRow:"tr",tableCell:"td",image:"img",video:"video"};if("heading"===t){o=`h${e.attrs.level||1}`}else i[t]&&(o=i[t]);s.unshift(o)}}D.value=s.join(" > ")}const N=[f,b.configure({types:["heading","paragraph"]}),v,g.configure({nested:!0}),h,j.configure({multicolor:!0}),T,V,$,k,y,C.configure({types:["textStyle"]}),_.configure({table:{resizable:!0}}),M,L],O=c({content:R.modelValue,extensions:N,editable:R.editable&&!R.disabled,editorProps:{attributes:{class:U}},onUpdate:({editor:e})=>{if(a(w))return;const t=e.getHTML();S("update:modelValue",t),S("change",t,e),F.value=e.storage.characterCount?.characters()||0,G(e)},onCreate:({editor:e})=>{S("init",e),F.value=e.storage.characterCount?.characters()||0},onFocus:()=>{z.value=!0,S("focus")},onBlur:()=>{z.value=!1,S("blur")},onSelectionUpdate:({editor:e})=>{G(e)}});return t(()=>R.modelValue,e=>{O.value&&e!==O.value.getHTML()&&!w.value&&(w.value=!0,O.value.commands.setContent(e,!1),w.value=!1)}),t(()=>R.disabled,e=>{O.value&&O.value.setEditable(!e&&R.editable)}),t(()=>R.editable,e=>{O.value&&O.value.setEditable(e&&!R.disabled)}),H({editor:O}),(e,t)=>(o(),i("div",{class:s(["gsc-tiptap-editor",[e.disabled&&"bg-gray-100",e.isDarkMode&&"dark-theme"]])},[e.toolbar&&a(O)?(o(),d(E,{key:0,editor:a(O),disabled:e.disabled,"prefix-cls":a(U)},{toolbar:r(()=>[n(e.$slots,"toolbar",{},void 0,!0)]),_:3},8,["editor","disabled","prefix-cls"])):l("",!0),p(a(x),{class:s(["gsc-tiptap-editor-content",[`${a(U)}-content`]]),editor:a(O)},null,8,["class","editor"]),u("div",I,[u("span",null,m(D.value),1),u("span",null,m(F.value)+"字",1)])],2))}}),[["__scopeId","data-v-0e86ce6f"]]);export{P as default};