import{E as p,P as u,a as y,ah as m,aO as E,aN as f}from"./BHBC6_hE.js";const w=p.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new u({key:new y("placeholder"),props:{decorations:({doc:s,selection:a})=>{const l=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=a,i=[];if(!l)return null;const d=this.editor.isEmpty;return s.descendants((e,t)=>{const n=o>=t&&o<=t+e.nodeSize,h=!e.isLeaf&&m(e);if((n||!this.options.showOnlyCurrent)&&h){const r=[this.options.emptyNodeClass];d&&r.push(this.options.emptyEditorClass);const c=E.node(t,t+e.nodeSize,{class:r.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:e,pos:t,hasAnchor:n}):this.options.placeholder});i.push(c)}return this.options.includeChildren}),f.create(s,i)}}})]}});export{w as Placeholder,w as default};
