weekly release 4.0dev
[moodle.git] / lib / editor / atto / plugins / table / yui / build / moodle-atto_table-button / moodle-atto_table-button-min.js
CommitLineData
29c5faff 1YUI.add("moodle-atto_table-button",function(O,e){var C="atto_table",S="none",R="1",T="480px",l={CAPTION:"caption",CAPTIONPOSITION:"captionposition",HEADERS:"headers",ROWS:"rows",COLUMNS:"columns",SUBMIT:"submit",FORM:"atto_form",BORDERS:"borders",BORDERSIZE:"bordersize",BORDERSIZEUNIT:"px",BORDERCOLOUR:"bordercolour",BORDERSTYLE:"borderstyle",BACKGROUNDCOLOUR:"backgroundcolour",WIDTH:"customwidth",WIDTHUNIT:"%",AVAILABLECOLORS:"availablecolors",COLOURROW:"colourrow"},w={CAPTION:"."+l.CAPTION,CAPTIONPOSITION:"."+l.CAPTIONPOSITION,HEADERS:"."+l.HEADERS,ROWS:"."+l.ROWS,COLUMNS:"."+l.COLUMNS,SUBMIT:"."+l.SUBMIT,BORDERS:"."+l.BORDERS,BORDERSIZE:"."+l.BORDERSIZE,BORDERCOLOURS:"."+l.BORDERCOLOUR+' input[name="borderColour"]',SELECTEDBORDERCOLOUR:"."+l.BORDERCOLOUR+' input[name="borderColour"]:checked',BORDERSTYLE:"."+l.BORDERSTYLE,BACKGROUNDCOLOURS:"."+l.BACKGROUNDCOLOUR+' input[name="backgroundColour"]',SELECTEDBACKGROUNDCOLOUR:"."+l.BACKGROUNDCOLOUR+' input[name="backgroundColour"]:checked',FORM:".atto_form",WIDTH:"."+l.WIDTH,AVAILABLECOLORS:"."+l.AVAILABLECOLORS};O.namespace("M.atto_table").Button=O.Base.create("button",O.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_contextMenu:null,_lastTarget:null,_menuOptions:null,initializer:function(){this.addButton({icon:"e/table",callback:this._displayTableEditor,tags:"table"}),O.UA.gecko&&(document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("enableObjectResizing",!1,!1))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection(),!1===this._currentSelection||this._currentSelection.collapsed||(this.getDialogue({headerContent:M.util.get_string("createtable",C),focusAfterHide:!0,focusOnShowSelector:w.CAPTION,width:T}).set("bodyContent",this._getDialogueContent(!1)).show(),this._updateAvailableSettings())},_displayTableEditor:function(e){var t=this._getSuitableTableCell();return t?(e.tableCell=t,this._showTableMenu(e)):this._displayDialogue(e)},_stopAtContentEditableFilter:function(e){return this.editor.contains(e)},_getDialogueContent:function(e){var t=O.Handlebars.compile(
4394f9e3 2'<form class="{{CSS.FORM}}"><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_caption">{{get_string "caption" component}}</label></div><div class="col-sm-8"><input type="text" class="form-control {{CSS.CAPTION}}" id="{{elementid}}_atto_table_caption" required /></div></div><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_captionposition">{{get_string "captionposition" component}}</label></div><div class="col-sm-8"><select class="custom-select {{CSS.CAPTIONPOSITION}}" id="{{elementid}}_atto_table_captionposition"><option value=""></option><option value="top">{{get_string "top" "editor"}}</option><option value="bottom">{{get_string "bottom" "editor"}}</option></select></div></div><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_headers">{{get_string "headers" component}}</label></div><div class="col-sm-8"><select class="custom-select {{CSS.HEADERS}}" id="{{elementid}}_atto_table_headers"><option value="columns">{{get_string "columns" component}}</option><option value="rows">{{get_string "rows" component}}</option><option value="both">{{get_string "both" component}}</option></select></div></div>{{#if nonedit}}<div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_rows">{{get_string "numberofrows" component}}</label></div><div class="col-sm-8"><input class="form-control w-auto {{CSS.ROWS}}" type="number" value="3" id="{{elementid}}_atto_table_rows" size="8" min="1" max="50"/></div></div><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_columns" >{{get_string "numberofcolumns" component}}</label></div><div class="col-sm-8"><input class="form-control w-auto {{CSS.COLUMNS}}" type="number" value="3" id="{{elementid}}_atto_table_columns"size="8" min="1" max="20"/></div></div>{{/if}}{{#if allowStyling}}<fieldset><legend class="mdl-align">{{get_string "appearance" component}}</legend>{{#if allowBorders}}<div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_borders">{{get_string "borders" component}}</label></div><div class="col-sm-8"><select name="borders" class="custom-select {{CSS.BORDERS}}" id="{{elementid}}_atto_table_borders"><option value="default">{{get_string "themedefault" component}}</option><option value="outer">{{get_string "outer" component}}</option><option value="all">{{get_string "all" component}}</option></select></div></div><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_borderstyle">{{get_string "borderstyles" component}}</label></div><div class="col-sm-8"><select name="borderstyles" class="custom-select {{CSS.BORDERSTYLE}}" id="{{elementid}}_atto_table_borderstyle">{{#each borderStyles}}<option value="{{this}}">{{get_string this ../component}}</option>{{/each}}</select></div></div><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_bordersize">{{get_string "bordersize" component}}</label></div><div class="col-sm-8"><div class="form-inline"><input name="bordersize" id="{{elementid}}_atto_table_bordersize" class="form-control w-auto mr-1 {{CSS.BORDERSIZE}}"type="number" value="1" size="8" min="1" max="50"/><label>{{CSS.BORDERSIZEUNIT}}</label></div></div></div><div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_bordercolour">{{get_string "bordercolour" component}}</label></div><div class="col-sm-8"><div id="{{elementid}}_atto_table_bordercolour"class="form-inline {{CSS.BORDERCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1"><div class="tablebordercolor" style="background-color:transparent;color:transparent"><input id="{{../elementid}}_atto_table_bordercolour_-1"type="radio" class="m-0" name="borderColour" value="none" checked="checked"title="{{get_string "themedefault" component}}"></input><label for="{{../elementid}}_atto_table_bordercolour_-1" class="accesshide">{{get_string "themedefault" component}}</label></div>{{#each availableColours}}<div class="tablebordercolor" style="background-color:{{this}};color:{{this}}"><input id="{{../elementid}}_atto_table_bordercolour_{{@index}}"type="radio" class="m-0" name="borderColour" value="{{this}}" title="{{this}}"><label for="{{../elementid}}_atto_table_bordercolour_{{@index}}" class="accesshide">{{this}}</label></div>{{/each}}</div></div></div>{{/if}}{{#if allowBackgroundColour}}<div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_backgroundcolour">{{get_string "backgroundcolour" component}}</label></div><div class="col-sm-8"><div id="{{elementid}}_atto_table_backgroundcolour"class="form-inline {{CSS.BACKGROUNDCOLOUR}} {{CSS.AVAILABLECOLORS}}" size="1"><div class="tablebackgroundcolor" style="background-color:transparent;color:transparent"><input id="{{../elementid}}_atto_table_backgroundcolour_-1"type="radio" class="m-0" name="backgroundColour" value="none" checked="checked"title="{{get_string "themedefault" component}}"></input><label for="{{../elementid}}_atto_table_backgroundcolour_-1" class="accesshide">{{get_string "themedefault" component}}</label></div>{{#each availableColours}}<div class="tablebackgroundcolor" style="background-color:{{this}};color:{{this}}"><input id="{{../elementid}}_atto_table_backgroundcolour_{{@index}}"type="radio" class="m-0" name="backgroundColour" value="{{this}}" title="{{this}}"><label for="{{../elementid}}_atto_table_backgroundcolour_{{@index}}" class="accesshide">{{this}}</label></div>{{/each}}</div></div></div>{{/if}}{{#if allowWidth}}<div class="mb-1 form-group row"><div class="col-sm-4"><label for="{{elementid}}_atto_table_width">{{get_string "width" component}}</label></div><div class="col-sm-8"><div class="form-inline"><input name="width" id="{{elementid}}_atto_table_width" class="form-control w-auto mr-1 {{CSS.WIDTH}}" size="8" type="number" min="0" max="100"/><label>{{CSS.WIDTHUNIT}}</label></div></div></div>{{/if}}</fieldset>{{/if}}<div class="mdl-align"><br/>{{#if edit}}<button class="btn btn-secondary submit" type="submit">{{get_string "updatetable" component}}</button>{{/if}}{{#if nonedit}}<button class="btn btn-secondary submit" type="submit">{{get_string "createtable" component}}</button>{{/if}}</div></form>'
29c5faff
AN
3),o=this.get("allowBorders");return this._content=O.Node.create(t({CSS:l,elementid:this.get("host").get("elementid"),component:C,edit:e,nonedit:!e,allowStyling:this.get("allowStyling"),allowBorders:o,borderStyles:this.get("borderStyles"),allowBackgroundColour:this.get("allowBackgroundColour"),availableColours:this.get("availableColors"),allowWidth:this.get("allowWidth")})),e?this._content.one(".submit").on("click",this._updateTable,this):this._content.one(".submit").on("click",this._setTable,this),o&&this._content.one('[name="borders"]').on("change",this._updateAvailableSettings,this),this._content},_updateAvailableSettings:function(){var e=this._content,t=e.one('[name="borders"]'),o=e.one('[name="borderstyles"]'),a=e.one('[name="bordersize"]'),n=e.all('[name="borderColour"]'),r="removeAttribute";t&&("default"===t.get("value")&&(r="setAttribute"),o&&o[r]("disabled"),a&&a[r]("disabled"),n&&n[r]("disabled"))},_getSuitableTableCell:function(){var e,a=null,t=this.get("host"),n=O.bind(this._stopAtContentEditableFilter,this);return t.getSelectedNodes().some(function(e){var t,o;if(e.ancestor("td, th, caption",!0,n))return(t=(a=e).ancestor("caption",!0,n))&&(o=t.get("parentNode"))&&(a=o.one("td, th")),!0}),a&&(e=t.getSelectionFromNode(a),t.setSelection(e)),a},_changeNodeType:function(e,t){var o=O.Node.create("<"+t+"></"+t+">");return o.setAttrs(e.getAttrs()),e.get("childNodes").each(function(e){o.append(e.remove())}),e.replace(o),o},_updateTable:function(e){var t,o,a,n,r,l,i,s,d,c,u,g;e.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),t=e.currentTarget.ancestor(w.FORM).one(w.CAPTION),o=e.currentTarget.ancestor(w.FORM).one(w.CAPTIONPOSITION),a=e.currentTarget.ancestor(w.FORM).one(w.HEADERS),n=e.currentTarget.ancestor(w.FORM).one(w.BORDERS),r=e.currentTarget.ancestor(w.FORM).one(w.BORDERSIZE),i=e.currentTarget.ancestor(w.FORM).one(w.SELECTEDBORDERCOLOUR),l=e.currentTarget.ancestor(w.FORM).one(w.BORDERSTYLE),s=e.currentTarget.ancestor(w.FORM).one(w.SELECTEDBACKGROUNDCOLOUR),c=e.currentTarget.ancestor(w.FORM).one(w.WIDTH),d=this._lastTarget.ancestor("table"),this._setAppearance(d,{width:c,borders:n,borderColour:i,borderSize:r,borderStyle:l,backgroundColour:s}),(u=d.one("caption"))||(u=O.Node.create("<caption></caption>"),d.insert(u,0)),u.setHTML(t.get("value")),u.setStyle("caption-side",o.get("value")),u.getAttribute("style")||u.removeAttribute("style"),"rows"!==a.get("value")&&"both"!==a.get("value")||d.all("tr").each(function(e){var t=e.all("th, td"),o=t.shift();"TD"===o.get("tagName")?this._changeNodeType(o,"th").setAttribute("scope","row"):o.setAttribute("scope","row"),t.each(function(e){"TH"===e.get("tagName")&&this._changeNodeType(e,"td").removeAttribute("scope")},this)},this),"columns"!==a.get("value")&&"both"!==a.get("value")||((g=d.all("tr")).shift().all("td, th").each(function(e){"TD"===e.get("tagName")?this._changeNodeType(e,"th").setAttribute("scope","col"):e.setAttribute("scope","col")},this),g.each(function(e){var t=e.all("th, td");"both"===a.get("value")&&t.shift(),t.each(function(e){"TH"===e.get("tagName")&&this._changeNodeType(e,"td").removeAttribute("scope")},this)},this)),this.markUpdated()},_setTable:function(e){var t,o,a,n,r,l,i,s,d,c,u,g,h,b,m,_,v,p;if(e.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),t=e.currentTarget.ancestor(w.FORM).one(w.CAPTION),o=e.currentTarget.ancestor(w.FORM).one(w.CAPTIONPOSITION),a=e.currentTarget.ancestor(w.FORM).one(w.BORDERS),n=e.currentTarget.ancestor(w.FORM).one(w.BORDERSIZE),l=e.currentTarget.ancestor(w.FORM).one(w.SELECTEDBORDERCOLOUR),r=e.currentTarget.ancestor(w.FORM).one(w.BORDERSTYLE),u=e.currentTarget.ancestor(w.FORM).one(w.SELECTEDBACKGROUNDCOLOUR),i=e.currentTarget.ancestor(w.FORM).one(w.ROWS),s=e.currentTarget.ancestor(w.FORM).one(w.COLUMNS),d=e.currentTarget.ancestor(w.FORM).one(w.HEADERS),g=e.currentTarget.ancestor(w.FORM).one(w.WIDTH),this.get("host").setSelection(this._currentSelection),c="<br/>"+(m="\n")+'<table id="'+(_=O.guid())+'">'+m,v="",o.get("value")&&(v=' style="caption-side: '+o.get("value")+'"'),c+="<caption"+v+">"+O.Escape.html(t.get("value"))+"</caption>"+m,h=0,"columns"===d.get("value")||"both"===d.get("value")){for(h=1,c+="<thead>"+m+"<tr>"+m,b=0;b<parseInt(s.get("value"),10);b++)c+='<th scope="col"></th>'+m;c+="</tr>"+m+"</thead>"+m}for(c+="<tbody>"+m;h<parseInt(i.get("value"),10);h++){for(c+="<tr>"+m,b=0;b<parseInt(s.get("value"),10);b++)0!==b||"rows"!==d.get("value")&&"both"!==d.get("value")?c+="<td ></td>"+m:c+='<th scope="row"></th>'+m;c+="</tr>"+m}c+="</tbody>"+m,c+="</table>"+m+"<br/>",this.get("host").insertContentAtFocusPoint(c),p=O.one("#"+_),this._setAppearance(p,{width:g,borders:a,borderColour:l,borderSize:n,borderStyle:r,backgroundColour:u}),p.removeAttribute("id"),this.markUpdated()},_findColumnCells:function(){var r=this._getColumnIndex(this._lastTarget),e=this._lastTarget.ancestor("table").all("tr"),l=new O.NodeList,i=new O.NodeList,s=new O.NodeList;return e.each(function(e){var t=e.all("td, th"),o=t.item(r),a=t.item(r-1),n=t.item(r+1);l.push(o),a&&i.push(a),n&&s.push(n)}),{current:l,prev:i,next:s}},_hideInvalidEntries:function(e){var t,o,a,n,r=this._lastTarget.ancestor("table"),l=this._lastTarget.ancestor("tr"),i=r.all("tr"),s=i.indexOf(l),d=i.item(s-1),c=d?d.one("td"):null;l&&c?e.one('[data-change="moverowup"]').show():e.one('[data-change="moverowup"]').hide(),t=i.item(s+1),o=!!l&&l.one("td"),l&&t&&o?e.one('[data-change="moverowdown"]').show():e.one('[data-change="moverowdown"]').hide(),0<(a=this._findColumnCells()).prev.filter("td").size()?e.one('[data-change="movecolumnleft"]').show():e.one('[data-change="movecolumnleft"]').hide(),n=0<a.current.filter("td").size(),0<a.next.size()&&n?e.one('[data-change="movecolumnright"]').show():e.one('[data-change="movecolumnright"]').hide(),0<a.current.filter("td").size()?e.one('[data-change="deletecolumn"]').show():e.one('[data-change="deletecolumn"]').hide(),l&&l.one("td")?e.one('[data-change="deleterow"]').show():e.one(
4'[data-change="deleterow"]').hide()},_showTableMenu:function(e){var t,o;e.preventDefault(),this._contextMenu||(this._menuOptions=[{text:M.util.get_string("addcolumnafter",C),data:{change:"addcolumnafter"}},{text:M.util.get_string("addrowafter",C),data:{change:"addrowafter"}},{text:M.util.get_string("moverowup",C),data:{change:"moverowup"}},{text:M.util.get_string("moverowdown",C),data:{change:"moverowdown"}},{text:M.util.get_string("movecolumnleft",C),data:{change:"movecolumnleft"}},{text:M.util.get_string("movecolumnright",C),data:{change:"movecolumnright"}},{text:M.util.get_string("deleterow",C),data:{change:"deleterow"}},{text:M.util.get_string("deletecolumn",C),data:{change:"deletecolumn"}},{text:M.util.get_string("edittable",C),data:{change:"edittable"}}],this._contextMenu=new O.M.editor_atto.Menu({items:this._menuOptions}),(t=this._contextMenu.get("boundingBox")).delegate("click",this._handleTableChange,"a",this)),t=this._contextMenu.get("boundingBox"),this._lastTarget=e.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._hideInvalidEntries(t),O.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)}),o=this.buttons[this.name],this.get("host")._setTabFocus(o),this._contextMenu.show(),this._contextMenu.align(this.buttons.table,[O.WidgetPositionAlign.TL,O.WidgetPositionAlign.BL]),this._contextMenu.set("focusAfterHide",o),t.one("a")&&t.one("a").focus(),this.get("host").openMenus=[this._contextMenu]},_handleTableChange:function(e){switch(e.preventDefault(),this._contextMenu.set("focusAfterHide",this.get("host").editor),this._contextMenu.hide(e),e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"edittable":this._editTable();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),o=e.ancestor("tr");if(t&&o)return t.all("tr").indexOf(o)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(t)return t.all("td, th").indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");e&&t&&(e.swap(t),this.markUpdated())},_moveColumnLeft:function(){var e,t,o,a=this._findColumnCells();if(0<a.current.size()&&0<a.prev.size()&&a.current.size()===a.prev.size())for(e=e=0;e<a.current.size();e++)t=a.current.item(e),o=a.prev.item(e),t.swap(o);this.markUpdated()},_addCaption:function(){var e=this._lastTarget.ancestor("table");e.one("caption")||e.insert(O.Node.create("<caption>&nbsp;</caption>"),1)},_removeCaption:function(){var e=this._lastTarget.ancestor("table").one("caption");e&&e.remove(!0)},_moveColumnRight:function(){var e,t,o,a=this._findColumnCells();if(0<a.next.size()&&a.current.size()===a.next.size()&&0<a.current.filter("td").size())for(e=e=0;e<a.current.size();e++)t=a.current.item(e),o=a.next.item(e),t.swap(o);this.markUpdated()},_moveRowDown:function(){var e=this._lastTarget.ancestor("tr"),t=e.next("tr");e&&t&&e.one("td")&&(e.swap(t),this.markUpdated())},_getBorderConfiguration:function(e){var t,o,a=e.cloneNode(!0),n=a.getStyle("borderStyle"),r=a.getStyle("borderColor"),l=a.getStyle("borderWidth");return!!(n||r||l)&&(t=O.Color.toHex(r),o=parseInt(l,10),{borderStyle:n,borderColor:"#"===t?null:t,borderWidth:isNaN(o)?null:o})},_setAppearance:function(e,t){var o,a,n,r;t.borderColour&&(o=t.borderColour.get("value")),t.borderSize&&(a=t.borderSize.get("value")),t.borderStyle&&(n=t.borderStyle.get("value")),t.backgroundColour&&(r=t.backgroundColour.get("value")),e.removeAttribute("style"),e.all("td, th").each(function(e){e.removeAttribute("style")},this),t.borders&&("outer"===t.borders.get("value")?(e.setStyle("borderWidth",a+l.BORDERSIZEUNIT),e.setStyle("borderStyle",n),"none"!==o&&e.setStyle("borderColor",o)):"all"===t.borders.get("value")&&e.all("td, th").each(function(e){e.setStyle("borderWidth",a+l.BORDERSIZEUNIT),e.setStyle("borderStyle",n),"none"!==o&&e.setStyle("borderColor",o)},this)),"none"!==r&&e.setStyle("backgroundColor",r),t.width&&t.width.get("value")&&e.setStyle("width",t.width.get("value")+l.WIDTHUNIT)},_editTable:function(){var e,t,o,a,n,r,l,i=this.getDialogue({headerContent:M.util.get_string("edittable",C),focusAfterHide:!1,focusOnShowSelector:w.CAPTION,width:T}),s=this._getDialogueContent(!0),d=s.one(w.CAPTION),c=s.one(w.CAPTIONPOSITION),u=s.one(w.HEADERS),g=s.one(w.BORDERS),h=s.one(w.BORDERSTYLE),b=s.all(w.BORDERCOLOURS),m=s.one(w.BORDERSIZE),_=s.all(w.BACKGROUNDCOLOURS),v=s.one(w.WIDTH),p=this._lastTarget.ancestor("table"),f=p.one("caption");f?d.set("value",f.getHTML()):d.set("value",""),v&&-1===p.getStyle("width").indexOf("px")&&v.set("value",parseInt(p.getStyle("width"),10)),c&&f&&f.getAttribute("style")?c.set("value",f.getStyle("caption-side")):c.set("value",""),p.getStyle("backgroundColor")&&this.get("allowBackgroundColour")&&(e=O.Color.toHex(p.getStyle("backgroundColor")),(t=_.filter('[value="'+e+'"]'))&&t.set("checked",!0)),this.get("allowBorders")&&(o="default",(a=this._getBorderConfiguration(p))?o="outer":(a=this._getBorderConfiguration(p.one("td")))&&(o="all"),a&&(n=a.borderStyle||S,r=a.borderWidth||R,h.set("value",n),m.set("value",r),g.set("value",o),e=a.borderColor,(t=b.filter('[value="'+e+'"]'))&&t.set("checked",!0))),l="columns",p.one('th[scope="row"]')&&(l="rows",p.one('th[scope="col"]')&&(l="both")),u.set("value",l),i.set("bodyContent",s).show(),this._updateAvailableSettings()},_deleteColumn:function(){var a=this._getColumnIndex(this._lastTarget),e=this._lastTarget.ancestor("table").all("tr"),n=new O.NodeList,r=!1;e.each(function(e){var t=e.all("td, th"),o=t.item(a);"TD"===o.get("tagName")&&(r=!0),n.push(o)}),r&&n.remove(!0),this.markUpdated(
5)},_addRowAfter:function(){var e,t,o=this._lastTarget.ancestor("tr"),a=this._lastTarget.ancestor("table").one("tbody");(e=(e=(a=a||this._lastTarget.ancestor("table")).one("tr"))||this._lastTarget.ancestor("table").one("tr"))&&((t=e.cloneNode(!0)).all("th, td").each(function(e){if("TH"===e.get("tagName")&&"row"!==e.getAttribute("scope")){var t=O.Node.create("<td></td>");e.replace(t),e=t}e.setHTML("&nbsp;")}),o.ancestor("thead")?(o=e,a.insert(t,o)):o.insert(t,"after"),this.markUpdated())},_addColumnAfter:function(){var e=this._findColumnCells(),o=!0,t=e.next;e.next.size()<=0&&(o=!1,t=e.current),O.each(t,function(e){var t=e.cloneNode();t.setHTML("&nbsp;"),o?e.get("parentNode").insert(t,e):(e.get("parentNode").insert(t,e),e.swap(t))},this),this.markUpdated()}},{ATTRS:{allowBorders:{value:!0},borderStyles:{value:["none","solid","dashed","dotted"]},allowBackgroundColour:{value:!0},allowWidth:{value:!0},allowStyling:{readOnly:!0,getter:function(){return this.get("allowBorders")||this.get("allowBackgroundColour")||this.get("allowWidth")}},availableColors:{value:["#FFFFFF","#EF4540","#FFCF35","#98CA3E","#7D9FD3","#333333"],readOnly:!0}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]});