@blockslides/vue-3 0.3.0 → 0.4.1
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.cjs +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +92 -299
- package/package.json +2 -14
- package/src/index.ts +1 -4
- package/dist/FloatingMenu-AygIYJQV.js +0 -226
- package/dist/FloatingMenu-Un--4r7A.cjs +0 -1
- package/dist/menus/BubbleMenu.d.ts +0 -6
- package/dist/menus/FloatingMenu.d.ts +0 -6
- package/dist/menus/index.d.ts +0 -3
- package/dist/menus.cjs +0 -1
- package/dist/menus.d.ts +0 -1
- package/dist/menus.js +0 -6
- package/dist/useSlideEditor.d.ts +0 -53
- package/src/SlideEditor.vue +0 -54
- package/src/menus/BubbleMenu.ts +0 -111
- package/src/menus/BubbleMenuPreset.vue +0 -137
- package/src/menus/FloatingMenu.ts +0 -84
- package/src/menus/index.ts +0 -3
- package/src/useSlideEditor.ts +0 -255
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@blockslides/core"),r=require("vue"),V=require("@blockslides/ai-context"),P=require("@blockslides/extension-kit"),h=require("./FloatingMenu-Un--4r7A.cjs");function w(s){return r.customRef((e,t)=>({get(){return e(),s},set(n){s=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class S extends c.Editor{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=w(this.view.state),this.reactiveExtensionStorage=w(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),r.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const C=r.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(s){const e=r.ref(),t=r.getCurrentInstance();return r.watchEffect(()=>{const n=s.editor;n&&n.options.element&&e.value&&r.nextTick(()=>{var i;if(!e.value||!((i=n.view.dom)!=null&&i.parentNode))return;const o=r.unref(e.value);e.value.append(...n.view.dom.parentNode.childNodes),n.contentComponent=t.ctx._,t&&(n.appContext={...t.appContext,provides:t.provides}),n.setOptions({element:o}),n.createNodeViews()})}),r.onBeforeUnmount(()=>{const n=s.editor;n&&(n.contentComponent=null,n.appContext=null)}),{rootEl:e}},render(){return r.h("div",{ref:s=>{this.rootEl=s}})}}),E=r.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return r.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),O=r.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var s,e;return r.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(s=this.$slots).default)==null?void 0:e.call(s))}}),x=(s={})=>{const e=r.shallowRef();return r.onMounted(()=>{e.value=new S(s)}),r.onBeforeUnmount(()=>{var o,i,d,a;const t=(i=(o=e.value)==null?void 0:o.view.dom)==null?void 0:i.parentNode,n=t==null?void 0:t.cloneNode(!0);(d=t==null?void 0:t.parentNode)==null||d.replaceChild(n,t),(a=e.value)==null||a.destroy()}),e},j=()=>({type:"doc",content:[{type:"slide",attrs:{size:"16x9",className:"",id:"slide-1",backgroundMode:"none",backgroundColor:null,backgroundImage:null,backgroundOverlayColor:null,backgroundOverlayOpacity:null},content:[{type:"column",attrs:{align:"center",padding:"lg",margin:null,gap:"md",backgroundColor:"#ffffff",backgroundImage:null,borderRadius:null,border:null,fill:!0,width:null,height:null,justify:"center"},content:[{type:"heading",attrs:{align:null,padding:null,margin:null,gap:null,backgroundColor:null,backgroundImage:null,borderRadius:null,border:null,fill:null,width:null,height:null,justify:null,id:"1fc4664c-333d-4203-a3f1-3ad27a54c535","data-toc-id":"1fc4664c-333d-4203-a3f1-3ad27a54c535",level:1},content:[{type:"text",text:"Lorem ipsum dolor sit amet"}]},{type:"paragraph",attrs:{align:null,padding:null,margin:null,gap:null,backgroundColor:null,backgroundImage:null,borderRadius:null,border:null,fill:null,width:null,height:null,justify:null},content:[{type:"text",text:"Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. "}]}]}]}]}),q=s=>({showPresets:!0,presets:s,presetBackground:"#0f172a",presetForeground:"#e5e7eb"}),D={renderMode:"dynamic",hoverOutline:{color:"#3b82f6",width:"1.5px",offset:"4px"},hoverOutlineCascade:!1},_=(s={})=>{const{content:e,onChange:t,extensions:n,extensionKitOptions:o,presetTemplates:i,onEditorReady:d,theme:a="light",editorProps:l,onUpdate:p,editorOptions:y={}}=s,b=r.computed(()=>i??V.templatesV1.listPresetTemplates()),k=r.computed(()=>{const u=(o==null?void 0:o.addSlideButton)===!1?!1:{...q(b.value),...(o==null?void 0:o.addSlideButton)??{}},m=(o==null?void 0:o.slide)===!1?!1:{...D,...(o==null?void 0:o.slide)??{}};return{...o,addSlideButton:u,slide:m}}),f=r.computed(()=>{const u=P.ExtensionKit.configure(k.value);return n?[u,...n]:[u]}),M=e??j();console.log("resolvedExtensions",f.value,f),console.log("editorOptions (as single prop):",y);const v=x({content:M,extensions:f.value,theme:a,editorProps:{attributes:{autocomplete:"off",autocorrect:"off",autocapitalize:"off",class:"min-h-full min-w-full",...(l==null?void 0:l.attributes)??{}},...l},...y,onUpdate:u=>{const m=u.editor.getJSON();t==null||t(m,u.editor),p==null||p(u)}});return r.watch(v,u=>{u&&!u.isDestroyed?d==null||d(u):console.log("[useSlideEditor] ❌ Editor not ready or destroyed")},{immediate:!0}),{editor:v,presets:b}},B={class:"bs-viewport"},A=r.defineComponent({__name:"SlideEditor",props:{bubbleMenuPreset:{type:[Boolean,Object],default:!0},className:{},style:{},content:{},onChange:{},extensions:{},extensionKitOptions:{},presetTemplates:{},onEditorReady:{},theme:{},editorProps:{},onUpdate:{},editorOptions:{}},setup(s){const e=s,{bubbleMenuPreset:t,className:n,style:o,...i}=e,{editor:d}=_(i),a=r.computed(()=>e.bubbleMenuPreset===!1?null:e.bubbleMenuPreset===!0?{}:e.bubbleMenuPreset);return(l,p)=>r.unref(d)?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(r.unref(n)),style:r.normalizeStyle(r.unref(o))},[r.createElementVNode("div",B,[r.createVNode(r.unref(C),{editor:r.unref(d)},null,8,["editor"]),a.value?(r.openBlock(),r.createBlock(h._sfc_main,r.mergeProps({key:0,editor:r.unref(d)},a.value),null,16,["editor"])):r.createCommentVNode("",!0)])],6)):r.createCommentVNode("",!0)}});class g{constructor(e,{props:t={},editor:n}){this.destroyed=!1,this.editor=n,this.component=r.markRaw(e),this.el=document.createElement("div"),this.props=r.reactive(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,n,o;return(t=(e=this.renderedComponent.vNode)==null?void 0:e.component)!=null&&t.exposed?this.renderedComponent.vNode.component.exposed:(o=(n=this.renderedComponent.vNode)==null?void 0:n.component)==null?void 0:o.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=r.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&r.render(e,this.el),{vNode:e,destroy:()=>{this.el&&r.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([t,n])=>{this.props[t]=n}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}}const R={editor:{type:Object,required:!0},mark:{type:Object,required:!0},extension:{type:Object,required:!0},inline:{type:Boolean,required:!0},view:{type:Object,required:!0},updateAttributes:{type:Function,required:!0},HTMLAttributes:{type:Object,required:!0}},W=r.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return r.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});class N extends c.MarkView{constructor(e,t,n){super(e,t,n);const o={...t,updateAttributes:this.updateAttributes.bind(this)},i=r.defineComponent({extends:{...e},props:Object.keys(o),template:this.component.template,setup:d=>{var a;return(a=e.setup)==null?void 0:a.call(e,d,{expose:()=>{}})},__scopeId:e.__scopeId,__cssModules:e.__cssModules,__name:e.__name,__file:e.__file});this.renderer=new g(i,{editor:this.editor,props:o})}get dom(){return this.renderer.element}get contentDOM(){return this.dom.querySelector("[data-mark-view-content]")}updateAttributes(e){const t=r.toRaw(this.mark);super.updateAttributes(e,t)}destroy(){this.renderer.destroy()}}function F(s,e={}){return t=>t.editor.contentComponent?new N(s,t,e):{}}const I={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class T extends c.NodeView{constructor(){super(...arguments),this.cachedExtensionWithSyncedStorage=null}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,o,i){return o==="storage"?e.storage[t.name]??{}:Reflect.get(n,o,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},t=this.onDragStart.bind(this);this.decorationClasses=r.ref(this.getDecorationClasses());const n=r.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:o=>{var i,d;return r.provide("onDragStart",t),r.provide("decorationClasses",this.decorationClasses),(d=(i=this.component).setup)==null?void 0:d.call(i,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new g(n,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,n){const o=i=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(i)};if(typeof this.options.update=="function"){const i=this.node,d=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:d,newNode:e,newDecorations:t,oldInnerDecorations:a,innerDecorations:n,updateProps:()=>o({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,o({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function U(s,e){return t=>{if(!t.editor.contentComponent)return{};const n=typeof s=="function"&&"__vccOpts"in s?s.__vccOpts:s;return new T(n,t,e)}}exports.BubbleMenu=h.BubbleMenu;exports.BubbleMenuPreset=h._sfc_main;exports.FloatingMenu=h.FloatingMenu;exports.Editor=S;exports.EditorContent=C;exports.MarkViewContent=W;exports.NodeViewContent=E;exports.NodeViewWrapper=O;exports.SlideEditor=A;exports.VueMarkView=N;exports.VueMarkViewRenderer=F;exports.VueNodeViewRenderer=U;exports.VueRenderer=g;exports.markViewProps=R;exports.nodeViewProps=I;exports.useEditor=x;exports.useSlideEditor=_;Object.keys(c).forEach(s=>{s!=="default"&&!Object.prototype.hasOwnProperty.call(exports,s)&&Object.defineProperty(exports,s,{enumerable:!0,get:()=>c[s]})});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@blockslides/core"),n=require("vue");function p(o){return n.customRef((e,t)=>({get(){return e(),o},set(r){o=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class h extends u.Editor{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=p(this.view.state),this.reactiveExtensionStorage=p(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),n.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const r=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const m=n.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(o){const e=n.ref(),t=n.getCurrentInstance();return n.watchEffect(()=>{const r=o.editor;r&&r.options.element&&e.value&&n.nextTick(()=>{var s;if(!e.value||!((s=r.view.dom)!=null&&s.parentNode))return;const i=n.unref(e.value);e.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:i}),r.createNodeViews()})}),n.onBeforeUnmount(()=>{const r=o.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return n.h("div",{ref:o=>{this.rootEl=o}})}}),f=n.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return n.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),y=n.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var o,e;return n.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(o=this.$slots).default)==null?void 0:e.call(o))}}),w=(o={})=>{const e=n.shallowRef();return n.onMounted(()=>{e.value=new h(o)}),n.onBeforeUnmount(()=>{var i,s,d,a;const t=(s=(i=e.value)==null?void 0:i.view.dom)==null?void 0:s.parentNode,r=t==null?void 0:t.cloneNode(!0);(d=t==null?void 0:t.parentNode)==null||d.replaceChild(r,t),(a=e.value)==null||a.destroy()}),e};class c{constructor(e,{props:t={},editor:r}){this.destroyed=!1,this.editor=r,this.component=n.markRaw(e),this.el=document.createElement("div"),this.props=n.reactive(t),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,t,r,i;return(t=(e=this.renderedComponent.vNode)==null?void 0:e.component)!=null&&t.exposed?this.renderedComponent.vNode.component.exposed:(i=(r=this.renderedComponent.vNode)==null?void 0:r.component)==null?void 0:i.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let e=n.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&n.render(e,this.el),{vNode:e,destroy:()=>{this.el&&n.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){this.destroyed||(Object.entries(e).forEach(([t,r])=>{this.props[t]=r}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}}const v={editor:{type:Object,required:!0},mark:{type:Object,required:!0},extension:{type:Object,required:!0},inline:{type:Boolean,required:!0},view:{type:Object,required:!0},updateAttributes:{type:Function,required:!0},HTMLAttributes:{type:Object,required:!0}},g=n.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return n.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});class l extends u.MarkView{constructor(e,t,r){super(e,t,r);const i={...t,updateAttributes:this.updateAttributes.bind(this)},s=n.defineComponent({extends:{...e},props:Object.keys(i),template:this.component.template,setup:d=>{var a;return(a=e.setup)==null?void 0:a.call(e,d,{expose:()=>{}})},__scopeId:e.__scopeId,__cssModules:e.__cssModules,__name:e.__name,__file:e.__file});this.renderer=new c(s,{editor:this.editor,props:i})}get dom(){return this.renderer.element}get contentDOM(){return this.dom.querySelector("[data-mark-view-content]")}updateAttributes(e){const t=n.toRaw(this.mark);super.updateAttributes(e,t)}destroy(){this.renderer.destroy()}}function C(o,e={}){return t=>t.editor.contentComponent?new l(o,t,e):{}}const S={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class x extends u.NodeView{constructor(){super(...arguments),this.cachedExtensionWithSyncedStorage=null}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(r,i,s){return i==="storage"?e.storage[t.name]??{}:Reflect.get(r,i,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(i={})=>this.updateAttributes(i),deleteNode:()=>this.deleteNode()},t=this.onDragStart.bind(this);this.decorationClasses=n.ref(this.getDecorationClasses());const r=n.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:i=>{var s,d;return n.provide("onDragStart",t),n.provide("decorationClasses",this.decorationClasses),(d=(s=this.component).setup)==null?void 0:d.call(s,i,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new c(r,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=s=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(s)};if(typeof this.options.update=="function"){const s=this.node,d=this.decorations,a=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:s,oldDecorations:d,newNode:e,newDecorations:t,oldInnerDecorations:a,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function b(o,e){return t=>{if(!t.editor.contentComponent)return{};const r=typeof o=="function"&&"__vccOpts"in o?o.__vccOpts:o;return new x(r,t,e)}}exports.Editor=h;exports.EditorContent=m;exports.MarkViewContent=g;exports.NodeViewContent=f;exports.NodeViewWrapper=y;exports.VueMarkView=l;exports.VueMarkViewRenderer=C;exports.VueNodeViewRenderer=b;exports.VueRenderer=c;exports.markViewProps=v;exports.nodeViewProps=S;exports.useEditor=w;Object.keys(u).forEach(o=>{o!=="default"&&!Object.prototype.hasOwnProperty.call(exports,o)&&Object.defineProperty(exports,o,{enumerable:!0,get:()=>u[o]})});
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,7 @@ export * from './EditorContent.js';
|
|
|
3
3
|
export * from './NodeViewContent.js';
|
|
4
4
|
export * from './NodeViewWrapper.js';
|
|
5
5
|
export * from './useEditor.js';
|
|
6
|
-
export * from './useSlideEditor.js';
|
|
7
|
-
export { default as SlideEditor } from './SlideEditor.vue';
|
|
8
6
|
export * from './VueMarkViewRenderer.js';
|
|
9
7
|
export * from './VueNodeViewRenderer.js';
|
|
10
8
|
export * from './VueRenderer.js';
|
|
11
9
|
export * from '../../core/src';
|
|
12
|
-
export * from './menus/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { Editor as
|
|
1
|
+
import { Editor as v, MarkView as g, NodeView as w } from "@blockslides/core";
|
|
2
2
|
export * from "@blockslides/core";
|
|
3
|
-
import { markRaw as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { _ as Z } from "./FloatingMenu-AygIYJQV.js";
|
|
7
|
-
import { B as Ne, F as ke } from "./FloatingMenu-AygIYJQV.js";
|
|
8
|
-
function _(o) {
|
|
9
|
-
return D((e, t) => ({
|
|
3
|
+
import { markRaw as l, customRef as S, defineComponent as a, h as u, ref as m, getCurrentInstance as x, watchEffect as C, nextTick as _, unref as b, onBeforeUnmount as f, shallowRef as N, onMounted as q, reactive as E, render as c, toRaw as O, provide as p } from "vue";
|
|
4
|
+
function h(n) {
|
|
5
|
+
return S((e, t) => ({
|
|
10
6
|
get() {
|
|
11
|
-
return e(),
|
|
7
|
+
return e(), n;
|
|
12
8
|
},
|
|
13
9
|
set(r) {
|
|
14
|
-
|
|
10
|
+
n = r, requestAnimationFrame(() => {
|
|
15
11
|
requestAnimationFrame(() => {
|
|
16
12
|
t();
|
|
17
13
|
});
|
|
@@ -19,11 +15,11 @@ function _(o) {
|
|
|
19
15
|
}
|
|
20
16
|
}));
|
|
21
17
|
}
|
|
22
|
-
class
|
|
18
|
+
class V extends v {
|
|
23
19
|
constructor(e = {}) {
|
|
24
|
-
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState =
|
|
20
|
+
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = h(this.view.state), this.reactiveExtensionStorage = h(this.extensionStorage), this.on("beforeTransaction", ({ nextState: t }) => {
|
|
25
21
|
this.reactiveState.value = t, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
26
|
-
}),
|
|
22
|
+
}), l(this);
|
|
27
23
|
}
|
|
28
24
|
get state() {
|
|
29
25
|
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
@@ -46,7 +42,7 @@ class K extends V {
|
|
|
46
42
|
return this.reactiveState && t && (this.reactiveState.value = t), t;
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
|
-
const
|
|
45
|
+
const k = a({
|
|
50
46
|
name: "EditorContent",
|
|
51
47
|
props: {
|
|
52
48
|
editor: {
|
|
@@ -54,15 +50,15 @@ const ee = u({
|
|
|
54
50
|
type: Object
|
|
55
51
|
}
|
|
56
52
|
},
|
|
57
|
-
setup(
|
|
58
|
-
const e =
|
|
59
|
-
return
|
|
60
|
-
const r =
|
|
61
|
-
r && r.options.element && e.value &&
|
|
62
|
-
var
|
|
63
|
-
if (!e.value || !((
|
|
53
|
+
setup(n) {
|
|
54
|
+
const e = m(), t = x();
|
|
55
|
+
return C(() => {
|
|
56
|
+
const r = n.editor;
|
|
57
|
+
r && r.options.element && e.value && _(() => {
|
|
58
|
+
var i;
|
|
59
|
+
if (!e.value || !((i = r.view.dom) != null && i.parentNode))
|
|
64
60
|
return;
|
|
65
|
-
const
|
|
61
|
+
const s = b(e.value);
|
|
66
62
|
e.value.append(...r.view.dom.parentNode.childNodes), r.contentComponent = t.ctx._, t && (r.appContext = {
|
|
67
63
|
...t.appContext,
|
|
68
64
|
// Vue internally uses prototype chain to forward/shadow injects across the entire component chain
|
|
@@ -70,22 +66,22 @@ const ee = u({
|
|
|
70
66
|
// @ts-expect-error forward instance's 'provides' into appContext
|
|
71
67
|
provides: t.provides
|
|
72
68
|
}), r.setOptions({
|
|
73
|
-
element:
|
|
69
|
+
element: s
|
|
74
70
|
}), r.createNodeViews();
|
|
75
71
|
});
|
|
76
|
-
}),
|
|
77
|
-
const r =
|
|
72
|
+
}), f(() => {
|
|
73
|
+
const r = n.editor;
|
|
78
74
|
r && (r.contentComponent = null, r.appContext = null);
|
|
79
75
|
}), { rootEl: e };
|
|
80
76
|
},
|
|
81
77
|
render() {
|
|
82
|
-
return
|
|
83
|
-
ref: (
|
|
84
|
-
this.rootEl =
|
|
78
|
+
return u("div", {
|
|
79
|
+
ref: (n) => {
|
|
80
|
+
this.rootEl = n;
|
|
85
81
|
}
|
|
86
82
|
});
|
|
87
83
|
}
|
|
88
|
-
}),
|
|
84
|
+
}), A = a({
|
|
89
85
|
name: "NodeViewContent",
|
|
90
86
|
props: {
|
|
91
87
|
as: {
|
|
@@ -94,14 +90,14 @@ const ee = u({
|
|
|
94
90
|
}
|
|
95
91
|
},
|
|
96
92
|
render() {
|
|
97
|
-
return
|
|
93
|
+
return u(this.as, {
|
|
98
94
|
style: {
|
|
99
95
|
whiteSpace: "pre-wrap"
|
|
100
96
|
},
|
|
101
97
|
"data-node-view-content": ""
|
|
102
98
|
});
|
|
103
99
|
}
|
|
104
|
-
}),
|
|
100
|
+
}), W = a({
|
|
105
101
|
name: "NodeViewWrapper",
|
|
106
102
|
props: {
|
|
107
103
|
as: {
|
|
@@ -111,8 +107,8 @@ const ee = u({
|
|
|
111
107
|
},
|
|
112
108
|
inject: ["onDragStart", "decorationClasses"],
|
|
113
109
|
render() {
|
|
114
|
-
var
|
|
115
|
-
return
|
|
110
|
+
var n, e;
|
|
111
|
+
return u(
|
|
116
112
|
this.as,
|
|
117
113
|
{
|
|
118
114
|
// @ts-ignore
|
|
@@ -124,234 +120,36 @@ const ee = u({
|
|
|
124
120
|
// @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
|
|
125
121
|
onDragstart: this.onDragStart
|
|
126
122
|
},
|
|
127
|
-
(e = (
|
|
123
|
+
(e = (n = this.$slots).default) == null ? void 0 : e.call(n)
|
|
128
124
|
);
|
|
129
125
|
}
|
|
130
|
-
}),
|
|
131
|
-
const e =
|
|
132
|
-
return
|
|
133
|
-
e.value = new
|
|
134
|
-
}),
|
|
135
|
-
var
|
|
136
|
-
const t = (
|
|
137
|
-
(
|
|
126
|
+
}), R = (n = {}) => {
|
|
127
|
+
const e = N();
|
|
128
|
+
return q(() => {
|
|
129
|
+
e.value = new V(n);
|
|
130
|
+
}), f(() => {
|
|
131
|
+
var s, i, o, d;
|
|
132
|
+
const t = (i = (s = e.value) == null ? void 0 : s.view.dom) == null ? void 0 : i.parentNode, r = t == null ? void 0 : t.cloneNode(!0);
|
|
133
|
+
(o = t == null ? void 0 : t.parentNode) == null || o.replaceChild(r, t), (d = e.value) == null || d.destroy();
|
|
138
134
|
}), e;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
* Placeholder slide if no content is provided.
|
|
142
|
-
*/
|
|
143
|
-
type: "doc",
|
|
144
|
-
content: [
|
|
145
|
-
{
|
|
146
|
-
type: "slide",
|
|
147
|
-
attrs: {
|
|
148
|
-
size: "16x9",
|
|
149
|
-
className: "",
|
|
150
|
-
id: "slide-1",
|
|
151
|
-
backgroundMode: "none",
|
|
152
|
-
backgroundColor: null,
|
|
153
|
-
backgroundImage: null,
|
|
154
|
-
backgroundOverlayColor: null,
|
|
155
|
-
backgroundOverlayOpacity: null
|
|
156
|
-
},
|
|
157
|
-
content: [
|
|
158
|
-
{
|
|
159
|
-
type: "column",
|
|
160
|
-
attrs: {
|
|
161
|
-
align: "center",
|
|
162
|
-
padding: "lg",
|
|
163
|
-
margin: null,
|
|
164
|
-
gap: "md",
|
|
165
|
-
backgroundColor: "#ffffff",
|
|
166
|
-
backgroundImage: null,
|
|
167
|
-
borderRadius: null,
|
|
168
|
-
border: null,
|
|
169
|
-
fill: !0,
|
|
170
|
-
width: null,
|
|
171
|
-
height: null,
|
|
172
|
-
justify: "center"
|
|
173
|
-
},
|
|
174
|
-
content: [
|
|
175
|
-
{
|
|
176
|
-
type: "heading",
|
|
177
|
-
attrs: {
|
|
178
|
-
align: null,
|
|
179
|
-
padding: null,
|
|
180
|
-
margin: null,
|
|
181
|
-
gap: null,
|
|
182
|
-
backgroundColor: null,
|
|
183
|
-
backgroundImage: null,
|
|
184
|
-
borderRadius: null,
|
|
185
|
-
border: null,
|
|
186
|
-
fill: null,
|
|
187
|
-
width: null,
|
|
188
|
-
height: null,
|
|
189
|
-
justify: null,
|
|
190
|
-
id: "1fc4664c-333d-4203-a3f1-3ad27a54c535",
|
|
191
|
-
"data-toc-id": "1fc4664c-333d-4203-a3f1-3ad27a54c535",
|
|
192
|
-
level: 1
|
|
193
|
-
},
|
|
194
|
-
content: [
|
|
195
|
-
{
|
|
196
|
-
type: "text",
|
|
197
|
-
text: "Lorem ipsum dolor sit amet"
|
|
198
|
-
}
|
|
199
|
-
]
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
type: "paragraph",
|
|
203
|
-
attrs: {
|
|
204
|
-
align: null,
|
|
205
|
-
padding: null,
|
|
206
|
-
margin: null,
|
|
207
|
-
gap: null,
|
|
208
|
-
backgroundColor: null,
|
|
209
|
-
backgroundImage: null,
|
|
210
|
-
borderRadius: null,
|
|
211
|
-
border: null,
|
|
212
|
-
fill: null,
|
|
213
|
-
width: null,
|
|
214
|
-
height: null,
|
|
215
|
-
justify: null
|
|
216
|
-
},
|
|
217
|
-
content: [
|
|
218
|
-
{
|
|
219
|
-
type: "text",
|
|
220
|
-
text: "Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. "
|
|
221
|
-
}
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
}
|
|
228
|
-
]
|
|
229
|
-
}), ne = (o) => ({
|
|
230
|
-
showPresets: !0,
|
|
231
|
-
presets: o,
|
|
232
|
-
presetBackground: "#0f172a",
|
|
233
|
-
presetForeground: "#e5e7eb"
|
|
234
|
-
}), oe = {
|
|
235
|
-
renderMode: "dynamic",
|
|
236
|
-
hoverOutline: { color: "#3b82f6", width: "1.5px", offset: "4px" },
|
|
237
|
-
hoverOutlineCascade: !1
|
|
238
|
-
}, se = (o = {}) => {
|
|
239
|
-
const {
|
|
240
|
-
content: e,
|
|
241
|
-
onChange: t,
|
|
242
|
-
extensions: r,
|
|
243
|
-
extensionKitOptions: n,
|
|
244
|
-
presetTemplates: s,
|
|
245
|
-
onEditorReady: i,
|
|
246
|
-
theme: d = "light",
|
|
247
|
-
editorProps: c,
|
|
248
|
-
onUpdate: h,
|
|
249
|
-
editorOptions: y = {}
|
|
250
|
-
} = o, b = m(
|
|
251
|
-
() => s ?? X.listPresetTemplates()
|
|
252
|
-
), M = m(() => {
|
|
253
|
-
const a = (n == null ? void 0 : n.addSlideButton) === !1 ? !1 : {
|
|
254
|
-
...ne(b.value),
|
|
255
|
-
...(n == null ? void 0 : n.addSlideButton) ?? {}
|
|
256
|
-
}, g = (n == null ? void 0 : n.slide) === !1 ? !1 : {
|
|
257
|
-
...oe,
|
|
258
|
-
...(n == null ? void 0 : n.slide) ?? {}
|
|
259
|
-
};
|
|
260
|
-
return {
|
|
261
|
-
...n,
|
|
262
|
-
addSlideButton: a,
|
|
263
|
-
slide: g
|
|
264
|
-
};
|
|
265
|
-
}), f = m(() => {
|
|
266
|
-
const a = Y.configure(M.value);
|
|
267
|
-
return r ? [a, ...r] : [a];
|
|
268
|
-
}), O = e ?? re();
|
|
269
|
-
console.log("resolvedExtensions", f.value, f), console.log("editorOptions (as single prop):", y);
|
|
270
|
-
const v = te(
|
|
271
|
-
{
|
|
272
|
-
content: O,
|
|
273
|
-
extensions: f.value,
|
|
274
|
-
theme: d,
|
|
275
|
-
editorProps: {
|
|
276
|
-
attributes: {
|
|
277
|
-
autocomplete: "off",
|
|
278
|
-
autocorrect: "off",
|
|
279
|
-
autocapitalize: "off",
|
|
280
|
-
class: "min-h-full min-w-full",
|
|
281
|
-
...(c == null ? void 0 : c.attributes) ?? {}
|
|
282
|
-
},
|
|
283
|
-
...c
|
|
284
|
-
},
|
|
285
|
-
...y,
|
|
286
|
-
onUpdate: (a) => {
|
|
287
|
-
const g = a.editor.getJSON();
|
|
288
|
-
t == null || t(g, a.editor), h == null || h(a);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
|
-
return F(
|
|
293
|
-
v,
|
|
294
|
-
(a) => {
|
|
295
|
-
a && !a.isDestroyed ? i == null || i(a) : console.log("[useSlideEditor] ❌ Editor not ready or destroyed");
|
|
296
|
-
},
|
|
297
|
-
{ immediate: !0 }
|
|
298
|
-
), { editor: v, presets: b };
|
|
299
|
-
}, ie = { class: "bs-viewport" }, ge = /* @__PURE__ */ u({
|
|
300
|
-
__name: "SlideEditor",
|
|
301
|
-
props: {
|
|
302
|
-
bubbleMenuPreset: { type: [Boolean, Object], default: !0 },
|
|
303
|
-
className: {},
|
|
304
|
-
style: {},
|
|
305
|
-
content: {},
|
|
306
|
-
onChange: {},
|
|
307
|
-
extensions: {},
|
|
308
|
-
extensionKitOptions: {},
|
|
309
|
-
presetTemplates: {},
|
|
310
|
-
onEditorReady: {},
|
|
311
|
-
theme: {},
|
|
312
|
-
editorProps: {},
|
|
313
|
-
onUpdate: {},
|
|
314
|
-
editorOptions: {}
|
|
315
|
-
},
|
|
316
|
-
setup(o) {
|
|
317
|
-
const e = o, {
|
|
318
|
-
bubbleMenuPreset: t,
|
|
319
|
-
className: r,
|
|
320
|
-
style: n,
|
|
321
|
-
...s
|
|
322
|
-
} = e, { editor: i } = se(s), d = m(() => e.bubbleMenuPreset === !1 ? null : e.bubbleMenuPreset === !0 ? {} : e.bubbleMenuPreset);
|
|
323
|
-
return (c, h) => l(i) ? (S(), T("div", {
|
|
324
|
-
key: 0,
|
|
325
|
-
class: L(l(r)),
|
|
326
|
-
style: U(l(n))
|
|
327
|
-
}, [
|
|
328
|
-
z("div", ie, [
|
|
329
|
-
H(l(ee), { editor: l(i) }, null, 8, ["editor"]),
|
|
330
|
-
d.value ? (S(), $(Z, J({
|
|
331
|
-
key: 0,
|
|
332
|
-
editor: l(i)
|
|
333
|
-
}, d.value), null, 16, ["editor"])) : w("", !0)
|
|
334
|
-
])
|
|
335
|
-
], 6)) : w("", !0);
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
class E {
|
|
135
|
+
};
|
|
136
|
+
class y {
|
|
339
137
|
constructor(e, { props: t = {}, editor: r }) {
|
|
340
|
-
this.destroyed = !1, this.editor = r, this.component =
|
|
138
|
+
this.destroyed = !1, this.editor = r, this.component = l(e), this.el = document.createElement("div"), this.props = E(t), this.renderedComponent = this.renderComponent();
|
|
341
139
|
}
|
|
342
140
|
get element() {
|
|
343
141
|
return this.renderedComponent.el;
|
|
344
142
|
}
|
|
345
143
|
get ref() {
|
|
346
|
-
var e, t, r,
|
|
347
|
-
return (t = (e = this.renderedComponent.vNode) == null ? void 0 : e.component) != null && t.exposed ? this.renderedComponent.vNode.component.exposed : (
|
|
144
|
+
var e, t, r, s;
|
|
145
|
+
return (t = (e = this.renderedComponent.vNode) == null ? void 0 : e.component) != null && t.exposed ? this.renderedComponent.vNode.component.exposed : (s = (r = this.renderedComponent.vNode) == null ? void 0 : r.component) == null ? void 0 : s.proxy;
|
|
348
146
|
}
|
|
349
147
|
renderComponent() {
|
|
350
148
|
if (this.destroyed)
|
|
351
149
|
return this.renderedComponent;
|
|
352
|
-
let e =
|
|
353
|
-
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el &&
|
|
354
|
-
this.el &&
|
|
150
|
+
let e = u(this.component, this.props);
|
|
151
|
+
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && c(e, this.el), { vNode: e, destroy: () => {
|
|
152
|
+
this.el && c(null, this.el), this.el = null, e = null;
|
|
355
153
|
}, el: this.el ? this.el.firstElementChild : null };
|
|
356
154
|
}
|
|
357
155
|
updateProps(e = {}) {
|
|
@@ -363,7 +161,7 @@ class E {
|
|
|
363
161
|
this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
|
|
364
162
|
}
|
|
365
163
|
}
|
|
366
|
-
const
|
|
164
|
+
const U = {
|
|
367
165
|
editor: {
|
|
368
166
|
type: Object,
|
|
369
167
|
required: !0
|
|
@@ -392,7 +190,7 @@ const ye = {
|
|
|
392
190
|
type: Object,
|
|
393
191
|
required: !0
|
|
394
192
|
}
|
|
395
|
-
},
|
|
193
|
+
}, L = a({
|
|
396
194
|
name: "MarkViewContent",
|
|
397
195
|
props: {
|
|
398
196
|
as: {
|
|
@@ -401,7 +199,7 @@ const ye = {
|
|
|
401
199
|
}
|
|
402
200
|
},
|
|
403
201
|
render() {
|
|
404
|
-
return
|
|
202
|
+
return u(this.as, {
|
|
405
203
|
style: {
|
|
406
204
|
whiteSpace: "inherit"
|
|
407
205
|
},
|
|
@@ -409,16 +207,16 @@ const ye = {
|
|
|
409
207
|
});
|
|
410
208
|
}
|
|
411
209
|
});
|
|
412
|
-
class
|
|
210
|
+
class M extends g {
|
|
413
211
|
constructor(e, t, r) {
|
|
414
212
|
super(e, t, r);
|
|
415
|
-
const
|
|
213
|
+
const s = { ...t, updateAttributes: this.updateAttributes.bind(this) }, i = a({
|
|
416
214
|
extends: { ...e },
|
|
417
|
-
props: Object.keys(
|
|
215
|
+
props: Object.keys(s),
|
|
418
216
|
template: this.component.template,
|
|
419
|
-
setup: (
|
|
217
|
+
setup: (o) => {
|
|
420
218
|
var d;
|
|
421
|
-
return (d = e.setup) == null ? void 0 : d.call(e,
|
|
219
|
+
return (d = e.setup) == null ? void 0 : d.call(e, o, {
|
|
422
220
|
expose: () => {
|
|
423
221
|
}
|
|
424
222
|
});
|
|
@@ -429,9 +227,9 @@ class de extends j {
|
|
|
429
227
|
__name: e.__name,
|
|
430
228
|
__file: e.__file
|
|
431
229
|
});
|
|
432
|
-
this.renderer = new
|
|
230
|
+
this.renderer = new y(i, {
|
|
433
231
|
editor: this.editor,
|
|
434
|
-
props:
|
|
232
|
+
props: s
|
|
435
233
|
});
|
|
436
234
|
}
|
|
437
235
|
get dom() {
|
|
@@ -441,17 +239,17 @@ class de extends j {
|
|
|
441
239
|
return this.dom.querySelector("[data-mark-view-content]");
|
|
442
240
|
}
|
|
443
241
|
updateAttributes(e) {
|
|
444
|
-
const t =
|
|
242
|
+
const t = O(this.mark);
|
|
445
243
|
super.updateAttributes(e, t);
|
|
446
244
|
}
|
|
447
245
|
destroy() {
|
|
448
246
|
this.renderer.destroy();
|
|
449
247
|
}
|
|
450
248
|
}
|
|
451
|
-
function
|
|
452
|
-
return (t) => t.editor.contentComponent ? new
|
|
249
|
+
function F(n, e = {}) {
|
|
250
|
+
return (t) => t.editor.contentComponent ? new M(n, t, e) : {};
|
|
453
251
|
}
|
|
454
|
-
const
|
|
252
|
+
const I = {
|
|
455
253
|
editor: {
|
|
456
254
|
type: Object,
|
|
457
255
|
required: !0
|
|
@@ -497,7 +295,7 @@ const Se = {
|
|
|
497
295
|
required: !0
|
|
498
296
|
}
|
|
499
297
|
};
|
|
500
|
-
class
|
|
298
|
+
class P extends w {
|
|
501
299
|
constructor() {
|
|
502
300
|
super(...arguments), this.cachedExtensionWithSyncedStorage = null;
|
|
503
301
|
}
|
|
@@ -510,8 +308,8 @@ class ae extends q {
|
|
|
510
308
|
if (!this.cachedExtensionWithSyncedStorage) {
|
|
511
309
|
const e = this.editor, t = this.extension;
|
|
512
310
|
this.cachedExtensionWithSyncedStorage = new Proxy(t, {
|
|
513
|
-
get(r,
|
|
514
|
-
return
|
|
311
|
+
get(r, s, i) {
|
|
312
|
+
return s === "storage" ? e.storage[t.name] ?? {} : Reflect.get(r, s, i);
|
|
515
313
|
}
|
|
516
314
|
});
|
|
517
315
|
}
|
|
@@ -528,17 +326,17 @@ class ae extends q {
|
|
|
528
326
|
extension: this.extensionWithSyncedStorage,
|
|
529
327
|
HTMLAttributes: this.HTMLAttributes,
|
|
530
328
|
getPos: () => this.getPos(),
|
|
531
|
-
updateAttributes: (
|
|
329
|
+
updateAttributes: (s = {}) => this.updateAttributes(s),
|
|
532
330
|
deleteNode: () => this.deleteNode()
|
|
533
331
|
}, t = this.onDragStart.bind(this);
|
|
534
|
-
this.decorationClasses =
|
|
535
|
-
const r =
|
|
332
|
+
this.decorationClasses = m(this.getDecorationClasses());
|
|
333
|
+
const r = a({
|
|
536
334
|
extends: { ...this.component },
|
|
537
335
|
props: Object.keys(e),
|
|
538
336
|
template: this.component.template,
|
|
539
|
-
setup: (
|
|
540
|
-
var
|
|
541
|
-
return
|
|
337
|
+
setup: (s) => {
|
|
338
|
+
var i, o;
|
|
339
|
+
return p("onDragStart", t), p("decorationClasses", this.decorationClasses), (o = (i = this.component).setup) == null ? void 0 : o.call(i, s, {
|
|
542
340
|
expose: () => {
|
|
543
341
|
}
|
|
544
342
|
});
|
|
@@ -559,7 +357,7 @@ class ae extends q {
|
|
|
559
357
|
// eslint-disable-next-line
|
|
560
358
|
__file: this.component.__file
|
|
561
359
|
});
|
|
562
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new
|
|
360
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new y(r, {
|
|
563
361
|
editor: this.editor,
|
|
564
362
|
props: e
|
|
565
363
|
});
|
|
@@ -602,22 +400,22 @@ class ae extends q {
|
|
|
602
400
|
* To prevent unnecessary updates, the `update` option can be used.
|
|
603
401
|
*/
|
|
604
402
|
update(e, t, r) {
|
|
605
|
-
const
|
|
606
|
-
this.decorationClasses.value = this.getDecorationClasses(), this.renderer.updateProps(
|
|
403
|
+
const s = (i) => {
|
|
404
|
+
this.decorationClasses.value = this.getDecorationClasses(), this.renderer.updateProps(i);
|
|
607
405
|
};
|
|
608
406
|
if (typeof this.options.update == "function") {
|
|
609
|
-
const
|
|
407
|
+
const i = this.node, o = this.decorations, d = this.innerDecorations;
|
|
610
408
|
return this.node = e, this.decorations = t, this.innerDecorations = r, this.options.update({
|
|
611
|
-
oldNode:
|
|
612
|
-
oldDecorations:
|
|
409
|
+
oldNode: i,
|
|
410
|
+
oldDecorations: o,
|
|
613
411
|
newNode: e,
|
|
614
412
|
newDecorations: t,
|
|
615
413
|
oldInnerDecorations: d,
|
|
616
414
|
innerDecorations: r,
|
|
617
|
-
updateProps: () =>
|
|
415
|
+
updateProps: () => s({ node: e, decorations: t, innerDecorations: r, extension: this.extensionWithSyncedStorage })
|
|
618
416
|
});
|
|
619
417
|
}
|
|
620
|
-
return e.type !== this.node.type ? !1 : (e === this.node && this.decorations === t && this.innerDecorations === r || (this.node = e, this.decorations = t, this.innerDecorations = r,
|
|
418
|
+
return e.type !== this.node.type ? !1 : (e === this.node && this.decorations === t && this.innerDecorations === r || (this.node = e, this.decorations = t, this.innerDecorations = r, s({ node: e, decorations: t, innerDecorations: r, extension: this.extensionWithSyncedStorage })), !0);
|
|
621
419
|
}
|
|
622
420
|
/**
|
|
623
421
|
* Select the node.
|
|
@@ -644,30 +442,25 @@ class ae extends q {
|
|
|
644
442
|
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate);
|
|
645
443
|
}
|
|
646
444
|
}
|
|
647
|
-
function
|
|
445
|
+
function T(n, e) {
|
|
648
446
|
return (t) => {
|
|
649
447
|
if (!t.editor.contentComponent)
|
|
650
448
|
return {};
|
|
651
|
-
const r = typeof
|
|
652
|
-
return new
|
|
449
|
+
const r = typeof n == "function" && "__vccOpts" in n ? n.__vccOpts : n;
|
|
450
|
+
return new P(r, t, e);
|
|
653
451
|
};
|
|
654
452
|
}
|
|
655
453
|
export {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
E as VueRenderer,
|
|
669
|
-
ye as markViewProps,
|
|
670
|
-
Se as nodeViewProps,
|
|
671
|
-
te as useEditor,
|
|
672
|
-
se as useSlideEditor
|
|
454
|
+
V as Editor,
|
|
455
|
+
k as EditorContent,
|
|
456
|
+
L as MarkViewContent,
|
|
457
|
+
A as NodeViewContent,
|
|
458
|
+
W as NodeViewWrapper,
|
|
459
|
+
M as VueMarkView,
|
|
460
|
+
F as VueMarkViewRenderer,
|
|
461
|
+
T as VueNodeViewRenderer,
|
|
462
|
+
y as VueRenderer,
|
|
463
|
+
U as markViewProps,
|
|
464
|
+
I as nodeViewProps,
|
|
465
|
+
R as useEditor
|
|
673
466
|
};
|