import{r as e}from"./rolldown-runtime.WmLfqUcM.js";var t=e({plugin_exports:()=>n});(function(){var e=hugerte.util.Tools.resolve(`hugerte.PluginManager`);let t=(e,t)=>{e.focus(),e.undoManager.transact(()=>{e.setContent(t)}),e.selection.setCursorLocation(),e.nodeChanged()},n=e=>e.getContent({source_view:!0}),r=e=>{let r=n(e);e.windowManager.open({title:`Source Code`,size:`large`,body:{type:`panel`,items:[{type:`textarea`,name:`code`}]},buttons:[{type:`cancel`,name:`cancel`,text:`Cancel`},{type:`submit`,name:`save`,text:`Save`,primary:!0}],initialData:{code:r},onSubmit:n=>{t(e,n.getData().code),n.close()}})},i=e=>{e.addCommand(`mceCodeEditor`,()=>{r(e)})},a=e=>{let t=()=>e.execCommand(`mceCodeEditor`);e.ui.registry.addButton(`code`,{icon:`sourcecode`,tooltip:`Source code`,onAction:t}),e.ui.registry.addMenuItem(`code`,{icon:`sourcecode`,text:`Source code`,onAction:t})};e.add(`code`,e=>(i(e),a(e),{}))})();var n={};export{t};