import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import"./CtrlWysiwyg.scss";import{Editor}from"@tinymce/tinymce-react";import wysiwygColors from"../../utils/defaultWysiwygColors";import config from"@parent/nitrogen.config.ts";let wysiwyg_colors=wysiwygColors;config.wysiwygColors&&(wysiwyg_colors=config.wysiwygColors,wysiwyg_colors=Object.keys(wysiwyg_colors).flatMap((o=>[wysiwyg_colors[o],o])));const WYSIWYG_COLORS=wysiwyg_colors;export default function CtrlWysiwyg({currMod:o,updatePath:r,prop:i,value:e,inheritVal:s,deleteProp:t,updateProps:a}){return _jsxs("div",{className:"ctrl-wysiwyg",children:[!1!==i.clearable&&e&&!s&&_jsx("div",{className:"ctrl-wysiwyg__clear-btn",onClick:()=>t(r),children:"Clear"}),_jsx(Editor,{tinymceScriptSrc:"/tinymce/tinymce.min.js",value:s?"":e??"Lorem ipsum dolor sit amet...",onEditorChange:(i,e)=>a(o.id,r,i),init:{skin:window.matchMedia("(prefers-color-scheme: dark)").matches?"oxide-dark":void 0,content_css:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":void 0,placeholder:s?e:"",plugins:["advlist","autolink","link","lists","charmap","anchor","searchreplace","wordcount","visualblocks","visualchars","code","fullscreen","insertdatetime","table","emoticons","nonbreaking"],branding:!1,promotion:!1,nonbreaking_wrap:!1,menubar:"edit view insert format",menu:{format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | align | forecolor backcolor | language | removeformat"}},toolbar:"fullscreen | undo redo | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | link",paste_as_text:!0,color_map:WYSIWYG_COLORS,...i?.config??{}}})]},o.id+r)}