From d3d2f09cefd4cdbf673ca7a0109dfa1795e141a1 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 20 Dec 2016 14:39:22 +0800 Subject: [PATCH] MDL-40759 atto: Use pix_icon renderer for atto buttons --- blog/rsslib.php | 4 +-- lib/editor/atto/plugins/collapse/lib.php | 6 +++++ lib/editor/atto/styles.css | 12 +++------ .../moodle-editor_atto-plugin-debug.js | 27 ++++++++++++------- .../moodle-editor_atto-plugin-min.js | 4 +-- .../moodle-editor_atto-plugin.js | 27 ++++++++++++------- .../src/editor/js/editor-plugin-buttons.js | 27 ++++++++++++------- lib/outputlib.php | 17 ++++++------ theme/boost/scss/moodle/icons.scss | 8 +++++- 9 files changed, 84 insertions(+), 48 deletions(-) diff --git a/blog/rsslib.php b/blog/rsslib.php index 4c6c808a757..d671d1b52f9 100644 --- a/blog/rsslib.php +++ b/blog/rsslib.php @@ -82,8 +82,8 @@ function blog_rss_print_link($context, $filtertype, $filterselect = 0, $tagid = } $url = blog_rss_get_url($context->id, $userid, $filtertype, $filterselect, $tagid); - $rsspix = $OUTPUT->pix_url('i/rss'); - print '
'.get_string('rss').'
'; + $rsspix = $OUTPUT->pix_icon('i/rss', get_string('rss'), 'core', array('title' => $tooltiptext)); + print '
' . $rsspix . '
'; } /** diff --git a/lib/editor/atto/plugins/collapse/lib.php b/lib/editor/atto/plugins/collapse/lib.php index 94b1e839036..76517f5b337 100644 --- a/lib/editor/atto/plugins/collapse/lib.php +++ b/lib/editor/atto/plugins/collapse/lib.php @@ -42,3 +42,9 @@ function atto_collapse_params_for_js($elementid, $options, $fpoptions) { $params = array('showgroups' => get_config('atto_collapse', 'showgroups')); return $params; } + +function atto_collapse_get_fontawesome_icon_map() { + return [ + 'atto_collapse:icon' => 'fa-level-down' + ]; +} diff --git a/lib/editor/atto/styles.css b/lib/editor/atto/styles.css index 8133d936609..1ccc40aa60f 100644 --- a/lib/editor/atto/styles.css +++ b/lib/editor/atto/styles.css @@ -68,13 +68,9 @@ div.editor_atto_toolbar button::-moz-focus-inner { padding: 0; } -div.editor_atto_toolbar button img.icon { +div.editor_atto_toolbar button .icon { padding: 0; margin: 2px 0; - /* The following is dedicated to the beloved IE8, clashing with Bootstrap. God bless you IE. */ - vertical-align: text-bottom; - width: auto; - height: auto; } div.editor_atto_toolbar div.atto_group { @@ -96,7 +92,7 @@ div.editor_atto_toolbar div.atto_group { white-space: nowrap; } -.atto_menuentry img { +.atto_menuentry .icon { width: 16px; height: 16px; } @@ -139,7 +135,7 @@ div.editor_atto_toolbar div.atto_group { cursor: pointer; } -.atto_control img { +.atto_control .icon { background-color: white; } @@ -166,7 +162,7 @@ div.editor_atto_content:hover .atto_control { } .editor_atto_menu .dropdown-menu > li > a { - padding: 3px 14px; + margin: 3px 14px; } .editor_atto_menu .open ul.dropdown-menu { 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 6e42e312d65..a746da38d7c 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 @@ -183,10 +183,10 @@ var MENUTEMPLATE = '' + 'tabindex="-1" ' + 'type="button" ' + 'title="{{title}}">' + - '' + - '' + + // '' + + // '' + ''; var DISABLED = 'disabled', @@ -360,11 +360,12 @@ EditorPluginButtons.prototype = { // Create the actual button. button = Y.Node.create(''); + 'tabindex="-1">'); button.setAttribute('title', title); + window.require(['core/templates'], function(Templates) { + var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title); + button.append(iconhtml); + }); // Append it to the group. group.append(button); @@ -533,6 +534,14 @@ EditorPluginButtons.prototype = { title: title })); + window.require(['core/templates'], function(Templates) { + var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title); + button.append(iconhtml); + iconhtml = Templates.renderPix('t/expanded', 'core', ''); + button.append(iconhtml); + }); + + // Append it to the group. group.append(button); @@ -727,7 +736,7 @@ EditorPluginButtons.prototype = { _normalizeIcon: function(config) { if (!config.iconurl) { // The default icon component. - if (!config.iconComponent) { + if (!config.iconComponent || config.iconComponent == 'moodle') { config.iconComponent = 'core'; } config.iconurl = M.util.image_url(config.icon, config.iconComponent); 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 040eb14a1d7..7468c206225 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(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function l(){}function c(){}var r=".atto_group.",i="_group";e.extend(n,e.Base,{name:null,editor:null,toolbar:null,initializer:function(e){this.name=e.name,this.toolbar=e.toolbar,this.editor=e.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 n=this.toolbar.one(r+t+i);return n||(n=e.Node.create('
'),this.toolbar.append(n)),n}}}}),e.namespace("M.editor_atto").EditorPlugin=n;var s='',o="disabled",u="highlight",a="moodle-editor_atto-editor-plugin",f={EDITORWRAPPER:".editor_atto_content"};l.ATTRS={},l.prototype={buttons:null,buttonNames:null,buttonStates:null,menus:null,DISABLED:0,ENABLED:1,_buttonHandlers:null,_menuHideHandlers:null,_primaryKeyboardShortcut:null,_highlightQueue:null,addButton:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",s,o=this.get("host");t.exec&&(i=i+"_"+t.exec),t.buttonName?i=i+"_"+t.buttonName:t.buttonName=t.exec||r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var u=M.util.get_string(t.title,"atto_"+r);s=e.Node.create('"),s.setAttribute("title",u),n.append(s);var a=this.toolbar.getAttribute("aria-activedescendant");a||(s.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",s.generateID()),this.get("host")._tabFocus=s),t=this._normalizeCallback(t),this._buttonHandlers.push(this.toolbar.delegate("click",t.callback,"."+i,this)),t.keys&&(typeof t.keyDescription!="undefined"&&(this._primaryKeyboardShortcut[i]=t.keyDescription),this._addKeyboardListener(t.callback,t.keys,i),this._primaryKeyboardShortcut[i]&&s.setAttribute("title",M.util.get_string("plugin_title_shortcut","editor_atto",{title:u,shortcut:this._primaryKeyboardShortcut[i]})));if(t.tags){var f=!0;typeof t.tagMatchRequiresAll=="boolean"&&(f=t.tagMatchRequiresAll),this._buttonHandlers.push(o.on(["atto:selectionchanged","change"],function(n){typeof this._highlightQueue[t.buttonName]!="undefined"&&this._highlightQueue[t.buttonName].cancel(),this._highlightQueue[t.buttonName]=e.soon(e.bind(function(e){o.selectionFilterMatches(t.tags,e.selectedNodes,f)?this.highlightButtons(t.buttonName):this.unHighlightButtons(t.buttonName)},this,n))},this))}return this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=s,this.buttonStates[t.buttonName]=this.ENABLED,s},addBasicButton:function(e){return e.exec?(e.icon||(e.icon="e/"+e.exec),e.callback=function(){document.execCommand(e.exec,!1,null),this.markUpdated()},this.addButton(e)):null},addToolbarMenu:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",o,u;t.buttonName?i=i+"_"+t.buttonName:t.buttonName=r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var a=M.util.get_string(t.title,"atto_"+r);t.menuColor||(t.menuColor="transparent");var f=e.Handlebars.compile(s);return o=e.Node.create(f({buttonClass:i,config:t,title:a})),n.append(o),u=this.toolbar.getAttribute("aria-activedescendant"),u||(o.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",o.generateID())),this._buttonHandlers.push(this.toolbar.delegate("click",this._showToolbarMenu,"."+i,this,t),this.toolbar.delegate("key",this._showToolbarMenuAndFocus,"40, 32, enter","."+i,this,t)),this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=o,this.buttonStates[t.buttonName]=this.ENABLED,o},_showToolbarMenu:function(t,n){t.preventDefault();if(!this.isEnabled())return;if(t.currentTarget.ancestor("button",!0).hasAttribute(o))return;var r;this.menus[n.buttonClass]||(n.overlayWidth||(n.overlayWidth="14"),n.innerOverlayWidth||(n.innerOverlayWidth=parseInt(n.overlayWidth,10)-2+"em"),n.overlayWidth=parseInt(n.overlayWidth,10)+"em",this.menus[n.buttonClass]=new e.M.editor_atto.Menu(n),this.menus[n.buttonClass].get("contentBox").delegate("click",this._chooseMenuItem,".atto_menuentry a",this,n)),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[n.buttonName];i.focus(),this.get("host")._setTabFocus(i),r=this.menus[n.buttonClass],r.set("focusAfterHide",i),r.show(),r.align(this.buttons[n.buttonName],[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this.get("host").openMenus=[r]},_showToolbarMenuAndFocus:function(e,t){this._showToolbarMenu(e,t),this.menus[t.buttonClass].get("boundingBox").one("a").focus()},_chooseMenuItem:function(e,t,n){var r=e.target.ancestor("a",!0).getData("index"),i=this._normalizeCallback(t.items[r],t.globalItemConfig);n=this.menus[t.buttonClass],n.set("preventHideMenu",!0),i.callback(e,i._callback,i.callbackArgs),n.set("preventHideMenu",!1),n.set("focusAfterHide",this.get("host").editor),n.hide(e)},_normalizeCallback:function(t,n){return t._callbackNormalized?t:(n||(n={}),t.inlineFormat=t.inlineFormat||n.inlineFormat,t._inlineCallback=t.callback||n.callback,t._callback=t.callback||n.callback,t.inlineFormat&&typeof t._inlineCallback=="function"&&(t._callback=function(e,n){this.get("host").applyFormat(e,t._inlineCallback,this,n)}),t.callback=e.rbind(this._callbackWrapper,this,t._callback,t.callbackArgs),t._callbackNormalized=!0 -,t)},_normalizeIcon:function(e){return e.iconurl||(e.iconComponent||(e.iconComponent="core"),e.iconurl=M.util.image_url(e.icon,e.iconComponent)),e},_callbackWrapper:function(e,t,n){e.preventDefault();if(!this.isEnabled())return;var r=e.currentTarget.ancestor("button",!0);if(r&&r.hasAttribute(o))return;!YUI.Env.UA.android&&!this.get("host").isActive()&&this.get("host").focus(),this.get("host").saveSelection(),r&&this.get("host")._setTabFocus(r);var i=[e,n];return this.get("host").restoreSelection(),t.apply(this,i)},_addKeyboardListener:function(t,n,r){var i="key",s=f.EDITORWRAPPER,o,u,a;if(e.Lang.isArray(n))return e.Array.each(n,function(e){this._addKeyboardListener(t,e)},this),this;typeof n=="object"?(n.eventtype&&(i=n.eventtype),n.container&&(s=n.container),o=n.keyCodes,u=t):(a=this._getDefaultMetaKey(),o=this._getKeyEvent()+n+"+"+a,typeof this._primaryKeyboardShortcut[r]=="undefined"&&(this._primaryKeyboardShortcut[r]=this._getDefaultMetaKeyDescription(n)),u=e.bind(function(e,n){this._eventUsesExactKeyModifiers(e,n)&&t.apply(this,[n])},this,[a])),this._buttonHandlers.push(this.editor.delegate(i,u,o,s,this))},_eventUsesExactKeyModifiers:function(t,n){var r=!0,i;return n.type!=="key"?!1:(i=e.Array.indexOf(t,"alt")>-1,r=r&&(n.altKey&&i||!n.altKey&&!i),i=e.Array.indexOf(t,"ctrl")>-1,r=r&&(n.ctrlKey&&i||!n.ctrlKey&&!i),i=e.Array.indexOf(t,"meta")>-1,r=r&&(n.metaKey&&i||!n.metaKey&&!i),i=e.Array.indexOf(t,"shift")>-1,r=r&&(n.shiftKey&&i||!n.shiftKey&&!i),r)},isEnabled:function(){var t=e.Object.some(this.buttonStates,function(e){return e===this.ENABLED},this);return t},disableButtons:function(e){return this._setButtonState(!1,e)},enableButtons:function(e){return this._setButtonState(!0,e)},_setButtonState:function(t,n){var r="setAttribute";return t&&(r="removeAttribute"),n?this.buttons[n]&&(this.buttons[n][r](o,o),this.buttonStates[n]=t?this.ENABLED:this.DISABLED):e.Array.each(this.buttonNames,function(e){this.buttons[e][r](o,o),this.buttonStates[e]=t?this.ENABLED:this.DISABLED},this),this.get("host").checkTabFocus(),this},highlightButtons:function(e){return this._changeButtonHighlight(!0,e)},unHighlightButtons:function(e){return this._changeButtonHighlight(!1,e)},_changeButtonHighlight:function(t,n){var r="addClass";return t||(r="removeClass"),n?this.buttons[n]&&this.buttons[n][r](u):e.Object.each(this.buttons,function(e){e[r](u)},this),this},_getDefaultMetaKey:function(){return e.UA.os==="macintosh"?"meta":"ctrl"},_getDefaultMetaKeyDescription:function(t){return e.UA.os==="macintosh"?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:"}},e.Base.mix(e.M.editor_atto.EditorPlugin,[l]),c.ATTRS={},c.prototype={_dialogue:null,getDialogue:function(t){t=t||{};var n=!1;t.focusAfterHide&&(n=t.focusAfterHide,delete t.focusAfterHide);if(!this._dialogue){var r=e.merge({visible:!1,modal:!0,close:!0,draggable:!0},t);this._dialogue=new M.core.dialogue(r)}return n!==!1&&(n===!0?this._dialogue.set("focusAfterHide",this.buttons[this.buttonNames[0]]):typeof n=="string"?this._dialogue.set("focusAfterHide",this.buttons[n]):this._dialogue.set("focusAfterHide",n)),this._dialogue}},e.Base.mix(e.M.editor_atto.EditorPlugin,[c])},"@VERSION@",{requires:["node","base","escape","event","event-outside","handlebars","event-custom","timers","moodle-editor_atto-menu"]}); +YUI.add("moodle-editor_atto-plugin",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function l(){}function c(){}var r=".atto_group.",i="_group";e.extend(n,e.Base,{name:null,editor:null,toolbar:null,initializer:function(e){this.name=e.name,this.toolbar=e.toolbar,this.editor=e.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 n=this.toolbar.one(r+t+i);return n||(n=e.Node.create('
'),this.toolbar.append(n)),n}}}}),e.namespace("M.editor_atto").EditorPlugin=n;var s='',o="disabled",u="highlight",a="moodle-editor_atto-editor-plugin",f={EDITORWRAPPER:".editor_atto_content"};l.ATTRS={},l.prototype={buttons:null,buttonNames:null,buttonStates:null,menus:null,DISABLED:0,ENABLED:1,_buttonHandlers:null,_menuHideHandlers:null,_primaryKeyboardShortcut:null,_highlightQueue:null,addButton:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",s,o=this.get("host");t.exec&&(i=i+"_"+t.exec),t.buttonName?i=i+"_"+t.buttonName:t.buttonName=t.exec||r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var u=M.util.get_string(t.title,"atto_"+r);s=e.Node.create(''),s.setAttribute("title",u),window.require(["core/templates"],function(e){var n=e.renderPix(t.icon,t.iconComponent,u);s.append(n)}),n.append(s);var a=this.toolbar.getAttribute("aria-activedescendant");a||(s.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",s.generateID()),this.get("host")._tabFocus=s),t=this._normalizeCallback(t),this._buttonHandlers.push(this.toolbar.delegate("click",t.callback,"."+i,this)),t.keys&&(typeof t.keyDescription!="undefined"&&(this._primaryKeyboardShortcut[i]=t.keyDescription),this._addKeyboardListener(t.callback,t.keys,i),this._primaryKeyboardShortcut[i]&&s.setAttribute("title",M.util.get_string("plugin_title_shortcut","editor_atto",{title:u,shortcut:this._primaryKeyboardShortcut[i]})));if(t.tags){var f=!0;typeof t.tagMatchRequiresAll=="boolean"&&(f=t.tagMatchRequiresAll),this._buttonHandlers.push(o.on(["atto:selectionchanged","change"],function(n){typeof this._highlightQueue[t.buttonName]!="undefined"&&this._highlightQueue[t.buttonName].cancel(),this._highlightQueue[t.buttonName]=e.soon(e.bind(function(e){o.selectionFilterMatches(t.tags,e.selectedNodes,f)?this.highlightButtons(t.buttonName):this.unHighlightButtons(t.buttonName)},this,n))},this))}return this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=s,this.buttonStates[t.buttonName]=this.ENABLED,s},addBasicButton:function(e){return e.exec?(e.icon||(e.icon="e/"+e.exec),e.callback=function(){document.execCommand(e.exec,!1,null),this.markUpdated()},this.addButton(e)):null},addToolbarMenu:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",o,u;t.buttonName?i=i+"_"+t.buttonName:t.buttonName=r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var a=M.util.get_string(t.title,"atto_"+r);t.menuColor||(t.menuColor="transparent");var f=e.Handlebars.compile(s);return o=e.Node.create(f({buttonClass:i,config:t,title:a})),window.require(["core/templates"],function(e){var n=e.renderPix(t.icon,t.iconComponent,a);o.append(n),n=e.renderPix("t/expanded","core",""),o.append(n)}),n.append(o),u=this.toolbar.getAttribute("aria-activedescendant"),u||(o.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",o.generateID())),this._buttonHandlers.push(this.toolbar.delegate("click",this._showToolbarMenu,"."+i,this,t),this.toolbar.delegate("key",this._showToolbarMenuAndFocus,"40, 32, enter","."+i,this,t)),this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=o,this.buttonStates[t.buttonName]=this.ENABLED,o},_showToolbarMenu:function(t,n){t.preventDefault();if(!this.isEnabled())return;if(t.currentTarget.ancestor("button",!0).hasAttribute(o))return;var r;this.menus[n.buttonClass]||(n.overlayWidth||(n.overlayWidth="14"),n.innerOverlayWidth||(n.innerOverlayWidth=parseInt(n.overlayWidth,10)-2+"em"),n.overlayWidth=parseInt(n.overlayWidth,10)+"em",this.menus[n.buttonClass]=new e.M.editor_atto.Menu(n),this.menus[n.buttonClass].get("contentBox").delegate("click",this._chooseMenuItem,".atto_menuentry a",this,n)),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[n.buttonName];i.focus(),this.get("host")._setTabFocus(i),r=this.menus[n.buttonClass],r.set("focusAfterHide",i),r.show(),r.align(this.buttons[n.buttonName],[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this.get("host").openMenus=[r]},_showToolbarMenuAndFocus:function(e,t){this._showToolbarMenu(e,t),this.menus[t.buttonClass].get("boundingBox").one("a").focus()},_chooseMenuItem:function(e,t,n){var r=e.target.ancestor("a",!0).getData("index"),i=this._normalizeCallback(t.items[r],t.globalItemConfig);n=this.menus[t.buttonClass],n.set("preventHideMenu",!0),i.callback(e,i._callback,i.callbackArgs),n.set("preventHideMenu",!1),n.set("focusAfterHide",this.get("host").editor),n.hide(e)},_normalizeCallback:function(t,n){return t._callbackNormalized?t:(n||(n={}),t.inlineFormat=t.inlineFormat||n.inlineFormat,t._inlineCallback=t.callback||n.callback,t._callback=t.callback||n.callback,t.inlineFormat&&typeof t._inlineCallback=="function"&&(t._callback=function(e,n){this.get("host").applyFormat(e,t._inlineCallback,this,n)}),t.callback=e.rbind(this._callbackWrapper,this,t._callback,t.callbackArgs),t._callbackNormalized=!0,t)},_normalizeIcon:function(e){if(!e.iconurl){if(!e.iconComponent||e.iconComponent=="moodle")e.iconComponent="core" +;e.iconurl=M.util.image_url(e.icon,e.iconComponent)}return e},_callbackWrapper:function(e,t,n){e.preventDefault();if(!this.isEnabled())return;var r=e.currentTarget.ancestor("button",!0);if(r&&r.hasAttribute(o))return;!YUI.Env.UA.android&&!this.get("host").isActive()&&this.get("host").focus(),this.get("host").saveSelection(),r&&this.get("host")._setTabFocus(r);var i=[e,n];return this.get("host").restoreSelection(),t.apply(this,i)},_addKeyboardListener:function(t,n,r){var i="key",s=f.EDITORWRAPPER,o,u,a;if(e.Lang.isArray(n))return e.Array.each(n,function(e){this._addKeyboardListener(t,e)},this),this;typeof n=="object"?(n.eventtype&&(i=n.eventtype),n.container&&(s=n.container),o=n.keyCodes,u=t):(a=this._getDefaultMetaKey(),o=this._getKeyEvent()+n+"+"+a,typeof this._primaryKeyboardShortcut[r]=="undefined"&&(this._primaryKeyboardShortcut[r]=this._getDefaultMetaKeyDescription(n)),u=e.bind(function(e,n){this._eventUsesExactKeyModifiers(e,n)&&t.apply(this,[n])},this,[a])),this._buttonHandlers.push(this.editor.delegate(i,u,o,s,this))},_eventUsesExactKeyModifiers:function(t,n){var r=!0,i;return n.type!=="key"?!1:(i=e.Array.indexOf(t,"alt")>-1,r=r&&(n.altKey&&i||!n.altKey&&!i),i=e.Array.indexOf(t,"ctrl")>-1,r=r&&(n.ctrlKey&&i||!n.ctrlKey&&!i),i=e.Array.indexOf(t,"meta")>-1,r=r&&(n.metaKey&&i||!n.metaKey&&!i),i=e.Array.indexOf(t,"shift")>-1,r=r&&(n.shiftKey&&i||!n.shiftKey&&!i),r)},isEnabled:function(){var t=e.Object.some(this.buttonStates,function(e){return e===this.ENABLED},this);return t},disableButtons:function(e){return this._setButtonState(!1,e)},enableButtons:function(e){return this._setButtonState(!0,e)},_setButtonState:function(t,n){var r="setAttribute";return t&&(r="removeAttribute"),n?this.buttons[n]&&(this.buttons[n][r](o,o),this.buttonStates[n]=t?this.ENABLED:this.DISABLED):e.Array.each(this.buttonNames,function(e){this.buttons[e][r](o,o),this.buttonStates[e]=t?this.ENABLED:this.DISABLED},this),this.get("host").checkTabFocus(),this},highlightButtons:function(e){return this._changeButtonHighlight(!0,e)},unHighlightButtons:function(e){return this._changeButtonHighlight(!1,e)},_changeButtonHighlight:function(t,n){var r="addClass";return t||(r="removeClass"),n?this.buttons[n]&&this.buttons[n][r](u):e.Object.each(this.buttons,function(e){e[r](u)},this),this},_getDefaultMetaKey:function(){return e.UA.os==="macintosh"?"meta":"ctrl"},_getDefaultMetaKeyDescription:function(t){return e.UA.os==="macintosh"?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:"}},e.Base.mix(e.M.editor_atto.EditorPlugin,[l]),c.ATTRS={},c.prototype={_dialogue:null,getDialogue:function(t){t=t||{};var n=!1;t.focusAfterHide&&(n=t.focusAfterHide,delete t.focusAfterHide);if(!this._dialogue){var r=e.merge({visible:!1,modal:!0,close:!0,draggable:!0},t);this._dialogue=new M.core.dialogue(r)}return n!==!1&&(n===!0?this._dialogue.set("focusAfterHide",this.buttons[this.buttonNames[0]]):typeof n=="string"?this._dialogue.set("focusAfterHide",this.buttons[n]):this._dialogue.set("focusAfterHide",n)),this._dialogue}},e.Base.mix(e.M.editor_atto.EditorPlugin,[c])},"@VERSION@",{requires:["node","base","escape","event","event-outside","handlebars","event-custom","timers","moodle-editor_atto-menu"]}); 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 fc571a146fe..4cf0b1e2209 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 @@ -183,10 +183,10 @@ var MENUTEMPLATE = '' + 'tabindex="-1" ' + 'type="button" ' + 'title="{{title}}">' + - '' + - '' + + // '' + + // '' + ''; var DISABLED = 'disabled', @@ -360,11 +360,12 @@ EditorPluginButtons.prototype = { // Create the actual button. button = Y.Node.create(''); + 'tabindex="-1">'); button.setAttribute('title', title); + window.require(['core/templates'], function(Templates) { + var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title); + button.append(iconhtml); + }); // Append it to the group. group.append(button); @@ -531,6 +532,14 @@ EditorPluginButtons.prototype = { title: title })); + window.require(['core/templates'], function(Templates) { + var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title); + button.append(iconhtml); + iconhtml = Templates.renderPix('t/expanded', 'core', ''); + button.append(iconhtml); + }); + + // Append it to the group. group.append(button); @@ -725,7 +734,7 @@ EditorPluginButtons.prototype = { _normalizeIcon: function(config) { if (!config.iconurl) { // The default icon component. - if (!config.iconComponent) { + if (!config.iconComponent || config.iconComponent == 'moodle') { config.iconComponent = 'core'; } config.iconurl = M.util.image_url(config.icon, config.iconComponent); 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 18964d592ca..d2a3761355d 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 @@ -33,10 +33,10 @@ var MENUTEMPLATE = '' + 'tabindex="-1" ' + 'type="button" ' + 'title="{{title}}">' + - '' + - '' + + // '' + + // '' + ''; var DISABLED = 'disabled', @@ -210,11 +210,12 @@ EditorPluginButtons.prototype = { // Create the actual button. button = Y.Node.create(''); + 'tabindex="-1">'); button.setAttribute('title', title); + window.require(['core/templates'], function(Templates) { + var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title); + button.append(iconhtml); + }); // Append it to the group. group.append(button); @@ -383,6 +384,14 @@ EditorPluginButtons.prototype = { title: title })); + window.require(['core/templates'], function(Templates) { + var iconhtml = Templates.renderPix(config.icon, config.iconComponent, title); + button.append(iconhtml); + iconhtml = Templates.renderPix('t/expanded', 'core', ''); + button.append(iconhtml); + }); + + // Append it to the group. group.append(button); @@ -577,7 +586,7 @@ EditorPluginButtons.prototype = { _normalizeIcon: function(config) { if (!config.iconurl) { // The default icon component. - if (!config.iconComponent) { + if (!config.iconComponent || config.iconComponent == 'moodle') { config.iconComponent = 'core'; } config.iconurl = M.util.image_url(config.icon, config.iconComponent); diff --git a/lib/outputlib.php b/lib/outputlib.php index 73198c425c2..b60dacedae9 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -131,6 +131,7 @@ function theme_get_fontawesome_icon_map() { static $map = [ 'core:docs' => 'fa-info-circle', 'core:help' => 'fa-question-circle', + 'core:req' => 'fa-exclamation-circle', 'core:a/add_file' => 'fa-file-o', 'core:a/create_folder' => 'fa-folder-o', 'core:a/download_all' => 'fa-download', @@ -172,7 +173,7 @@ function theme_get_fontawesome_icon_map() { 'core:e/delete' => 'fa-minus', 'core:e/delete_table' => 'fa-minus', 'core:e/document_properties' => 'fa-info', - 'core:e/emoticons' => 'fa-meh', + 'core:e/emoticons' => 'fa-meh-o', 'core:e/find_replace' => 'fa-search-plus', 'core:e/forward' => 'fa-arrow-right', 'core:e/fullpage' => 'fa-arrows-alt', @@ -198,7 +199,7 @@ function theme_get_fontawesome_icon_map() { 'core:e/layers_over' => 'fa-level-up', 'core:e/layers' => 'fa-window-restore', 'core:e/layers_under' => 'fa-level-down', - 'core:e/left_to_right' => 'fa-language', + 'core:e/left_to_right' => 'fa-chevron-right', 'core:e/manage_files' => 'fa-files-o', 'core:e/math' => 'fa-calculator', 'core:e/merge_cells' => 'fa-compress', @@ -218,7 +219,7 @@ function theme_get_fontawesome_icon_map() { 'core:e/resize' => 'fa-expand', 'core:e/restore_draft' => 'fa-undo', 'core:e/restore_last_draft' => 'fa-undo', - 'core:e/right_to_left' => 'fa-language', + 'core:e/right_to_left' => 'fa-chevron-left', 'core:e/row_props' => 'fa-info', 'core:e/save' => 'fa-floppy-o', 'core:e/screenreader_helper' => 'fa-braille', @@ -236,10 +237,10 @@ function theme_get_fontawesome_icon_map() { 'core:e/table_props' => 'fa-table', 'core:e/table' => 'fa-table', 'core:e/template' => 'fa-sticky-note', - 'core:e/text_color_picker' => 'fa-hand-pointer-o', - 'core:e/text_color' => 'fa-hand-pointer-o', - 'core:e/text_highlight_picker' => 'fa-hand-pointer-o', - 'core:e/text_highlight' => 'fa-hand-pointer-o', + 'core:e/text_color_picker' => 'fa-paint-brush', + 'core:e/text_color' => 'fa-paint-brush', + 'core:e/text_highlight_picker' => 'fa-lightbulb-o', + 'core:e/text_highlight' => 'fa-lightbulb-o', 'core:e/tick' => 'fa-check', 'core:e/toggle_blockquote' => 'fa-quote-left', 'core:e/underline' => 'fa-underline', @@ -835,7 +836,7 @@ function theme_get_fontawesome_icon_map() { 'core:t/emailno' => 'fa-envelope-o', 'core:t/email' => 'fa-envelope', 'core:t/enrolusers' => 'fa-user-plus', - 'core:t/expanded' => 'fa-minus-square', + 'core:t/expanded' => 'fa-caret-down', 'core:t/go' => 'fa-arrow-right', 'core:t/grades' => 'fa-graduation-cap', 'core:t/groupn' => 'fa-users', diff --git a/theme/boost/scss/moodle/icons.scss b/theme/boost/scss/moodle/icons.scss index 7484d540b7a..dc61d029cc3 100644 --- a/theme/boost/scss/moodle/icons.scss +++ b/theme/boost/scss/moodle/icons.scss @@ -11,8 +11,14 @@ margin-right: 0.5rem; } +$icon-color: $body-color !default; + a .icon { - color: $body-color ! important; + color: $icon-color ! important; +} + +.navbar-dark a .icon { + color: $navbar-dark-color ! important; } a:first-of-type > .icon,