From 1e47c534a7d5ebdfdead5122943d355f7bf4f788 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie <shamim@moodle.com> Date: Mon, 5 Jul 2021 14:58:17 +1000 Subject: [PATCH] MDL-71671 editor_atto: Insert html of button menus after the button --- .../moodle-editor_atto-plugin-debug.js | 2 ++ .../moodle-editor_atto-plugin-min.js | 4 ++-- .../moodle-editor_atto-plugin.js | 2 ++ .../atto/yui/src/editor/js/editor-plugin-buttons.js | 2 ++ theme/boost/scss/moodle/atto.scss | 11 +++++++++-- theme/boost/style/moodle.css | 6 +++++- theme/classic/style/moodle.css | 6 +++++- 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js index ea4b1ae4b6d..39b637d6592 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js @@ -558,6 +558,8 @@ EditorPluginButtons.prototype = { // Append it to the group. group.append(button); + group.append(Y.Node.create('<div class="menuplaceholder" id="' + id + '_menu"></div>')); + config.attachmentPoint = '#' + id + '_menu'; currentFocus = this.toolbar.getAttribute('aria-activedescendant'); if (!currentFocus) { diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js index 8de8406f348..3454c496283 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-editor_atto-plugin",function(u,t){var i,n,l,a,o,h,c,d;function e(){e.superclass.constructor.apply(this,arguments)}function s(){}function r(){}i=".atto_group.",n="_group",u.extend(e,u.Base,{name:null,editor:null,toolbar:null,initializer:function(t){this.name=t.name,this.toolbar=t.toolbar,this.editor=t.editor,this.buttons={},this.buttonNames=[],this.buttonStates={},this.menus={},this._primaryKeyboardShortcut=[],this._buttonHandlers=[],this._menuHideHandlers=[],this._highlightQueue={}},markUpdated:function(){return this.get("host").saveSelection(),this.get("host").updateOriginal()}},{NAME:"editorPlugin",ATTRS:{host:{writeOnce:!0},group:{writeOnce:!0,getter:function(t){var e=this.toolbar.one(i+t+n);return e||(e=u.Node.create('<div class="atto_group '+t+n+'"></div>'),this.toolbar.append(e)),e}}}}),u.namespace("M.editor_atto").EditorPlugin=e,l='<button class="{{buttonClass}} atto_hasmenu" id="{{id}}" tabindex="-1" title="{{title}}" aria-label="{{title}}" aria-haspopup="true" aria-controls="{{id}}_menu"><span class="editor_atto_menu_icon"></span><span class="editor_atto_menu_expand"></span></button>',a="disabled",o="highlight",h=".editor_atto_content",c=".editor_atto_menu_icon",d=".editor_atto_menu_expand",s.ATTRS={},s.prototype={buttons:null,buttonNames:null,buttonStates:null,menus:null,DISABLED:0,ENABLED:1,_buttonHandlers:null,_menuHideHandlers:null,_primaryKeyboardShortcut:null,_highlightQueue:null,addButton:function(e){var i,t,n,o=this.get("group"),a=this.name,s="atto_"+a+"_button",r=this.get("host");return e.exec&&(s=s+"_"+e.exec),e.buttonName?s=s+"_"+e.buttonName:e.buttonName=e.exec||a,e.buttonClass=s,(e=this._normalizeIcon(e)).title||(e.title="pluginname"),t=M.util.get_string(e.title,"atto_"+a),(i=u.Node.create('<button type="button" class="'+s+'"tabindex="-1"></button>')).setAttribute("title",t),i.setAttribute("aria-label",t),window.require(["core/templates"],function(t){t.renderPix(e.icon,e.iconComponent,"").then(function(t){i.append(t)})}),o.append(i),this.toolbar.getAttribute("aria-activedescendant")||(i.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",i.generateID()),this.get("host")._tabFocus=i),e=this._normalizeCallback(e),this._buttonHandlers.push(this.toolbar.delegate("click",e.callback,"."+s,this)),e.keys&&("undefined"!=typeof e.keyDescription&&(this._primaryKeyboardShortcut[s]=e.keyDescription),this._addKeyboardListener(e.callback,e.keys,s),this._primaryKeyboardShortcut[s]&&(t=M.util.get_string("plugin_title_shortcut","editor_atto",{title:t,shortcut:this._primaryKeyboardShortcut[s]}),i.setAttribute("title",t),i.setAttribute("aria-label",t))),e.tags&&(n=!0,"boolean"==typeof e.tagMatchRequiresAll&&(n=e.tagMatchRequiresAll),this._buttonHandlers.push(r.on(["atto:selectionchanged","change"],function(t){"undefined"!=typeof this._highlightQueue[e.buttonName]&&this._highlightQueue[e.buttonName].cancel(),this._highlightQueue[e.buttonName]=u.soon(u.bind(function(t){r.selectionFilterMatches(e.tags,t.selectedNodes,n)?this.highlightButtons(e.buttonName):this.unHighlightButtons(e.buttonName)},this,t))},this))),this.buttonNames.push(e.buttonName),this.buttons[e.buttonName]=i,this.buttonStates[e.buttonName]=this.ENABLED,i},addBasicButton:function(t){return t.exec?(t.icon||(t.icon="e/"+t.exec),t.callback=function(){document.execCommand(t.exec,!1,null),this.markUpdated()},this.addButton(t)):null},addToolbarMenu:function(e){var i,t,n,o,a=this.get("group"),s=this.name,r="atto_"+s+"_button";return e.buttonName?r=r+"_"+e.buttonName:e.buttonName=s,e.buttonClass=r,(e=this._normalizeIcon(e)).title||(e.title="pluginname"),t=M.util.get_string(e.title,"atto_"+s),e.menuColor||(e.menuColor="transparent"),n="atto_"+s+"_menubutton_"+u.stamp(this),o=u.Handlebars.compile(l),i=u.Node.create(o({buttonClass:r,config:e,title:t,id:n})),e.buttonId=n,window.require(["core/templates"],function(t){t.renderPix(e.icon,e.iconComponent,"").then(function(t){i.one(c).append(t)}),t.renderPix("t/expanded","core","").then(function(t){i.one(d).append(t)})}),a.append(i),this.toolbar.getAttribute("aria-activedescendant")||(i.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",i.generateID())),this._buttonHandlers.push(this.toolbar.delegate("click",this._showToolbarMenu,"."+r,this,e),this.toolbar.delegate("key",this._showToolbarMenuAndFocus,"40, 32, enter","."+r,this,e)),this.buttonNames.push(e.buttonName),this.buttons[e.buttonName]=i,this.buttonStates[e.buttonName]=this.ENABLED,i},_showToolbarMenu:function(t,e){var i,n,o;t.preventDefault(),this.isEnabled()&&((i=t.currentTarget.ancestor("button",!0)).hasAttribute(a)||(this.menus[e.buttonClass]||(e.overlayWidth||(e.overlayWidth="14"),e.innerOverlayWidth||(e.innerOverlayWidth=parseInt(e.overlayWidth,10)-2+"em"),e.overlayWidth=parseInt(e.overlayWidth,10)+"em",this.menus[e.buttonClass]=new u.M.editor_atto.Menu(e),this.menus[e.buttonClass].get("contentBox").delegate("click",this._chooseMenuItem,".atto_menuentry a",this,e)),u.Array.each(this.get("host").openMenus,function(t){t.set("focusAfterHide",null)}),(o=this.buttons[e.buttonName]).focus(),this.get("host")._setTabFocus(o),(n=this.menus[e.buttonClass]).set("focusAfterHide",o),n.show(),i.setAttribute("aria-expanded",!0),n.align(this.buttons[e.buttonName],[u.WidgetPositionAlign.TL,u.WidgetPositionAlign.BL]),this.get("host").openMenus=[n]))},_showToolbarMenuAndFocus:function(t,e){this._showToolbarMenu(t,e),this.menus[e.buttonClass].get("boundingBox").one("a").focus()},_chooseMenuItem:function(t,e,i){var n=t.target.ancestor("a",!0).getData("index"),o=this._normalizeCallback(e.items[n],e.globalItemConfig);(i=this.menus[e.buttonClass]).set("preventHideMenu",!0),o.callback(t,o._callback,o.callbackArgs),i.set("preventHideMenu",!1),i.set("focusAfterHide",this.get("host").editor),i.hide(t)},_normalizeCallback:function(i,t){return i._callbackNormalized||(t=t||{},i.inlineFormat=i.inlineFormat||t.inlineFormat,i._inlineCallback=i.callback||t.callback, -i._callback=i.callback||t.callback,i.inlineFormat&&"function"==typeof i._inlineCallback&&(i._callback=function(t,e){this.get("host").applyFormat(t,i._inlineCallback,this,e)}),i.callback=u.rbind(this._callbackWrapper,this,i._callback,i.callbackArgs),i._callbackNormalized=!0),i},_normalizeIcon:function(t){return t.iconurl||(t.iconComponent&&"moodle"!=t.iconComponent||(t.iconComponent="core"),t.iconurl=M.util.image_url(t.icon,t.iconComponent)),t},_callbackWrapper:function(t,e,i){var n,o;if(t.preventDefault(),this.isEnabled()&&(!(n=t.currentTarget.ancestor("button",!0))||!n.hasAttribute(a)))return YUI.Env.UA.android||this.get("host").isActive()||this.get("host").focus(),this.get("host").saveSelection(),n&&this.get("host")._setTabFocus(n),o=[t,i],this.get("host").restoreSelection(),e.apply(this,o)},_addKeyboardListener:function(i,t,e){var n,o,a,s="key",r=h;if(u.Lang.isArray(t))return u.Array.each(t,function(t){this._addKeyboardListener(i,t)},this),this;o="object"==typeof t?(t.eventtype&&(s=t.eventtype),t.container&&(r=t.container),n=t.keyCodes,i):(a=this._getDefaultMetaKey(),n=this._getKeyEvent()+t+"+"+a,"undefined"==typeof this._primaryKeyboardShortcut[e]&&(this._primaryKeyboardShortcut[e]=this._getDefaultMetaKeyDescription(t)),u.bind(function(t,e){this._eventUsesExactKeyModifiers(t,e)&&i.apply(this,[e])},this,[a])),this._buttonHandlers.push(this.editor.delegate(s,o,n,r,this))},_eventUsesExactKeyModifiers:function(t,e){var i,n=!0;return"key"===e.type&&(i=-1<u.Array.indexOf(t,"alt"),n=n&&(e.altKey&&i||!e.altKey&&!i),i=-1<u.Array.indexOf(t,"ctrl"),n=n&&(e.ctrlKey&&i||!e.ctrlKey&&!i),i=-1<u.Array.indexOf(t,"meta"),n=n&&(e.metaKey&&i||!e.metaKey&&!i),i=-1<u.Array.indexOf(t,"shift"),n=n&&(e.shiftKey&&i||!e.shiftKey&&!i))},isEnabled:function(){return u.Object.some(this.buttonStates,function(t){return t===this.ENABLED},this)},disableButtons:function(t){return this._setButtonState(!1,t)},enableButtons:function(t){return this._setButtonState(!0,t)},_setButtonState:function(e,t){var i="setAttribute";return e&&(i="removeAttribute"),t?this.buttons[t]&&(this.buttons[t][i](a,a),this.buttonStates[t]=e?this.ENABLED:this.DISABLED):u.Array.each(this.buttonNames,function(t){this.buttons[t][i](a,a),this.buttonStates[t]=e?this.ENABLED:this.DISABLED},this),this.get("host").checkTabFocus(),this},highlightButtons:function(t){return this._changeButtonHighlight(!0,t)},unHighlightButtons:function(t){return this._changeButtonHighlight(!1,t)},_changeButtonHighlight:function(e,t){var i="addClass";return e||(i="removeClass"),t?this.buttons[t]&&(this.buttons[t][i](o),this.buttons[t].setAttribute("aria-pressed",e?"true":"false"),this._buttonHighlightToggled(t,e)):u.Object.each(this.buttons,function(t){t[i](o),t.setAttribute("aria-pressed",e?"true":"false"),this._buttonHighlightToggled(t,e)},this),this},_buttonHighlightToggled:function(e,i){var n=this.buttons[e];n&&require(["editor_atto/events"],function(t){t.notifyButtonHighlightToggled(n.getDOMNode(),e,i)})},_getDefaultMetaKey:function(){return"macintosh"===u.UA.os?"meta":"ctrl"},_getDefaultMetaKeyDescription:function(t){return"macintosh"===u.UA.os?M.util.get_string("editor_command_keycode","editor_atto",String.fromCharCode(t).toLowerCase()):M.util.get_string("editor_control_keycode","editor_atto",String.fromCharCode(t).toLowerCase())},_getKeyEvent:function(){return"down:"}},u.Base.mix(u.M.editor_atto.EditorPlugin,[s]),r.ATTRS={},r.prototype={_dialogue:null,getDialogue:function(t){var e,i;return e=!1,(t=t||{}).focusAfterHide&&(e=t.focusAfterHide,delete t.focusAfterHide),this._dialogue||(i=u.merge({visible:!1,modal:!0,close:!0,draggable:!0},t),this._dialogue=new M.core.dialogue(i)),!1!==e&&(!0===e?this._dialogue.set("focusAfterHide",this.buttons[this.buttonNames[0]]):"string"==typeof e?this._dialogue.set("focusAfterHide",this.buttons[e]):this._dialogue.set("focusAfterHide",e)),this._dialogue}},u.Base.mix(u.M.editor_atto.EditorPlugin,[r])},"@VERSION@",{requires:["node","base","escape","event","event-outside","handlebars","event-custom","timers","moodle-editor_atto-menu"]}); \ No newline at end of file +YUI.add("moodle-editor_atto-plugin",function(u,t){var i,n,l,a,o,h,c,d;function e(){e.superclass.constructor.apply(this,arguments)}function s(){}function r(){}i=".atto_group.",n="_group",u.extend(e,u.Base,{name:null,editor:null,toolbar:null,initializer:function(t){this.name=t.name,this.toolbar=t.toolbar,this.editor=t.editor,this.buttons={},this.buttonNames=[],this.buttonStates={},this.menus={},this._primaryKeyboardShortcut=[],this._buttonHandlers=[],this._menuHideHandlers=[],this._highlightQueue={}},markUpdated:function(){return this.get("host").saveSelection(),this.get("host").updateOriginal()}},{NAME:"editorPlugin",ATTRS:{host:{writeOnce:!0},group:{writeOnce:!0,getter:function(t){var e=this.toolbar.one(i+t+n);return e||(e=u.Node.create('<div class="atto_group '+t+n+'"></div>'),this.toolbar.append(e)),e}}}}),u.namespace("M.editor_atto").EditorPlugin=e,l='<button class="{{buttonClass}} atto_hasmenu" id="{{id}}" tabindex="-1" title="{{title}}" aria-label="{{title}}" aria-haspopup="true" aria-controls="{{id}}_menu"><span class="editor_atto_menu_icon"></span><span class="editor_atto_menu_expand"></span></button>',a="disabled",o="highlight",h=".editor_atto_content",c=".editor_atto_menu_icon",d=".editor_atto_menu_expand",s.ATTRS={},s.prototype={buttons:null,buttonNames:null,buttonStates:null,menus:null,DISABLED:0,ENABLED:1,_buttonHandlers:null,_menuHideHandlers:null,_primaryKeyboardShortcut:null,_highlightQueue:null,addButton:function(e){var i,t,n,o=this.get("group"),a=this.name,s="atto_"+a+"_button",r=this.get("host");return e.exec&&(s=s+"_"+e.exec),e.buttonName?s=s+"_"+e.buttonName:e.buttonName=e.exec||a,e.buttonClass=s,(e=this._normalizeIcon(e)).title||(e.title="pluginname"),t=M.util.get_string(e.title,"atto_"+a),(i=u.Node.create('<button type="button" class="'+s+'"tabindex="-1"></button>')).setAttribute("title",t),i.setAttribute("aria-label",t),window.require(["core/templates"],function(t){t.renderPix(e.icon,e.iconComponent,"").then(function(t){i.append(t)})}),o.append(i),this.toolbar.getAttribute("aria-activedescendant")||(i.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",i.generateID()),this.get("host")._tabFocus=i),e=this._normalizeCallback(e),this._buttonHandlers.push(this.toolbar.delegate("click",e.callback,"."+s,this)),e.keys&&("undefined"!=typeof e.keyDescription&&(this._primaryKeyboardShortcut[s]=e.keyDescription),this._addKeyboardListener(e.callback,e.keys,s),this._primaryKeyboardShortcut[s]&&(t=M.util.get_string("plugin_title_shortcut","editor_atto",{title:t,shortcut:this._primaryKeyboardShortcut[s]}),i.setAttribute("title",t),i.setAttribute("aria-label",t))),e.tags&&(n=!0,"boolean"==typeof e.tagMatchRequiresAll&&(n=e.tagMatchRequiresAll),this._buttonHandlers.push(r.on(["atto:selectionchanged","change"],function(t){"undefined"!=typeof this._highlightQueue[e.buttonName]&&this._highlightQueue[e.buttonName].cancel(),this._highlightQueue[e.buttonName]=u.soon(u.bind(function(t){r.selectionFilterMatches(e.tags,t.selectedNodes,n)?this.highlightButtons(e.buttonName):this.unHighlightButtons(e.buttonName)},this,t))},this))),this.buttonNames.push(e.buttonName),this.buttons[e.buttonName]=i,this.buttonStates[e.buttonName]=this.ENABLED,i},addBasicButton:function(t){return t.exec?(t.icon||(t.icon="e/"+t.exec),t.callback=function(){document.execCommand(t.exec,!1,null),this.markUpdated()},this.addButton(t)):null},addToolbarMenu:function(e){var i,t,n,o,a=this.get("group"),s=this.name,r="atto_"+s+"_button";return e.buttonName?r=r+"_"+e.buttonName:e.buttonName=s,e.buttonClass=r,(e=this._normalizeIcon(e)).title||(e.title="pluginname"),t=M.util.get_string(e.title,"atto_"+s),e.menuColor||(e.menuColor="transparent"),n="atto_"+s+"_menubutton_"+u.stamp(this),o=u.Handlebars.compile(l),i=u.Node.create(o({buttonClass:r,config:e,title:t,id:n})),e.buttonId=n,window.require(["core/templates"],function(t){t.renderPix(e.icon,e.iconComponent,"").then(function(t){i.one(c).append(t)}),t.renderPix("t/expanded","core","").then(function(t){i.one(d).append(t)})}),a.append(i),a.append(u.Node.create('<div class="menuplaceholder" id="'+n+'_menu"></div>')),e.attachmentPoint="#"+n+"_menu",this.toolbar.getAttribute("aria-activedescendant")||(i.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",i.generateID())),this._buttonHandlers.push(this.toolbar.delegate("click",this._showToolbarMenu,"."+r,this,e),this.toolbar.delegate("key",this._showToolbarMenuAndFocus,"40, 32, enter","."+r,this,e)),this.buttonNames.push(e.buttonName),this.buttons[e.buttonName]=i,this.buttonStates[e.buttonName]=this.ENABLED,i},_showToolbarMenu:function(t,e){var i,n,o;t.preventDefault(),this.isEnabled()&&((i=t.currentTarget.ancestor("button",!0)).hasAttribute(a)||(this.menus[e.buttonClass]||(e.overlayWidth||(e.overlayWidth="14"),e.innerOverlayWidth||(e.innerOverlayWidth=parseInt(e.overlayWidth,10)-2+"em"),e.overlayWidth=parseInt(e.overlayWidth,10)+"em",this.menus[e.buttonClass]=new u.M.editor_atto.Menu(e),this.menus[e.buttonClass].get("contentBox").delegate("click",this._chooseMenuItem,".atto_menuentry a",this,e)),u.Array.each(this.get("host").openMenus,function(t){t.set("focusAfterHide",null)}),(o=this.buttons[e.buttonName]).focus(),this.get("host")._setTabFocus(o),(n=this.menus[e.buttonClass]).set("focusAfterHide",o),n.show(),i.setAttribute("aria-expanded",!0),n.align(this.buttons[e.buttonName],[u.WidgetPositionAlign.TL,u.WidgetPositionAlign.BL]),this.get("host").openMenus=[n]))},_showToolbarMenuAndFocus:function(t,e){this._showToolbarMenu(t,e),this.menus[e.buttonClass].get("boundingBox").one("a").focus()},_chooseMenuItem:function(t,e,i){var n=t.target.ancestor("a",!0).getData("index"),o=this._normalizeCallback(e.items[n],e.globalItemConfig);(i=this.menus[e.buttonClass]).set("preventHideMenu",!0),o.callback(t,o._callback,o.callbackArgs),i.set("preventHideMenu",!1),i.set("focusAfterHide",this.get("host").editor),i.hide(t)},_normalizeCallback:function(i,t){return i._callbackNormalized||(t=t||{}, +i.inlineFormat=i.inlineFormat||t.inlineFormat,i._inlineCallback=i.callback||t.callback,i._callback=i.callback||t.callback,i.inlineFormat&&"function"==typeof i._inlineCallback&&(i._callback=function(t,e){this.get("host").applyFormat(t,i._inlineCallback,this,e)}),i.callback=u.rbind(this._callbackWrapper,this,i._callback,i.callbackArgs),i._callbackNormalized=!0),i},_normalizeIcon:function(t){return t.iconurl||(t.iconComponent&&"moodle"!=t.iconComponent||(t.iconComponent="core"),t.iconurl=M.util.image_url(t.icon,t.iconComponent)),t},_callbackWrapper:function(t,e,i){var n,o;if(t.preventDefault(),this.isEnabled()&&(!(n=t.currentTarget.ancestor("button",!0))||!n.hasAttribute(a)))return YUI.Env.UA.android||this.get("host").isActive()||this.get("host").focus(),this.get("host").saveSelection(),n&&this.get("host")._setTabFocus(n),o=[t,i],this.get("host").restoreSelection(),e.apply(this,o)},_addKeyboardListener:function(i,t,e){var n,o,a,s="key",r=h;if(u.Lang.isArray(t))return u.Array.each(t,function(t){this._addKeyboardListener(i,t)},this),this;o="object"==typeof t?(t.eventtype&&(s=t.eventtype),t.container&&(r=t.container),n=t.keyCodes,i):(a=this._getDefaultMetaKey(),n=this._getKeyEvent()+t+"+"+a,"undefined"==typeof this._primaryKeyboardShortcut[e]&&(this._primaryKeyboardShortcut[e]=this._getDefaultMetaKeyDescription(t)),u.bind(function(t,e){this._eventUsesExactKeyModifiers(t,e)&&i.apply(this,[e])},this,[a])),this._buttonHandlers.push(this.editor.delegate(s,o,n,r,this))},_eventUsesExactKeyModifiers:function(t,e){var i,n=!0;return"key"===e.type&&(i=-1<u.Array.indexOf(t,"alt"),n=n&&(e.altKey&&i||!e.altKey&&!i),i=-1<u.Array.indexOf(t,"ctrl"),n=n&&(e.ctrlKey&&i||!e.ctrlKey&&!i),i=-1<u.Array.indexOf(t,"meta"),n=n&&(e.metaKey&&i||!e.metaKey&&!i),i=-1<u.Array.indexOf(t,"shift"),n=n&&(e.shiftKey&&i||!e.shiftKey&&!i))},isEnabled:function(){return u.Object.some(this.buttonStates,function(t){return t===this.ENABLED},this)},disableButtons:function(t){return this._setButtonState(!1,t)},enableButtons:function(t){return this._setButtonState(!0,t)},_setButtonState:function(e,t){var i="setAttribute";return e&&(i="removeAttribute"),t?this.buttons[t]&&(this.buttons[t][i](a,a),this.buttonStates[t]=e?this.ENABLED:this.DISABLED):u.Array.each(this.buttonNames,function(t){this.buttons[t][i](a,a),this.buttonStates[t]=e?this.ENABLED:this.DISABLED},this),this.get("host").checkTabFocus(),this},highlightButtons:function(t){return this._changeButtonHighlight(!0,t)},unHighlightButtons:function(t){return this._changeButtonHighlight(!1,t)},_changeButtonHighlight:function(e,t){var i="addClass";return e||(i="removeClass"),t?this.buttons[t]&&(this.buttons[t][i](o),this.buttons[t].setAttribute("aria-pressed",e?"true":"false"),this._buttonHighlightToggled(t,e)):u.Object.each(this.buttons,function(t){t[i](o),t.setAttribute("aria-pressed",e?"true":"false"),this._buttonHighlightToggled(t,e)},this),this},_buttonHighlightToggled:function(e,i){var n=this.buttons[e];n&&require(["editor_atto/events"],function(t){t.notifyButtonHighlightToggled(n.getDOMNode(),e,i)})},_getDefaultMetaKey:function(){return"macintosh"===u.UA.os?"meta":"ctrl"},_getDefaultMetaKeyDescription:function(t){return"macintosh"===u.UA.os?M.util.get_string("editor_command_keycode","editor_atto",String.fromCharCode(t).toLowerCase()):M.util.get_string("editor_control_keycode","editor_atto",String.fromCharCode(t).toLowerCase())},_getKeyEvent:function(){return"down:"}},u.Base.mix(u.M.editor_atto.EditorPlugin,[s]),r.ATTRS={},r.prototype={_dialogue:null,getDialogue:function(t){var e,i;return e=!1,(t=t||{}).focusAfterHide&&(e=t.focusAfterHide,delete t.focusAfterHide),this._dialogue||(i=u.merge({visible:!1,modal:!0,close:!0,draggable:!0},t),this._dialogue=new M.core.dialogue(i)),!1!==e&&(!0===e?this._dialogue.set("focusAfterHide",this.buttons[this.buttonNames[0]]):"string"==typeof e?this._dialogue.set("focusAfterHide",this.buttons[e]):this._dialogue.set("focusAfterHide",e)),this._dialogue}},u.Base.mix(u.M.editor_atto.EditorPlugin,[r])},"@VERSION@",{requires:["node","base","escape","event","event-outside","handlebars","event-custom","timers","moodle-editor_atto-menu"]}); \ No newline at end of file diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js index 8155f70be7b..fef7f0ebc33 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js @@ -556,6 +556,8 @@ EditorPluginButtons.prototype = { // Append it to the group. group.append(button); + group.append(Y.Node.create('<div class="menuplaceholder" id="' + id + '_menu"></div>')); + config.attachmentPoint = '#' + id + '_menu'; currentFocus = this.toolbar.getAttribute('aria-activedescendant'); if (!currentFocus) { diff --git a/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js b/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js index 942b679b69f..e3528bdb787 100644 --- a/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js +++ b/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js @@ -408,6 +408,8 @@ EditorPluginButtons.prototype = { // Append it to the group. group.append(button); + group.append(Y.Node.create('<div class="menuplaceholder" id="' + id + '_menu"></div>')); + config.attachmentPoint = '#' + id + '_menu'; currentFocus = this.toolbar.getAttribute('aria-activedescendant'); if (!currentFocus) { diff --git a/theme/boost/scss/moodle/atto.scss b/theme/boost/scss/moodle/atto.scss index 451357785fc..75d19afe11c 100644 --- a/theme/boost/scss/moodle/atto.scss +++ b/theme/boost/scss/moodle/atto.scss @@ -39,8 +39,15 @@ div.editor_atto_toolbar button { cursor: pointer; } -div.editor_atto_toolbar button + button { - border-left: 1px solid #ccc; +div.editor_atto_toolbar .menuplaceholder { + display: inline-block; +} + +div.editor_atto_toolbar { + button + button, + .menuplaceholder + button { + border-left: 1px solid #ccc; + } } div.editor_atto_toolbar button[disabled] { diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index cc89d9003ce..366c03c6b30 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -19649,7 +19649,11 @@ div.editor_atto_toolbar button { border-radius: 0; cursor: pointer; } -div.editor_atto_toolbar button + button { +div.editor_atto_toolbar .menuplaceholder { + display: inline-block; } + +div.editor_atto_toolbar button + button, +div.editor_atto_toolbar .menuplaceholder + button { border-left: 1px solid #ccc; } div.editor_atto_toolbar button[disabled] { diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index 75bd52a5002..3322501e182 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -19839,7 +19839,11 @@ div.editor_atto_toolbar button { border-radius: 0; cursor: pointer; } -div.editor_atto_toolbar button + button { +div.editor_atto_toolbar .menuplaceholder { + display: inline-block; } + +div.editor_atto_toolbar button + button, +div.editor_atto_toolbar .menuplaceholder + button { border-left: 1px solid #ccc; } div.editor_atto_toolbar button[disabled] {