diff --git a/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-debug.js b/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-debug.js index 2c864522711..3af90d3a415 100644 --- a/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-debug.js +++ b/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-debug.js @@ -37,7 +37,8 @@ var PLUGINNAME = 'atto_collapse', ATTRSHOWGROUPS = 'showgroups', COLLAPSE = 'collapse', COLLAPSED = 'collapsed', - GROUPS = '.atto_group'; + GROUPS = '.atto_group', + ROWS = '.atto_toolbar_row'; Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { initializer: function() { @@ -62,11 +63,23 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto. // Perform a toggle after all plugins have been loaded for the first time. this.get('host').on('pluginsloaded', function(e, button) { - this._setVisibility(button); + // Add 2 rows in the toolbar. + var toolbarRows = [ + Y.Node.create('
'), + Y.Node.create('
'), + ]; + this.toolbar.appendChild(toolbarRows[0]).insert(toolbarRows[1], 'after'); - // Set the toolbar to break after the initial those displayed by default. - var firstGroup = this.toolbar.all(GROUPS).item(this.get(ATTRSHOWGROUPS)); - firstGroup.insert('
', 'before'); + // Split toolbar buttons between the 2 rows created above. + var buttonGroups = this.toolbar.all(GROUPS); + buttonGroups.slice(0, this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) { + toolbarRows[0].appendChild(buttonGroup); + }); + buttonGroups.slice(this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) { + toolbarRows[1].appendChild(buttonGroup); + }); + + this._setVisibility(button); }, this, button); }, @@ -101,15 +114,15 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto. * @private */ _setVisibility: function(button, visibility) { - var groups = this.toolbar.all(GROUPS).slice(this.get(ATTRSHOWGROUPS)); + var secondaryRow = this.toolbar.all(ROWS).item(1); if (visibility) { button.set('title', M.util.get_string('showfewer', PLUGINNAME)); - groups.show(); + secondaryRow.show(); button.setData(COLLAPSED, false); } else { button.set('title', M.util.get_string('showmore', PLUGINNAME)); - groups.hide(); + secondaryRow.hide(); button.setData(COLLAPSED, true); } diff --git a/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-min.js b/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-min.js index bf69dae776b..d6b85b48d0f 100644 --- a/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-min.js +++ b/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_collapse-button",function(s,t){var o="atto_collapse",e="showgroups",l="collapse",a="collapsed",n=".atto_group";s.namespace("M.atto_collapse").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{initializer:function(){var t,i=s.Object.size(this.get("host").get("plugins"));i<=1+parseInt(this.get(e),10)||this.toolbar.all(n).size()>this.get(e)||(t=this.addButton({icon:"icon",iconComponent:o,callback:this._toggle}),this.get("host").on("pluginsloaded",function(t,i){this._setVisibility(i),this.toolbar.all(n).item(this.get(e)).insert('
',"before")},this,t))},_toggle:function(t){t.preventDefault();var i=this.buttons[l];i.getData(a)?(this.highlightButtons(l),this._setVisibility(i,!0)):(this.unHighlightButtons(l),this._setVisibility(i)),this.buttons[this.name].focus()},_setVisibility:function(t,i){var s=this.toolbar.all(n).slice(this.get(e));i?(t.set("title",M.util.get_string("showfewer",o)),s.show(),t.setData(a,!1)):(t.set("title",M.util.get_string("showmore",o)),s.hide(),t.setData(a,!0))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file +YUI.add("moodle-atto_collapse-button",function(s,t){var e="atto_collapse",a="showgroups",o="collapse",l="collapsed",n=".atto_group";s.namespace("M.atto_collapse").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{initializer:function(){var t,i=s.Object.size(this.get("host").get("plugins"));i<=1+parseInt(this.get(a),10)||this.toolbar.all(n).size()>this.get(a)||(t=this.addButton({icon:"icon",iconComponent:e,callback:this._toggle}),this.get("host").on("pluginsloaded",function(t,i){var o,e=[s.Node.create('
'),s.Node.create('
')];this.toolbar.appendChild(e[0]).insert(e[1],"after"),(o=this.toolbar.all(n)).slice(0,this.get(a)).each(function(t){e[0].appendChild(t)}),o.slice(this.get(a)).each(function(t){e[1].appendChild(t)}),this._setVisibility(i)},this,t))},_toggle:function(t){t.preventDefault();var i=this.buttons[o];i.getData(l)?(this.highlightButtons(o),this._setVisibility(i,!0)):(this.unHighlightButtons(o),this._setVisibility(i)),this.buttons[this.name].focus()},_setVisibility:function(t,i){var o=this.toolbar.all(".atto_toolbar_row").item(1);i?(t.set("title",M.util.get_string("showfewer",e)),o.show(),t.setData(l,!1)):(t.set("title",M.util.get_string("showmore",e)),o.hide(),t.setData(l,!0))}},{ATTRS:{showgroups:{value:3}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file diff --git a/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button.js b/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button.js index d4c0e9f4191..3c9fd95f0d2 100644 --- a/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button.js +++ b/lib/editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button.js @@ -37,7 +37,8 @@ var PLUGINNAME = 'atto_collapse', ATTRSHOWGROUPS = 'showgroups', COLLAPSE = 'collapse', COLLAPSED = 'collapsed', - GROUPS = '.atto_group'; + GROUPS = '.atto_group', + ROWS = '.atto_toolbar_row'; Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { initializer: function() { @@ -58,11 +59,23 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto. // Perform a toggle after all plugins have been loaded for the first time. this.get('host').on('pluginsloaded', function(e, button) { - this._setVisibility(button); + // Add 2 rows in the toolbar. + var toolbarRows = [ + Y.Node.create('
'), + Y.Node.create('
'), + ]; + this.toolbar.appendChild(toolbarRows[0]).insert(toolbarRows[1], 'after'); - // Set the toolbar to break after the initial those displayed by default. - var firstGroup = this.toolbar.all(GROUPS).item(this.get(ATTRSHOWGROUPS)); - firstGroup.insert('
', 'before'); + // Split toolbar buttons between the 2 rows created above. + var buttonGroups = this.toolbar.all(GROUPS); + buttonGroups.slice(0, this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) { + toolbarRows[0].appendChild(buttonGroup); + }); + buttonGroups.slice(this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) { + toolbarRows[1].appendChild(buttonGroup); + }); + + this._setVisibility(button); }, this, button); }, @@ -97,15 +110,15 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto. * @private */ _setVisibility: function(button, visibility) { - var groups = this.toolbar.all(GROUPS).slice(this.get(ATTRSHOWGROUPS)); + var secondaryRow = this.toolbar.all(ROWS).item(1); if (visibility) { button.set('title', M.util.get_string('showfewer', PLUGINNAME)); - groups.show(); + secondaryRow.show(); button.setData(COLLAPSED, false); } else { button.set('title', M.util.get_string('showmore', PLUGINNAME)); - groups.hide(); + secondaryRow.hide(); button.setData(COLLAPSED, true); } diff --git a/lib/editor/atto/plugins/collapse/yui/src/button/js/button.js b/lib/editor/atto/plugins/collapse/yui/src/button/js/button.js index 462654ae811..564bbb89590 100644 --- a/lib/editor/atto/plugins/collapse/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/collapse/yui/src/button/js/button.js @@ -35,7 +35,8 @@ var PLUGINNAME = 'atto_collapse', ATTRSHOWGROUPS = 'showgroups', COLLAPSE = 'collapse', COLLAPSED = 'collapsed', - GROUPS = '.atto_group'; + GROUPS = '.atto_group', + ROWS = '.atto_toolbar_row'; Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { initializer: function() { @@ -60,11 +61,23 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto. // Perform a toggle after all plugins have been loaded for the first time. this.get('host').on('pluginsloaded', function(e, button) { - this._setVisibility(button); + // Add 2 rows in the toolbar. + var toolbarRows = [ + Y.Node.create('
'), + Y.Node.create('
'), + ]; + this.toolbar.appendChild(toolbarRows[0]).insert(toolbarRows[1], 'after'); - // Set the toolbar to break after the initial those displayed by default. - var firstGroup = this.toolbar.all(GROUPS).item(this.get(ATTRSHOWGROUPS)); - firstGroup.insert('
', 'before'); + // Split toolbar buttons between the 2 rows created above. + var buttonGroups = this.toolbar.all(GROUPS); + buttonGroups.slice(0, this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) { + toolbarRows[0].appendChild(buttonGroup); + }); + buttonGroups.slice(this.get(ATTRSHOWGROUPS)).each(function(buttonGroup) { + toolbarRows[1].appendChild(buttonGroup); + }); + + this._setVisibility(button); }, this, button); }, @@ -99,15 +112,15 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto. * @private */ _setVisibility: function(button, visibility) { - var groups = this.toolbar.all(GROUPS).slice(this.get(ATTRSHOWGROUPS)); + var secondaryRow = this.toolbar.all(ROWS).item(1); if (visibility) { button.set('title', M.util.get_string('showfewer', PLUGINNAME)); - groups.show(); + secondaryRow.show(); button.setData(COLLAPSED, false); } else { button.set('title', M.util.get_string('showmore', PLUGINNAME)); - groups.hide(); + secondaryRow.hide(); button.setData(COLLAPSED, true); } diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js index a854730b4cc..e57624b3412 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js @@ -2310,7 +2310,6 @@ EditorToolbarNav.prototype = { */ _findFirstFocusable: function(buttons, startAt, direction) { var checkCount = 0, - group, candidate, button, index; @@ -2340,12 +2339,8 @@ EditorToolbarNav.prototype = { // Loop while: // * we haven't checked every button; // * the button is hidden or disabled; - // * the group is hidden. - if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled')) { - continue; - } - group = candidate.ancestor('.atto_group'); - if (group.hasAttribute('hidden')) { + // * the button is inside a hidden wrapper element. + if (candidate.hasAttribute('hidden') || candidate.hasAttribute('disabled') || candidate.ancestor('[hidden]')) { continue; } diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js index b41a5581e61..d9909ddb72f 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js @@ -1,5 +1,5 @@ YUI.add("moodle-editor_atto-editor",function(u,t){var o,r,n,l,s,a={CONTENT:"editor_atto_content",CONTENTWRAPPER:"editor_atto_content_wrap",TOOLBAR:"editor_atto_toolbar",WRAPPER:"editor_atto",HIGHLIGHT:"highlight"},c=window.rangy;function e(){e.superclass.constructor.apply(this,arguments)}function i(){}function h(){}function d(){}function g(){g.superclass.constructor.apply(this,arguments),this._submitEvents={},this._queue=[],this._throttle=null}function p(){}function f(){}function m(){}function v(){}function b(){}function _(){}function y(){}function S(){}u.extend(e,u.Base,{BLOCK_TAGS:["address","article","aside","audio","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],PLACEHOLDER_CLASS:"atto-tmp-class",ALL_NODES_SELECTOR:"[style],font[face]",FONT_FAMILY:"fontFamily",_wrapper:null,editor:null,textarea:null,textareaLabel:null,plugins:null,coreDirection:null,_eventHandles:null,initializer:function(){var t,e,i,n;this.textarea=u.one(document.getElementById(this.get("elementid"))),this.textarea&&(e=this.textarea.getAttribute("class"),this._eventHandles=[],i=u.Node.create('
'+M.util.get_string("richtexteditor","editor_atto")+"
"),this._wrapper=u.Node.create('
'),this._wrapper.appendChild(i),this._wrapper.setAttribute("aria-describedby",i.generateID()),t=u.Handlebars.compile('
'),this.editor=u.Node.create(t({elementid:this.get("elementid"),CSS:a})),this.textareaLabel=u.one('[for="'+this.get("elementid")+'"]'),this.textareaLabel&&(this.textareaLabel.generateID(),this.editor.setAttribute("aria-labelledby",this.textareaLabel.get("id"))),this.coreDirection=u.one("body").hasClass("dir-rtl")?"rtl":"ltr",this.setupToolbar(),(n=u.Node.create('
')).appendChild(this.editor),this._wrapper.appendChild(n),this.editor.setStyle("minHeight",20*this.textarea.getAttribute("rows")+8+"px"),0===u.UA.ie&&this.editor.setStyle("height",20*this.textarea.getAttribute("rows")+8+"px"),this.disableCssStyling(),document.queryCommandSupported("DefaultParagraphSeparator")&&document.execCommand("DefaultParagraphSeparator",!1,"p"),this.textarea.get("parentNode").insert(this._wrapper,this.textarea).setAttribute("class","editor_atto_wrap"),this.textarea.hide(),u.mix(u.Node.DOM_EVENTS,{"form:editorUpdated":!0}),this.textarea.on("form:editorUpdated",function(){this.updateEditorState()},this),this.updateFromTextArea(),this.publishEvents(),this.setupSelectionWatchers(),this.setupAutomaticPolling(),this.setupPlugins(),this.setupAutosave(),this.setupNotifications())},focus:function(){return this.editor.focus(),this},publishEvents:function(){return this.publish("change",{broadcast:!0,preventable:!0}),this.publish("pluginsloaded",{fireOnce:!0}),this.publish("atto:selectionchanged",{prefix:"atto"}),this},setupAutomaticPolling:function(){return this._registerEventHandle(this.editor.on(["keyup","cut"],this.updateOriginal,this)),this._registerEventHandle(this.editor.on("paste",this.pasteCleanup,this)),this._registerEventHandle(this.editor.on("drop",this.updateOriginalDelayed,this)),this},updateOriginalDelayed:function(){return u.soon(u.bind(this.updateOriginal,this)),this},setupPlugins:function(){var t,e,i,n,s,a;for(e in this.plugins={},t=this.get("plugins"))if((i=t[e]).plugins)for(n in i.plugins)s=i.plugins[n],a=u.mix({name:s.name,group:i.group,editor:this.editor,toolbar:this.toolbar,host:this},s),"undefined"!=typeof u.M["atto_"+s.name]&&(this.plugins[s.name]=new u.M["atto_"+s.name].Button(a));return this.fire("pluginsloaded"),this},enablePlugins:function(t){this._setPluginState(!0,t)},disablePlugins:function(t){this._setPluginState(!1,t)},_setPluginState:function(t,e){var i="disableButtons";t&&(i="enableButtons"),e?this.plugins[e][i]():u.Object.each(this.plugins,function(t){t[i]()},this)},updateEditorState:function(){var t=this.textarea.hasAttribute("readonly"),e=u.one("#"+this.get("elementid")+"editable");this._setPluginState(!t),e&&e.setAttribute("contenteditable",!t)},_registerEventHandle:function(t){this._eventHandles.push(t)}},{NS:"editor_atto",ATTRS:{elementid:{value:null,writeOnce:!0},contextid:{value:null,writeOnce:!0},plugins:{value:{},writeOnce:!0}}}),u.augment(e,u.EventTarget),u.namespace("M.editor_atto").Editor=e,u.namespace("M.editor_atto.Editor").init=function(t){return new u.M.editor_atto.Editor(t)},o="info",r="warning",i.ATTRS={},i.prototype={messageOverlay:null,hideTimer:null,setupNotifications:function(){var t=new Image,e=new Image;return t.src=M.util.image_url("i/warning","moodle"),e.src=M.util.image_url("i/info","moodle"),this},showMessage:function(t,e,i){var n,s,a="";return null===this.messageOverlay&&(this.messageOverlay=u.Node.create('
'),this.messageOverlay.hide(!0),this.textarea.get("parentNode").append(this.messageOverlay),this.messageOverlay.on("click",function(){this.messageOverlay.hide(!0)},this)),null!==this.hideTimer&&this.hideTimer.cancel(),e===r?a=''+M.util.get_string(':e===o&&(a=''+M.util.get_string('),(n=parseInt(i,10))<=0&&(n=6e4),e="atto_"+e,s=u.Node.create('"),this.messageOverlay.empty(),this.messageOverlay.append(s),this.messageOverlay.show(!0),this.hideTimer=u.later(n,this,function(){this.hideTimer=null,this.messageOverlay.inDoc()&&this.messageOverlay.hide(!0)}),this}},u.Base.mix(u.M.editor_atto.Editor,[i]),h.ATTRS={},h.prototype={_getEmptyContent:function(){var t ;return t="rtl"===this.coreDirection?'style="text-align: right;"':'style="text-align: left;"',u.UA.ie&&u.UA.ie<10?'

":'


"},updateFromTextArea:function(){return this.editor.setHTML(""),this.editor.append(this._cleanHTML(this.textarea.get("value"),!0)),""===this.editor.getHTML()&&this.editor.setHTML(this._getEmptyContent()),this},updateOriginal:function(){var t=this.textarea.get("value"),e=this.getCleanHTML();return""===e&&this.isActive()&&(e=this._getEmptyContent()),t!==e&&(this.textarea.set("value",e),this.textarea.simulate("change"),this.fire("change")),this}},u.Base.mix(u.M.editor_atto.Editor,[h]),n=5e3,l=6e4,d.ATTRS={autosaveEnabled:{value:!0,writeOnce:!0},autosaveFrequency:{value:60,writeOnce:!0},pageHash:{value:"",writeOnce:!0}},d.prototype={lastText:"",autosaveInstance:null,autosaveTimer:null,setupAutosave:function(){var t,e,i,n=-1,s=null,a=this.get("filepickeroptions");if(this.get("autosaveEnabled")){for(s in this.autosaveInstance=u.stamp(this),a)"undefined"!=typeof a[s].itemid&&(n=a[s].itemid);return e={contextid:this.get("contextid"),action:"resume",draftid:n,elementid:this.get("elementid"),pageinstance:this.autosaveInstance,pagehash:this.get("pageHash")},this.autosaveIo(e,this,{success:function(t){if(null!==t&&t){["

","


","
",'

','


','

','


',"

 

","


 

",'

 

','


 

','

 

','


 

'].includes(t.result)&&(t.result=""),t.error||"undefined"==typeof t.result?this.showMessage(M.util.get_string("errortextrecovery","editor_atto"),r,l):t.result!==this.textarea.get("value")&&""!==t.result&&this.recoverText(t.result),this._fireSelectionChanged()}},failure:function(){this.showMessage(M.util.get_string("errortextrecovery","editor_atto"),r,l)}}),i=1e3*parseInt(this.get("autosaveFrequency"),10),this.autosaveTimer=u.later(i,this,this.saveDraft,!1,!0),(t=this.textarea.ancestor("form"))&&this.autosaveIoOnSubmit(t,{action:"reset",contextid:this.get("contextid"),elementid:this.get("elementid"),pageinstance:this.autosaveInstance,pagehash:this.get("pageHash")}),this}},recoverText:function(t){return this.editor.setHTML(t),this.saveSelection(),this.updateOriginal(),this.lastText=t,this.showMessage(M.util.get_string("textrecovered","editor_atto"),o,l),require(["core_editor/events"],function(t){t.notifyEditorContentRestored(this.editor.getDOMNode())}.bind(this)),this},saveDraft:function(){var t,e,i;if(this.editor.getDOMNode())return this.editor.get("hidden")||this.updateOriginal(),(e=this.textarea.get("value"))!==this.lastText&&(M.cfg.wwwroot,this.get("autosaveAjaxScript"),t={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"save",drafttext:e,elementid:this.get("elementid"),pagehash:this.get("pageHash"),pageinstance:this.autosaveInstance},i=function(t){var e=1e3*parseInt(this.get("autosaveFrequency"),10);this.showMessage(M.util.get_string("autosavefailed","editor_atto"),r,e)},this.autosaveIo(t,this,{failure:i,success:function(t){t&&t.error?u.soon(u.bind(i,this,[t])):(this.lastText=e,this.showMessage(M.util.get_string("autosavesucceeded","editor_atto"),o,n))}})),this;this.autosaveTimer.cancel()}},u.Base.mix(u.M.editor_atto.Editor,[d]),s=null,g.NAME="EditorAutosaveIoDispatcher",g.ATTRS={autosaveAjaxScript:{value:"/lib/editor/atto/autosave-ajax.php",readOnly:!0},delay:{value:50,readOnly:!0}},u.extend(g,u.Base,{dispatch:function(t,e,i){this._throttle&&this._throttle.cancel(),this._throttle=u.later(this.get("delay"),this,this._processDispatchQueue),this._queue.push([t,e,i])},_processDispatchQueue:function(){var t=this._queue,i={};this._queue=[],t.length<1||(u.Array.each(t,function(t,e){i[e]=t[0]}),u.io(M.cfg.wwwroot+this.get("autosaveAjaxScript"),{method:"POST",data:u.QueryString.stringify({actions:i,sesskey:M.cfg.sesskey}),on:{start:this._makeIoEventCallback("start",t),complete:this._makeIoEventCallback("complete",t),failure:this._makeIoEventCallback("failure",t),end:this._makeIoEventCallback("end",t),success:this._makeIoEventCallback("success",t)}}))},_makeIoEventCallback:function(o,e){var r=function(){};return function(){var t=arguments[1],a={};"complete"!=o&&"success"!=o||void 0===t||"undefined"==typeof t.responseText||""===t.responseText||(a=JSON.parse(t.responseText)||{}),u.Array.each(e,function(t,e){var i,n=t[1],s=t[2]&&t[2][o]||r;a&&a.error?i=a:a&&(i=a[e]),s.apply(n,[i])})}},_onSubmit:function(t){var i={},e=t.currentTarget.generateID(),n=this._submitEvents[e];!n||n.ios.length<1||(u.Array.each(n.ios,function(t,e){i[e]=t}),u.io(M.cfg.wwwroot+this.get("autosaveAjaxScript"),{method:"POST",data:u.QueryString.stringify({actions:i,sesskey:M.cfg.sesskey}),sync:!0}))},whenSubmit:function(t,e){"undefined"==typeof this._submitEvents[t.generateID()]&&(this._submitEvents[t.generateID()]={event:t.on("submit",this._onSubmit,this),ajaxEvent:t.on(M.core.event.FORM_SUBMIT_AJAX,this._onSubmit,this),ios:[]}),this._submitEvents[t.get("id")].ios.push([e])}}),s=new g,p.prototype={autosaveIo:function(t,e,i){s.dispatch(t,e,i)},autosaveIoOnSubmit:function(t,e){s.whenSubmit(t,e)}},u.Base.mix(u.M.editor_atto.Editor,[p]),f.ATTRS={},f.prototype={getCleanHTML:function(){var t,e=this.editor.cloneNode(!0);return u.each(e.all('[id^="yui"]'),function(t){t.removeAttribute("id")}),e.all(".atto_control").remove(!0),t=e.get("innerHTML"),["

","


","
",'

','


','

','


',"

 

","


 

", '

 

','


 

','

 

','


 

'].includes(t)?"":this._cleanHTML(t)},cleanEditorHTML:function(){var t=this.editor.get("innerHTML");return this.editor.set("innerHTML",this._cleanHTML(t)),this},_cleanHTML:function(t,e){return t=this._filterContentWithRules(t,[{regex:/]*>[\s\S]*?<\/style>/gi,replace:""},{regex:/)/gi,replace:""},{regex:/<\/?(?:title|meta|style|st\d|head\b|font|html|body|link)[^>]*?>/gi,replace:""}]),e&&(t=this._cleanHTMLLists(t)),t},_filterContentWithRules:function(t,e){var i=0;for(i=0;i([\s\S]+)$/gi,replace:""},{regex://gi,replace:""},{regex://gi,replace:""},{regex:/]*>[\s\S]*?<\/xml>/gi,replace:""},{regex:/<\?xml[^>]*>[\s\S]*?<\\\?xml>/gi,replace:""},{regex:/<\/?\w+:[^>]*>/gi,replace:""}],t=this._filterContentWithRules(t,e),0!==(t=this._cleanHTML(t)).length&&t.match(/\S/)?((i=document.createElement("div")).innerHTML=t,t=i.innerHTML,e=[{regex:/(<[^>]*?class\s*?=\s*?")([^>"]*)(")/gi,replace:function(t,e,i,n){return e+(i=(i=i.replace(/(?:^|[\s])[\s]*MSO[_a-zA-Z0-9\-]*/gi,"")).replace(/(?:^|[\s])[\s]*Apple-[_a-zA-Z0-9\-]*/gi,""))+n}},{regex:/]*?name\s*?=\s*?"OLE_LINK\d*?"[^>]*?>\s*?<\/a>/gi,replace:i.innerHTML=""}],t=this._cleanStyles(t),t=this._filterContentWithRules(t,e),t=this._cleanHTML(t),t=this._cleanSpans(t)):t):""},_cleanStyles:function(t){var e,i,n,s=document.createElement("div");for(s.innerHTML=t,e=s.querySelectorAll("[style]"),i=i=0;i]*?)(?:[\s]*(?:class|style|id)\s*?=\s*?"\s*?")+/gi,replace:"$1"}],t=this._filterContentWithRules(t,e),(i=document.createElement("div")).innerHTML=t,n=i.getElementsByTagName("span"),Array.prototype.slice.call(n,0).forEach(function(t){if(!t.hasAttributes()){for(;t.firstChild;)t.parentNode.insertBefore(t.firstChild,t);t.parentNode.removeChild(t)}}),i.innerHTML):t:""},_cleanHTMLLists:function(t){for(var e,i="",n=t,s=null,a=[],o=null,r=null;s=n.match(/<(\/?)(li|ul|ol)[^>]*>/i);){if(o={tag:s[2],tagLowerCase:s[2].toLowerCase(),fullTag:s[0],isOpen:1!=s[1].length},r=a.length?a[a.length-1]:null,i+=n.slice(0,s.index),n=n.slice(s.index+s[0].length),o.isOpen){if("li"===o.tagLowerCase){if(!r){if(e=(n.match(/<\/(ol)[ >]/gi)||[]).length,(n.match(/<(ol)[ >]/gi)||[]).length"+o.fullTag+n;continue}n="
    "+o.fullTag+n;continue}if("li"===r.tagLowerCase){n=""+o.fullTag+n;continue}}a.push({tag:o.tag,tagLowerCase:o.tagLowerCase,position:i.length,length:o.fullTag.length})}else{if(0==a.length)continue;if(r.tagLowerCase===o.tagLowerCase)o.tag!=r.tag&&(o.fullTag=o.fullTag.replace(o.tag,r.tag)),a.pop(),r=a.length?a[a.length-1]:null;else if("li"===o.tagLowerCase&&r.liEnd&&r.liEnd",r.liEnd);else{if("li"!==o.tagLowerCase||r.liEnd||!(r.position+r.length"+o.fullTag+n;continue}i=this._insertString(i,"<"+o.tag+">",r.position+r.length)}"li"===o.tagLowerCase&&r&&(r.liEnd=i.length+o.fullTag.length)}i+=o.fullTag}if(i+=n,a.length)for(;o=a.pop();)i=o.liEnd?this._insertString(i,"",o.liEnd):i.slice(0,o.position)+i.slice(o.position+o.length);return i},_insertString:function(t,e,i){return t.slice(0,i)+e+t.slice(i)}},u.Base.mix(u.M.editor_atto.Editor,[f]),m.ATTRS={},m.prototype={applyFormat:function(t,e,i,n){var s,a;if(i=i||this,(s=window.rangy.getSelection()).isCollapsed)return a=this.editor.once("input",function o(t,e,i,n,s,a){u.soon(u.bind(function(t,e,i,n,s,a){var o=window.rangy.getSelection(),r=o.getRangeAt(0);r.setStart(s,a),o.setSingleRange(r),e.apply(i,[t,n]),o.collapseToEnd(),this.saveSelection(),this.updateOriginal()},this,t,e,i,n,s,a))},this,e,i,n,s.anchorNode,s.anchorOffset),void this.editor.onceAfter(["click","selectstart"],a.detach,a);e.apply(i,[t,n]),this.saveSelection(),this.updateOriginal()},replaceTags:function(t,e){var i,n,s,a;for(t.setAttribute("data-iterate",!0),i=this.editor.one('[data-iterate="true"]');i;){for(n=u.Node.create("<"+e+" />").setAttrs(i.getAttrs()).removeAttribute("data-iterate"),i.getAttribute( -"style")&&n.setAttribute("style",i.getAttribute("style")),i.getAttribute("class")&&n.setAttribute("class",i.getAttribute("class")),a=(s=i.getDOMNode().childNodes)[0];void 0!==a;)n.append(a),a=s[0];i.replace(n),i=this.editor.one('[data-iterate="true"]')}},changeToCSS:function(t,e){var i=window.rangy.saveSelection();this.editor.all(".rangySelectionBoundary").setStyle("display",null),this.editor.all(t).addClass(e),this.replaceTags(this.editor.all("."+e),"span"),window.rangy.restoreSelection(i)},changeToTags:function(e,i){var t=window.rangy.saveSelection();this.editor.all(".rangySelectionBoundary").setStyle("display",null),this.replaceTags(this.editor.all('span[class="'+e+'"]'),i),this.editor.all(i+'[class="'+e+'"]').removeAttribute("class"),this.editor.all("."+e).each(function(t){t.wrap("<"+i+"/>"),t.removeClass(e)}),this.editor.all('[class="'+e+'"]').removeAttribute("class"),this.editor.all(i).removeClass(e),window.rangy.restoreSelection(t)}},u.Base.mix(u.M.editor_atto.Editor,[m]),v.ATTRS={},v.prototype={toolbar:null,openMenus:null,setupToolbar:function(){return this.toolbar=u.Node.create('