@richscripts/richtexteditor 2.13.0 → 2.14.0
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/package.json +1 -1
- package/richtexteditor/all_plugins.js +43 -6
- package/richtexteditor/all_plugins.min.js +34 -34
- package/richtexteditor/plugins/a11yenhance.min.js +1 -0
- package/richtexteditor/plugins/accessibilitychecker.min.js +1 -0
- package/richtexteditor/plugins/aitoolkit.min.js +14 -0
- package/richtexteditor/plugins/all_plugins.js +43 -6
- package/richtexteditor/plugins/all_plugins.min.js +34 -34
- package/richtexteditor/plugins/autocorrect.min.js +1 -0
- package/richtexteditor/plugins/autoembed.min.js +1 -0
- package/richtexteditor/plugins/blocktypes.min.js +2 -0
- package/richtexteditor/plugins/bookmarkcard.min.js +2 -0
- package/richtexteditor/plugins/changecase.min.js +1 -0
- package/richtexteditor/plugins/charlimit.min.js +2 -0
- package/richtexteditor/plugins/comments.min.js +3 -0
- package/richtexteditor/plugins/contentminimap.min.js +1 -0
- package/richtexteditor/plugins/crossreference.min.js +1 -0
- package/richtexteditor/plugins/dialoga11y.min.js +1 -0
- package/richtexteditor/plugins/dictation.min.js +1 -0
- package/richtexteditor/plugins/documentimport.min.js +4 -0
- package/richtexteditor/plugins/documentoutline.js +43 -6
- package/richtexteditor/plugins/documentoutline.min.js +1 -0
- package/richtexteditor/plugins/docxexport.min.js +2 -0
- package/richtexteditor/plugins/draghandle.min.js +1 -0
- package/richtexteditor/plugins/emailtoolkit.min.js +1 -0
- package/richtexteditor/plugins/emojiautocomplete.min.js +1 -0
- package/richtexteditor/plugins/foldheadings.min.js +1 -0
- package/richtexteditor/plugins/footnotes.min.js +1 -0
- package/richtexteditor/plugins/formatpainter.min.js +1 -0
- package/richtexteditor/plugins/formattingmarks.min.js +1 -0
- package/richtexteditor/plugins/gapcursor.min.js +1 -0
- package/richtexteditor/plugins/ghostcomplete.min.js +1 -0
- package/richtexteditor/plugins/html2pdf.min.js +1 -0
- package/richtexteditor/plugins/imageeditor.min.js +1 -0
- package/richtexteditor/plugins/importstyles.min.js +1 -0
- package/richtexteditor/plugins/inlinecode.min.js +1 -0
- package/richtexteditor/plugins/insertcode.min.js +8 -0
- package/richtexteditor/plugins/insertemoji.min.js +1 -0
- package/richtexteditor/plugins/insertgallery.min.js +1 -0
- package/richtexteditor/plugins/inserttemplate.min.js +1 -0
- package/richtexteditor/plugins/keyboarda11y.min.js +1 -0
- package/richtexteditor/plugins/layouttable.min.js +1 -0
- package/richtexteditor/plugins/linenumbers.min.js +1 -0
- package/richtexteditor/plugins/linkchecker.min.js +1 -0
- package/richtexteditor/plugins/localdraft.min.js +1 -0
- package/richtexteditor/plugins/markdownexport.min.js +2 -0
- package/richtexteditor/plugins/mathdialog.min.js +1 -0
- package/richtexteditor/plugins/mentionplugin.min.js +3 -0
- package/richtexteditor/plugins/mergefields.min.js +1 -0
- package/richtexteditor/plugins/mermaiddiagram.min.js +16 -0
- package/richtexteditor/plugins/multilevellist.min.js +1 -0
- package/richtexteditor/plugins/multiroot.min.js +1 -0
- package/richtexteditor/plugins/nodetypes.min.js +1 -0
- package/richtexteditor/plugins/pagination.min.js +1 -0
- package/richtexteditor/plugins/pdfexport.min.js +19 -0
- package/richtexteditor/plugins/permanentpen.min.js +1 -0
- package/richtexteditor/plugins/readabilitystats.min.js +1 -0
- package/richtexteditor/plugins/readaloud.min.js +1 -0
- package/richtexteditor/plugins/restrictedediting.min.js +2 -0
- package/richtexteditor/plugins/revisionhistory.min.js +3 -0
- package/richtexteditor/plugins/rtlui.min.js +2 -0
- package/richtexteditor/plugins/rubyannotation.min.js +1 -0
- package/richtexteditor/plugins/sanitizer.min.js +1 -0
- package/richtexteditor/plugins/shadowdom.min.js +1 -0
- package/richtexteditor/plugins/slashcommand.min.js +2 -0
- package/richtexteditor/plugins/smartchips.min.js +2 -0
- package/richtexteditor/plugins/spellcheck.min.js +2 -0
- package/richtexteditor/plugins/stateinspector.min.js +2 -0
- package/richtexteditor/plugins/structured-content-bridge.js +5178 -0
- package/richtexteditor/plugins/structured-content-bridge.min.js +19 -0
- package/richtexteditor/plugins/tableofcontents.min.js +1 -0
- package/richtexteditor/plugins/tabletools.min.js +1 -0
- package/richtexteditor/plugins/textdirection.min.js +1 -0
- package/richtexteditor/plugins/textpartlanguage.min.js +1 -0
- package/richtexteditor/plugins/todolist.min.js +1 -0
- package/richtexteditor/plugins/trackedchanges.min.js +3 -0
- package/richtexteditor/plugins/typewriter.min.js +1 -0
- package/richtexteditor/plugins/watermark.min.js +1 -0
- package/richtexteditor/plugins/wordexport.min.js +23 -0
- package/richtexteditor/plugins/yjscollab.min.js +2 -0
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.min.js +1 -0
- package/richtexteditor/rte-config.js +2 -0
- package/richtexteditor/rte.js +4 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var pendingLoadsByBasePath={},INLINE_CONTAINER_TAGS={a:!0,abbr:!0,b:!0,big:!0,cite:!0,code:!0,del:!0,em:!0,font:!0,i:!0,label:!0,mark:!0,q:!0,s:!0,small:!0,span:!0,strike:!0,strong:!0,sub:!0,sup:!0,u:!0},BLOCK_CONTAINER_TAGS={article:!0,aside:!0,div:!0,footer:!0,header:!0,main:!0,section:!0},HTML_ENTITY_MAP={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"'},HTML_VOID_TAGS={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},BLOCK_NODE_TYPES={blockquote:!0,bulletList:!0,codeBlock:!0,footnotes:!0,heading:!0,horizontalRule:!0,htmlBlock:!0,image:!0,orderedList:!0,pageBreak:!0,paragraph:!0,tableOfContents:!0,taskList:!0,table:!0},INLINE_NODE_TYPES={footnoteReference:!0,hardBreak:!0,htmlInline:!0,image:!0,mergeField:!0,text:!0},MARK_TYPES={bold:!0,code:!0,italic:!0,link:!0,strike:!0,subscript:!0,superscript:!0,textStyle:!0,underline:!0};function ensureBrowserEnvironment(){if(typeof window>"u"||typeof document>"u")throw new Error("RichTextEditor integrations require a browser environment.")}function ensureRichTextEditorConstructor(){if(ensureBrowserEnvironment(),!window.RichTextEditor)throw new Error("RichTextEditor core is not loaded. Serve the /richtexteditor assets or load rte.js before mounting the framework wrapper.");return window.RichTextEditor}function isArray(t){return Object.prototype.toString.call(t)==="[object Array]"}function getElementTagName(t){return t&&t.tagName?String(t.tagName).toLowerCase():""}function normalizePlainText(t){return String(t||"").replace(/\s+/g," ").trim()}function getPlainTextFromHtml(t){return normalizePlainText(decodeHtmlEntities(String(t||"")).replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," "))}var CJK_WORD_CHAR=/[々〇-ヿ㐀-䶿一-鿿豈-]/g;function countWords(t){var r=normalizePlainText(t);if(!r)return 0;var e=r.match(CJK_WORD_CHAR),n=e?e.length:0,i=n?r.replace(CJK_WORD_CHAR," "):r,a=i.split(/\s+/).filter(Boolean).length;return n+a}function countCharactersNoSpaces(t){return normalizePlainText(t).replace(/\s/g,"").length}function normalizeMarkdownShortcutText(t){return String(t||"").replace(/\u00a0/g," ").replace(/\r\n?/g,`
|
|
2
|
+
`).replace(/[ \t]+/g," ").replace(/^\s+|\s+$/g,"")}function getMarkdownShortcutAction(t){var r=normalizeMarkdownShortcutText(t);if(!r)return null;if(/^(?:-{3,}|\*{3,}|_{3,})$/.test(r))return{kind:"horizontalRule",token:r};if(/^(?:```|~~~)([A-Za-z0-9_-]+)?$/.test(r))return{kind:"codeBlock",token:r};var e=r.match(/^(?:(-|\*|\+)\s+)?\[( |x|X)\]$/);return e?{kind:"taskList",checked:e[2].toLowerCase()==="x",token:r}:/^#{1,6}$/.test(r)?{kind:"heading",level:r.length,token:r}:r===">"||r===">"?{kind:"blockquote",token:r}:/^(?:-|\*|\+)$/.test(r)?{kind:"bulletList",token:r}:/^\d+[.)]$/.test(r)?{kind:"orderedList",token:r}:null}function getInlineMarkdownShortcutAction(t){var r=String(t||"").replace(/\u00a0/g," ");if(!r)return null;for(var e=[{kind:"link",command:"link",regex:/(^|[\s(\[{>])\[([^\]\n]+?)\]\((\S+?)\)$/},{kind:"bold",command:"bold",regex:/(^|[\s(\[{>])(\*\*|__)([^\s](?:[^\n]*?[^\s])?)\2$/},{kind:"strike",command:"strike",regex:/(^|[\s(\[{>])(~~)([^\s](?:[^\n]*?[^\s])?)~~$/},{kind:"code",command:"code",regex:/(^|[\s(\[{>])(`)([^`\n]+?)`$/},{kind:"italic",command:"italic",regex:/(^|[\s(\[{>])(\*|_)([^\s*_](?:[^\n]*?[^\s*_])?)\2$/}],n=0;n<e.length;n++){var i=e[n],a=i.regex.exec(r);if(a){var o=a[1]||"",u=a[2]||"",f=a[3]||"",s=null;if(!(i.kind==="link"&&(u="[]()",f=a[2]||"",s=normalizeInlineMarkdownLinkHref(a[3]||""),!s))){var p=a.index+o.length,c=r.length,g={kind:i.kind,command:i.command,content:f,marker:u,token:r.slice(p,c),rangeStart:p,rangeEnd:c,textStart:p+u.length,textEnd:c-u.length};return s&&(g.href=s,g.textStart=p+1,g.textEnd=g.textStart+f.length),g}}}return null}function normalizeInlineMarkdownLinkHref(t){var r=String(t||"").replace(/^\s+|\s+$/g,"");if(!r||/[\r\n]/.test(r))return null;var e=r.replace(/[\u0000-\u0020]+/g,"").toLowerCase();return!e||e.indexOf("javascript:")===0||e.indexOf("vbscript:")===0||e.indexOf("data:")===0&&e.indexOf("data:image/")!==0?null:r}function createTextStatistics(t,r){var e=String(t||""),n=String(r||"");return{characters:e.length,charactersNoSpaces:countCharactersNoSpaces(e),words:countWords(e),selectedCharacters:n.length,selectedCharactersNoSpaces:countCharactersNoSpaces(n),selectedWords:countWords(n)}}function countSentences(t){var r=normalizePlainText(t);if(!r)return 0;var e=r.match(/[^.!?]+(?:[.!?]+|$)/g);if(!e)return 0;for(var n=0,i=0;i<e.length;i++)normalizePlainText(e[i])&&(n+=1);return n}function roundMetric(t){return Math.round(t*10)/10}var PAGE_SETUP_FORMATS={A3:{width:"297mm",height:"420mm"},A4:{width:"210mm",height:"297mm"},A5:{width:"148mm",height:"210mm"},Legal:{width:"8.5in",height:"14in"},Letter:{width:"8.5in",height:"11in"},Tabloid:{width:"11in",height:"17in"}};function normalizePageMeasurement(t){if(!(t==null||t==="")){if(typeof t=="number"&&isFinite(t))return String(t)+"px";var r=String(t).replace(/^\s+|\s+$/g,"");return r||void 0}}function normalizePageOrientation(t){var r=String(t||"").toLowerCase();if(r==="landscape")return"landscape";if(r==="portrait")return"portrait"}function normalizePageFormat(t){var r=String(t||"").replace(/^\s+|\s+$/g,"");if(r){var e=r.toUpperCase();if(PAGE_SETUP_FORMATS[e])return e;var n=r.charAt(0).toUpperCase()+r.substring(1).toLowerCase();return PAGE_SETUP_FORMATS[n]?n:r}}function normalizePageMargins(t){if(!(!t||typeof t!="object")){for(var r={},e=["top","right","bottom","left"],n=0;n<e.length;n++){var i=e[n],a=normalizePageMeasurement(t[i]);a&&(r[i]=a)}return Object.keys(r).length?r:void 0}}function clonePageSetup(t){if(!t||typeof t!="object")return null;var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(e==="margins"&&t.margins&&typeof t.margins=="object"){r.margins=Object.assign({},t.margins);continue}r[e]=t[e]}return r}function normalizeDocumentPageSetup(t){if(t==null||typeof t!="object")return null;var r={},e=normalizePageFormat(t.format),n=normalizePageOrientation(t.orientation),i=normalizePageMeasurement(t.width),a=normalizePageMeasurement(t.height),o=normalizePageMargins(t.margins),u=typeof t.headerHtml=="string"?t.headerHtml:void 0,f=typeof t.footerHtml=="string"?t.footerHtml:void 0;return e&&(r.format=e),n&&(r.orientation=n),(!i||!a)&&e&&PAGE_SETUP_FORMATS[e]&&(i=i||PAGE_SETUP_FORMATS[e].width,a=a||PAGE_SETUP_FORMATS[e].height),i&&(r.width=i),a&&(r.height=a),o&&(r.margins=o),u!==void 0&&(r.headerHtml=u),f!==void 0&&(r.footerHtml=f),Object.keys(r).length?r:null}function getPageSetupFromDocument(t){return!t||typeof t!="object"?null:normalizeDocumentPageSetup(t.attrs&&t.attrs.pageSetup)}function getDocumentPageSetup(t){return getPageSetupFromDocument(createStructuredDocument(t))}function setDocumentPageSetup(t,r){var e=createStructuredDocument(t),n=normalizeDocumentPageSetup(r),i={type:"doc",version:e.version,format:e.format,content:e.content||[]};return e.attrs&&typeof e.attrs=="object"&&(i.attrs=Object.assign({},e.attrs)),n?(i.attrs||(i.attrs={}),i.attrs.pageSetup=n):i.attrs&&(delete i.attrs.pageSetup,Object.keys(i.attrs).length||delete i.attrs),createStructuredDocument(i)}function buildPageSetupMetadataAttributes(t){var r={"data-rte-page-setup":"true",contenteditable:"false",style:"display:none"};if(!t)return r;t.format&&(r["data-format"]=t.format),t.orientation&&(r["data-orientation"]=t.orientation),t.width&&(r["data-width"]=t.width),t.height&&(r["data-height"]=t.height),t.headerHtml!==void 0&&(r["data-header-html"]=t.headerHtml),t.footerHtml!==void 0&&(r["data-footer-html"]=t.footerHtml);var e=t.margins||{};return e.top&&(r["data-margin-top"]=e.top),e.right&&(r["data-margin-right"]=e.right),e.bottom&&(r["data-margin-bottom"]=e.bottom),e.left&&(r["data-margin-left"]=e.left),r}function serializePageSetupMetadata(t){return t?"<div"+buildAttributeString(buildPageSetupMetadataAttributes(t))+"></div>":""}function parsePageSetupNode(t){return!t||t.nodeType!==1?null:normalizeDocumentPageSetup({footerHtml:t.getAttribute("data-footer-html"),format:t.getAttribute("data-format"),headerHtml:t.getAttribute("data-header-html"),height:t.getAttribute("data-height"),margins:{top:t.getAttribute("data-margin-top"),right:t.getAttribute("data-margin-right"),bottom:t.getAttribute("data-margin-bottom"),left:t.getAttribute("data-margin-left")},orientation:t.getAttribute("data-orientation"),width:t.getAttribute("data-width")})}function collectDocumentMetrics(t,r){for(var e=isArray(t)?t:[],n=0;n<e.length;n++){var i=e[n];if(!(!i||typeof i!="object")){switch(i.type){case"paragraph":r.paragraphs+=1;break;case"heading":r.headings+=1;break;case"image":r.images+=1;break;case"table":r.tables+=1;break}for(var a=isArray(i.marks)?i.marks:[],o=0;o<a.length;o++)a[o]&&a[o].type==="link"&&(r.links+=1);isArray(i.content)&&i.content.length&&collectDocumentMetrics(i.content,r)}}}function createDocumentMetrics(t,r,e,n){var i=createTextStatistics(t,r),a={characters:i.characters,charactersNoSpaces:i.charactersNoSpaces,words:i.words,selectedCharacters:i.selectedCharacters,selectedCharactersNoSpaces:i.selectedCharactersNoSpaces,selectedWords:i.selectedWords,paragraphs:0,sentences:countSentences(t),headings:0,images:0,tables:0,links:0,estimatedReadingMinutes:0};e&&collectDocumentMetrics(e.content||[],a);var o=n&&parseFloat(n.wordsPerMinute,10);return(!o||o<1)&&(o=200),a.words>0&&(a.estimatedReadingMinutes=roundMetric(a.words/o),a.estimatedReadingMinutes===0&&(a.estimatedReadingMinutes=.1)),a}function getTextStatistics(t,r){var e=r&&r.selectionText,n=null,i="";return t&&typeof t=="object"&&t.type==="doc"?n=createStructuredDocument(t):typeof t=="string"?/<[a-z!\/?][^>]*>/i.test(t)?n=createStructuredDocument(t):i=normalizePlainText(t):t!=null&&(n=createStructuredDocument(t)),n&&(i=normalizePlainText(n.text||renderTextContent(n.content||[]))),createTextStatistics(i,e)}function getDocumentMetrics(t,r){var e=r&&r.selectionText,n=null,i="";return t&&typeof t=="object"&&t.type==="doc"?n=createStructuredDocument(t):typeof t=="string"?/<[a-z!\/?][^>]*>/i.test(t)?n=createStructuredDocument(t):i=normalizePlainText(t):t!=null&&(n=createStructuredDocument(t)),n&&(i=normalizePlainText(n.text||renderTextContent(n.content||[]))),createDocumentMetrics(i,e,n,r)}function slugifyOutlineText(t){var r=String(t||"").toLowerCase();return r=r.replace(/[^a-z0-9]+/g,"-"),r=r.replace(/^-+|-+$/g,""),r||"section"}function buildUniqueOutlineId(t,r){var e=String(t||"").replace(/^\s+|\s+$/g,"");e||(e="section");for(var n=e,i=2;r[n];)n=e+"-"+i,i+=1;return r[n]=!0,n}function collectDocumentOutline(t,r,e,n){for(var i=isArray(t)?t:[],a=0;a<i.length;a++){var o=i[a];if(!(!o||typeof o!="object")){var u=n+".content["+a+"]";if(o.type==="heading"){var f=o.attrs||{},s=parseInt(f.level,10)||1;s<1&&(s=1),s>6&&(s=6);var p=normalizePlainText(getNodeTextContent(o));p||(p="Untitled Section"),r.push({id:buildUniqueOutlineId(f.id||slugifyOutlineText(p),e),level:s,path:u,text:p})}isArray(o.content)&&o.content.length&&collectDocumentOutline(o.content,r,e,u)}}}function normalizeDocumentHeadingIdsNodeList(t,r){for(var e=isArray(t)?t:[],n=[],i=0;i<e.length;i++){var a=cloneStructuredNode(e[i]);if(!a||typeof a!="object"){n.push(a);continue}if(a.type==="heading"){var o=a.attrs?Object.assign({},a.attrs):{},u=normalizePlainText(getNodeTextContent(a));u||(u="Untitled Section"),o.id=buildUniqueOutlineId(o.id||slugifyOutlineText(u),r),a.attrs=o}isArray(a.content)&&a.content.length&&(a.content=normalizeDocumentHeadingIdsNodeList(a.content,r)),n.push(a)}return n}function normalizeDocumentHeadingIds(t){if(!t||typeof t!="object")return t;var r={type:t.type,version:t.version,format:t.format};return t.attrs&&typeof t.attrs=="object"&&(r.attrs=Object.assign({},t.attrs)),t.html!==void 0&&(r.html=t.html),t.text!==void 0&&(r.text=t.text),r.content=normalizeDocumentHeadingIdsNodeList(t.content||[],{}),r}function getDocumentOutline(t){var r=createStructuredDocument(t),e=[];return collectDocumentOutline(r.content||[],e,{},"content"),e}function normalizeHeadingLevelOption(t,r){var e=parseInt(t,10);return isNaN(e)&&(e=r),e<1&&(e=1),e>6&&(e=6),e}function getFilteredDocumentOutline(t,r){var e=isArray(t)?t:getDocumentOutline(t),n=normalizeHeadingLevelOption(r&&r.minLevel,1),i=normalizeHeadingLevelOption(r&&r.maxLevel,6);i<n&&(i=n);for(var a=[],o=0;o<e.length;o++){var u=e[o];if(!(!u||typeof u!="object")){var f=normalizeHeadingLevelOption(u.level,n);f<n||f>i||a.push({id:u.id,level:f,path:u.path,text:u.text})}}return a}function cloneTableOfContentsEntry(t){var r={id:t.id,level:t.level,path:t.path,text:t.text};return t.itemIndex!==void 0&&(r.itemIndex=t.itemIndex),t.indexLabel!==void 0&&(r.indexLabel=t.indexLabel),r}function normalizeOrderedListType(t){var r=String(t||"").replace(/^\s+|\s+$/g,"");if(r){if(r==="1"||r==="A"||r==="a"||r==="I"||r==="i")return r;switch(r.toLowerCase()){case"decimal":return"1";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";case"upper-roman":return"I";case"lower-roman":return"i";default:return}}}function normalizeTableOfContentsIndexMode(t){var r=String(t||"").toLowerCase();return r==="linear"||r==="hierarchical"?r:"none"}function buildTableOfContentsTreeFromItems(t){for(var r=[],e=[],n=0;n<t.length;n++){var i=t[n],a=cloneTableOfContentsEntry(i);for(a.children=[];e.length&&e[e.length-1].level>=a.level;)e.pop();e.length?e[e.length-1].children.push(a):r.push(a),e.push(a)}return r}function assignLinearTableOfContentsIndexes(t){var r=0;function e(n){for(var i=isArray(n)?n:[],a=0;a<i.length;a++){var o=i[a];!o||typeof o!="object"||(r+=1,o.itemIndex=r,o.indexLabel=String(r),isArray(o.children)&&o.children.length&&e(o.children))}}e(t)}function assignHierarchicalTableOfContentsIndexesToFlatItems(t){for(var r=isArray(t)?t:[],e=[],n=0,i=0;i<r.length;i++){var a=r[i];if(!(!a||typeof a!="object")){for(;e.length&&e[e.length-1].level>=a.level;)e.pop();if(!e.length)n+=1,a.itemIndex=n,a.indexLabel=String(n);else{var o=e[e.length-1];o.childCount+=1,a.itemIndex=o.childCount,a.indexLabel=o.indexLabel+"."+a.itemIndex}e.push({childCount:0,indexLabel:a.indexLabel,level:a.level})}}}function applyTableOfContentsIndexMode(t,r){var e=isArray(t)?t:[],n=normalizeTableOfContentsIndexMode(r&&r.indexMode);return n==="hierarchical"?assignHierarchicalTableOfContentsIndexesToFlatItems(e):n==="linear"&&assignLinearTableOfContentsIndexes(e),e}function getTableOfContents(t,r){var e=applyTableOfContentsIndexMode(getFilteredDocumentOutline(t,r),r),n=buildTableOfContentsTreeFromItems(e);return n}function collectFootnotes(t,r,e){for(var n=isArray(t)?t:[],i=0;i<n.length;i++){var a=n[i];if(!(!a||typeof a!="object")){var o=e+".content["+i+"]";if(a.type==="footnoteItem"){var u=a.attrs||{},f=parseInt(u.number,10)||r.length+1;r.push({id:String(u.id||"rte-footnote-item-"+f),number:f,path:o,refId:u.refId?String(u.refId):"rte-footnote-ref-"+f,text:normalizePlainText(getNodeTextContent(a))})}isArray(a.content)&&a.content.length&&collectFootnotes(a.content,r,o)}}}function getFootnotes(t){var r=createStructuredDocument(t),e=[];return collectFootnotes(r.content||[],e,"content"),e.sort(function(n,i){return n.number!==i.number?n.number-i.number:n.path<i.path?-1:n.path>i.path?1:0}),e}function cloneStructuredNode(t){if(!t||typeof t!="object")return t;var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(e==="attrs"){r.attrs=t.attrs?Object.assign({},t.attrs):void 0;continue}if(e==="marks"){var n=t.marks||[];r.marks=[];for(var i=0;i<n.length;i++){var a=n[i];!a||typeof a!="object"||r.marks.push({type:a.type,attrs:a.attrs?Object.assign({},a.attrs):void 0})}continue}if(e==="content"){var o=t.content||[];r.content=[];for(var u=0;u<o.length;u++)r.content.push(cloneStructuredNode(o[u]));continue}r[e]=t[e]}return r}function syncTableOfContentsNodeList(t,r,e){for(var n=isArray(t)?t:[],i=[],a=e&&typeof e.title=="string"?e.title:null,o=e&&e.includeTitle===!1?!1:void 0,u=e&&e.ordered===!0?!0:e&&e.ordered===!1?!1:void 0,f=normalizeOrderedListType(e&&e.orderedListType),s=0;s<n.length;s++){var p=n[s],c=cloneStructuredNode(p);if(c&&c.type==="tableOfContents"){var g=c.attrs?Object.assign({},c.attrs):{};g.items=[];for(var l=0;l<r.length;l++)g.items.push(cloneTableOfContentsEntry(r[l]));a!==null&&(g.title=a),o!==void 0&&(g.includeTitle=o),u!==void 0&&(g.ordered=u),f!==void 0?g.orderedListType=f:u===!1&&Object.prototype.hasOwnProperty.call(g,"orderedListType")&&delete g.orderedListType,c.attrs=g}c&&isArray(c.content)&&c.content.length&&(c.content=syncTableOfContentsNodeList(c.content,r,e)),i.push(c)}return i}function syncTableOfContents(t,r){var e=createStructuredDocument(t),n=applyTableOfContentsIndexMode(getFilteredDocumentOutline(e,r),r),i=syncTableOfContentsNodeList(e.content||[],n,r);return createStructuredDocument({type:"doc",version:e.version,format:e.format,content:i})}function decodeHtmlEntities(t){return String(t||"").replace(/&(#x?[0-9a-f]+|[a-z]+);/gi,function(r,e){var n=String(e||"").toLowerCase();if(n.charAt(0)==="#"){var i=n.charAt(1)==="x",a=parseInt(n.substring(i?2:1),i?16:10);if(!isNaN(a))try{return String.fromCodePoint(a)}catch{return r}}return Object.prototype.hasOwnProperty.call(HTML_ENTITY_MAP,n)?HTML_ENTITY_MAP[n]:r})}function kebabToCamelCase(t){return String(t||"").replace(/-([a-z])/g,function(r,e){return e.toUpperCase()})}function parseStyleText(t){for(var r={},e=String(t||"").split(";"),n=0;n<e.length;n++){var i=e[n];if(i){var a=i.indexOf(":");if(!(a<0)){var o=kebabToCamelCase(i.substring(0,a).replace(/^\s+|\s+$/g,"")),u=i.substring(a+1).replace(/^\s+|\s+$/g,"");!o||!u||(r[o]=u)}}}return r}function createVirtualTextNode(t){var r=decodeHtmlEntities(t);return{childNodes:[],nodeType:3,nodeValue:r,outerHTML:"",textContent:r}}function createVirtualElementNode(t,r){var e=r||{},n=String(t||"").toLowerCase();return{_attrs:e,childNodes:[],getAttribute:function(i){var a=String(i||"").toLowerCase();return Object.prototype.hasOwnProperty.call(e,a)?e[a]:null},nodeType:1,outerHTML:"",style:parseStyleText(e.style||""),tagName:n.toUpperCase(),textContent:""}}function parseHtmlAttributes(t){for(var r={},e=/([^\s=\/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g,n=null;n=e.exec(t||"");){var i=String(n[1]||"").toLowerCase();if(i){var a=n[2];a===void 0&&(a=n[3]),a===void 0&&(a=n[4]),r[i]=decodeHtmlEntities(a===void 0?"":a)}}return r}function finalizeVirtualNode(t){if(!t)return null;if(t.nodeType===3)return t.textContent=t.nodeValue||"",t.outerHTML=escapeHtml(t.nodeValue||""),t;for(var r="",e="",n=0;n<t.childNodes.length;n++){var i=finalizeVirtualNode(t.childNodes[n]);i&&(r+=i.nodeType===3?escapeHtml(i.nodeValue||""):i.outerHTML||"",e+=i.textContent||"")}t.textContent=e;var a=getElementTagName(t);if(!a||a==="body")return t.outerHTML=r,t;var o=t._attrs||{},u=buildAttributeString(o);return HTML_VOID_TAGS[a]?(t.outerHTML="<"+a+u+" />",t):(t.outerHTML="<"+a+u+">"+r+"</"+a+">",t)}function createVirtualDocumentBody(t){for(var r=createVirtualElementNode("body",{}),e=[r],n=/<!--[\s\S]*?-->|<!doctype[^>]*>|<\/?[^>]+>|[^<]+/gi,i=null;i=n.exec(String(t||""));){var a=i[0];if(a&&!(/^<!--/.test(a)||/^<!doctype/i.test(a))){if(a.charAt(0)!=="<"){var o=createVirtualTextNode(a);o.parentNode=e[e.length-1],e[e.length-1].childNodes.push(o);continue}if(/^<\//.test(a)){var u=/^<\s*\/\s*([^\s>\/]+)/.exec(a);if(!u)continue;for(var f=String(u[1]||"").toLowerCase();e.length>1;){var s=getElementTagName(e[e.length-1]);if(e.pop(),s===f)break}continue}var p=/^<\s*([^\s>\/]+)/.exec(a);if(p){var c=String(p[1]||"").toLowerCase(),g=a.replace(/^<\s*[^\s>\/]+/,"").replace(/\/?\s*>$/,""),l=createVirtualElementNode(c,parseHtmlAttributes(g));l.parentNode=e[e.length-1],e[e.length-1].childNodes.push(l),!HTML_VOID_TAGS[c]&&!/\/\s*>$/.test(a)&&e.push(l)}}}return finalizeVirtualNode(r)}function getDocumentBody(t){if(typeof document<"u"&&document.implementation&&document.implementation.createHTMLDocument){var r=document.implementation.createHTMLDocument("");return r.body.innerHTML=t||"",r.body}return typeof DOMParser<"u"?new DOMParser().parseFromString("<!doctype html><html><body>"+(t||"")+"</body></html>","text/html").body:createVirtualDocumentBody(t)}function copyAttributes(t){var r={},e=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]===void 0||t[n]===null||t[n]===""||(r[n]=t[n],e=!0));return e?r:void 0}function cloneMark(t){return{type:t.type,attrs:copyAttributes(t.attrs||{})}}function cloneMarks(t){if(!(!t||!t.length)){for(var r=[],e=0;e<t.length;e++)r.push(cloneMark(t[e]));return r}}function getMarkKey(t){return t.type+":"+JSON.stringify(t.attrs||{})}function appendMark(t,r){for(var e=t.slice(),n=getMarkKey(r),i=0;i<e.length;i++)if(getMarkKey(e[i])===n)return e;return e.push(cloneMark(r)),e}function sameMarks(t,r){var e=t?t.length:0,n=r?r.length:0;if(e!==n)return!1;for(var i=0;i<e;i++)if(getMarkKey(t[i])!==getMarkKey(r[i]))return!1;return!0}function mergeAdjacentTextNodes(t){for(var r=[],e=0;e<t.length;e++){var n=t[e];if(n){if(n.type==="text"&&n.text){var i=r.length?r[r.length-1]:null;if(i&&i.type==="text"&&sameMarks(i.marks,n.marks)){i.text+=n.text;continue}}r.push(n)}}return r}function createNode(t,r){var e={type:t},n=r||{};if(n.attrs){var i=copyAttributes(n.attrs);i&&(e.attrs=i)}return n.content&&n.content.length&&(e.content=n.content),n.text&&(e.text=n.text),n.marks&&n.marks.length&&(e.marks=n.marks),n.html&&(e.html=n.html),e}function createStructuredContent(t){var r="",e="",n=void 0;if(typeof t=="string"){r=t,e=getPlainTextFromHtml(r);var i=parseStructuredDocumentAttributes(r);i&&i.pageSetup&&(n=i)}else if(t){r=t.getHTMLCode?t.getHTMLCode():"",e=t.getPlainText?t.getPlainText():"",e||(e=getPlainTextFromHtml(r));var a=parseStructuredDocumentAttributes(r);a&&a.pageSetup&&(n=a)}return{type:"doc",version:2,format:"richtexteditor-json",attrs:n,html:r||"",text:e||"",content:parseStructuredContentHtml(r||"")}}function parseStructuredDocumentAttributes(t){var r=getDocumentBody(t);if(!r||!r.childNodes)return null;for(var e=0;e<r.childNodes.length;e++){var n=r.childNodes[e];if(!(!n||n.nodeType!==1)&&hasElementAttributeValue(n,"data-rte-page-setup","true")){var i=parsePageSetupNode(n);if(i)return{pageSetup:i}}}return null}function parseStructuredContentHtml(t){var r=getDocumentBody(t);return r?parseBlockNodes(r.childNodes):[]}function parseBlockNodes(t){var r=[],e=[];function n(){e.length&&(r.push(createNode("paragraph",{content:mergeAdjacentTextNodes(e)})),e=[])}for(var i=0;i<t.length;i++){var a=t[i];if(a){if(a.nodeType===3){var o=a.nodeValue||"";o.replace(/\s+/g,"")!==""&&(e=e.concat(parseInlineNode(a,[])));continue}if(a.nodeType===1){var u=getElementTagName(a);if(u==="br"||INLINE_CONTAINER_TAGS[u]){e=e.concat(parseInlineNode(a,[]));continue}n();var f=parseBlockNode(a);if(f){if(isArray(f)){for(var s=0;s<f.length;s++)r.push(f[s]);continue}r.push(f)}}}}return n(),r}function parseBlockNode(t){var r=getElementTagName(t),e=getElementTextAlignment(t,!0);if(hasElementAttributeValue(t,"data-rte-page-setup","true"))return null;if(hasElementAttributeValue(t,"data-rte-page-break","true"))return parsePageBreakNode(t);if(hasElementAttributeValue(t,"data-rte-toc","true"))return parseTableOfContentsNode(t);if(hasElementAttributeValue(t,"data-rte-footnotes","true"))return parseFootnotesNode(t);if(BLOCK_CONTAINER_TAGS[r]){var n=parseBlockNodes(t.childNodes);return n.length?n:null}if(r==="p")return createNode("paragraph",{attrs:e?{align:e}:void 0,content:parseInlineChildren(t)});if(/^h[1-6]$/.test(r))return createNode("heading",{attrs:createHeadingAttrs(parseInt(r.charAt(1),10)||1,e),content:parseInlineChildren(t)});if(r==="blockquote")return createNode("blockquote",{content:parseBlockNodes(t.childNodes)});if(r==="pre")return createNode("codeBlock",{text:t.textContent||""});if(r==="ul")return isTaskListElement(t)?createNode("taskList",{content:parseTaskListItems(t)}):createNode("bulletList",{content:parseListItems(t)});if(r==="ol"){var i=t.getAttribute("start"),a=normalizeOrderedListType(getElementAttribute(t,"type"));!a&&t.style&&typeof t.style.listStyleType=="string"&&(a=normalizeOrderedListType(t.style.listStyleType));var o={};return i&&(o.start=parseInt(i,10)||1),a&&(o.orderedListType=a),createNode("orderedList",{attrs:Object.keys(o).length?o:void 0,content:parseListItems(t)})}return r==="li"?createNode("listItem",{content:parseBlockNodes(t.childNodes)}):r==="hr"?createNode("horizontalRule"):r==="img"?parseImageNode(t):r==="table"?createNode("table",{content:parseTableRows(t)}):createNode("htmlBlock",{html:t.outerHTML||"",text:normalizePlainText(t.textContent||"")})}function parsePageBreakNode(t){var r={},e=normalizePlainText(t.textContent||"");return e&&(r.label=e),createNode("pageBreak",{attrs:r})}function parseTableOfContentsNode(t){var r=[],e=null,n=!1,i,a=findDescendantsByTagName(t,"ol");if(a.length)e=a[0],n=!0,i=normalizeOrderedListType(getElementAttribute(e,"type"));else{var o=findDescendantsByTagName(t,"ul");o.length&&(e=o[0])}if(e)collectTableOfContentsItemsFromList(e,1,r);else for(var u=findDescendantsByTagName(t,"a"),f=0;f<u.length;f++){var s=u[f],p=getElementAttribute(s,"href");if(!(!p||p.charAt(0)!=="#")){var c=s.parentNode,g=0;c&&c.style&&typeof c.style.marginLeft=="string"&&(g=parseInt(c.style.marginLeft,10)||0),r.push({id:p.substring(1),level:Math.max(1,Math.floor(g/16)+1),text:normalizePlainText(s.textContent||"")})}}var l={},h=getFirstElementChild(t,"div"),y=h?normalizePlainText(h.textContent||""):"";return y?l.title=y:l.includeTitle=!1,r.length&&(l.items=r),n&&(l.ordered=!0),i&&(l.orderedListType=i),createNode("tableOfContents",{attrs:l})}function collectTableOfContentsItemsFromList(t,r,e){for(var n=t&&t.childNodes?t.childNodes:[],i=0;i<n.length;i++){var a=n[i];if(!(!a||a.nodeType!==1||getElementTagName(a)!=="li")){var o=findDescendantsByTagName(a,"a"),u=o.length?o[0]:null;if(u){var f=getElementAttribute(u,"href");f&&f.charAt(0)==="#"&&e.push({id:f.substring(1),level:r,text:normalizePlainText(u.textContent||"")})}var s=getFirstElementChild(a,"ol")||getFirstElementChild(a,"ul");s&&collectTableOfContentsItemsFromList(s,r+1,e)}}}function parseFootnoteItemNode(t){var r={},e=parseInt(getElementAttribute(t,"data-rte-footnote-item"),10)||0;e&&(r.number=e),getElementAttribute(t,"id")&&(r.id=getElementAttribute(t,"id"));for(var n=[],i=t.childNodes||[],a=0;a<i.length;a++){var o=i[a];if(o){if(o.nodeType===1&&getElementTagName(o)==="a"){var u=getElementAttribute(o,"href");if(u&&u.charAt(0)==="#"){r.refId=u.substring(1);continue}}n.push(o)}}var f=parseBlockNodes(n);return f.length||(f=[createNode("paragraph",{content:[createNode("text",{text:normalizePlainText(t.textContent||"")})]})]),createNode("footnoteItem",{attrs:r,content:f})}function parseFootnotesNode(t){var r={},e=getFirstElementChild(t,"div"),n=e?normalizePlainText(e.textContent||""):"";n&&(r.title=n);var i=getFirstElementChild(t,"ol")||getFirstElementChild(t,"ul"),a=[];if(i)for(var o=getElementChildElements(i,"li"),u=0;u<o.length;u++)a.push(parseFootnoteItemNode(o[u]));return createNode("footnotes",{attrs:r,content:a})}function parseListItems(t){for(var r=[],e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];n&&n.nodeType===1&&getElementTagName(n)==="li"&&r.push(parseBlockNode(n))}return r}function isTaskListElement(t){if(!t||getElementTagName(t)!=="ul")return!1;if(String(t.getAttribute("data-rte-task-list")||"").toLowerCase()==="true")return!0;for(var r=0;r<t.childNodes.length;r++){var e=t.childNodes[r];if(!(!e||e.nodeType!==1||getElementTagName(e)!=="li")&&findTaskListCheckbox(e))return!0}return!1}function findTaskListCheckbox(t){if(!t||t.nodeType!==1)return null;for(var r=0;r<t.childNodes.length;r++){var e=t.childNodes[r];if(!(!e||e.nodeType!==1)){if(getElementTagName(e)==="input"&&String(e.getAttribute("type")||"").toLowerCase()==="checkbox")return e;if(getElementTagName(e)==="label")for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(i&&i.nodeType===1&&getElementTagName(i)==="input"&&String(i.getAttribute("type")||"").toLowerCase()==="checkbox")return i}}}return null}function parseTaskListItems(t){for(var r=[],e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];n&&n.nodeType===1&&getElementTagName(n)==="li"&&r.push(parseTaskListItem(n))}return r}function parseTaskListItem(t){var r={},e=findTaskListCheckbox(t),n=[];e&&(r.checked=e.checked||String(e.getAttribute("checked")||"").toLowerCase()==="checked");for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes[i];if(a&&a!==e&&!(a.nodeType===3&&!normalizePlainText(a.nodeValue||""))){if(a.nodeType===1&&getElementTagName(a)==="label"&&e&&a.contains(e)){for(var o=0;o<a.childNodes.length;o++){var u=a.childNodes[o];!u||u===e||n.push(u)}continue}n.push(a)}}var f=parseBlockNodes(n);return f.length||(f=[createNode("paragraph",{content:parseInlineChildren(t)})]),createNode("taskItem",{attrs:r,content:f})}function parseTableRows(t){var r=[];function e(n){for(var i=0;i<n.childNodes.length;i++){var a=n.childNodes[i];if(!(!a||a.nodeType!==1)){var o=getElementTagName(a);if(o==="tr"){r.push(parseTableRow(a));continue}(o==="thead"||o==="tbody"||o==="tfoot")&&e(a)}}}return e(t),r}function parseTableRow(t){for(var r=[],e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];if(!(!n||n.nodeType!==1)){var i=getElementTagName(n);(i==="td"||i==="th")&&r.push(parseTableCell(n))}}return createNode("tableRow",{content:r})}function parseTableCell(t){var r={},e=t.getAttribute("colspan"),n=t.getAttribute("rowspan");getElementTagName(t)==="th"&&(r.header=!0);var i=getElementTextAlignment(t,!1);return(i==="left"||i==="center"||i==="right")&&(r.align=i),e&&(r.colspan=parseInt(e,10)||1),n&&(r.rowspan=parseInt(n,10)||1),createNode("tableCell",{attrs:r,content:parseBlockNodes(t.childNodes)})}function createHeadingAttrs(t,r){var e={level:t};return r&&(e.align=r),e}function normalizeTextAlignment(t,r){var e=String(t||"").toLowerCase().replace(/^\s+|\s+$/g,"");return e==="left"||e==="center"||e==="right"||r&&e==="justify"?e:""}function getElementTextAlignment(t,r){var e="";return t&&t.style&&typeof t.style.textAlign=="string"&&(e=t.style.textAlign),normalizeTextAlignment(e||(t?t.getAttribute("align"):""),r)}function getElementAttribute(t,r){return!t||typeof t.getAttribute!="function"?"":t.getAttribute(r)||""}function hasElementAttributeValue(t,r,e){return String(getElementAttribute(t,r)).toLowerCase()===String(e||"").toLowerCase()}function getElementChildElements(t,r){var e=[],n=r?String(r).toLowerCase():"";if(!t||!t.childNodes)return e;for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes[i];!a||a.nodeType!==1||(!n||getElementTagName(a)===n)&&e.push(a)}return e}function getFirstElementChild(t,r){var e=getElementChildElements(t,r);return e.length?e[0]:null}function findDescendantsByTagName(t,r,e){var n=e||[],i=String(r||"").toLowerCase();if(!t||!t.childNodes)return n;for(var a=0;a<t.childNodes.length;a++){var o=t.childNodes[a];!o||o.nodeType!==1||(getElementTagName(o)===i&&n.push(o),findDescendantsByTagName(o,i,n))}return n}function parseImageNode(t){return createNode("image",{attrs:{src:t.getAttribute("src")||"",alt:t.getAttribute("alt")||"",title:t.getAttribute("title")||"",width:t.getAttribute("width")||"",height:t.getAttribute("height")||""}})}function parseInlineChildren(t,r){return mergeAdjacentTextNodes(parseInlineNodes(t.childNodes,r||[]))}function parseMergeFieldNode(t,r){var e=getElementAttribute(t,"data-rte-merge-field"),n=normalizePlainText(t.textContent||""),i={name:e};return n&&(i.label=n),createNode("mergeField",{attrs:i,marks:r.length?r.slice():void 0})}function parseFootnoteReferenceNode(t,r){var e=parseInt(getElementAttribute(t,"data-rte-footnote-ref"),10)||0,n=getFirstElementChild(t,"a"),i=n?String(getElementAttribute(n,"href")).replace(/^#/,""):"",a={number:e};return getElementAttribute(t,"id")&&(a.id=getElementAttribute(t,"id")),i&&(a.targetId=i),createNode("footnoteReference",{attrs:a,marks:r.length?r.slice():void 0})}function parseInlineNodes(t,r){for(var e=[],n=0;n<t.length;n++)e=e.concat(parseInlineNode(t[n],r));return e}function parseInlineNode(t,r){if(!t)return[];if(t.nodeType===3)return t.nodeValue?[createNode("text",{text:t.nodeValue,marks:r.length?r.slice():void 0})]:[];if(t.nodeType!==1)return[];var e=getElementTagName(t);if(e==="br")return[createNode("hardBreak")];if(getElementAttribute(t,"data-rte-merge-field"))return[parseMergeFieldNode(t,r)];if(e==="sup"&&getElementAttribute(t,"data-rte-footnote-ref"))return[parseFootnoteReferenceNode(t,r)];if(e==="img")return[parseImageNode(t)];for(var n=r.slice(),i=extractElementMarks(t),a=0;a<i.length;a++)n=appendMark(n,i[a]);return parseInlineNodes(t.childNodes,n)}function extractElementMarks(t){var r=[],e=getElementTagName(t),n=t.style||{},i=n.textDecorationLine||n.textDecoration||"",a={};function o(u,f){r.push({type:u,attrs:copyAttributes(f||{})})}return(e==="strong"||e==="b")&&o("bold"),(e==="em"||e==="i")&&o("italic"),e==="u"&&o("underline"),(e==="s"||e==="strike"||e==="del")&&o("strike"),e==="code"&&o("code"),e==="sub"&&o("subscript"),e==="sup"&&o("superscript"),e==="a"&&o("link",{href:t.getAttribute("href")||"",rel:t.getAttribute("rel")||"",target:t.getAttribute("target")||"",title:t.getAttribute("title")||""}),n.fontWeight&&/bold|[5-9]00/.test(n.fontWeight)&&o("bold"),n.fontStyle==="italic"&&o("italic"),i.indexOf("underline")>=0&&o("underline"),i.indexOf("line-through")>=0&&o("strike"),n.color&&(a.color=n.color),n.backgroundColor?a.backgroundColor=n.backgroundColor:e==="mark"&&(a.backgroundColor="#fff2ac"),n.fontSize&&(a.fontSize=n.fontSize),n.fontFamily&&(a.fontFamily=n.fontFamily),!a.color&&t.getAttribute("color")&&(a.color=t.getAttribute("color")),!a.fontFamily&&t.getAttribute("face")&&(a.fontFamily=t.getAttribute("face")),!a.fontSize&&t.getAttribute("size")&&(a.fontSize=t.getAttribute("size")),e==="small"&&!a.fontSize&&(a.fontSize="0.85em"),e==="big"&&!a.fontSize&&(a.fontSize="1.15em"),copyAttributes(a)&&o("textStyle",a),r}function escapeHtml(t){return String(t||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function escapeAttribute(t){return escapeHtml(t).replace(/"/g,""")}function buildAttributeString(t){var r="";if(!t)return r;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var n=t[e];n==null||n===""||(e==="href"||e==="src")&&normalizeInlineMarkdownLinkHref(n)===null||(r+=" "+e+'="'+escapeAttribute(n)+'"')}return r}function renderTableOfContentsList(t,r,e){var n=r?"ol":"ul",i="";r&&e&&(i=' type="'+escapeAttribute(e)+'"');for(var a="<"+n+i+' style="margin:0;padding-left:22px;color:#1e293b;">',o=0;o<t.length;o++){var u=t[o]||{};a+='<li style="margin:6px 0;"><a href="#'+escapeAttribute(u.id||"")+'" style="color:#1d4ed8;text-decoration:none;">'+escapeHtml(u.text||"")+"</a>",isArray(u.children)&&u.children.length&&(a+=renderTableOfContentsList(u.children,r,e)),a+="</li>"}return a+="</"+n+">",a}function buildStyleString(t){if(!t)return"";var r=[];return t.color&&r.push("color: "+t.color),t.backgroundColor&&r.push("background-color: "+t.backgroundColor),t.fontSize&&r.push("font-size: "+t.fontSize),t.fontFamily&&r.push("font-family: "+t.fontFamily),r.join("; ")}function serializeInlineNodes(t){for(var r="",e=0;e<(t||[]).length;e++)r+=serializeNode(t[e],!0);return r}function serializeBlockNodes(t){for(var r="",e=0;e<(t||[]).length;e++)r+=serializeNode(t[e],!1);return r}function serializeListItemContent(t){return!t||!t.length?"":t.length===1&&t[0].type==="paragraph"?serializeInlineNodes(t[0].content||[]):serializeBlockNodes(t)}function serializeTableCellContent(t){return!t||!t.length?"":t.length===1&&t[0].type==="paragraph"?serializeInlineNodes(t[0].content||[]):serializeBlockNodes(t)}function applyMark(t,r){var e=t.attrs||{};if(t.type==="bold")return"<strong>"+r+"</strong>";if(t.type==="italic")return"<em>"+r+"</em>";if(t.type==="underline")return"<u>"+r+"</u>";if(t.type==="strike")return"<s>"+r+"</s>";if(t.type==="code")return"<code>"+r+"</code>";if(t.type==="subscript")return"<sub>"+r+"</sub>";if(t.type==="superscript")return"<sup>"+r+"</sup>";if(t.type==="link")return"<a"+buildAttributeString({href:e.href,rel:e.rel,target:e.target,title:e.title})+">"+r+"</a>";if(t.type==="textStyle"){var n=buildStyleString(e);return n?'<span style="'+escapeAttribute(n)+'">'+r+"</span>":r}return r}function serializeNode(t,r){if(!t||typeof t!="object")return"";if(t.type==="doc")return serializeBlockNodes(t.content||[]);if(t.type==="text"){for(var e=escapeHtml(t.text||""),n=t.marks||[],i=n.length-1;i>=0;i--)e=applyMark(n[i],e);return e}if(t.type==="hardBreak")return"<br />";if(t.type==="mergeField"){var a=t.attrs||{},o=String(a.name||""),u=String(a.label||o||"");return'<span data-rte-merge-field="'+escapeAttribute(o)+'" contenteditable="false" style="display:inline-flex;align-items:center;gap:6px;padding:2px 8px;border:1px solid #bfdbfe;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-size:0.95em;font-weight:600;white-space:nowrap;">'+escapeHtml(u)+"</span>"}if(t.type==="footnoteReference"){var f=t.attrs||{},s=parseInt(f.number,10)||1,p=String(f.id||"rte-footnote-ref-"+s),c=String(f.targetId||"rte-footnote-item-"+s);return'<sup id="'+escapeAttribute(p)+'" data-rte-footnote-ref="'+escapeAttribute(s)+'" style="font-size:0.75em;line-height:1;vertical-align:super;"><a href="#'+escapeAttribute(c)+'" style="color:#1d4ed8;text-decoration:none;">['+escapeHtml(s)+"]</a></sup>"}if(t.type==="image")return"<img"+buildAttributeString(t.attrs||{})+" />";if(t.type==="paragraph"){var g=buildBlockAlignmentAttributes(t,!0);return r?serializeInlineNodes(t.content||[]):"<p"+buildAttributeString(g)+">"+serializeInlineNodes(t.content||[])+"</p>"}if(t.type==="heading"){var l=1,h=t.attrs||{};t.attrs&&t.attrs.level&&(l=parseInt(t.attrs.level,10)||1),l<1&&(l=1),l>6&&(l=6);var y=buildBlockAlignmentAttributes(t,!0);return h.id&&(y.id=h.id),"<h"+l+buildAttributeString(y)+">"+serializeInlineNodes(t.content||[])+"</h"+l+">"}if(t.type==="blockquote")return"<blockquote>"+serializeBlockNodes(t.content||[])+"</blockquote>";if(t.type==="codeBlock")return"<pre><code>"+escapeHtml(t.text||"")+"</code></pre>";if(t.type==="bulletList")return"<ul>"+serializeBlockNodes(t.content||[])+"</ul>";if(t.type==="orderedList"){var v={};if(t.attrs&&t.attrs.start&&(v.start=t.attrs.start),t.attrs){var b=normalizeOrderedListType(t.attrs.orderedListType);b&&(v.type=b)}return"<ol"+buildAttributeString(v)+">"+serializeBlockNodes(t.content||[])+"</ol>"}if(t.type==="listItem")return"<li>"+serializeListItemContent(t.content||[])+"</li>";if(t.type==="taskList")return'<ul data-rte-task-list="true">'+serializeBlockNodes(t.content||[])+"</ul>";if(t.type==="taskItem"){var m={type:"checkbox",disabled:"disabled"};return t.attrs&&t.attrs.checked&&(m.checked="checked"),'<li data-rte-task-item="true"><input'+buildAttributeString(m)+" />"+serializeListItemContent(t.content||[])+"</li>"}if(t.type==="horizontalRule")return"<hr />";if(t.type==="pageBreak"){var N=t.attrs||{},k=String(N.label||"Page Break");return'<div data-rte-page-break="true" contenteditable="false" style="position:relative;text-align:center;border-top:2px dashed #94a3b8;margin:18px 0 14px;padding:0;height:0;line-height:0;user-select:none;"><span style="position:relative;top:-0.75em;display:inline-block;padding:0 10px;background:#fff;color:#64748b;font-size:12px;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;line-height:1.6;">'+escapeHtml(k)+"</span></div>"}if(t.type==="tableOfContents"){var d=t.attrs||{},M=isArray(d.items)?d.items:[],x=String(d.title||"Table of Contents"),L=d.includeTitle!==!1,C=d.ordered===!0,S=normalizeOrderedListType(d.orderedListType),w="";return L&&(w+='<div style="font-size:12px;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:#475569;margin-bottom:10px;">'+escapeHtml(x)+"</div>"),w+=renderTableOfContentsList(buildTableOfContentsTreeFromItems(M),C,S),'<div data-rte-toc="true" contenteditable="false" style="margin:18px 0;padding:16px 18px;border:1px solid #dbeafe;border-radius:16px;background:#f8fbff;">'+w+"</div>"}if(t.type==="footnotes"){var O=t.attrs||{},R=String(O.title||"Footnotes");return'<div data-rte-footnotes="true" style="margin-top:24px;padding-top:14px;border-top:1px solid #cbd5e1;"><div style="margin-bottom:10px;font-size:12px;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:#475569;">'+escapeHtml(R)+'</div><ol style="margin:0;padding-left:22px;color:#334155;">'+serializeBlockNodes(t.content||[])+"</ol></div>"}if(t.type==="footnoteItem"){var j=t.attrs||{},A=parseInt(j.number,10)||1,$=String(j.id||"rte-footnote-item-"+A),P=String(j.refId||"rte-footnote-ref-"+A);return'<li id="'+escapeAttribute($)+'" data-rte-footnote-item="'+escapeAttribute(A)+'" style="margin:0 0 10px 0;line-height:1.7;">'+serializeListItemContent(t.content||[])+' <a href="#'+escapeAttribute(P)+'" style="color:#1d4ed8;text-decoration:none;">↩</a></li>'}if(t.type==="table")return"<table>"+serializeBlockNodes(t.content||[])+"</table>";if(t.type==="tableRow")return"<tr>"+serializeBlockNodes(t.content||[])+"</tr>";if(t.type==="tableCell"){var z=t.attrs&&t.attrs.header?"th":"td",T={};return t.attrs&&(t.attrs.align&&(T.align=t.attrs.align,T.style="text-align: "+t.attrs.align),t.attrs.colspan&&(T.colspan=t.attrs.colspan),t.attrs.rowspan&&(T.rowspan=t.attrs.rowspan)),"<"+z+buildAttributeString(T)+">"+serializeTableCellContent(t.content||[])+"</"+z+">"}return t.type==="htmlBlock"||t.type==="htmlInline"?t.html||"":isArray(t.content)?r?serializeInlineNodes(t.content):serializeBlockNodes(t.content):typeof t.html=="string"?t.html:typeof t.text=="string"?escapeHtml(t.text):""}function serializeStructuredContent(t){if(t==null)return"";if(typeof t=="string"){var r=t.trim();if(r&&(r.charAt(0)==="{"||r.charAt(0)==="["))try{return serializeStructuredContent(JSON.parse(r))}catch{return t}return t}if(typeof t!="object")return String(t);if(t.type==="doc"&&isArray(t.content)){var e=normalizeDocumentHeadingIds(t);return serializePageSetupMetadata(normalizeDocumentPageSetup(e.attrs&&e.attrs.pageSetup))+serializeBlockNodes(e.content)}if(t.type&&t.type!=="doc")return serializeNode(t,!1);if(isArray(t.content)){var n=normalizeDocumentHeadingIds({type:"doc",version:typeof t.version=="number"?t.version:2,format:t.format||"richtexteditor-json",attrs:t.attrs,content:t.content});return serializePageSetupMetadata(normalizeDocumentPageSetup(n.attrs&&n.attrs.pageSetup))+serializeBlockNodes(n.content)}return t.content&&typeof t.content.html=="string"?t.content.html:typeof t.html=="string"?t.html:""}function normalizeStructuredContent(t){return serializeStructuredContent(t)}function createValidationIssue(t,r){return{message:r,path:t}}function createAccessibilityIssue(t,r,e,n){return{code:r,message:e,path:t,severity:n||"warning"}}function buildBlockAlignmentAttributes(t,r){var e=t&&t.attrs?normalizeTextAlignment(t.attrs.align,r):"";return e?{align:e,style:"text-align: "+e}:{}}function isStructuredNodeObject(t){return!!t&&typeof t=="object"&&!isArray(t)}function createValidationDocument(t){return t==null||typeof t=="string"?createStructuredDocument(t):isStructuredNodeObject(t)?t.type==="doc"?{type:"doc",version:typeof t.version=="number"?t.version:2,format:typeof t.format=="string"?t.format:"richtexteditor-json",attrs:t.attrs&&typeof t.attrs=="object"?Object.assign({},t.attrs):void 0,html:typeof t.html=="string"?t.html:void 0,text:typeof t.text=="string"?t.text:void 0,content:isArray(t.content)?t.content:[]}:t.type&&t.type!=="doc"?{type:"doc",version:2,format:"richtexteditor-json",content:[t]}:isArray(t.content)?{type:"doc",version:typeof t.version=="number"?t.version:2,format:typeof t.format=="string"?t.format:"richtexteditor-json",attrs:t.attrs&&typeof t.attrs=="object"?Object.assign({},t.attrs):void 0,html:typeof t.html=="string"?t.html:void 0,text:typeof t.text=="string"?t.text:void 0,content:t.content}:t.content&&isStructuredNodeObject(t.content)?{type:"doc",version:typeof t.version=="number"?t.version:2,format:typeof t.format=="string"?t.format:"richtexteditor-json",attrs:t.attrs&&typeof t.attrs=="object"?Object.assign({},t.attrs):void 0,html:typeof t.html=="string"?t.html:void 0,text:typeof t.text=="string"?t.text:void 0,content:[t.content]}:createStructuredDocument(serializeStructuredContent(t)):createStructuredDocument(String(t))}function validateMark(t,r,e){if(!isStructuredNodeObject(t)){e.push(createValidationIssue(r,"Marks must be objects."));return}if(typeof t.type!="string"||!t.type){e.push(createValidationIssue(r+".type","Marks require a type."));return}MARK_TYPES[t.type]||e.push(createValidationIssue(r+".type",'Unsupported mark type "'+t.type+'".')),t.type==="link"&&(!t.attrs||typeof t.attrs.href!="string"||!t.attrs.href)&&e.push(createValidationIssue(r+".attrs.href","Link marks require a non-empty href."))}function validateNodeChildren(t,r,e,n){if(!isArray(t.content)){n.push(createValidationIssue(r+".content","Node content must be an array."));return}for(var i=0;i<t.content.length;i++)validateNode(t.content[i],r+".content["+i+"]",e,n)}function validateNode(t,r,e,n){if(!isStructuredNodeObject(t)){n.push(createValidationIssue(r,"Nodes must be objects."));return}if(typeof t.type!="string"||!t.type){n.push(createValidationIssue(r+".type","Nodes require a type."));return}if(t.marks)if(!isArray(t.marks))n.push(createValidationIssue(r+".marks","Marks must be an array."));else for(var i=0;i<t.marks.length;i++)validateMark(t.marks[i],r+".marks["+i+"]",n);if(e==="inline"&&!INLINE_NODE_TYPES[t.type]&&n.push(createValidationIssue(r+".type",'Inline content cannot contain "'+t.type+'" nodes.')),e==="block"&&!(BLOCK_NODE_TYPES[t.type]||t.type==="footnoteItem"||t.type==="tableRow"||t.type==="tableCell"||t.type==="listItem"||t.type==="taskItem")&&n.push(createValidationIssue(r+".type",'Block content cannot contain "'+t.type+'" nodes.')),t.type==="text"){typeof t.text!="string"&&n.push(createValidationIssue(r+".text","Text nodes require a string text value.")),t.content&&n.push(createValidationIssue(r+".content","Text nodes cannot contain child content."));return}if(t.type==="hardBreak"){t.content&&n.push(createValidationIssue(r+".content","Hard break nodes cannot contain child content."));return}if(t.type==="mergeField"){(!t.attrs||typeof t.attrs.name!="string"||!t.attrs.name)&&n.push(createValidationIssue(r+".attrs.name","Merge field nodes require a non-empty name."));return}if(t.type==="footnoteReference"){(!t.attrs||typeof t.attrs.number!="number"||t.attrs.number<1)&&n.push(createValidationIssue(r+".attrs.number","Footnote reference nodes require a positive number."));return}if(t.type==="image"){(!t.attrs||typeof t.attrs.src!="string"||!t.attrs.src)&&n.push(createValidationIssue(r+".attrs.src","Image nodes require a non-empty src."));return}if(t.type==="heading"){(!t.attrs||typeof t.attrs.level!="number"||t.attrs.level<1||t.attrs.level>6)&&n.push(createValidationIssue(r+".attrs.level","Heading nodes require a level between 1 and 6.")),t.attrs&&t.attrs.align!==void 0&&(typeof t.attrs.align!="string"||!/^(left|center|right|justify)$/.test(String(t.attrs.align).toLowerCase()))&&n.push(createValidationIssue(r+".attrs.align",'Heading nodes require align to be "left", "center", "right", or "justify" when provided.')),validateNodeChildren(t,r,"inline",n);return}if(t.type==="paragraph"){t.attrs&&t.attrs.align!==void 0&&(typeof t.attrs.align!="string"||!/^(left|center|right|justify)$/.test(String(t.attrs.align).toLowerCase()))&&n.push(createValidationIssue(r+".attrs.align",'Paragraph nodes require align to be "left", "center", "right", or "justify" when provided.')),validateNodeChildren(t,r,"inline",n);return}if(t.type==="blockquote"){validateNodeChildren(t,r,"block",n);return}if(t.type==="codeBlock"){typeof t.text!="string"&&n.push(createValidationIssue(r+".text","Code block nodes require a string text value."));return}if(t.type==="bulletList"||t.type==="orderedList"){if(t.type==="orderedList"&&t.attrs&&t.attrs.start!==void 0&&(typeof t.attrs.start!="number"||t.attrs.start<1)&&n.push(createValidationIssue(r+".attrs.start","Ordered lists require a positive numeric start value.")),t.type==="orderedList"&&t.attrs&&t.attrs.orderedListType!==void 0&&(typeof t.attrs.orderedListType!="string"||normalizeOrderedListType(t.attrs.orderedListType)!==t.attrs.orderedListType)&&n.push(createValidationIssue(r+".attrs.orderedListType",'Ordered lists require orderedListType to be one of "1", "A", "a", "I", or "i" when provided.')),!isArray(t.content)){n.push(createValidationIssue(r+".content","List nodes require a content array."));return}for(var a=0;a<t.content.length;a++){var o=t.content[a];if(!o||o.type!=="listItem"){n.push(createValidationIssue(r+".content["+a+"]","Lists can only contain listItem nodes."));continue}validateNode(o,r+".content["+a+"]","block",n)}return}if(t.type==="listItem"){validateNodeChildren(t,r,"block",n);return}if(t.type==="taskList"){if(!isArray(t.content)){n.push(createValidationIssue(r+".content","Task lists require a content array."));return}for(var u=0;u<t.content.length;u++){var f=t.content[u];if(!f||f.type!=="taskItem"){n.push(createValidationIssue(r+".content["+u+"]","Task lists can only contain taskItem nodes."));continue}validateNode(f,r+".content["+u+"]","block",n)}return}if(t.type==="taskItem"){t.attrs&&t.attrs.checked!==void 0&&typeof t.attrs.checked!="boolean"&&n.push(createValidationIssue(r+".attrs.checked","Task items require a boolean checked attribute when provided.")),validateNodeChildren(t,r,"block",n);return}if(t.type!=="horizontalRule"){if(t.type==="pageBreak"){t.content&&n.push(createValidationIssue(r+".content","Page break nodes cannot contain child content."));return}if(t.type==="tableOfContents"){var s=t.attrs&&t.attrs.items;if(!isArray(s)){n.push(createValidationIssue(r+".attrs.items","Table of contents nodes require an items array."));return}for(var p=0;p<s.length;p++){var c=s[p];if(!isStructuredNodeObject(c)){n.push(createValidationIssue(r+".attrs.items["+p+"]","Table of contents items must be objects."));continue}(typeof c.id!="string"||!c.id)&&n.push(createValidationIssue(r+".attrs.items["+p+"].id","Table of contents items require a non-empty id.")),(typeof c.text!="string"||!c.text)&&n.push(createValidationIssue(r+".attrs.items["+p+"].text","Table of contents items require non-empty text.")),(typeof c.level!="number"||c.level<1||c.level>6)&&n.push(createValidationIssue(r+".attrs.items["+p+"].level","Table of contents items require a level between 1 and 6."))}return}if(t.type==="footnotes"){if(!isArray(t.content)){n.push(createValidationIssue(r+".content","Footnotes nodes require a content array."));return}for(var g=0;g<t.content.length;g++){var l=t.content[g];if(!l||l.type!=="footnoteItem"){n.push(createValidationIssue(r+".content["+g+"]","Footnotes can only contain footnoteItem nodes."));continue}validateNode(l,r+".content["+g+"]","block",n)}return}if(t.type==="footnoteItem"){(!t.attrs||typeof t.attrs.number!="number"||t.attrs.number<1)&&n.push(createValidationIssue(r+".attrs.number","Footnote items require a positive number.")),validateNodeChildren(t,r,"block",n);return}if(t.type==="table"){if(!isArray(t.content)){n.push(createValidationIssue(r+".content","Table nodes require a content array."));return}for(var h=0;h<t.content.length;h++){var y=t.content[h];if(!y||y.type!=="tableRow"){n.push(createValidationIssue(r+".content["+h+"]","Tables can only contain tableRow nodes."));continue}validateNode(y,r+".content["+h+"]","block",n)}return}if(t.type==="tableRow"){if(!isArray(t.content)){n.push(createValidationIssue(r+".content","Table rows require a content array."));return}for(var v=0;v<t.content.length;v++){var b=t.content[v];if(!b||b.type!=="tableCell"){n.push(createValidationIssue(r+".content["+v+"]","Table rows can only contain tableCell nodes."));continue}validateNode(b,r+".content["+v+"]","block",n)}return}if(t.type==="tableCell"){t.attrs&&t.attrs.align!==void 0&&(typeof t.attrs.align!="string"||!/^(left|center|right)$/.test(String(t.attrs.align).toLowerCase()))&&n.push(createValidationIssue(r+".attrs.align",'Table cells require align to be "left", "center", or "right" when provided.')),validateNodeChildren(t,r,"block",n);return}if(t.type==="htmlBlock"||t.type==="htmlInline"){typeof t.html!="string"&&n.push(createValidationIssue(r+".html","HTML nodes require an html string."));return}n.push(createValidationIssue(r+".type",'Unsupported node type "'+t.type+'".'))}}function validateStructuredContent(t){var r=createValidationDocument(t),e=[];r.type!=="doc"&&e.push(createValidationIssue("type",'Structured content roots must use the "doc" type.')),typeof r.version!="number"&&e.push(createValidationIssue("version","Structured content documents require a numeric version.")),(typeof r.format!="string"||!r.format)&&e.push(createValidationIssue("format","Structured content documents require a format string."));var n=normalizeDocumentPageSetup(r.attrs&&r.attrs.pageSetup);if(r.attrs&&r.attrs.pageSetup&&!n&&e.push(createValidationIssue("attrs.pageSetup","Document pageSetup metadata must be an object when provided.")),n&&(n.orientation!==void 0&&n.orientation!=="portrait"&&n.orientation!=="landscape"&&e.push(createValidationIssue("attrs.pageSetup.orientation",'Document pageSetup orientation must be "portrait" or "landscape".')),(n.width&&!n.height||!n.width&&n.height)&&e.push(createValidationIssue("attrs.pageSetup","Document pageSetup width and height should be provided together when using custom dimensions."))),!isArray(r.content))e.push(createValidationIssue("content","Structured content documents require a content array."));else for(var i=0;i<r.content.length;i++)validateNode(r.content[i],"content["+i+"]","block",e);return{document:r,issues:e,valid:e.length===0}}function getNodeTextContent(t){if(!t)return"";if(typeof t=="string")return t;if(t.type==="text"||t.type==="codeBlock")return String(t.text||"");if(t.type==="mergeField")return String(t.attrs&&(t.attrs.label||t.attrs.name)||"");if(t.type==="footnoteReference")return String(t.attrs&&t.attrs.number||"");for(var r="",e=isArray(t.content)?t.content:[],n=0;n<e.length;n++)r+=getNodeTextContent(e[n])+" ";return normalizePlainText(r)}function renderTextContent(t){for(var r=isArray(t)?t:[],e="",n=0;n<r.length;n++)e+=getNodeTextContent(r[n])+" ";return normalizePlainText(e)}function tableHasHeaderCell(t){if(!t||!isArray(t.content))return!1;for(var r=0;r<t.content.length;r++){var e=t.content[r];if(!(!e||!isArray(e.content)))for(var n=0;n<e.content.length;n++){var i=e.content[n];if(i&&i.attrs&&i.attrs.header===!0)return!0}}return!1}function auditAccessibilityNode(t,r,e,n){if(!(!isStructuredNodeObject(t)||typeof t.type!="string"||!t.type)){if(t.type==="image"){var i=normalizePlainText(t.attrs&&t.attrs.alt);i||e.push(createAccessibilityIssue(r+".attrs.alt","image-missing-alt","Images should include meaningful alt text, or be marked decorative outside the structured-content model.","warning"))}if(t.type==="heading"){var a=normalizePlainText(getNodeTextContent(t)),o=t.attrs&&t.attrs.level;a||e.push(createAccessibilityIssue(r+".content","heading-empty","Headings should contain readable text.","error")),typeof o=="number"&&(n.lastHeadingLevel&&o>n.lastHeadingLevel+1&&e.push(createAccessibilityIssue(r+".attrs.level","heading-level-skip","Heading levels should not skip intermediate levels.","warning")),n.lastHeadingLevel=o)}if(t.type==="table"&&!tableHasHeaderCell(t)&&e.push(createAccessibilityIssue(r,"table-missing-header","Tables should include at least one header cell.","warning")),!!isArray(t.content))for(var u=0;u<t.content.length;u++)auditAccessibilityNode(t.content[u],r+".content["+u+"]",e,n)}}function auditAccessibility(t){for(var r=createStructuredDocument(t),e=[],n={lastHeadingLevel:0},i=0;i<r.content.length;i++)auditAccessibilityNode(r.content[i],"content["+i+"]",e,n);return{document:r,issues:e,valid:!e.some(function(a){return a&&a.severity==="error"})}}function createLinkAuditIssue(t,r,e,n,i){var a={code:r,message:e,path:t,severity:n||"warning"};return i!==void 0&&(a.href=i),a}function normalizeLinkAuditOptions(t){var r=t&&typeof t=="object"?t:{},e=isArray(r.allowedProtocols)?r.allowedProtocols:["http:","https:","mailto:","tel:"],n=isArray(r.allowedDomains)?r.allowedDomains:[];return{allowedProtocols:e.map(function(i){var a=String(i||"").toLowerCase();return a&&a.charAt(a.length-1)===":"?a:a+":"}).filter(Boolean),allowedDomains:n.map(function(i){return String(i||"").toLowerCase()}).filter(Boolean),requireHttps:r.requireHttps===!0,flagNewWindowWithoutRel:r.flagNewWindowWithoutRel!==!1}}function getLinkHostname(t){if(typeof URL>"u")return"";try{return new URL(t).hostname.toLowerCase()}catch{return""}}function isAllowedLinkDomain(t,r){if(!r.length||!t)return!0;for(var e=0;e<r.length;e++){var n=r[e];if(t===n||t.slice(-(n.length+1))==="."+n)return!0}return!1}function auditLinkMark(t,r,e,n){var i=t&&t.attrs?t.attrs:{},a=String(i.href||"").replace(/^\s+|\s+$/g,""),o=String(i.target||"").toLowerCase(),u=String(i.rel||"").toLowerCase();if(!a){e.push(createLinkAuditIssue(r+".attrs.href","link-empty-href","Links should include a destination URL.","error",a));return}if(/^[a-z][a-z0-9+.-]*:/i.test(a)){var f=a.replace(/^([a-z][a-z0-9+.-]*:).*$/i,"$1").toLowerCase();if(n.allowedProtocols.indexOf(f)<0){e.push(createLinkAuditIssue(r+".attrs.href","link-disallowed-protocol","Links should use an approved URL protocol.","error",a));return}n.requireHttps&&f==="http:"&&e.push(createLinkAuditIssue(r+".attrs.href","link-insecure-http","Public links should use HTTPS.","warning",a));var s=getLinkHostname(a);s&&!isAllowedLinkDomain(s,n.allowedDomains)&&e.push(createLinkAuditIssue(r+".attrs.href","link-domain-not-allowed","Links should point to an approved domain.","warning",a))}else/^[a-z][a-z0-9+.-]*$/i.test(a)&&e.push(createLinkAuditIssue(r+".attrs.href","link-malformed-url","Links should use a valid absolute URL, relative URL, anchor, email, or phone destination.","error",a));n.flagNewWindowWithoutRel&&o==="_blank"&&u.indexOf("noopener")<0&&e.push(createLinkAuditIssue(r+".attrs.rel","link-missing-noopener",'Links that open in a new window should include rel="noopener".',"warning",a))}function auditLinksNode(t,r,e,n){if(isStructuredNodeObject(t)){for(var i=isArray(t.marks)?t.marks:[],a=0;a<i.length;a++)i[a]&&i[a].type==="link"&&auditLinkMark(i[a],r+".marks["+a+"]",e,n);if(isArray(t.content))for(var o=0;o<t.content.length;o++)auditLinksNode(t.content[o],r+".content["+o+"]",e,n)}}function auditLinks(t,r){for(var e=createStructuredDocument(t),n=[],i=normalizeLinkAuditOptions(r),a=0;a<e.content.length;a++)auditLinksNode(e.content[a],"content["+a+"]",n,i);return{document:e,issues:n,valid:!n.some(function(o){return o&&o.severity==="error"})}}function cloneStructuredDocument(t){return JSON.parse(JSON.stringify(t||createStructuredContent("")))}function resolveAccessibilityIssueNodePath(t){return!t||typeof t.path!="string"?"":t.code==="image-missing-alt"?t.path.replace(/\.attrs\.alt$/,""):t.code==="heading-empty"?t.path.replace(/\.content$/,""):t.code==="heading-level-skip"?t.path.replace(/\.attrs\.level$/,""):t.path}function parseStructuredPath(t){var r=[];return typeof t!="string"||!t||t.replace(/([^[.\]]+)|\[(\d+)\]/g,function(e,n,i){return r.push(typeof i=="string"?parseInt(i,10):n),e}),r}function getValueAtStructuredPath(t,r){for(var e=parseStructuredPath(r),n=t,i=0;i<e.length;i++){if(n==null)return null;n=n[e[i]]}return n??null}function ensureStructuredTextNode(t){return{type:"text",text:normalizePlainText(t)}}function findPreviousHeadingLevel(t,r){var e=resolveAccessibilityIssueNodePath({path:r}),n=0,i=!1;function a(u,f){if(!(i||!isStructuredNodeObject(u))){if(f===e){i=!0;return}if(u.type==="heading"&&u.attrs&&typeof u.attrs.level=="number"&&(n=u.attrs.level),!!isArray(u.content)){for(var s=0;s<u.content.length;s++)if(a(u.content[s],f+".content["+s+"]"),i)return}}}if(t&&isArray(t.content))for(var o=0;o<t.content.length&&(a(t.content[o],"content["+o+"]"),!i);o++);return n}function repairAccessibilityIssue(t,r,e){var n=createStructuredDocument(t),i=cloneStructuredDocument(n),a=r||{},o=resolveAccessibilityIssueNodePath(a),u=getValueAtStructuredPath(i,o),f=e||{};if(!u||typeof a.code!="string")return i;if(a.code==="image-missing-alt"){var s=normalizePlainText(f.altText);return s&&(u.attrs=u.attrs||{},u.attrs.alt=s),i}if(a.code==="heading-empty"){var p=normalizePlainText(f.headingText);return p&&(u.content=[ensureStructuredTextNode(p)]),i}if(a.code==="heading-level-skip"){var c=typeof f.targetLevel=="number"?f.targetLevel:Math.min(6,Math.max(1,findPreviousHeadingLevel(i,o)+1||1));return u.attrs=u.attrs||{},u.attrs.level=c,i}if(a.code==="table-missing-header"){if(!isArray(u.content)||!u.content.length||!u.content[0]||!isArray(u.content[0].content))return i;for(var g=0;g<u.content[0].content.length;g++){var l=u.content[0].content[g];isStructuredNodeObject(l)&&(l.attrs=l.attrs||{},l.attrs.header=!0)}return i}return i}function createStructuredDocument(t){if(t==null)return createStructuredContent("");if(typeof t=="string"){var r=t.trim();if(r&&(r.charAt(0)==="{"||r.charAt(0)==="["))try{return createStructuredDocument(JSON.parse(r))}catch{return createStructuredContent(t)}return createStructuredContent(t)}if(typeof t!="object")return createStructuredContent(String(t));if(t.type==="doc"&&isArray(t.content)){var e=normalizeDocumentHeadingIds({type:"doc",version:typeof t.version=="number"?t.version:2,format:t.format||"richtexteditor-json",attrs:t.attrs&&typeof t.attrs=="object"?Object.assign({},t.attrs,{pageSetup:normalizeDocumentPageSetup(t.attrs.pageSetup)||void 0}):void 0,content:t.content}),n=serializeStructuredContent(e);return{type:e.type,version:e.version,format:e.format,attrs:e.attrs,html:n,text:getPlainTextFromHtml(n),content:e.content}}return createStructuredContent(serializeStructuredContent(t))}function normalizeMarkdownSource(t){return String(t||"").replace(/\r\n?/g,`
|
|
3
|
+
`)}function stripMarkdownIndent(t,r){for(var e=0,n=Math.max(0,r||0);e<t.length&&e<n&&t.charAt(e)===" ";)e++;return t.substring(e)}function getMarkdownListMatch(t){var r=/^(\s*)([-+*])\s+(.*)$/.exec(t);if(r){var e=getMarkdownTaskState(r[3]);return{indent:r[1].length,ordered:!1,start:1,text:e?e.text:r[3],marker:r[2],contentIndent:r[1].length+r[2].length+1,taskState:e?e.checked:null}}var n=/^(\s*)(\d+)\.\s+(.*)$/.exec(t);return n?{indent:n[1].length,ordered:!0,start:parseInt(n[2],10)||1,text:n[3],marker:n[2]+".",contentIndent:n[1].length+n[2].length+2,taskState:null}:null}function getMarkdownTaskState(t){var r=/^\[( |x|X)\]\s+(.*)$/.exec(String(t||""));return r?{checked:r[1].toLowerCase()==="x",text:r[2]}:null}function getMarkdownLineIndent(t){var r=/^(\s*)/.exec(t);return r?r[1].length:0}function isMarkdownFence(t){return/^\s*```/.test(t||"")}function isMarkdownHeading(t){return/^\s{0,3}#{1,6}\s+/.test(t||"")}function isMarkdownHorizontalRule(t){var r=String(t||"").trim();return/^(\*\s*){3,}$/.test(r)||/^(-\s*){3,}$/.test(r)||/^(_\s*){3,}$/.test(r)}function isMarkdownBlockquote(t){return/^\s{0,3}>/.test(t||"")}function splitMarkdownTableRow(t){var r=String(t||"").replace(/^\s+|\s+$/g,""),e=[],n="",i=!1,a=r.charAt(0)==="|",o=r.charAt(r.length-1)==="|";a&&(r=r.substring(1)),o&&(r=r.substring(0,r.length-1));for(var u=0;u<r.length;u++){var f=r.charAt(u);if(i){n+=f,i=!1;continue}if(f==="\\"){n+=f,i=!0;continue}if(f==="|"){e.push(n.replace(/^\s+|\s+$/g,"")),n="";continue}n+=f}return e.push(n.replace(/^\s+|\s+$/g,"")),e}function isMarkdownTableDelimiterCell(t){return/^:?-{3,}:?$/.test(String(t||"").replace(/\s+/g,""))}function parseMarkdownTableAlignment(t){var r=String(t||"").replace(/\s+/g,"");return/^:-{3,}:$/.test(r)?"center":/^:-{3,}$/.test(r)?"left":/^-{3,}:$/.test(r)?"right":""}function getMarkdownTableMatch(t,r){if(!t||r+1>=t.length)return null;var e=t[r],n=t[r+1];if(isMarkdownBlankLine(e)||isMarkdownBlankLine(n)||isMarkdownBlockStarter(e)||isMarkdownFence(e)||isMarkdownHeading(e)||isMarkdownHorizontalRule(e)||isMarkdownBlockquote(e)||String(e).indexOf("|")===-1||String(n).indexOf("|")===-1)return null;var i=splitMarkdownTableRow(e),a=splitMarkdownTableRow(n);if(!i.length||i.length!==a.length)return null;for(var o=0;o<a.length;o++)if(!isMarkdownTableDelimiterCell(a[o]))return null;return{alignments:a.map(parseMarkdownTableAlignment),headerCells:i,columnCount:i.length}}function isMarkdownBlockStarter(t){return isMarkdownFence(t)||isMarkdownHeading(t)||isMarkdownHorizontalRule(t)||isMarkdownBlockquote(t)||!!getMarkdownListMatch(t)}function isMarkdownBlankLine(t){return String(t||"").trim()===""}function parseMarkdownBlocksFromLines(t){return parseMarkdownBlocks({lines:t,index:0})}function parseMarkdownBlocks(t){for(var r=[];t.index<t.lines.length;){var e=t.lines[t.index];if(isMarkdownBlankLine(e)){t.index++;continue}if(isMarkdownFence(e)){r.push(parseMarkdownCodeBlock(t));continue}if(isMarkdownHeading(e)){r.push(parseMarkdownHeading(t));continue}if(isMarkdownHorizontalRule(e)){t.index++,r.push(createNode("horizontalRule"));continue}if(isMarkdownBlockquote(e)){r.push(parseMarkdownBlockquote(t));continue}var n=getMarkdownTableMatch(t.lines,t.index);if(n){r.push(parseMarkdownTable(t,n));continue}var i=getMarkdownListMatch(e);if(i){r.push(parseMarkdownList(t,i));continue}r.push(parseMarkdownParagraph(t))}return r}function parseMarkdownCodeBlock(t){var r=/^\s*```(.*)$/.exec(t.lines[t.index]||""),e=r&&r[1]?r[1].replace(/\s+$/,""):"",n=[];for(t.index++;t.index<t.lines.length&&!isMarkdownFence(t.lines[t.index]);)n.push(t.lines[t.index]),t.index++;return t.index<t.lines.length&&t.index++,createNode("codeBlock",{attrs:e?{language:e}:void 0,text:n.join(`
|
|
4
|
+
`)})}function parseMarkdownHeading(t){var r=/^\s{0,3}(#{1,6})\s+(.*)$/.exec(t.lines[t.index]||""),e=r?r[1].length:1,n=r?r[2].replace(/\s+#+\s*$/,""):"";return t.index++,createNode("heading",{attrs:{level:e},content:parseMarkdownInline(n,[])})}function parseMarkdownBlockquote(t){for(var r=[];t.index<t.lines.length;){var e=t.lines[t.index];if(isMarkdownBlankLine(e)){r.push(""),t.index++;continue}if(!isMarkdownBlockquote(e))break;r.push(String(e).replace(/^\s{0,3}>\s?/,"")),t.index++}return createNode("blockquote",{content:parseMarkdownBlocksFromLines(r)})}function parseMarkdownList(t,r){for(var e=[],n=r.ordered,i=r.indent,a=r.start,o=!n&&r.taskState!==null;t.index<t.lines.length;){var u=getMarkdownListMatch(t.lines[t.index]);if(!u||u.indent!==i||u.ordered!==n||!!o!=(u.taskState!==null))break;e.push(parseMarkdownListItem(t,u,o))}return createNode(o?"taskList":n?"orderedList":"bulletList",{attrs:n&&a!==1?{start:a}:void 0,content:e})}function parseMarkdownListItem(t,r,e){var n=[r.text];for(t.index++;t.index<t.lines.length;){var i=t.lines[t.index];if(isMarkdownBlankLine(i)){n.push(""),t.index++;continue}var a=getMarkdownListMatch(i);if(a&&a.indent===r.indent&&a.ordered===r.ordered)break;var o=getMarkdownLineIndent(i);if(o>r.indent){n.push(stripMarkdownIndent(i,r.contentIndent)),t.index++;continue}if(r.indent===0&&!a&&!isMarkdownBlockStarter(i)){n.push(i),t.index++;continue}break}var u=parseMarkdownBlocksFromLines(n);return u.length||(u=[createNode("paragraph",{content:parseMarkdownInline(r.text,[])})]),createNode(e?"taskItem":"listItem",{attrs:e?{checked:!!r.taskState}:void 0,content:u})}function parseMarkdownParagraph(t){for(var r=[];t.index<t.lines.length;){var e=t.lines[t.index];if(isMarkdownBlankLine(e)||r.length&&isMarkdownBlockStarter(e))break;r.push(e),t.index++}return createNode("paragraph",{content:parseMarkdownParagraphLines(r)})}function parseMarkdownTable(t,r){var e=[];for(e.push(createNode("tableRow",{content:parseMarkdownTableCells(r.headerCells,!0,r.alignments)})),t.index+=2;t.index<t.lines.length;){var n=t.lines[t.index];if(isMarkdownBlankLine(n)||String(n).indexOf("|")===-1)break;var i=splitMarkdownTableRow(n);if(i.length!==r.columnCount)break;e.push(createNode("tableRow",{content:parseMarkdownTableCells(i,!1,r.alignments)})),t.index++}return createNode("table",{content:e})}function parseMarkdownTableCells(t,r,e){for(var n=[],i=0;i<t.length;i++){var a=r?{header:!0}:void 0,o=e&&e[i];o&&(a=a||{},a.align=o),n.push(createNode("tableCell",{attrs:a,content:[createNode("paragraph",{content:parseMarkdownInline(t[i],[])})]}))}return n}function parseMarkdownParagraphLines(t){for(var r=[],e=!1,n=0;n<t.length;n++){var i=String(t[n]||""),a=!1;/\\$/.test(i)?(i=i.replace(/\\$/,""),a=!0):/\s{2,}$/.test(i)&&(i=i.replace(/\s+$/,""),a=!0),r.length&&r.push(e?createNode("hardBreak"):createNode("text",{text:" "})),r=r.concat(parseMarkdownInline(i,[])),e=a}return mergeAdjacentTextNodes(r)}function isMarkdownEscaped(t,r){for(var e=0,n=r-1;n>=0&&t.charAt(n)==="\\";n--)e++;return e%2===1}function findMarkdownClosingDelimiter(t,r,e){for(var n=e;n<t.length;){var i=t.indexOf(r,n);if(i<0)return-1;if(!isMarkdownEscaped(t,i))return i;n=i+r.length}return-1}function createMarkdownTextNode(t,r){return t?createNode("text",{text:t,marks:cloneMarks(r||[])}):null}function parseMarkdownInline(t,r){for(var e=String(t||""),n=[],i=0;i<e.length;){if(e.charAt(i)==="\\"&&i+1<e.length){var a=createMarkdownTextNode(e.charAt(i+1),r);a&&n.push(a),i+=2;continue}if(e.substr(i,2)==="!["){var o=parseMarkdownImage(e,i);if(o){n.push(createNode("image",{attrs:{src:o.src,alt:o.alt}})),i=o.nextIndex;continue}}if(e.charAt(i)==="["){var u=parseMarkdownLink(e,i);if(u){var f=appendMark(r||[],{type:"link",attrs:{href:u.href}});n=n.concat(parseMarkdownInline(u.label,f)),i=u.nextIndex;continue}}if(e.charAt(i)==="`"){var s=findMarkdownClosingDelimiter(e,"`",i+1);if(s>i+1){n.push(createNode("text",{text:e.substring(i+1,s),marks:appendMark(r||[],{type:"code"})})),i=s+1;continue}}var p=e.substr(i,2);if(p==="**"||p==="__"){var c=findMarkdownClosingDelimiter(e,p,i+2);if(c>i+2){n=n.concat(parseMarkdownInline(e.substring(i+2,c),appendMark(r||[],{type:"bold"}))),i=c+2;continue}}var g=e.charAt(i);if(g==="*"||g==="_"){var l=findMarkdownClosingDelimiter(e,g,i+1);if(l>i+1){n=n.concat(parseMarkdownInline(e.substring(i+1,l),appendMark(r||[],{type:"italic"}))),i=l+1;continue}}var h=findNextMarkdownSpecial(e,i+1),y=e.substring(i,h<0?e.length:h),v=createMarkdownTextNode(y,r);v&&n.push(v),i=h<0?e.length:h}return mergeAdjacentTextNodes(n)}function parseMarkdownImage(t,r){var e=t.indexOf("]",r+2);if(e<0||t.charAt(e+1)!=="(")return null;var n=findMarkdownClosingDelimiter(t,")",e+2);if(n<0)return null;var i=normalizeInlineMarkdownLinkHref(t.substring(e+2,n));return i===null?null:{alt:t.substring(r+2,e),src:i,nextIndex:n+1}}function parseMarkdownLink(t,r){var e=t.indexOf("]",r+1);if(e<0||t.charAt(e+1)!=="(")return null;var n=findMarkdownClosingDelimiter(t,")",e+2);if(n<0)return null;var i=normalizeInlineMarkdownLinkHref(t.substring(e+2,n));return i===null?null:{label:t.substring(r+1,e),href:i,nextIndex:n+1}}function findNextMarkdownSpecial(t,r){for(var e=r;e<t.length;e++){var n=t.charAt(e);if(n==="\\"||n==="["||n==="*"||n==="_"||n==="`"||n==="!"&&t.charAt(e+1)==="[")return e}return-1}function fromMarkdown(t){var r=normalizeMarkdownSource(t),e=parseMarkdownBlocksFromLines(r.split(`
|
|
5
|
+
`)),n=serializeBlockNodes(e);return{type:"doc",version:2,format:"richtexteditor-json",html:n,text:getPlainTextFromHtml(n),content:e}}function escapeMarkdownText(t){return String(t||"").replace(/([\\`*_\\[\\]])/g,"\\$1")}function escapeMarkdownCodeText(t){return String(t||"").replace(/\\/g,"\\\\").replace(/`/g,"\\`")}function wrapMarkdownMark(t,r){if(!r||!r.type)return t;if(r.type==="bold")return"**"+t+"**";if(r.type==="italic")return"*"+t+"*";if(r.type==="strike")return"~~"+t+"~~";if(r.type==="code")return"`"+escapeMarkdownCodeText(t)+"`";if(r.type==="link"&&r.attrs&&r.attrs.href)return"["+t+"]("+String(r.attrs.href)+")";if(r.type==="underline")return"<u>"+t+"</u>";if(r.type==="subscript")return"<sub>"+t+"</sub>";if(r.type==="superscript")return"<sup>"+t+"</sup>";if(r.type==="textStyle"){var e=buildStyleString(r.attrs||{});return e?'<span style="'+escapeAttribute(e)+'">'+t+"</span>":t}return t}function serializeMarkdownInlineNodes(t){for(var r="",e=0;e<t.length;e++){var n=t[e];if(n){if(n.type==="text"){for(var i=!1,a=n.marks||[],o=0;o<a.length;o++)if(a[o].type==="code"){i=!0;break}for(var u=i?String(n.text||""):escapeMarkdownText(n.text||""),f=0;f<a.length;f++)u=wrapMarkdownMark(u,a[f]);r+=u;continue}if(n.type==="hardBreak"){r+=`
|
|
6
|
+
`;continue}if(n.type==="mergeField"){var s=n.attrs||{};r+="{{"+String(s.name||s.label||"")+"}}";continue}if(n.type==="footnoteReference"){var p=n.attrs||{};r+="[^"+String(p.number||1)+"]";continue}if(n.type==="image"){var c=n.attrs||{};r+="+")";continue}if(n.type==="htmlInline"){r+=n.html||"";continue}if(isArray(n.content)){r+=serializeMarkdownInlineNodes(n.content);continue}r+=serializeNode(n,!0)}}return r}function normalizeMarkdownListItemText(t){return String(t||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}function escapeMarkdownTableCellText(t){return String(t||"").replace(/\\/g,"\\\\").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>")}function isSimpleMarkdownTableCell(t){if(!t||t.type!=="tableCell"||t.attrs&&(t.attrs.colspan||t.attrs.rowspan))return!1;var r=t.content||[];if(r.length!==1||r[0].type!=="paragraph")return!1;for(var e=r[0].content||[],n=0;n<e.length;n++){var i=e[n];if(i&&i.type!=="hardBreak"&&i.type!=="text"&&i.type!=="image"&&i.type!=="htmlInline")return!1}return!0}function serializeMarkdownTable(t){var r=t&&t.content?t.content:[];if(!r.length)return"";var e=r[0];if(!e||e.type!=="tableRow"||!e.content||!e.content.length)return"";for(var n=e.content.length,i=[],a=0;a<r.length;a++){var o=r[a];if(!o||o.type!=="tableRow"||!o.content||o.content.length!==n)return"";for(var u=[],f=0;f<o.content.length;f++){var s=o.content[f];if(!isSimpleMarkdownTableCell(s))return"";u.push(escapeMarkdownTableCellText(serializeMarkdownInlineNodes(s.content[0].content||[])))}i.push(u)}for(var p=i[0],c=[],g=0;g<n;g++){var l=e.content[g],h=l&&l.attrs&&l.attrs.align?String(l.attrs.align).toLowerCase():"";if(!h&&r.length>1){var y=r[1]&&r[1].content?r[1].content[g]:null;h=y&&y.attrs&&y.attrs.align?String(y.attrs.align).toLowerCase():""}if(h==="left"){c.push(":---");continue}if(h==="center"){c.push(":---:");continue}if(h==="right"){c.push("---:");continue}c.push("---")}for(var v=["| "+p.join(" | ")+" |","| "+c.join(" | ")+" |"],b=1;b<i.length;b++)v.push("| "+i[b].join(" | ")+" |");return v.join(`
|
|
7
|
+
`)}function indentMarkdown(t,r){var e=String(t||"");return e?r+e.replace(/\n/g,`
|
|
8
|
+
`+r):""}function serializeMarkdownListItem(t,r){if(!t.length)return r.trim();var e=t[0],n="",i=[];if(e.type==="paragraph"?(n=r+normalizeMarkdownListItemText(serializeMarkdownInlineNodes(e.content||[])),i=t.slice(1)):(n=r.trim(),i=t.slice()),!i.length)return n;var a=serializeMarkdownBlocks(i);return a?n+`
|
|
9
|
+
`+indentMarkdown(a,new Array(r.length+1).join(" ")):n}function serializeMarkdownFootnoteItem(t){var r=t&&t.attrs?t.attrs:{},e=String(r.number||1),n=t&&t.content?t.content:[];if(!n.length)return"[^"+e+"]:";var i=n[0],a=n.slice(1),o="[^"+e+"]:";if(i.type==="paragraph"?o+=" "+normalizeMarkdownListItemText(serializeMarkdownInlineNodes(i.content||[])):a=n.slice(),!a.length)return o;var u=serializeMarkdownBlocks(a);return u?o+`
|
|
10
|
+
`+indentMarkdown(u," "):o}function serializeMarkdownBlocks(t){for(var r=[],e=0;e<t.length;e++){var n=t[e];if(n){if(n.type==="paragraph"){if(n.attrs&&normalizeTextAlignment(n.attrs.align,!0)){r.push(serializeNode(n,!1));continue}r.push(serializeMarkdownInlineNodes(n.content||[]));continue}if(n.type==="heading"){var i=n.attrs&&n.attrs.level?parseInt(n.attrs.level,10):1;if((!i||i<1)&&(i=1),i>6&&(i=6),n.attrs&&normalizeTextAlignment(n.attrs.align,!0)){r.push(serializeNode(n,!1));continue}r.push(new Array(i+1).join("#")+" "+serializeMarkdownInlineNodes(n.content||[]));continue}if(n.type==="blockquote"){var a=serializeMarkdownBlocks(n.content||[]);r.push(a?indentMarkdown(a,"> "):">");continue}if(n.type==="codeBlock"){var o=n.attrs&&(n.attrs.language||n.attrs.lang)?String(n.attrs.language||n.attrs.lang):"";r.push("```"+o+`
|
|
11
|
+
`+String(n.text||"")+"\n```");continue}if(n.type==="bulletList"||n.type==="orderedList"){for(var u=[],f=n.type==="orderedList"&&n.attrs&&n.attrs.start&&parseInt(n.attrs.start,10)||1,s=n.content||[],p=0;p<s.length;p++){var c=n.type==="orderedList"?f+p+". ":"- ";u.push(serializeMarkdownListItem(s[p].content||[],c))}r.push(u.join(`
|
|
12
|
+
`));continue}if(n.type==="taskList"){for(var g=[],l=n.content||[],h=0;h<l.length;h++){var y="- ["+(l[h]&&l[h].attrs&&l[h].attrs.checked?"x":" ")+"] ";g.push(serializeMarkdownListItem(l[h].content||[],y))}r.push(g.join(`
|
|
13
|
+
`));continue}if(n.type==="horizontalRule"){r.push("---");continue}if(n.type==="pageBreak"){r.push(serializeNode(n,!1));continue}if(n.type==="tableOfContents"){var v=n.attrs||{},b=isArray(v.items)?v.items:[],m=[],N=v.ordered===!0;v.includeTitle!==!1&&v.title&&m.push("**"+escapeMarkdownText(String(v.title))+"**");for(var k=0;k<b.length;k++){var d=b[k]||{},M=new Array(Math.max(0,(parseInt(d.level,10)||1)-1)*3+1).join(" "),x=N?"1.":"-";m.push(M+x+" ["+escapeMarkdownText(String(d.text||""))+"](#"+String(d.id||"")+")")}r.push(m.join(`
|
|
14
|
+
`));continue}if(n.type==="footnotes"){for(var L=[],C=n.content||[],S=0;S<C.length;S++)L.push(serializeMarkdownFootnoteItem(C[S]));r.push(L.join(`
|
|
15
|
+
`));continue}if(n.type==="image"){var w=n.attrs||{};r.push("+")");continue}if(n.type==="table"){var O=serializeMarkdownTable(n);r.push(O||serializeNode(n,!1));continue}if(n.type==="htmlBlock"){r.push(n.html||"");continue}r.push(serializeNode(n,!1))}}return r.join(`
|
|
16
|
+
|
|
17
|
+
`).replace(/\n{3,}/g,`
|
|
18
|
+
|
|
19
|
+
`)}function toMarkdown(t){var r=createStructuredDocument(t);return serializeMarkdownBlocks(r.content||[]).replace(/^\s+|\s+$/g,"")}function renderHTML(t){return serializeStructuredContent(t)}function installStructuredContentBridge(){var t=ensureRichTextEditorConstructor();return t.prototype.getJSON=function(){return createStructuredContent(this)},t.prototype.setJSON=function(r){return this.setHTMLCode(serializeStructuredContent(r)),this},t.fromMarkdown=fromMarkdown,t.getDocumentPageSetup=getDocumentPageSetup,t.getDocumentMetrics=getDocumentMetrics,t.getDocumentOutline=getDocumentOutline,t.getFootnotes=getFootnotes,t.getTableOfContents=getTableOfContents,t.repairAccessibilityIssue=repairAccessibilityIssue,t.renderHTML=renderHTML,t.setDocumentPageSetup=setDocumentPageSetup,t.syncTableOfContents=syncTableOfContents,t.toMarkdown=toMarkdown,t.auditAccessibility=auditAccessibility,t.validateStructuredContent=validateStructuredContent,t.prototype.getDocumentPageSetup=function(){return getDocumentPageSetup(this.getJSON())},t.prototype.setDocumentPageSetup=function(r){return this.setJSON(setDocumentPageSetup(this.getJSON(),r)),this},t.prototype.getDocumentMetrics=function(){return getDocumentMetrics(this.getJSON())},t.prototype.getFootnotes=function(){return getFootnotes(this.getJSON())},t.prototype.getTextStatistics=function(){var r="";try{r=this.getSelectedText&&this.getSelectedText()||""}catch{}return getTextStatistics(this.getJSON(),{selectionText:r})},t.prototype.getSelectionStatistics=function(){var r="";try{r=this.getSelectedText&&this.getSelectedText()||""}catch{}return getTextStatistics(r,{selectionText:r})},t}function ensureStylesheet(t){if(!document.querySelector('link[data-rte-style="'+t+'"]')){var r=document.createElement("link");r.rel="stylesheet",r.href=t,r.setAttribute("data-rte-style",t),document.head.appendChild(r)}}function loadScript(t){return new Promise(function(r,e){var n=document.querySelector('script[data-rte-script="'+t+'"]');if(n){if(n.getAttribute("data-rte-loaded")==="true"){r(n);return}n.addEventListener("load",function(){r(n)},{once:!0}),n.addEventListener("error",function(){e(new Error("Failed to load "+t))},{once:!0});return}var i=document.createElement("script");i.src=t,i.async=!1,i.setAttribute("data-rte-script",t),i.onload=function(){i.setAttribute("data-rte-loaded","true"),r(i)},i.onerror=function(){e(new Error("Failed to load "+t))},document.head.appendChild(i)})}function trimTrailingSlash(t){return t?t.replace(/\/+$/,""):""}function loadRichTextEditorAssets(t){ensureBrowserEnvironment();var r=trimTrailingSlash(t&&t.basePath?t.basePath:"/richtexteditor");return window.RichTextEditor?Promise.resolve(installStructuredContentBridge()):(pendingLoadsByBasePath[r]||(ensureStylesheet(r+"/rte_theme_default.css"),pendingLoadsByBasePath[r]=loadScript(r+"/rte.js").then(function(){return loadScript(r+"/plugins/all_plugins.js")}).then(function(){return installStructuredContentBridge()})),pendingLoadsByBasePath[r])}function createEditor(t,r){return installStructuredContentBridge(),new window.RichTextEditor(t,r||{})}function getEditorValue(t,r){return r==="json"?t.getJSON():t.getHTMLCode()}function setEditorValue(t,r,e){if(e==="json"){t.setJSON(r);return}t.setHTMLCode(serializeStructuredContent(r))}window.RichTextEditorStructuredBridge={createEditor,createStructuredDocument,createStructuredContent,ensureRichTextEditorConstructor,fromMarkdown,getEditorValue,installStructuredContentBridge,loadRichTextEditorAssets,normalizeStructuredContent,parseStructuredContentHtml,renderHTML,serializeStructuredContent,setEditorValue,toMarkdown,validateStructuredContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_tableofcontents=RTE_Plugin_TableOfContents,typeof RTE_DefaultConfig.tocTitle>"u"&&(RTE_DefaultConfig.tocTitle="Contents"),typeof RTE_DefaultConfig.tocMinLevel>"u"&&(RTE_DefaultConfig.tocMinLevel=1),typeof RTE_DefaultConfig.tocMaxLevel>"u"&&(RTE_DefaultConfig.tocMaxLevel=3),typeof RTE_DefaultConfig.tocPageNumbers>"u"&&(RTE_DefaultConfig.tocPageNumbers="auto");function RTE_Plugin_TableOfContents(){var l=this,s,n,L=null,E=!1,j=0;l.PluginName="TableOfContents",l.InitConfig=function(t){s=t},l.InitEditor=function(t){n=t,n.attachEvent("exec_command_inserttoc",function(e){e.returnValue=!0,l.Insert()}),p();try{n.attachEvent("ready",p)}catch{}try{n.attachEvent("aftersethtml",function(){p(),d()})}catch{}setTimeout(function(){p(),d()},0),n.insertTableOfContents=function(){return l.Insert()},n.updateTableOfContents=function(){return b()},n.removeTableOfContents=function(){return l.Remove()},n.hasTableOfContents=function(){return!!v()},n.getTableOfContents=function(){return l.List()},n.getTocCss=function(){return A()}};function p(){var t=x();if(t&&(F(t),t!==L)){L=t;var e=h();e&&(e.addEventListener("keyup",d),e.addEventListener("cut",d),e.addEventListener("paste",d),e.addEventListener("drop",d),e.addEventListener("click",function(a){var r=B(a.target,"rte-toc-link",e);if(r){a.preventDefault();var i=e.querySelector("#"+H(r.getAttribute("data-toc-target")));if(i)try{i.scrollIntoView({block:"center"})}catch{i.scrollIntoView()}}}))}}function x(){try{return n.getDocument()}catch{return null}}function h(){try{return n.getEditable()}catch{return null}}function d(){E||(E=!0,setTimeout(function(){E=!1,b()},0))}function B(t,e,a){for(;t&&t!==a;){if(t.nodeType===1&&t.classList&&t.classList.contains(e))return t;t=t.parentNode}return null}function H(t){return String(t||"").replace(/["\\\]\[]/g,"\\$&")}function v(){var t=h();return t?t.querySelector("nav.rte-toc"):null}function _(){var t=Math.max(1,Math.min(6,parseInt(s.tocMinLevel,10)||1)),e=Math.max(t,Math.min(6,parseInt(s.tocMaxLevel,10)||3));return{min:t,max:e}}function Y(){var t=h();if(!t)return[];for(var e=_(),a=[],r=e.min;r<=e.max;r++)a.push("h"+r);for(var i=t.querySelectorAll(a.join(",")),o=[],c=0;c<i.length;c++){var u=i[c];u.closest&&(u.closest("nav.rte-toc")||u.closest("section.rte-footnotes"))||(u.textContent||"").trim()&&o.push(u)}return o}function $(t){var e=t.getAttribute("id");return e&&e.indexOf("rte-h-")===0||e||(e="rte-h-"+Math.floor(Math.random()*1e9).toString(36)+(j++).toString(36),t.setAttribute("id",e)),e}function z(){var t=s.tocPageNumbers;if(t===!1||typeof n.getPageOfElement!="function")return!1;if(t===!0)return!0;try{return typeof n.isPageView=="function"&&n.isPageView()}catch{return!1}}l.Insert=function(){var t=x(),e=h();if(!t||!e)return!1;var a=v();if(a)return b(),!0;var r=t.createElement("nav");r.className="rte-toc",r.setAttribute("contenteditable","false"),r.setAttribute("data-rte-toc","1");var i=!1;try{typeof n.insertElement=="function"&&(n.insertElement(r),i=!0)}catch{}return i||e.insertBefore(r,e.firstChild),b(),R(),!0},l.Remove=function(){var t=v();return!t||!t.parentNode?!1:(t.parentNode.removeChild(t),R(),!0)};function b(){var t=v();if(!t)return[];var e=x();if(!e)return[];for(var a=Y(),r=_(),i=z(),o={},c=t.querySelectorAll("li.rte-toc-item"),u=0;u<c.length;u++){var w=c[u].querySelector("a.rte-toc-link"),q=c[u].querySelector(".rte-toc-page");if(w&&q){var M=parseInt(q.textContent,10);M&&(o[w.getAttribute("data-toc-target")]=M)}}for(;t.firstChild;)t.removeChild(t.firstChild);var P=String(s.tocTitle==null?"":s.tocTitle);if(P){var T=e.createElement("div");T.className="rte-toc-title",T.textContent=P,t.appendChild(T)}if(!a.length){var N=e.createElement("div");return N.className="rte-toc-empty",N.textContent="No headings yet.",t.appendChild(N),[]}var S=e.createElement("ol");S.className="rte-toc-list";for(var k=[],D=0;D<a.length;D++){var C=a[D],O=parseInt(C.nodeName.substring(1),10)||1,m=$(C),V=(C.textContent||"").trim(),y=e.createElement("li");y.className="rte-toc-item rte-toc-l"+(O-r.min+1);var g=e.createElement("a");g.className="rte-toc-link",g.setAttribute("href","#"+m),g.setAttribute("data-toc-target",m),g.textContent=V,y.appendChild(g);var f=null;if(i)try{f=n.getPageOfElement(C)}catch{f=null}if(!f&&o[m]&&(f=o[m]),f){var I=e.createElement("span");I.className="rte-toc-page",I.textContent=String(f),y.appendChild(I)}S.appendChild(y),k.push({id:m,level:O,text:V,page:f})}return t.appendChild(S),k}l.List=function(){var t=v();if(!t)return[];for(var e=t.querySelectorAll("li.rte-toc-item"),a=[],r=0;r<e.length;r++){var i=e[r].querySelector("a.rte-toc-link"),o=e[r].querySelector(".rte-toc-page"),c=e[r].className.match(/rte-toc-l(\d+)/);a.push({id:i?i.getAttribute("data-toc-target"):null,level:c?parseInt(c[1],10):1,text:i?i.textContent:"",page:o?parseInt(o.textContent,10):null})}return a};function R(){try{typeof n.updateDesign=="function"&&n.updateDesign()}catch{}try{typeof n.fireChange=="function"&&n.fireChange()}catch{}}function A(){return"nav.rte-toc{margin:0 0 1.4em;padding:.9em 1.1em;border:1px solid #ddd;border-radius:6px;background:#fafbfc;}nav.rte-toc .rte-toc-title{font-weight:700;margin-bottom:.45em;}nav.rte-toc .rte-toc-empty{color:#888;font-style:italic;}ol.rte-toc-list{list-style:none;margin:0;padding:0;counter-reset:rte-toc;}ol.rte-toc-list>li{counter-increment:rte-toc;margin:.16em 0;display:flex;align-items:baseline;gap:.5em;}ol.rte-toc-list>li>a{color:#1474ea;text-decoration:none;cursor:pointer;}ol.rte-toc-list>li>a:hover{text-decoration:underline;}ol.rte-toc-list>li:has(>.rte-toc-page)>a::after{content:'';flex:1 1 auto;margin:0 .4em;border-bottom:1px dotted #bbb;transform:translateY(-.25em);display:inline-block;min-width:1.5em;}ol.rte-toc-list>li>a{flex:1 1 auto;display:flex;align-items:baseline;}.rte-toc-page{flex:0 0 auto;color:#666;font-variant-numeric:tabular-nums;}.rte-toc-l2{padding-left:1.3em;}.rte-toc-l3{padding-left:2.6em;}.rte-toc-l4{padding-left:3.9em;}.rte-toc-l5{padding-left:5.2em;}.rte-toc-l6{padding-left:6.5em;}"}function F(t){if(t){var e=t.getElementById("rte-toc-styles"),a=A();if(e){if(e.getAttribute("data-css")===a)return;e.parentNode&&e.parentNode.removeChild(e)}var r=t.createElement("style");r.id="rte-toc-styles",r.setAttribute("data-css",a),r.appendChild(t.createTextNode(a)),(t.head||t.getElementsByTagName("head")[0]||t.documentElement).appendChild(r),n&&typeof n.ensureStyleSheetLive=="function"&&n.ensureStyleSheetLive(t,r,"rte-toc-styles",r.textContent)}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_tabletools=RTE_Plugin_TableTools,typeof RTE_DefaultConfig.tableNumberSeries>"u"&&(RTE_DefaultConfig.tableNumberSeries="numeric"),typeof RTE_DefaultConfig.tableNumberHeader>"u"&&(RTE_DefaultConfig.tableNumberHeader="#");function RTE_Plugin_TableTools(){var o=this,g,u;o.PluginName="TableTools",o.InitConfig=function(r){g=r},o.InitEditor=function(r){u=r,u.attachEvent("exec_command_sorttable",function(e){e.returnValue=!0,o.SortAtCaret(e&&e.value==="desc"?"desc":"asc")}),u.attachEvent("exec_command_tablerownumbers",function(e){e.returnValue=!0,o.ToggleRowNumbers()}),u.sortTableByColumn=function(e,t){return o.Sort(c(),e,t)},u.sortTableAtCaret=function(e){return o.SortAtCaret(e)},u.canSortTable=function(){return A(c())},u.addTableRowNumbers=function(e){return o.AddRowNumbers(e)},u.removeTableRowNumbers=function(){return o.RemoveRowNumbers()},u.hasTableRowNumbers=function(){var e=c();return!!(e&&e.querySelector("[data-rte-rownum]"))}};function R(){try{return u.getEditable()}catch{return null}}function c(){try{var r=u.getSelection();if(!r||r.rangeCount===0)return null;var e=r.getRangeAt(0).startContainer;e&&e.nodeType===3&&(e=e.parentNode);for(var t=R();e&&e!==t;){if(e.nodeName==="TABLE")return e;e=e.parentNode}return null}catch{return null}}function _(){try{var r=u.getSelection();if(!r||r.rangeCount===0)return null;var e=r.getRangeAt(0).startContainer;e&&e.nodeType===3&&(e=e.parentNode);for(var t=R();e&&e!==t;){if(e.nodeName==="TD"||e.nodeName==="TH")return e;e=e.parentNode}return null}catch{return null}}function y(r){if(!r)return[];for(var e=Array.prototype.slice.call(r.rows||[]),t=[],a=0;a<e.length;a++){var n=e[a],l=n.parentNode?n.parentNode.nodeName:"";l==="THEAD"||l==="TFOOT"||t.length===0&&a===0&&n.cells.length&&L(n)||t.push(n)}return t}function L(r){for(var e=0;e<r.cells.length;e++)if(r.cells[e].nodeName!=="TH")return!1;return!0}function A(r){if(!r)return{ok:!1,reason:"The caret is not inside a table."};var e=y(r);if(e.length<2)return{ok:!1,reason:"The table has fewer than two sortable rows."};for(var t=0;t<e.length;t++)for(var a=0;a<e[t].cells.length;a++){var n=e[t].cells[a];if((n.rowSpan||1)>1||(n.colSpan||1)>1)return{ok:!1,reason:"This table has merged cells. Sorting would move rows out from under a rowspan and break the table, so it has been left alone."}}return{ok:!0,reason:""}}function E(r){var e=String(r??"").trim();if(!e)return{type:"empty",v:""};if(/\d/.test(e)){var t=e.replace(/[\s ,]/g,"").replace(/^\(([^)]*)\)$/,"-$1").replace(/[^0-9.eE+-]/g,"");if(t&&/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(t))return{type:"number",v:parseFloat(t)};var a=Date.parse(e);if(!isNaN(a))return{type:"date",v:a}}return{type:"text",v:e.toLowerCase()}}function V(r,e){for(var t={number:0,date:0,text:0},a=0;a<r.length;a++){var n=r[a].cells[e];if(n){var l=E(n.textContent);l.type!=="empty"&&t[l.type]++}}return t.number>=t.date&&t.number>=t.text&&t.number>0?"number":t.date>=t.text&&t.date>0?"date":"text"}o.SortAtCaret=function(r){var e=c(),t=_();return!e||!t?!1:o.Sort(e,t.cellIndex,r)},o.Sort=function(r,e,t){var a=A(r);if(!a.ok)return a;for(var n=String(t).toLowerCase()==="desc",l=y(r),s=V(l,e),i=[],f=0;f<l.length;f++){var m=l[f].cells[e];i.push({row:l[f],order:f,val:E(m?m.textContent:"")})}i.sort(function(v,d){if(v.val.type==="empty"&&d.val.type==="empty")return v.order-d.order;if(v.val.type==="empty")return 1;if(d.val.type==="empty")return-1;var h;if(s==="number"||s==="date"){var x=v.val.type===s?v.val.v:Number.POSITIVE_INFINITY,H=d.val.type===s?d.val.v:Number.POSITIVE_INFINITY;h=x<H?-1:x>H?1:0}else{var w=String(v.val.v),S=String(d.val.v);h=w.localeCompare?w.localeCompare(S,void 0,{numeric:!0,sensitivity:"base"}):w<S?-1:w>S?1:0}return h===0?v.order-d.order:n?-h:h});var p=i.length?i[0].row.parentNode:null;if(!p)return{ok:!1,reason:"The table has no sortable rows."};for(var b=_(),T=0;T<i.length;T++)p.appendChild(i[T].row);return K(b),C(r),N(),{ok:!0,reason:"",sortedBy:e,direction:n?"desc":"asc",detectedType:s}};function q(r,e){switch(String(e)){case"upper-alpha":return I(r).toUpperCase();case"lower-alpha":return I(r);case"upper-roman":return D(r);case"lower-roman":return D(r).toLowerCase();default:return String(r)}}function I(r){for(var e="";r>0;){var t=(r-1)%26;e=String.fromCharCode(97+t)+e,r=Math.floor((r-1)/26)}return e||"a"}function D(r){for(var e=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],t="",a=0;a<e.length;a++)for(;r>=e[a][0];)t+=e[a][1],r-=e[a][0];return t||"I"}o.AddRowNumbers=function(r){var e=c();if(!e)return!1;if(e.querySelector("[data-rte-rownum]"))return C(e),!0;r=r||{};for(var t=r.series||g.tableNumberSeries,a=e.ownerDocument,n=Array.prototype.slice.call(e.rows||[]),l=y(e),s={},i=0;i<l.length;i++)s[k(l[i])]=!0;for(var f=0;f<n.length;f++){var m=n[f],p=s[k(m)],b=a.createElement(p?"td":"th");b.setAttribute("data-rte-rownum",p?"value":"header"),p||(b.textContent=String(g.tableNumberHeader==null?"#":g.tableNumberHeader)),m.insertBefore(b,m.firstChild)}return e.setAttribute("data-rte-rownum-series",t),C(e),N(),!0};var F=0;function k(r){return r.__rteKey||(r.__rteKey="r"+F++),r.__rteKey}o.RemoveRowNumbers=function(){var r=c();if(!r)return!1;var e=r.querySelectorAll("[data-rte-rownum]");if(!e.length)return!1;for(var t=0;t<e.length;t++)e[t].parentNode&&e[t].parentNode.removeChild(e[t]);return r.removeAttribute("data-rte-rownum-series"),N(),!0},o.ToggleRowNumbers=function(){var r=c();return r?r.querySelector("[data-rte-rownum]")?o.RemoveRowNumbers():o.AddRowNumbers():!1};function C(r){if(r)for(var e=r.getAttribute("data-rte-rownum-series")||g.tableNumberSeries,t=y(r),a=1,n=0;n<t.length;n++){var l=t[n].querySelector("[data-rte-rownum='value']");l&&(l.textContent=q(a++,e))}}function K(r){if(!(!r||!r.parentNode))try{var e=r.ownerDocument,t=e.createRange();t.selectNodeContents(r),t.collapse(!0);var a=u.getSelection();a.removeAllRanges(),a.addRange(t)}catch{}}function N(){try{typeof u.updateDesign=="function"&&u.updateDesign()}catch{}try{typeof u.fireChange=="function"&&u.fireChange()}catch{}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_textdirection=RTE_Plugin_TextDirection,typeof RTE_DefaultConfig.defaultTextDirection>"u"&&(RTE_DefaultConfig.defaultTextDirection=null),typeof RTE_DefaultConfig.textDirectionAutoDetect>"u"&&(RTE_DefaultConfig.textDirectionAutoDetect=!1),typeof RTE_DefaultConfig.textDirectionSwapAlign>"u"&&(RTE_DefaultConfig.textDirectionSwapAlign=!0);function RTE_Plugin_TextDirection(){var u=this,l,i,D=null,d={P:1,DIV:1,LI:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,BLOCKQUOTE:1,TD:1,TH:1,PRE:1,UL:1,OL:1,TABLE:1,SECTION:1,ARTICLE:1},m=/[--ۿ܀-ݏݐ-ݿހ-߀-߿ࠀ-ࡀ-ࢠ-ࣿיִ-﷿ﹰ-]/,S=/[A-Za-zÀ-ʯͰ-֏ऀ-႟Ḁ-Ⰰ-ⷿ⺀-가-]/;u.PluginName="TextDirection",u.InitConfig=function(t){l=t},u.InitEditor=function(t){i=t,i.attachEvent("exec_command_textdirection",function(e){e.returnValue=!0;var r=e&&e.value;r==="rtl"||r==="ltr"?u.Apply(r):u.Toggle()}),s();try{i.attachEvent("ready",s)}catch{}try{i.attachEvent("aftersethtml",function(){s(),y()})}catch{}setTimeout(function(){s(),y()},0),i.setTextDirection=function(e){return u.Apply(e)},i.toggleTextDirection=function(){return u.Toggle()},i.getTextDirection=function(){return u.Current()},i.setBaseDirection=function(e){return u.Base(e)},i.getBaseDirection=function(){var e=f();return e&&e.getAttribute("dir")||"ltr"},i.detectTextDirection=function(e){return A(String(e??""))},i.autoDetectTextDirection=function(){return u.AutoDetect()},i.isolateBidi=function(e,r){return u.Isolate(e,r)},i.insertIsolated=function(e,r){return u.InsertIsolated(e,r)},i.getTextDirectionCss=function(){return E()}};function s(){var t=h();!t||t===D||(D=t,_(t))}function y(){var t=f();t&&((l.defaultTextDirection==="rtl"||l.defaultTextDirection==="ltr")&&(t.getAttribute("dir")||u.Base(l.defaultTextDirection)),l.textDirectionAutoDetect&&u.AutoDetect())}function h(){try{return i.getDocument()}catch{return null}}function f(){try{return i.getEditable()}catch{return null}}function A(t){for(var e=0;e<t.length;e++){var r=t.charAt(e);if(m.test(r))return"rtl";if(S.test(r))return"ltr"}return"neutral"}function T(){var t=f(),e=[];try{var r=i.getSelection();if(!r||r.rangeCount===0)return e;var n=r.getRangeAt(0),a=x(n.startContainer),o=x(n.endContainer);if(!a)return e;if(a===o||n.collapsed)return[a];for(var v=t.querySelectorAll("*"),b=!1,p=0;p<v.length;p++){var g=v[p];if(d[g.nodeName]&&(g===a&&(b=!0),b&&!C(g)&&e.push(g),g===o))break}e.length||e.push(a)}catch{}return e}function C(t){for(var e=0;e<t.children.length;e++)if(d[t.children[e].nodeName])return!0;return!1}function x(t){for(var e=f(),r=t&&t.nodeType===3?t.parentNode:t;r&&r!==e;){if(r.nodeType===1&&d[r.nodeName])return r;r=r.parentNode}return e&&e.firstElementChild?e.firstElementChild:null}u.Current=function(){var t=T()[0];if(!t)return i.getBaseDirection?i.getBaseDirection():"ltr";var e=t.getAttribute("dir");if(e)return e;try{var r=h(),n=r&&(r.defaultView||r.parentWindow);if(n)return n.getComputedStyle(t).direction||"ltr"}catch{}return"ltr"},u.Apply=function(t){t=t==="rtl"?"rtl":t==="auto"?"auto":"ltr";var e=T();if(!e.length)return!1;for(var r=0;r<e.length;r++){var n=e[r],a=n.getAttribute("dir")||"ltr";n.setAttribute("dir",t),l.textDirectionSwapAlign!==!1&&t!=="auto"&&a!==t&&R(n,t)}return c(),t},u.Toggle=function(){return u.Apply(u.Current()==="rtl"?"ltr":"rtl")};function R(t,e){var r=t.style&&t.style.textAlign||t.getAttribute("align")||"";if(r){var n=null;if(r==="left"?n="right":r==="right"&&(n="left"),!!n){var a=e==="rtl"?"right":"left";t.style&&(t.style.textAlign=n===a?"":n),t.getAttribute("align")&&t.removeAttribute("align")}}}u.Base=function(t){var e=f();return e?(t=t==="rtl"?"rtl":t==="auto"?"auto":"ltr",e.setAttribute("dir",t),c(),t):!1},u.AutoDetect=function(){var t=f();if(!t)return[];for(var e=[],r=t.querySelectorAll("*"),n=0;n<r.length;n++){var a=r[n];if(!(!d[a.nodeName]||C(a))){var o=A(a.textContent||"");o!=="neutral"&&a.getAttribute("dir")!==o&&(a.setAttribute("dir",o),e.push({tag:a.nodeName,dir:o}))}}return e.length&&c(),e},u.Isolate=function(t,e){var r=e==="rtl"||e==="ltr"?e:"auto";return'<bdi dir="'+r+'">'+String(t??"")+"</bdi>"},u.InsertIsolated=function(t,e){var r=h();if(!r)return!1;var n=r.createElement("bdi");n.setAttribute("dir",e==="rtl"||e==="ltr"?e:"auto"),n.innerHTML=String(t??"");try{if(typeof i.insertElement=="function")return i.insertElement(n),c(),!0}catch{}try{var a=i.getSelection();if(a&&a.rangeCount){var o=a.getRangeAt(0);return o.collapse(!1),o.insertNode(n),o.setStartAfter(n),o.collapse(!0),a.removeAllRanges(),a.addRange(o),c(),!0}}catch{}return!1};function c(){try{typeof i.updateDesign=="function"&&i.updateDesign()}catch{}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}}function E(){return"[dir='rtl'] ul,[dir='rtl'] ol{padding-right:1.6em;padding-left:0;}[dir='rtl'] blockquote{border-right:3px solid #ddd;border-left:0;padding-right:.9em;padding-left:0;margin-right:0;}[dir='rtl'] table{direction:rtl;}bdi{unicode-bidi:isolate;}"}function _(t){if(t){var e=t.getElementById("rte-textdirection-styles"),r=E();if(e){if(e.getAttribute("data-css")===r)return;e.parentNode&&e.parentNode.removeChild(e)}var n=t.createElement("style");n.id="rte-textdirection-styles",n.setAttribute("data-css",r),n.appendChild(t.createTextNode(r)),(t.head||t.getElementsByTagName("head")[0]||t.documentElement).appendChild(n),i&&typeof i.ensureStyleSheetLive=="function"&&i.ensureStyleSheetLive(t,n,"rte-textdirection-styles",n.textContent)}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_textpartlanguage=RTE_Plugin_TextPartLanguage,typeof RTE_DefaultConfig.textPartLanguages>"u"&&(RTE_DefaultConfig.textPartLanguages=[{code:"ar",label:"Arabic",dir:"rtl"},{code:"zh-Hans",label:"Chinese (Simplified)"},{code:"zh-Hant",label:"Chinese (Traditional)"},{code:"cs",label:"Czech"},{code:"nl",label:"Dutch"},{code:"en",label:"English"},{code:"fr",label:"French"},{code:"de",label:"German"},{code:"el",label:"Greek"},{code:"he",label:"Hebrew",dir:"rtl"},{code:"hi",label:"Hindi"},{code:"it",label:"Italian"},{code:"ja",label:"Japanese"},{code:"ko",label:"Korean"},{code:"fa",label:"Persian",dir:"rtl"},{code:"pl",label:"Polish"},{code:"pt",label:"Portuguese"},{code:"ru",label:"Russian"},{code:"es",label:"Spanish"},{code:"sv",label:"Swedish"},{code:"tr",label:"Turkish"},{code:"uk",label:"Ukrainian"},{code:"ur",label:"Urdu",dir:"rtl"},{code:"vi",label:"Vietnamese"}]),typeof RTE_DefaultConfig.textPartLanguageHighlight>"u"&&(RTE_DefaultConfig.textPartLanguageHighlight=!0);function RTE_Plugin_TextPartLanguage(){var u=this,g,a,T=null;u.PluginName="TextPartLanguage",u.InitConfig=function(e){g=e},u.InitEditor=function(e){a=e,a.attachEvent("exec_command_textpartlanguage",function(r){r.returnValue=!0;var t=r&&r.value;!t||t==="none"||t==="remove"?u.Remove():u.Apply(t)}),a.toolbarFactoryMap&&(a.toolbarFactoryMap.textpartlanguage=function(r){return a.createToolbarItemDropDownPanel(r,q)}),h();try{a.attachEvent("ready",h)}catch{}try{a.attachEvent("aftersethtml",h)}catch{}setTimeout(h,0),a.setTextLanguage=function(r){return u.Apply(r)},a.removeTextLanguage=function(){return u.Remove()},a.getTextLanguage=function(){return u.Current()},a.listTextLanguages=function(){return y().slice()},a.getMarkedLanguages=function(){return u.List()}};function w(){try{return a.getDocument()}catch{return null}}function b(){try{return a.getEditable()}catch{return null}}function y(){var e=g&&g.textPartLanguages;return e&&e.length?e:[]}function E(e){for(var r=y(),t=0;t<r.length;t++)if(r[t].code===e)return r[t];return{code:e,label:e}}function s(e){for(var r=b(),t=e&&e.nodeType===3?e.parentNode:e;t&&t!==r&&t.nodeType===1;){if(t.hasAttribute&&t.hasAttribute("lang"))return t;t=t.parentNode}return null}function m(){try{var e=a.getSelection();return!e||e.rangeCount===0?null:e.getRangeAt(0)}catch{return null}}u.Current=function(){var e=m();if(!e)return null;var r=s(e.startContainer);return r&&!e.collapsed&&s(e.endContainer)!==r?null:r?r.getAttribute("lang"):null},u.List=function(){var e=b(),r=[];if(!e)return r;for(var t={},n=e.querySelectorAll("[lang]"),i=0;i<n.length;i++){var o=n[i].getAttribute("lang");!o||t[o]||(t[o]=!0,r.push({code:o,label:E(o).label}))}return r},u.Apply=function(e){if(e=String(e??"").trim(),!e)return!1;var r=w(),t=m();if(!r||!t)return!1;if(u.Current()===e)return u.Remove();if(t.collapsed){var n=s(t.startContainer);return n?(N(n,e),x(),e):!1}var i=r.createElement("span");N(i,e);try{t.surroundContents(i)}catch{var o=t.extractContents();i.appendChild(o),t.insertNode(i)}return L(i),k(i),i.firstChild?(_(i),H(i),x(),e):(i.parentNode&&i.parentNode.removeChild(i),!1)},u.Remove=function(){var e=m();if(!e)return!1;var r=b();if(!r)return!1;var t=0,n=s(e.startContainer);if(n&&(C(n),t++),!e.collapsed)for(var i=r.querySelectorAll("[lang]"),o=i.length-1;o>=0;o--){var l=i[o];l!==n&&S(e,l)&&(C(l),t++)}return t&&x(),t>0};function S(e,r){try{var t=r.ownerDocument.createRange();return t.selectNodeContents(r),e.compareBoundaryPoints(Range.END_TO_START,t)<0&&e.compareBoundaryPoints(Range.START_TO_END,t)>0}catch{return!1}}function N(e,r){e.setAttribute("lang",r);var t=E(r).dir;t==="rtl"||t==="ltr"?e.setAttribute("dir",t):e.removeAttribute("dir")}function L(e){for(var r=e.querySelectorAll("[lang]"),t=r.length-1;t>=0;t--)C(r[t])}function C(e){if(!(!e||!e.parentNode))if(e.nodeName==="SPAN"&&e.attributes.length<=2&&!e.getAttribute("class")&&!e.getAttribute("style")&&!e.getAttribute("id")){for(var r=e.parentNode;e.firstChild;)r.insertBefore(e.firstChild,e);r.removeChild(e);try{r.normalize()}catch{}}else e.removeAttribute("lang"),e.removeAttribute("dir")}function k(e){for(var r=e.childNodes.length-1;r>=0;r--){var t=e.childNodes[r];t.nodeType===3&&t.nodeValue===""&&e.removeChild(t)}}function _(e){var r=e.getAttribute("lang"),t=e.previousSibling;if(t&&t.nodeType===1&&t.nodeName==="SPAN"&&t.getAttribute("lang")===r){for(;e.firstChild;)t.appendChild(e.firstChild);e.parentNode.removeChild(e),e=t}var n=e.nextSibling;if(n&&n.nodeType===1&&n.nodeName==="SPAN"&&n.getAttribute("lang")===r){for(;n.firstChild;)e.appendChild(n.firstChild);n.parentNode.removeChild(n)}try{e.normalize()}catch{}return e}function H(e){try{var r=a.getSelection(),t=e.ownerDocument.createRange();t.selectNodeContents(e),r.removeAllRanges(),r.addRange(t)}catch{}}function x(){try{typeof a.updateDesign=="function"&&a.updateDesign()}catch{}try{typeof a.fireChange=="function"&&a.fireChange()}catch{}}function q(e){var r=u.Current();e.style.width="220px",e.style.maxHeight="340px",e.style.overflowY="auto",e.style.padding="4px 0";var t=y();D(e,a.getLangText&&a.getLangText("removelanguage")||"Remove language",null,!r,function(){u.Remove()});var n=e.ownerDocument.createElement("div");n.style.cssText="height:1px;margin:4px 6px;background:var(--rte-border-color,#e0e0e0);",e.appendChild(n);for(var i=0;i<t.length;i++)(function(o){D(e,o.label,o.code,r===o.code,function(){u.Apply(o.code)})})(t[i]);setTimeout(function(){var o=e.querySelectorAll("rte-toolbar-dropdown-item");if(o.length){for(var l=o[0],d=0;d<o.length;d++)if(o[d].getAttribute("aria-checked")==="true"){l=o[d];break}try{l.focus()}catch{}}},0)}function D(e,r,t,n,i){var o=e.ownerDocument,l=o.createElement("rte-toolbar-dropdown-item");e.appendChild(l),l.setAttribute("role","menuitemradio"),l.setAttribute("aria-checked",n?"true":"false"),l.setAttribute("tabindex","0"),l.style.cssText="padding:5px 12px;cursor:pointer;white-space:nowrap;display:flex;justify-content:space-between;gap:12px;color:var(--rte-text-color,inherit);"+(n?"font-weight:600;":"");var d=o.createElement("span");if(d.appendChild(o.createTextNode(r)),l.appendChild(d),t){var p=o.createElement("span");p.style.cssText="opacity:.55;font-size:11px;",p.appendChild(o.createTextNode(t)),l.appendChild(p)}l.onmouseover=function(){l.style.backgroundColor="var(--rte-hover-bg,#e6e6e6)"},l.onmouseout=function(){l.style.backgroundColor=""},l.onclick=function(){try{a.closeCurrentPopup()}catch{}try{a.focus()}catch{}i()},l.onkeydown=function(c){var f=c.key;if(f==="Enter"||f===" "||f==="Spacebar"){c.preventDefault(),c.stopPropagation(),l.onclick();return}if(f==="ArrowDown"||f==="ArrowUp"){c.preventDefault(),c.stopPropagation();var B=e.querySelectorAll("rte-toolbar-dropdown-item"),v=Array.prototype.slice.call(B),j=v.indexOf(l),R=v[(j+(f==="ArrowDown"?1:-1)+v.length)%v.length];R&&R.focus();return}if(f==="Home"||f==="End"){c.preventDefault(),c.stopPropagation();var A=e.querySelectorAll("rte-toolbar-dropdown-item"),P=f==="Home"?A[0]:A[A.length-1];P&&P.focus();return}if(f==="Escape"){c.preventDefault(),c.stopPropagation();try{a.closeCurrentPopup()}catch{}}}}function h(){var e=w();!e||e===T||(T=e,I(e))}function z(){return g&&g.textPartLanguageHighlight===!1?"":"[lang]:not(html):not(body){border-bottom:1px dotted rgba(120,120,120,.75);}[lang]:not(html):not(body):hover{background:rgba(120,120,120,.10);}"}function I(e){if(e){var r=z(),t=e.getElementById("rte-textpartlanguage-styles");if(t){if(t.getAttribute("data-css")===r)return;t.parentNode&&t.parentNode.removeChild(t)}if(r){var n=e.createElement("style");n.id="rte-textpartlanguage-styles",n.setAttribute("data-css",r),n.appendChild(e.createTextNode(r)),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(n),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(e,n,"rte-textpartlanguage-styles",n.textContent)}}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_todolist=RTE_Plugin_TodoList;function RTE_Plugin_TodoList(){var c=this,h,n,s,l;c.PluginName="TodoList",c.InitConfig=function(t){h=t},c.InitEditor=function(t){n=t,s=n.getEditable(),l=n.getDocument(),n.attachEvent("exec_command_inserttodolist",function(r){r.returnValue=!0,c.InsertTaskList()}),s&&(s.addEventListener("click",function(r){var e=d(r.target,"rte-task-checkbox",s);if(e){var i=e.parentNode;if(!(!i||!i.classList||!i.classList.contains("rte-task-item"))){var a=i.getAttribute("data-checked")==="true";i.setAttribute("data-checked",a?"false":"true"),r.preventDefault(),u()}}}),s.addEventListener("keyup",function(r){if(r.key==="Enter"&&!r.shiftKey){c.Normalize();var e=k();e&&e.setAttribute("data-checked","false")}}),setTimeout(function(){f(l)},0))};function d(t,r,e){for(;t&&t!==e;){if(t.nodeType===1&&t.classList&&t.classList.contains(r))return t;t=t.parentNode}return null}function u(){if(typeof n.fireChange=="function")try{n.fireChange()}catch{}}function k(){try{var t=n.getSelection();if(!t||t.rangeCount===0)return null;var r=t.getRangeAt(0).startContainer;return d(r,"rte-task-item",s)}catch{return null}}function f(t){if(!(!t||t.getElementById("rte-todolist-styles"))){var r="ul.rte-task-list{list-style:none;margin:.4em 0;padding-left:0;}ul.rte-task-list li.rte-task-item{position:relative;padding-left:28px;margin:3px 0;min-height:20px;}li.rte-task-item>.rte-task-checkbox{position:absolute;left:0;top:1px;width:18px;height:18px;border:2px solid #94a3b8;border-radius:5px;box-sizing:border-box;cursor:pointer;user-select:none;transition:background .12s,border-color .12s;}li.rte-task-item>.rte-task-checkbox:hover{border-color:#1d67ba;}li.rte-task-item[data-checked='true']>.rte-task-checkbox{background:#1d67ba;border-color:#1d67ba;}li.rte-task-item[data-checked='true']>.rte-task-checkbox::after{content:'';position:absolute;left:4px;top:0px;width:6px;height:11px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);}li.rte-task-item[data-checked='true']{color:#94a3b8;text-decoration:line-through;}",e=t.createElement("style");e.id="rte-todolist-styles",e.appendChild(t.createTextNode(r)),(t.head||t.getElementsByTagName("head")[0]||t.documentElement).appendChild(e),n&&typeof n.ensureStyleSheetLive=="function"&&n.ensureStyleSheetLive(t,e,"rte-todolist-styles",e.textContent)}}function g(){var t=l.createElement("span");return t.className="rte-task-checkbox",t.setAttribute("contenteditable","false"),t}c.Normalize=function(){if(s)for(var t=s.querySelectorAll("ul.rte-task-list"),r=0;r<t.length;r++)for(var e=t[r].children,i=0;i<e.length;i++){var a=e[i];if(a.nodeName==="LI"){a.classList.add("rte-task-item"),a.getAttribute("data-checked")!=="true"&&a.getAttribute("data-checked")!=="false"&&a.setAttribute("data-checked","false");var o=a.firstChild;o&&o.nodeType===1&&o.classList&&o.classList.contains("rte-task-checkbox")||a.insertBefore(g(),a.firstChild)}}},c.InsertTaskList=function(){f(l);var t="rte-todo-pending",r='<ul class="rte-task-list"><li class="rte-task-item" data-checked="false" id="'+t+'"><span class="rte-task-checkbox" contenteditable="false"></span>​</li></ul>';n.insertHTML(r);try{var e=l.getElementById(t);if(e){e.removeAttribute("id");var i=l.createRange(),a=e.lastChild;a&&a.nodeType===3?i.setStart(a,a.length):i.setStart(e,e.childNodes.length),i.collapse(!0);var o=n.getSelection();o&&(o.removeAllRanges(),o.addRange(i))}}catch{}n.focus(),u()}}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.svgCode_trackchanges||(RTE_DefaultConfig.svgCode_trackchanges='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 17l4-1 10-10-3-3L5 13l-1 4z"/><path d="M14 4l3 3"/><path d="M4 21h10"/></svg>'),RTE_DefaultConfig.plugin_trackedchanges=RTE_Plugin_TrackedChanges;function RTE_Plugin_TrackedChanges(){var C=this,o,a,f=!1;C.PluginName="TrackedChanges",C.InitConfig=function(t){o=t,o.trackChangesEnabled!==!1&&(o.currentUser=o.currentUser||null,o.trackChangesInsertClass=o.trackChangesInsertClass||"rte-tc rte-tc-insert",o.trackChangesDeleteClass=o.trackChangesDeleteClass||"rte-tc rte-tc-delete",o.reviewCanDecide=o.reviewCanDecide||null,o.onReviewDecisionDenied=o.onReviewDecisionDenied||null,o.text_trackchanges=o.text_trackchanges||"Suggesting mode",x("toolbar_default","#{trackchanges}"),x("toolbar_full","#{trackchanges}"),x("toolbar_mobile","#{trackchanges}"),(o.controltoolbar_TEXT||"").indexOf("trackchanges")===-1&&(o.controltoolbar_TEXT=(o.controltoolbar_TEXT||"")+"|{trackchanges}"))},C.InitEditor=function(t){a=t,o.trackChangesEnabled!==!1&&(a.trackedChanges={enable:function(e){m(e)},disable:function(){S()},isEnabled:function(){return f},acceptAll:function(e){return te(e)},rejectAll:function(e){return re(e)},accept:function(e){return F(e)},reject:function(e){return j(e)},canDecide:function(e,r){var n=a.reviewLedger&&a.reviewLedger.get(e);return!!n&&y(n,r||"accept")},list:function(e){if(!a.reviewLedger)return[];var r=e&&e.all===!0;return a.reviewLedger.list().filter(function(n){return n.changeType!=="insert"&&n.changeType!=="delete"?!1:r||n.status==="pending"})}},ne(),a.toolbarFactoryMap=a.toolbarFactoryMap||{},a.toolbarFactoryMap.trackchanges=function(e){var r=a.createToolbarButton(e);return r.__tcSync=function(){f?r.classList.add("rte-ui-active"):r.classList.remove("rte-ui-active"),r.setAttribute("aria-pressed",f?"true":"false"),r.setAttribute("title",o.text_trackchanges||"Suggesting mode")},r.__tcSync(),r},a.attachEvent("exec_command_trackchanges",function(e){e.returnValue=!0,e.stopBubble=!0,f?S():m()}),a.getEditable().addEventListener("beforeinput",H,!0))};function x(t,e){o[t]&&o[t].indexOf(e)===-1&&(o[t]=o[t]+e)}function m(t){t&&(o.currentUser=t),o.currentUser||(o.currentUser={id:"user",name:"User",color:"#2563eb"},console.warn("trackedchanges: no config.currentUser configured; defaulting to generic user.")),f=!0,D()}function S(){f=!1,D()}function D(){for(var t=a.iframe&&a.iframe.ownerDocument||document,e=t.querySelectorAll(".rte_command_trackchanges"),r=0;r<e.length;r++)e[r].__tcSync&&e[r].__tcSync()}function H(t){if(f&&a.reviewLedger){var e=t.inputType;if(e){if(e==="insertText"||e==="insertReplacementText"){t.preventDefault(),P(t.data||"");return}if(e==="deleteContentBackward"||e==="deleteContentForward"||e==="deleteByCut"){t.preventDefault(),z(e);return}}}}function P(t){if(t){var e=a.getSelection();if(!(!e||e.rangeCount===0)){var r=e.getRangeAt(0);if(!r.collapsed){if(!T(r))return;r=e.getRangeAt(0),L(t,r);return}var n=X(r);n?q(n,t):L(t,r)}}}function X(t){var e=t.startContainer;if(e.nodeType===3&&e.parentNode&&h(e.parentNode))return e.parentNode;if(e.nodeType===1&&t.startOffset>0){var r=e.childNodes[t.startOffset-1];if(r&&r.nodeType===1&&h(r))return r}return e.nodeType===3&&e.previousSibling&&h(e.previousSibling)&&t.startOffset===0?e.previousSibling:null}function h(t){return!t||t.nodeType!==1||!t.classList||!t.classList.contains("rte-tc-insert")?!1:t.getAttribute("data-tc-author")===o.currentUser.id}function E(t){if(!(!t||t.nodeType!==3)){var e=t.nodeValue;e.indexOf(" ")===-1&&e.indexOf("\xA0")===-1||(e=e.replace(/\u00a0/g," "),e=e.replace(/ (?= )/g,"\xA0"),e=e.replace(/ $/,"\xA0"),e!==t.nodeValue&&(t.nodeValue=e))}}function q(t,e){var r=a.getDocument(),n=t.lastChild,i;n&&n.nodeType===3?(n.nodeValue=n.nodeValue+e,i=n):(i=r.createTextNode(e),t.appendChild(i)),E(i),I(i),_(t)}function L(t,e){var r=a.getDocument(),n=r.createElement("span");n.className=o.trackChangesInsertClass;var i=o.currentUser,c="tc-"+Date.now()+"-"+Math.floor(Math.random()*1e4);n.setAttribute("data-tc-id",c),n.setAttribute("data-tc-author",i.id),n.setAttribute("data-tc-at",new Date().toISOString()),n.style.color=i.color,n.style.textDecoration="underline",n.appendChild(r.createTextNode(t)),e.insertNode(n),E(n.firstChild),I(n.firstChild),a.reviewLedger.add({id:c,changeType:"insert",author:i,text:t,status:"pending",sourceLabel:"Suggested insert",createdAt:Date.now()})}function _(t){var e=t.getAttribute("data-tc-id");e&&a.reviewLedger.update(e,{text:t.textContent})}function z(t){var e=a.getSelection();if(!(!e||e.rangeCount===0)){var r=e.getRangeAt(0);if(!r.collapsed){T(r);return}var n=a.getDocument().createRange();if(t==="deleteContentBackward"){var i=J(r.startContainer,r.startOffset);if(!i)return;n.setStart(i.node,i.offset),n.setEnd(i.node,i.offset+1)}else{var c=K(r.startContainer,r.startOffset);if(!c)return;n.setStart(c.node,c.offset-1),n.setEnd(c.node,c.offset)}if(G(n)){n.deleteContents();var l=a.getSelection();l.removeAllRanges(),l.addRange(n),ee();return}T(n)}}function $(t){for(var e=t.nodeType===1?t:t.parentNode;e&&e!==a.getEditable();){if(e.classList&&e.classList.contains("rte-tc-delete"))return!0;e=e.parentNode}return!1}function A(){for(var t=a.getEditable(),e=a.getDocument().createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:function(i){return $(i)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),r=[],n;n=e.nextNode();)r.push(n);return r}function J(t,e){var r=A();if(!r.length)return null;var n=N(t,e,r);return n<=0?null:R(n-1,r)}function K(t,e){var r=A();if(!r.length)return null;for(var n=0,i=0;i<r.length;i++)n+=r[i].nodeValue.length;var c=N(t,e,r);return c>=n?null:R(c+1,r)}function N(t,e,r){var n=a.getDocument().createRange();n.setStart(t,e),n.collapse(!0);for(var i=0,c=0;c<r.length;c++){var l=r[c],u=n.comparePoint(l,l.nodeValue.length);if(u<=0){i+=l.nodeValue.length;continue}var s=n.comparePoint(l,0);if(s>=0)break;for(var g=0,v=l.nodeValue.length;g<v;){var p=g+v>>1;n.comparePoint(l,p)<0?g=p+1:v=p}i+=g;break}return i}function R(t,e){for(var r=t,n=0;n<e.length;n++){if(r<=e[n].nodeValue.length)return{node:e[n],offset:r};r-=e[n].nodeValue.length}return null}function ae(t){if(!t)return null;if(t.nodeType===3)return t;var e=a.getDocument().createTreeWalker(t,NodeFilter.SHOW_TEXT);return e.nextNode()}function ie(t){if(!t)return null;if(t.nodeType===3)return t;for(var e=a.getDocument().createTreeWalker(t,NodeFilter.SHOW_TEXT),r=null,n;n=e.nextNode();)r=n;return r}function oe(t){for(var e=a.getEditable(),r=a.getDocument().createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null,i;i=r.nextNode();){if(i===t)return n;n=i}return null}function ce(t){for(var e=a.getEditable(),r=a.getDocument().createTreeWalker(e,NodeFilter.SHOW_TEXT),n=!1,i;i=r.nextNode();){if(n)return i;i===t&&(n=!0)}return null}function G(t){for(var e=t.startContainer.parentNode;e&&e!==a.getEditable();){if(h(e))return t.endContainer.parentNode===e||e.contains(t.endContainer);e=e.parentNode}return!1}function T(t){if(t.collapsed)return!1;var e=a.getDocument(),r=t.cloneContents();if(!Z(r))return!1;var n=o.currentUser,i=O(t,"before",n),c=O(t,"after",n);if(t.deleteContents(),i){if(Q(i,r),c&&c!==i){for(;c.firstChild;)i.appendChild(c.firstChild);var l=c.getAttribute("data-tc-id");c.remove(),l&&a.reviewLedger&&a.reviewLedger.remove(l)}var u=e.createRange();u.setStartAfter(i),u.collapse(!0);var s=a.getSelection();s.removeAllRanges(),s.addRange(u);var g=i.getAttribute("data-tc-id");return g&&a.reviewLedger&&a.reviewLedger.update(g,{text:i.textContent}),!0}if(c){Y(c,r);var v=e.createRange();v.setStartBefore(c),v.collapse(!0);var p=a.getSelection();p.removeAllRanges(),p.addRange(v);var M=c.getAttribute("data-tc-id");return M&&a.reviewLedger&&a.reviewLedger.update(M,{text:c.textContent}),!0}var d=e.createElement("span");d.className=o.trackChangesDeleteClass;var B="tc-"+Date.now()+"-"+Math.floor(Math.random()*1e4);d.setAttribute("data-tc-id",B),d.setAttribute("data-tc-author",n.id),d.setAttribute("data-tc-at",new Date().toISOString()),d.style.color=n.color,d.style.textDecoration="line-through",d.appendChild(r),t.insertNode(d);var k=e.createRange();k.setStartAfter(d),k.collapse(!0);var W=a.getSelection();return W.removeAllRanges(),W.addRange(k),a.reviewLedger.add({id:B,changeType:"delete",author:n,text:d.textContent,originalHtml:d.innerHTML,status:"pending",sourceLabel:"Suggested delete",createdAt:Date.now()}),!0}function O(t,e,r){var n=e==="before"?t.startContainer:t.endContainer,i=e==="before"?t.startOffset:t.endOffset;if(n.nodeType===3){if(e==="before"&&i===0){var c=n.previousSibling;if(c&&b(c,r))return c}if(e==="after"&&i===n.nodeValue.length){var l=n.nextSibling;if(l&&b(l,r))return l}return null}if(e==="before"&&i>0){var u=n.childNodes[i-1];if(u&&b(u,r))return u}if(e==="after"&&i<n.childNodes.length){var s=n.childNodes[i];if(s&&b(s,r))return s}return null}function b(t,e){return!t||t.nodeType!==1||!t.classList||!t.classList.contains("rte-tc-delete")?!1:t.getAttribute("data-tc-author")===e.id}function Q(t,e){for(;e.firstChild;)t.appendChild(e.firstChild)}function Y(t,e){for(var r=t.firstChild;e.firstChild;)t.insertBefore(e.firstChild,r)}function Z(t){var e=(t.textContent||"").replace(/\s+/g,"");return!!e}function ee(){for(var t=a.getEditable().querySelectorAll(".rte-tc-insert"),e=0;e<t.length;e++){var r=t[e];if(!r.textContent||!r.textContent.length){var n=r.getAttribute("data-tc-id");n&&a.reviewLedger&&a.reviewLedger.remove(n),r.remove()}else _(r)}}function I(t){if(t){var e=a.getDocument(),r=e.createRange();t.nodeType===3?r.setStart(t,t.nodeValue.length):r.setStart(t,t.childNodes.length),r.collapse(!0);var n=a.getSelection();n.removeAllRanges(),n.addRange(r)}}function w(){return o.currentUser||{id:"user",name:"User",color:"#2563eb"}}function y(t,e){if(typeof o.reviewCanDecide!="function")return!0;var r=!1,n=w();try{r=o.reviewCanDecide(t,e,n,a)!==!1}catch(c){console.warn("trackedchanges: reviewCanDecide threw; denying decision.",c)}if(r)return!0;var i={entry:t,action:e,user:n};try{typeof o.onReviewDecisionDenied=="function"&&o.onReviewDecisionDenied(i)}catch{}try{typeof a.fireEvent=="function"&&a.fireEvent("review_decision_denied",i)}catch{}return!1}function F(t){var e=a.reviewLedger.get(t);if(!e||!y(e,"accept"))return!1;var r=a.getEditable().querySelector('[data-tc-id="'+U(t)+'"]');return e.changeType==="insert"?r&&V(r):e.changeType==="delete"&&r&&r.remove(),a.reviewLedger.update(t,{status:"accepted",decidedAt:Date.now(),decidedBy:w()}),!0}function j(t){var e=a.reviewLedger.get(t);if(!e||!y(e,"reject"))return!1;var r=a.getEditable().querySelector('[data-tc-id="'+U(t)+'"]');return e.changeType==="insert"?r&&r.remove():e.changeType==="delete"&&r&&V(r),a.reviewLedger.update(t,{status:"rejected",decidedAt:Date.now(),decidedBy:w()}),!0}function te(t){for(var e=a.reviewLedger.list(t).filter(function(i){return(i.changeType==="insert"||i.changeType==="delete")&&i.status==="pending"}),r=0,n=0;n<e.length;n++)F(e[n].id)&&r++;return r}function re(t){for(var e=a.reviewLedger.list(t).filter(function(i){return(i.changeType==="insert"||i.changeType==="delete")&&i.status==="pending"}),r=0,n=0;n<e.length;n++)j(e[n].id)&&r++;return r}function V(t){var e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function U(t){var e=String(t);if(typeof CSS<"u"&&typeof CSS.escape=="function")try{return CSS.escape(e)}catch{}return e.replace(/["\\\]\[\(\)\{\}'#:;,<>=`~!@$%^&*+/?\s\x00-\x1F]/g,function(r){return"\\"+r})}function ne(){var t=a&&a.iframe&&a.iframe.ownerDocument||document;if(!t.querySelector("style[data-rte-trackchanges]")){var e=t.createElement("style");e.setAttribute("data-rte-trackchanges","1"),e.textContent=[".richtexteditor rte-toolbar-button.rte_command_trackchanges{position:relative;border-radius:8px;transition:background .14s ease,color .14s ease,box-shadow .14s ease}",".richtexteditor rte-toolbar-button.rte_command_trackchanges.rte-ui-active{background:linear-gradient(135deg,#e9f7ef,#eef5ff);color:#17633f;box-shadow:inset 0 0 0 1px rgba(34,132,82,.28),0 6px 14px rgba(34,132,82,.12)}",".richtexteditor rte-toolbar-button.rte_command_trackchanges.rte-ui-active:after{content:'';position:absolute;right:5px;top:5px;width:6px;height:6px;border-radius:50%;background:#22a66a;box-shadow:0 0 0 2px #fff}",".rte-tc{border-radius:4px;padding:0 2px;box-decoration-break:clone;-webkit-box-decoration-break:clone}",".rte-tc-insert{background:linear-gradient(180deg,rgba(232,248,239,.78),rgba(232,248,239,.38));color:#125b39;text-decoration:underline;text-decoration-color:#22a66a;text-decoration-thickness:2px;text-underline-offset:3px}",".rte-tc-delete{background:linear-gradient(180deg,rgba(255,240,240,.82),rgba(255,240,240,.42));color:#9f1d1d;text-decoration:line-through;text-decoration-color:#dc4c4c;text-decoration-thickness:2px;opacity:.92}"].join(`
|
|
2
|
+
`),t.head.appendChild(e),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(t,e,"rte-trackedchanges-style",e.textContent)}var r=a.getDocument();if(r&&r.head&&!r.querySelector("style[data-rte-trackchanges-inline]")){var n=r.createElement("style");n.setAttribute("data-rte-trackchanges-inline","1"),n.textContent=[".rte-tc{border-radius:4px;padding:0 2px;box-decoration-break:clone;-webkit-box-decoration-break:clone}",".rte-tc-insert{background:linear-gradient(180deg,rgba(232,248,239,.78),rgba(232,248,239,.38));color:#125b39;text-decoration:underline;text-decoration-color:#22a66a;text-decoration-thickness:2px;text-underline-offset:3px}",".rte-tc-delete{background:linear-gradient(180deg,rgba(255,240,240,.82),rgba(255,240,240,.42));color:#9f1d1d;text-decoration:line-through;text-decoration-color:#dc4c4c;text-decoration-thickness:2px;opacity:.92}"].join(`
|
|
3
|
+
`),r.head.appendChild(n),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(r,n,"rte-trackedchanges-iStyle",n.textContent)}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_typewriter=RTE_Plugin_Typewriter,typeof RTE_DefaultConfig.typewriterModeEnabled>"u"&&(RTE_DefaultConfig.typewriterModeEnabled=!1),typeof RTE_DefaultConfig.focusModeEnabled>"u"&&(RTE_DefaultConfig.focusModeEnabled=!1),typeof RTE_DefaultConfig.typewriterAnchor>"u"&&(RTE_DefaultConfig.typewriterAnchor=.5);function RTE_Plugin_Typewriter(){var g=this,l,n,a=!1,c=!1,m=null,E=!1,y=0;g.PluginName="Typewriter",g.InitConfig=function(e){l=e,a=!!l.typewriterModeEnabled,c=!!l.focusModeEnabled},g.InitEditor=function(e){n=e,f();try{n.attachEvent("ready",f)}catch{}try{n.attachEvent("aftersethtml",f)}catch{}setTimeout(f,0),setTimeout(f,200),n.setTypewriterMode=function(r){return a=!!r,s(),a},n.setFocusMode=function(r){return c=!!r,s(),c},n.toggleTypewriterMode=function(){return a=!a,s(),a},n.toggleFocusMode=function(){return c=!c,s(),c},n.isTypewriterMode=function(){return a},n.isFocusMode=function(){return c}};function f(){var e=n.getDocument();e&&(M(e),e!==m&&(e.addEventListener("keyup",h,!0),e.addEventListener("mouseup",h,!0),e.addEventListener("input",h,!0),m=e)),D(),s()}function b(e){return e&&e.nodeType===1&&/^(P|H[1-6]|LI|BLOCKQUOTE|PRE|DIV|TD|TH|FIGCAPTION)$/.test(e.nodeName)}function w(){try{var e=n.getSelection();if(!e||e.rangeCount===0)return null;var r=n.getEditable(),t=e.getRangeAt(0).startContainer;t&&t.nodeType===3&&(t=t.parentNode);for(var i=null;t&&t!==r;)b(t)&&(i=t),t=t.parentNode;return i}catch{return null}}function L(){try{var e=n.getSelection();if(!e||e.rangeCount===0)return null;var r=e.getRangeAt(0).cloneRange(),t=r.getBoundingClientRect();if(t&&(t.top||t.bottom||t.height))return t;var i=w();return i?i.getBoundingClientRect():null}catch{return null}}function h(){if(!(!a&&!c)&&!y){var e=typeof requestAnimationFrame=="function"?requestAnimationFrame:function(r){return setTimeout(r,16)};y=e(function(){y=0,c&&T(),a&&C()})}}function T(){var e=n.getEditable();if(e){for(var r=e.querySelectorAll(".rte-focus-current"),t=0;t<r.length;t++)r[t].classList.remove("rte-focus-current");var i=w();i&&i.classList.add("rte-focus-current")}}function C(){var e=n.getDocument();if(e){var r=L();if(r){var t=e.defaultView||e.parentWindow;if(t){var i=t.innerHeight||e.documentElement.clientHeight;if(i){var o=i*R(l.typewriterAnchor,.15,.85),v=r.top+r.height/2,d=v-o;if(!(Math.abs(d)<2)){var u=e.scrollingElement||e.documentElement||e.body;if(u&&u.scrollHeight-u.clientHeight<=4){var p=n.getEditable();p&&p.scrollHeight-p.clientHeight>4&&(u=p)}u&&(u.scrollTop+=d)}}}}}}function R(e,r,t){return e=typeof e=="number"&&!isNaN(e)?e:.5,e<r?r:e>t?t:e}function s(){var e=n.getEditable();if(e){if(c)e.classList.add("rte-focus-active"),T();else{e.classList.remove("rte-focus-active");for(var r=e.querySelectorAll(".rte-focus-current"),t=0;t<r.length;t++)r[t].classList.remove("rte-focus-current")}a?(e.classList.add("rte-typewriter-active"),C()):e.classList.remove("rte-typewriter-active")}}function M(e){if(!(!e||e.getElementById("rte-typewriter-styles"))){var r=".rte-focus-active p,.rte-focus-active h1,.rte-focus-active h2,.rte-focus-active h3,.rte-focus-active h4,.rte-focus-active h5,.rte-focus-active h6,.rte-focus-active li,.rte-focus-active blockquote,.rte-focus-active pre,.rte-focus-active figcaption{opacity:.28;transition:opacity .18s ease;}.rte-focus-active .rte-focus-current,.rte-focus-active .rte-focus-current *{opacity:1 !important;}.rte-typewriter-active{padding-bottom:45vh !important;}@media (prefers-reduced-motion: reduce){.rte-focus-active p,.rte-focus-active h1,.rte-focus-active h2,.rte-focus-active h3,.rte-focus-active h4,.rte-focus-active h5,.rte-focus-active h6,.rte-focus-active li,.rte-focus-active blockquote,.rte-focus-active pre,.rte-focus-active figcaption{transition:none !important;}}",t=e.createElement("style");t.id="rte-typewriter-styles",t.appendChild(e.createTextNode(r)),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(t),n&&typeof n.ensureStyleSheetLive=="function"&&n.ensureStyleSheetLive(e,t,"rte-typewriter-styles",t.textContent)}}function _(){var e=n.getEditable();if(!e)return function(){};for(var r=e.querySelectorAll(".rte-focus-current"),t=0;t<r.length;t++)r[t].classList.remove("rte-focus-current");return function(){for(var o=0;o<r.length;o++)r[o].classList.add("rte-focus-current")}}function D(){if(!E){for(var e=["getHTMLCode","getJSON","getHTMLContent"],r=!1,t=0;t<e.length;t++)(function(i){var o=n[i];if(!(typeof o!="function"||o.__rteTwWrapped)){var v=function(){var d=_();try{return o.apply(n,arguments)}finally{d()}};v.__rteTwWrapped=!0,n[i]=v,r=!0}})(e[t]);r&&(E=!0)}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_watermark=RTE_Plugin_Watermark,typeof RTE_DefaultConfig.watermarkText>"u"&&(RTE_DefaultConfig.watermarkText="DRAFT"),typeof RTE_DefaultConfig.watermarkColor>"u"&&(RTE_DefaultConfig.watermarkColor="#94a3b8"),typeof RTE_DefaultConfig.watermarkOpacity>"u"&&(RTE_DefaultConfig.watermarkOpacity=.18),typeof RTE_DefaultConfig.watermarkAngle>"u"&&(RTE_DefaultConfig.watermarkAngle=-30),typeof RTE_DefaultConfig.watermarkFontSize>"u"&&(RTE_DefaultConfig.watermarkFontSize=48),typeof RTE_DefaultConfig.watermarkMode>"u"&&(RTE_DefaultConfig.watermarkMode="tile"),typeof RTE_DefaultConfig.watermarkPrint>"u"&&(RTE_DefaultConfig.watermarkPrint=!1),typeof RTE_DefaultConfig.watermarkImage>"u"&&(RTE_DefaultConfig.watermarkImage=null);function RTE_Plugin_Watermark(){var l=this,r,a,d=null,f=!1,c=!1;l.PluginName="Watermark",l.InitConfig=function(e){r=e},l.InitEditor=function(e){a=e,a.attachEvent("exec_command_watermark",function(t){t.returnValue=!0,l.Toggle()}),m();try{a.attachEvent("ready",m)}catch{}try{a.attachEvent("aftersethtml",m)}catch{}setTimeout(m,0),a.setWatermark=function(t){return f=!!t,g(),f},a.toggleWatermark=function(){return f=!f,g(),f},a.isWatermark=function(){return f},a.setWatermarkOptions=function(t){if(t&&typeof t=="object"){var i=["watermarkText","watermarkColor","watermarkOpacity","watermarkAngle","watermarkFontSize","watermarkMode","watermarkPrint","watermarkImage"],o={text:0,color:1,opacity:2,angle:3,fontSize:4,mode:5,print:6,image:7};for(var n in t)t.hasOwnProperty(n)&&(o[n]!==void 0?r[i[o[n]]]=t[n]:i.indexOf(n)>=0&&(r[n]=t[n]))}return g(),l.Options()},a.getWatermarkOptions=function(){return l.Options()}},l.Options=function(){return{text:r.watermarkText,color:r.watermarkColor,opacity:r.watermarkOpacity,angle:r.watermarkAngle,fontSize:r.watermarkFontSize,mode:r.watermarkMode,print:r.watermarkPrint,image:r.watermarkImage}};function m(){var e=s();e&&(v(),e!==d&&(d=e),f&&g())}function s(){try{return a.getDocument()}catch{return null}}function k(){try{return a.getEditable()}catch{return null}}function p(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(){if(r.watermarkImage)return String(r.watermarkImage);var e=String(r.watermarkText==null?"":r.watermarkText);if(!e)return null;var t=parseInt(r.watermarkFontSize,10)||48,i=parseFloat(r.watermarkAngle);isNaN(i)&&(i=-30);var o=Math.max(240,e.length*t*.72),n=Math.max(160,t*3.2),u='<svg xmlns="http://www.w3.org/2000/svg" width="'+Math.round(o)+'" height="'+Math.round(n)+'"><text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle" transform="rotate('+i+" "+Math.round(o/2)+" "+Math.round(n/2)+')" font-family="Segoe UI, Arial, sans-serif" font-size="'+t+'" font-weight="700" fill="'+p(r.watermarkColor||"#94a3b8")+'">'+p(e)+"</text></svg>";return"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(u)}function g(){var e=k(),t=s();if(!(!e||!t)){if(b(t),!f){e.style.backgroundImage="",e.style.backgroundRepeat="",e.style.backgroundPosition="",e.removeAttribute("data-rte-watermark");return}var i=w();if(i){var o=String(r.watermarkMode)==="single";e.setAttribute("data-rte-watermark","true"),e.style.backgroundImage='url("'+i+'")',e.style.backgroundRepeat=o?"no-repeat":"repeat",e.style.backgroundPosition=o?"center center":"0 0";var n=parseFloat(r.watermarkOpacity);e.style.opacity="";var u=t.getElementById("rte-watermark-dynamic");u||(u=t.createElement("style"),u.id="rte-watermark-dynamic",(t.head||t.documentElement).appendChild(u)),u.textContent="[data-rte-watermark]{background-blend-mode:multiply;}[data-rte-watermark]::before{content:'';position:absolute;inset:0;pointer-events:none;background-image:inherit;background-repeat:inherit;background-position:inherit;opacity:"+(isNaN(n)?.18:n)+";z-index:0;}"+(r.watermarkPrint?"":"@media print{[data-rte-watermark]{background-image:none !important;}[data-rte-watermark]::before{display:none !important;}}"),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(t,u,"rte-watermark-dynamic",u.textContent)}}}function y(){var e=k();if(!e||!f)return function(){};var t=e.style.backgroundImage,i=e.style.backgroundRepeat,o=e.style.backgroundPosition,n=e.getAttribute("data-rte-watermark");return e.style.backgroundImage="",e.style.backgroundRepeat="",e.style.backgroundPosition="",e.removeAttribute("data-rte-watermark"),function(){e.style.backgroundImage=t,e.style.backgroundRepeat=i,e.style.backgroundPosition=o,n&&e.setAttribute("data-rte-watermark",n)}}function v(){if(!c){for(var e=["getHTMLCode","getJSON","getHTMLContent","getText"],t=!1,i=0;i<e.length;i++)(function(o){var n=a[o];if(!(typeof n!="function"||n.__rteWmWrapped)){var u=function(){var h=y();try{return n.apply(a,arguments)}finally{h()}};u.__rteWmWrapped=!0,a[o]=u,t=!0}})(e[i]);t&&(c=!0)}}function b(e){if(!(!e||e.getElementById("rte-watermark-styles"))){var t=e.createElement("style");t.id="rte-watermark-styles",t.appendChild(e.createTextNode("[data-rte-watermark]{position:relative;}")),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(t),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(e,t,"rte-watermark-styles",t.textContent)}}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_wordexport=RTE_Plugin_WordExport,typeof RTE_DefaultConfig.wordExport>"u"&&(RTE_DefaultConfig.wordExport=!0);function RTE_Plugin_WordExport(){var c=this,i,r;c.PluginName="WordExport",c.InitConfig=function(e){i=e},c.InitEditor=function(e){if(r=e,i.wordExport!==!1&&(r.getWordDocument=function(t){return u(t||{})},r.exportToWord=function(t,o){var a=u(o||{}),n=f(t)||f(i.wordExportFileName)||w();return x(a,n+".doc")},r.downloadWord=r.exportToWord,r.attachEvent("exec_command_exportword",function(t){t.returnValue=!0,t.stopBubble=!0;try{r.exportToWord()}catch(o){window.console&&console.error("wordexport:",o)}}),r.slashCommands&&typeof r.slashCommands.register=="function"))try{r.slashCommands.register({id:"export-word",title:"Export to Word (legacy .doc)",description:"HTML wrapped for Word \u2014 use Export to Word (.docx) for a real OOXML file",keywords:["word","doc","legacy","html","export","download"],run:function(){r.exportToWord()}})}catch{}};function d(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function m(){if(r&&typeof r.getHTMLCode=="function"){var e=r.getHTMLCode();if(e!=null)return e}var t=r&&r.getEditable?r.getEditable():null;return t?t.innerHTML:""}function s(){try{if(!r||typeof r.getDocumentPageSetup!="function")return null;var e=r.getDocumentPageSetup();if(!e||typeof e!="object")return null;var t={};e.width&&e.height&&(t.pageSize=e.width+" "+e.height),e.orientation&&(t.landscape=String(e.orientation).toLowerCase()==="landscape");var o=e.margins;return o&&typeof o=="object"&&o.top&&o.right&&o.bottom&&o.left&&(t.margin=o.top+" "+o.right+" "+o.bottom+" "+o.left),t}catch{return null}}function u(e){var t=s()||{},o=e.fontFamily||i.wordExportFontFamily||"Calibri, 'Segoe UI', Arial, sans-serif",a=e.fontSize||i.wordExportFontSize||"11pt",n=e.pageSize||t.pageSize||i.wordExportPageSize||"8.5in 11in",l=e.margin||t.margin||i.wordExportMargin||"1in",g=typeof e.landscape<"u"?e.landscape:typeof t.landscape<"u"?t.landscape:i.wordExportLandscape,h=d(e.title||p()||"Document"),y="Print",v=g?"landscape":"portrait";return`<!DOCTYPE html>\r
|
|
2
|
+
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">\r
|
|
3
|
+
<head>\r
|
|
4
|
+
<meta charset="utf-8">\r
|
|
5
|
+
<meta name="ProgId" content="Word.Document">\r
|
|
6
|
+
<title>`+h+`</title>\r
|
|
7
|
+
<!--[if gte mso 9]><xml>\r
|
|
8
|
+
<w:WordDocument><w:View>`+y+`</w:View><w:Zoom>100</w:Zoom><w:DoNotOptimizeForBrowser/></w:WordDocument>\r
|
|
9
|
+
</xml><![endif]-->\r
|
|
10
|
+
<style>\r
|
|
11
|
+
@page { size: `+d(n)+" "+v+"; margin: "+d(l)+`; }\r
|
|
12
|
+
body { font-family: `+d(o)+"; font-size: "+d(a)+`; color: #000; }\r
|
|
13
|
+
table { border-collapse: collapse; }\r
|
|
14
|
+
td, th { border: 1px solid #999; padding: 4px 8px; }\r
|
|
15
|
+
img { max-width: 100%; height: auto; }\r
|
|
16
|
+
blockquote { border-left: 3px solid #ccc; padding-left: 12px; color: #444; }\r
|
|
17
|
+
pre { font-family: Consolas, 'Courier New', monospace; background: #f4f4f4; padding: 8px; }\r
|
|
18
|
+
</style>\r
|
|
19
|
+
</head>\r
|
|
20
|
+
<body>\r
|
|
21
|
+
`+m()+`\r
|
|
22
|
+
</body>\r
|
|
23
|
+
</html>`}function p(){try{var e=r.getEditable();if(e){var t=e.querySelector("h1,h2,h3");if(t&&t.textContent)return t.textContent.trim().slice(0,80)}}catch{}return""}function w(){var e=p(),t=f(e);return t||"document"}function f(e){return e?String(e).replace(/[\\/:*?"<>|\x00-\x1f]+/g," ").replace(/\s+/g," ").trim().slice(0,80):""}function x(e,t){try{var o=new Blob(["\uFEFF",e],{type:"application/msword;charset=utf-8"}),a=URL.createObjectURL(o),n=document.createElement("a");return n.href=a,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),setTimeout(function(){try{document.body.removeChild(n)}catch{}try{URL.revokeObjectURL(a)}catch{}},0),!0}catch(l){return window.console&&console.error("wordexport download failed:",l),!1}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_yjscollab=RTE_Plugin_YjsCollab;function RTE_Plugin_YjsCollab(){var q=this,p,a,t=null,de={},R=!1,b=null,h=null;q.PluginName="YjsCollab",q.InitConfig=function(e){p=e,p.collabEnabled!==!1&&(p.collabLedgerMapName=p.collabLedgerMapName||"reviewLedger",p.collabShowPresence=p.collabShowPresence!==!1,p.collabShowRemoteCursors=p.collabShowRemoteCursors!==!1)},q.InitEditor=function(e){a=e,p.collabEnabled!==!1&&(a.collab={attach:function(n){return Q(n)},detach:function(){return I()},isAttached:function(){return!!t},getSession:function(){return t},getStatus:function(){return V()},peers:function(){return t?B():[]},setUser:function(n){t&&$(n)}},ue())};function Q(e){t&&I(),e=e||{};var n=e.doc,r=e.provider;if(!n||typeof n.getMap!="function")return console.warn("yjscollab: attach() requires a Y.Doc via options.doc"),null;if(!r||!r.awareness)return console.warn("yjscollab: attach() requires a provider with an awareness field"),null;var o=e.user||p.currentUser||{id:"user",name:"User",color:"#2563eb"},d=n.getMap(p.collabLedgerMapName),u=e.textSync;u===void 0&&(u=p.collabTextSync==="crdt"?"crdt":p.collabTextSync===!0);var c,s=null,v=null,S=null;if(u==="crdt"){var M=typeof window<"u"?window.RichTextEditorCrdt:null;M&&typeof M.attachCrdtBinding=="function"?c="crdt":(s="crdt-engine-unavailable",c=e.requireCrdt||p.collabRequireCrdt?"off":"legacy",c==="legacy"&&(v=n.getText(p.collabTextName||"richtextbox.body")))}else u===!0?(c="legacy",v=n.getText(p.collabTextName||"richtextbox.body")):c="off";if(t={doc:n,provider:r,awareness:r.awareness,ledgerMap:d,textMap:v,textSyncEnabled:c!=="off",textSyncMode:c,requestedTextSync:u||!1,fallbackReason:s,crdtBinding:S,user:o,cleanup:[]},t.awareness.setLocalStateField("user",{id:o.id,name:o.name,color:o.color}),G(),ne(),a.reviewLedger&&(re(),ae()),t.textSyncMode==="crdt")try{var w=window.RichTextEditorCrdt.Y||null,x=e.Y||(typeof window<"u"?window.Y:null)||null,L=n,U=!!(w&&w.Doc&&!(n instanceof w.Doc));if(U){if(!x||typeof x.applyUpdate!="function"||typeof x.encodeStateAsUpdate!="function")throw new Error("yjscollab: the Y.Doc was created by a different Yjs instance than crdt-engine.js bundles. Pass your Yjs module to attach({ Y }) (or build the doc with window.RichTextEditorCrdt.Y) so text can be bridged.");var T={bridge:"rte-yjs-bridge"},C=new w.Doc;w.applyUpdate(C,x.encodeStateAsUpdate(n),T);var m=window.RichTextEditorCrdt.LOCAL_ORIGIN,k=function(l,i){if(i!==T)try{w.applyUpdate(C,l,m&&i===m?m:T)}catch(f){window.console&&console.error("yjscollab bridge host->inner:",f)}},j=function(l,i){if(i!==T)try{x.applyUpdate(n,l,T)}catch(f){window.console&&console.error("yjscollab bridge inner->host:",f)}};n.on("update",k),C.on("update",j),t.cleanup.push(function(){try{n.off("update",k)}catch{}try{C.off("update",j)}catch{}try{C.destroy()}catch{}}),t.yjsBridge=!0,L=C,window.console&&console.info&&console.info("yjscollab: bridging a foreign Yjs doc into the CRDT engine (updates relayed both ways).")}t.crdtBinding=window.RichTextEditorCrdt.attachCrdtBinding({editable:a.getEditable(),ydoc:L,provider:r,awareness:r.awareness,fragmentName:e.fragmentName||"default",Y:e.Y||(typeof window<"u"?window.Y:null)}),t.cleanup.push(function(){try{t.crdtBinding&&t.crdtBinding.dispose()}catch{}});try{if(typeof window.RichTextEditorCrdt.attachUndoManager=="function"&&t.crdtBinding&&t.crdtBinding.fragment){t.undoManager=window.RichTextEditorCrdt.attachUndoManager({fragment:t.crdtBinding.fragment});var D=function(l){if(!(!t||!t.undoManager)){l.returnValue=!0,l.stopBubble=!0;try{t.undoManager.undo()}catch{}}},O=function(l){if(!(!t||!t.undoManager)){l.returnValue=!0,l.stopBubble=!0;try{t.undoManager.redo()}catch{}}};a.attachEvent("exec_command_undo",D),a.attachEvent("exec_command_redo",O),t.cleanup.push(function(){try{typeof a.detachEvent=="function"&&(a.detachEvent("exec_command_undo",D),a.detachEvent("exec_command_redo",O))}catch{}try{t.undoManager&&t.undoManager.destroy()}catch{}t.undoManager=null})}}catch(l){window.console&&console.warn("yjscollab: undo manager not attached:",l)}}catch(l){t.fallbackReason="crdt-attach-failed",t.crdtError=l,e.requireCrdt||p.collabRequireCrdt?t.textSyncMode="off":(t.textSyncMode="legacy",t.textMap=n.getText(p.collabTextName||"richtextbox.body"),Y())}else t.textSyncMode==="legacy"&&t.textMap&&Y();return p.collabShowRemoteCursors&&oe(),p.collabShowPresence&&le(),J(),H(),Z(),t}function V(){return t?{attached:!0,textSyncMode:t.textSyncMode,yjsBridge:!!t.yjsBridge,requestedTextSync:t.requestedTextSync,fallbackReason:t.fallbackReason||null,peerCount:B().length}:{attached:!1,textSyncMode:"off",requestedTextSync:!1,fallbackReason:null}}function Z(){var e=V();if(e.fallbackReason){var n=e.textSyncMode==="legacy"?" Falling back to legacy snapshot synchronization.":" Content synchronization is disabled; presence and the review ledger remain active.";console.warn("yjscollab: "+e.fallbackReason+"."+n)}var r=p.onCollabStatus;if(typeof r=="function")try{r(e)}catch{}}function I(){if(t){for(var e=0;e<t.cleanup.length;e++)try{t.cleanup[e]()}catch{}try{t.awareness.setLocalState(null)}catch{}b&&b.parentNode&&b.parentNode.removeChild(b),b=null,h&&h.parentNode&&h.parentNode.removeChild(h),h=null,t=null}}function $(e){t&&(t.user=e,t.awareness.setLocalStateField("user",{id:e.id,name:e.name,color:e.color}))}function G(){var e=a.getDocument(),n=function(){if(t){var r=a.getSelection();if(!r||r.rangeCount===0){t.awareness.setLocalStateField("caret",null);return}var o=r.getRangeAt(0),d=ee(o);t.awareness.setLocalStateField("caret",d)}};e.addEventListener("selectionchange",n),e.addEventListener("input",n),t.cleanup.push(function(){e.removeEventListener("selectionchange",n),e.removeEventListener("input",n)})}function ee(e){for(var n=a.getEditable(),r=e.startContainer;r&&r.parentNode!==n;){if(!r.parentNode)return null;r=r.parentNode}if(!r)return null;var o=Array.prototype.slice.call(n.children),d=o.indexOf(r);if(d<0)return null;for(var u=0,c=a.getDocument().createTreeWalker(r,NodeFilter.SHOW_TEXT),s;s=c.nextNode();){if(s===e.startContainer)return u+=e.startOffset,{blockIndex:d,offset:u,collapsed:e.collapsed};u+=s.nodeValue.length}return{blockIndex:d,offset:0,collapsed:e.collapsed}}function te(e){if(!e)return null;var n=a.getEditable(),r=n.children[e.blockIndex];if(!r)return null;for(var o=e.offset,d=a.getDocument().createTreeWalker(r,NodeFilter.SHOW_TEXT),u;u=d.nextNode();){if(o<=u.nodeValue.length){var c=a.getDocument().createRange();return c.setStart(u,o),c.collapse(!0),c}o-=u.nodeValue.length}var s=a.getDocument().createRange();return s.selectNodeContents(r),s.collapse(!1),s}function ne(){var e=function(){H(),J()};t.awareness.on("change",e),t.cleanup.push(function(){t.awareness.off("change",e)})}function B(){var e=t.awareness.getStates(),n=t.awareness.clientID,r=[];return e.forEach(function(o,d){d===n||!o||!o.user||r.push({clientId:d,user:o.user,caret:o.caret||null})}),r}function Y(){var e=!1,n=!1,r=null,o=null;function d(){return a&&a.getHTMLCode?a.getHTMLCode():""}function u(){try{var l=a.getDocument&&a.getDocument(),i=l&&l.body;if(!i)return null;var f=l.getSelection?l.getSelection():null;if(!f||f.rangeCount===0)return null;var g=f.getRangeAt(0);if(!i.contains(g.startContainer))return null;var E=l.createRange();return E.selectNodeContents(i),E.setEnd(g.startContainer,g.startOffset),E.toString().length}catch{return null}}function c(l){if(l!=null)try{var i=a.getDocument&&a.getDocument(),f=i&&i.body;if(!f)return;for(var g=i.createTreeWalker(f,NodeFilter.SHOW_TEXT,null),E=l,y=null,_=0;g.nextNode();){var N=g.currentNode,A=N.nodeValue?N.nodeValue.length:0;if(E<=A){y=N,_=E;break}E-=A}if(!y){for(var P=null,K=i.createTreeWalker(f,NodeFilter.SHOW_TEXT,null);K.nextNode();)P=K.currentNode;if(!P)return;y=P,_=P.nodeValue.length}var z=i.getSelection?i.getSelection():null;if(!z)return;var W=i.createRange();W.setStart(y,_),W.collapse(!0),z.removeAllRanges(),z.addRange(W)}catch{}}function s(l){if(!(!a||!a.setHTMLCode)){var i=u();e=!0;try{a.setHTMLCode(l)}finally{e=!1}setTimeout(function(){c(i)},0)}}var v=t.textMap.toString();if(v&&v.length>0)s(v),o=v;else{var S=d();S&&t.textMap.insert(0,S),o=S}var M=!1,w=null,x=a.getDocument&&a.getDocument()||null;if(x){var L=function(){M=!0},U=function(){M&&(M=!1,setTimeout(function(){w!==null&&(o=w,w=null),C()},0))};x.addEventListener("compositionstart",L,!0),x.addEventListener("compositionend",U,!0),t.cleanup.push(function(){x.removeEventListener("compositionstart",L,!0),x.removeEventListener("compositionend",U,!0)})}var T=function(l,i){if(!n&&!(i&&i.local)){var f=t.textMap.toString();if(f!==o){if(M){w=f;return}s(f),o=f,D()}}};t.textMap.observe(T),t.cleanup.push(function(){t.textMap.unobserve(T)});var C=function(){e||M||r||(D(),r=setTimeout(function(){if(r=null,!(!t||!t.textMap)){var l=d();if(l!==o){for(var i=o||"",f=l,g=0,E=Math.min(i.length,f.length);g<E&&i.charCodeAt(g)===f.charCodeAt(g);)g++;for(var y=0,_=Math.min(i.length-g,f.length-g);y<_&&i.charCodeAt(i.length-1-y)===f.charCodeAt(f.length-1-y);)y++;var N=i.length-g-y,A=f.substring(g,f.length-y);n=!0;try{t.doc.transact(function(){N>0&&t.textMap.delete(g,N),A.length>0&&t.textMap.insert(g,A)},t.user&&t.user.id)}finally{n=!1,o=f}}}},250))},m=null,k=null;function j(){var l=a.getDocument&&a.getDocument(),i=l&&l.body;if(!(!i||typeof MutationObserver!="function")&&!(m&&k===i)){if(m){try{m.disconnect()}catch{}m=null}m=new MutationObserver(C),m.observe(i,{childList:!0,characterData:!0,subtree:!0,attributes:!0}),k=i}}j();function D(){j()}var O=function(){C()};a.attachEvent&&a.attachEvent("blur",O),t.cleanup.push(function(){if(r&&(clearTimeout(r),r=null),m&&(m.disconnect(),m=null),a.detachEvent)try{a.detachEvent("blur",O)}catch{}})}function re(){var e=a.reviewLedger,n=e.add,r=e.update,o=e.remove;e.add=function(u){var c=n.call(e,u);return c&&!R&&F(function(){t.ledgerMap.set(c.id,X(c))}),c},e.update=function(u,c){var s=r.call(e,u,c);return s&&!R&&F(function(){t.ledgerMap.set(s.id,X(s))}),s},e.remove=function(u){var c=o.call(e,u);return c&&!R&&F(function(){t.ledgerMap.delete(u)}),c};var d=function(u){R=!0;try{u.keysChanged.forEach(function(c){var s=u.changes.keys.get(c);if(s)if(s.action==="delete")o.call(e,c);else{var v=t.ledgerMap.get(c);if(!v)return;o.call(e,c),n.call(e,v)}})}finally{R=!1}e.refreshPanel&&e.refreshPanel()};t.ledgerMap.observe(d),t.cleanup.push(function(){t.ledgerMap.unobserve(d),e.add=n,e.update=r,e.remove=o})}function F(e){var n=t&&t.textSyncMode==="crdt"&&window.RichTextEditorCrdt?window.RichTextEditorCrdt.LOCAL_ORIGIN:null;n&&t&&t.doc&&typeof t.doc.transact=="function"?t.doc.transact(e,n):e()}function ae(){if(!(!a.reviewLedger||!t.ledgerMap)){R=!0;try{t.ledgerMap.forEach(function(e,n){a.reviewLedger.get(n)||a.reviewLedger.add(e)})}finally{R=!1}}}function X(e){try{return JSON.parse(JSON.stringify(e))}catch{return e}}function oe(){if(!(b&&b.parentNode)){b=document.createElement("div"),b.className="rte-collab-overlay",b.setAttribute("aria-hidden","true"),document.body.appendChild(b);var e=function(){H()};window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),t.cleanup.push(function(){window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)})}}function H(){if(!(!t||!b)){b.innerHTML="";for(var e=B(),n=a.iframe,r=n.getBoundingClientRect(),o=0;o<e.length;o++){var d=e[o];if(d.caret){var u=null;try{u=te(d.caret)}catch{}if(u){var c=u.getClientRects(),s=c&&c.length?c[0]:u.getBoundingClientRect();if(!(!s||!s.top&&!s.left)){var v=document.createElement("div");v.className="rte-collab-caret",v.style.left=r.left+s.left+"px",v.style.top=r.top+s.top+"px",v.style.height=(s.height||18)+"px",v.style.background=d.user.color;var S=document.createElement("div");S.className="rte-collab-caret-label",S.textContent=d.user.name,S.style.background=d.user.color,v.appendChild(S),b.appendChild(v)}}}}}}function le(){if(!(h&&h.parentNode)){h=document.createElement("div"),h.className="rte-collab-presence";var e=ie();e&&e.parentNode?e.parentNode.insertBefore(h,e):document.body.appendChild(h)}}function J(){if(!(!t||!h)){h.innerHTML="";var e=[{user:t.user,self:!0}].concat(B().map(function(u){return{user:u.user,self:!1}})),n=document.createElement("span");n.className="rte-collab-presence-title",n.textContent="Online ("+e.length+")",h.appendChild(n);for(var r=0;r<e.length;r++){var o=e[r].user,d=document.createElement("span");d.className="rte-collab-presence-chip"+(e[r].self?" is-self":""),d.style.background=o.color,d.title=o.name+(e[r].self?" (you)":""),d.textContent=ce(o.name||o.id||"?"),h.appendChild(d)}}}function ie(){for(var e=a.iframe;e&&e!==document.body;){if(e.classList&&e.classList.contains("richtexteditor"))return e;e=e.parentNode}return null}function ce(e){var n=String(e).trim().split(/\s+/);return n[0]?n.length===1?n[0].charAt(0).toUpperCase():(n[0].charAt(0)+n[n.length-1].charAt(0)).toUpperCase():"?"}function ue(){if(!document.querySelector("style[data-rte-collab]")){var e=document.createElement("style");e.setAttribute("data-rte-collab","1"),e.textContent=[".rte-collab-overlay{position:fixed;top:0;left:0;pointer-events:none;z-index:2147482900}",".rte-collab-caret{position:absolute;width:2px;pointer-events:none}",".rte-collab-caret-label{position:absolute;top:-18px;left:0;padding:1px 6px;border-radius:4px;color:#fff;font:10px/1.3 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;white-space:nowrap;font-weight:600;letter-spacing:.01em;box-shadow:0 1px 2px rgba(15,23,42,.15)}",".rte-collab-presence{display:flex;align-items:center;gap:8px;padding:8px 14px;border-radius:10px 10px 0 0;background:#f4f7ff;border:1px solid rgba(71,85,155,.15);border-bottom:0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;font-size:12px;color:#33506f;margin:0}",".rte-collab-presence-title{font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:#475569}",".rte-collab-presence-chip{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:50%;color:#fff;font-size:10px;font-weight:700;box-shadow:0 0 0 2px #fff;letter-spacing:.02em}",".rte-collab-presence-chip.is-self{outline:2px solid rgba(15,23,42,.25);outline-offset:1px}"].join(`
|
|
2
|
+
`),document.head.appendChild(e),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(document,e,"rte-yjscollab-style",e.textContent)}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
RTE_DefaultConfig.plugin_zz_richtextbox_dialog_style=RTE_Plugin_RichTextBoxDialogStyle;function RTE_Plugin_RichTextBoxDialogStyle(){var v=this;v.PluginName="RichTextBoxDialogStyle",v.InitConfig=function(e){e.imageItems||(e.imageItems=[]),e.galleryImages||(e.galleryImages=[]),e.htmlTemplates||(e.htmlTemplates=[]),e.documentItems||(e.documentItems=[])},v.InitEditor=function(){};function c(e,i,r,t){var n=e.ownerDocument.createElement(i);return r&&(n.style.cssText=r),t&&(n.className=t),e.appendChild(n),n}function f(e){return e&&e.value?e.value.replace(/^\s+|\s+$/g,""):""}function w(e){try{return new URL(e,window.location.href).hostname||""}catch{return""}}function p(e){var i=String(e||"").split("#")[0].split("?")[0],r=i.lastIndexOf("/"),t=r>=0?i.substring(r+1):i;try{t=decodeURIComponent(t)}catch{}return t||""}function L(e){var i=p(e),r=i.lastIndexOf(".");return r<0?"LINK":i.substring(r+1).toUpperCase().substring(0,4)}function u(e,i,r){if(!(!e||e.querySelector("."+i))){var t=c(e,"div","",i);t.innerText=r}}function g(e,i,r){return e[r]?!1:(e.addEventListener?e.addEventListener("input",i):(e.onkeyup=i,e.onchange=i,e.onpaste=i),e[r]=!0,!0)}function S(e,i){if(!e||!i)return;var r=i.querySelector("input[type='text']");if(!r)return;r.placeholder||(r.placeholder="https://example.com/image.jpg");var t=e.querySelector(".rte-insertimage-preview");if(!t){t=c(e,"div","","rte-insertimage-preview is-empty");var n=c(t,"img","","rte-insertimage-preview-image");n.alt="Image preview",c(t,"div","","rte-insertimage-preview-caption")}if(r.__rteRichTextBoxImagePreviewBound)return;var s=t.querySelector(".rte-insertimage-preview-image"),a=t.querySelector(".rte-insertimage-preview-caption");function o(){var l=f(r);if(!l){t.classList.add("is-empty"),t.classList.remove("is-error"),s.removeAttribute("src"),a.innerText="Enter an image URL to preview it here.";return}t.classList.remove("is-empty"),t.classList.remove("is-error"),a.innerText="Loading preview...",s.src=l}s.onload=function(){t.classList.remove("is-empty"),t.classList.remove("is-error"),a.innerText="Ready to insert this image."},s.onerror=function(){t.classList.remove("is-empty"),t.classList.add("is-error"),a.innerText="Preview unavailable for this URL."},g(r,o,"__rteRichTextBoxImagePreviewBound"),o()}function I(e,i){if(!e||!i)return;var r=i.querySelector("input[type='text']");if(!r)return;r.placeholder||(r.placeholder="https://example.com/files/proposal.pdf");var t=e.querySelector(".rte-insertdocument-preview");if(!t){t=c(e,"div","","rte-insertdocument-preview is-empty");var n=c(t,"div","","rte-insertdocument-preview-icon");c(n,"div","","rte-insertdocument-preview-ext");var s=c(t,"div","","rte-insertdocument-preview-body");c(s,"div","","rte-insertdocument-preview-title"),c(s,"div","","rte-insertdocument-preview-meta")}if(r.__rteRichTextBoxDocumentPreviewBound)return;var a=t.querySelector(".rte-insertdocument-preview-ext"),o=t.querySelector(".rte-insertdocument-preview-title"),l=t.querySelector(".rte-insertdocument-preview-meta");function y(){var d=f(r);if(!d){t.classList.add("is-empty"),a.innerText="DOC",o.innerText="No document selected",l.innerText="Enter a document URL to preview the inserted link.";return}t.classList.remove("is-empty"),a.innerText=L(d),o.innerText=p(d)||d;var x=w(d);l.innerText=x?"Source: "+x+" | The editor inserts a clickable link.":"The editor inserts a clickable link at the current cursor position."}g(r,y,"__rteRichTextBoxDocumentPreviewBound"),y()}function q(e){var i=[],r;if(e.classList&&e.classList.contains("rte-panel-insertimage")&&i.push(e),e.querySelectorAll){var t=e.querySelectorAll(".rte-panel-insertimage");for(r=0;r<t.length;r++)i.push(t[r])}for(r=0;r<i.length;r++){var n=i[r];n.classList.add("rte-richtextbox-dialog");var s=n.querySelector(".fileuploader-dragdrop");s&&u(s,"rte-insertimage-intro","Drop an image here or click anywhere in this panel to browse.");var a=n.querySelector(".rte_insertimage_byurl");a&&(u(a,"rte-insertimage-intro","Paste a hosted image URL and verify the preview before inserting."),S(a,a.querySelector(".rte-dialog-line-url")));var o=n.querySelector(".rte-dialog-line-action .rte-dialog-button");o&&o.innerText==="Insert"&&(o.innerText="Insert image")}}function T(e){var i=[],r;if(e.classList&&e.classList.contains("rte-panel-insertdocument")&&i.push(e),e.querySelectorAll){var t=e.querySelectorAll(".rte-panel-insertdocument");for(r=0;r<t.length;r++)i.push(t[r])}for(r=0;r<i.length;r++){var n=i[r];n.classList.add("rte-richtextbox-dialog");var s=n.querySelector(".fileuploader-dragdrop");s&&u(s,"rte-insertdocument-intro","Upload a local file or drag it into the dialog to create a document link.");var a=n.querySelector(".rte_insertdocument_byurl");a&&(u(a,"rte-insertdocument-intro","Paste a hosted file URL and review the link details before inserting."),I(a,a.querySelector(".rte-dialog-line-url")));var o=n.querySelector(".rte-dialog-line-action");o&&o.classList.add("rte-insertdocument-actions");var l=n.querySelector(".rte-dialog-line-action .rte-dialog-button");l&&l.innerText==="Insert"&&(l.innerText="Insert document"),l&&l.innerText==="Update"&&(l.innerText="Update document")}}function h(e){!e||e.nodeType!==1||(q(e),T(e))}function m(){if(h(document.documentElement),!!window.MutationObserver){var e=new MutationObserver(function(i){var r,t;for(r=0;r<i.length;r++)for(t=0;t<i[r].addedNodes.length;t++)h(i[r].addedNodes[t])});e.observe(document.documentElement,{childList:!0,subtree:!0})}}document.readyState==="loading"?document.addEventListener?document.addEventListener("DOMContentLoaded",m):window.attachEvent("onload",m):m()}
|
|
@@ -59,6 +59,7 @@ RTE_DefaultConfig.autoGrow = false; // When true, the editor auto-expands to fit
|
|
|
59
59
|
RTE_DefaultConfig.autoHeadingAnchors = true; // Auto-assign stable slug IDs to h1-h6 elements so deep-links / TOC navigation work.
|
|
60
60
|
RTE_DefaultConfig.copyHeadingLink = true; // Show a 🔗 "copy link" icon on hover over h1-h6 in the editor.
|
|
61
61
|
RTE_DefaultConfig.smartPasteToast = true; // Show a brief "Cleaned from Word / Google Docs" toast after a successful paste-cleanup.
|
|
62
|
+
RTE_DefaultConfig.pasteStripThemeStyles = true; // On paste, drop inline styles that only repeat the editor's own theme (browsers inline computed styles on copy, so text copied inside the editor arrived carrying its margin, font-size and colour). Styles the author set that differ from the theme are kept.
|
|
62
63
|
RTE_DefaultConfig.smartLinkPaste = true; // Paste a URL while text is selected -> wrap the selection in <a href> instead of replacing it. Matches Google Docs / Notion / TipTap behavior.
|
|
63
64
|
RTE_DefaultConfig.aiContextMenu = true; // Right-click on selected text shows Ask AI / Rewrite / Summarize / Translate (when AI Toolkit is loaded).
|
|
64
65
|
RTE_DefaultConfig.tableColumnResize = true; // Hover near a table column border to drag-resize the column.
|
|
@@ -169,6 +170,7 @@ RTE_DefaultConfig.sanitizerGuardLiveDom = true;
|
|
|
169
170
|
|
|
170
171
|
RTE_DefaultConfig.tabSpaces = 4; //Gets or sets the number of spaces to be inserted when the user hits the "tab" key.
|
|
171
172
|
RTE_DefaultConfig.enterKeyTag = "p" // Determines what happens when the "enter" key is pressed in the editor. div, p or br.
|
|
173
|
+
RTE_DefaultConfig.styleWithCSS = false; // false (default): Bold/Italic/Underline save <b>/<i>/<u>, which boldTag/italicTag normalise and which screen readers announce as emphasis. true: inline styles (<span style="font-weight: bold">) instead. Before core 2.6.8 this depended on whether the plugin bundle happened to load first.
|
|
172
174
|
RTE_DefaultConfig.boldTag = "b" // Tag the Bold command writes to the saved HTML: "b" (default) or "strong".
|
|
173
175
|
RTE_DefaultConfig.italicTag = "i" // Tag the Italic command writes to the saved HTML: "i" (default) or "em".
|
|
174
176
|
RTE_DefaultConfig.strikeTag = "s" // Tag the Strikethrough command writes to the saved HTML: "s" (default), "strike" or "del".
|