mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Merge branch 'MDL-71656-master' of git://github.com/HuongNV13/moodle
This commit is contained in:
commit
537c909680
14 changed files with 160 additions and 20 deletions
|
@ -22,5 +22,11 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['color_white'] = 'White';
|
||||
$string['color_red'] = 'Red';
|
||||
$string['color_yellow'] = 'Yellow';
|
||||
$string['color_green'] = 'Green';
|
||||
$string['color_blue'] = 'Blue';
|
||||
$string['color_black'] = 'Black';
|
||||
$string['pluginname'] = 'Background colour';
|
||||
$string['privacy:metadata'] = 'The atto_backcolor plugin does not store any personal data.';
|
||||
|
|
41
lib/editor/atto/plugins/backcolor/lib.php
Normal file
41
lib/editor/atto/plugins/backcolor/lib.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Atto text editor integration version file.
|
||||
*
|
||||
* @package atto_backcolor
|
||||
* @copyright 2021 Huong Nguyen <huongn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise the js strings required for this module.
|
||||
*/
|
||||
function atto_backcolor_strings_for_js() {
|
||||
global $PAGE;
|
||||
|
||||
$PAGE->requires->strings_for_js([
|
||||
'color_white',
|
||||
'color_red',
|
||||
'color_yellow',
|
||||
'color_green',
|
||||
'color_blue',
|
||||
'color_black'
|
||||
], 'atto_backcolor');
|
||||
}
|
|
@ -1,3 +1,26 @@
|
|||
.atto_backcolor_button .dropdown-menu {
|
||||
min-width: inherit;
|
||||
}
|
||||
|
||||
.atto_backcolor_button .dropdown-menu .atto_menuentry {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.atto_backcolor_button .dropdown-menu .atto_menuentry a[role=menuitem] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.atto_backcolor_button .dropdown-menu .atto_menuentry a[role=menuitem]:hover,
|
||||
.atto_backcolor_button .dropdown-menu .atto_menuentry a[role=menuitem]:focus {
|
||||
box-shadow: #0f6fc5 0 0 3px 1px;
|
||||
}
|
||||
|
||||
.atto_backcolor_button .dropdown-menu .coloroption {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
float: left;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ Y.namespace('M.atto_backcolor').Button = Y.Base.create('button', Y.M.editor_atto
|
|||
initializer: function() {
|
||||
var items = [];
|
||||
Y.Array.each(colors, function(color) {
|
||||
var colorLabel = M.util.get_string('color_' + color.name, 'atto_backcolor');
|
||||
items.push({
|
||||
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
|
||||
color.color +
|
||||
'"></div>',
|
||||
text: '<div class="coloroption" style="background-color: '
|
||||
+ color.color + '" aria-label="' + colorLabel + '" title="' + colorLabel + '"></div>',
|
||||
callbackArgs: color.color
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
YUI.add("moodle-atto_backcolor-button",function(o,t){var e=[{name:"white",color:"#FFFFFF"},{name:"red",color:"#EF4540"},{name:"yellow",color:"#FFCF35"},{name:"green",color:"#98CA3E"},{name:"blue",color:"#7D9FD3"},{name:"black",color:"#333333"}];o.namespace("M.atto_backcolor").Button=o.Base.create("button",o.M.editor_atto.EditorPlugin,[],{initializer:function(){var t=[];o.Array.each(e,function(o){t.push({text:'<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: '+o.color+'"></div>',callbackArgs:o.color})}),this.addToolbarMenu({icon:"e/text_highlight",overlayWidth:"4",globalItemConfig:{inlineFormat:!0,callback:this._changeStyle},items:t})},_changeStyle:function(o,t){this.get("host").formatSelectionInlineStyle({backgroundColor:t})}})},"@VERSION@");
|
||||
YUI.add("moodle-atto_backcolor-button",function(o,t){var e=[{name:"white",color:"#FFFFFF"},{name:"red",color:"#EF4540"},{name:"yellow",color:"#FFCF35"},{name:"green",color:"#98CA3E"},{name:"blue",color:"#7D9FD3"},{name:"black",color:"#333333"}];o.namespace("M.atto_backcolor").Button=o.Base.create("button",o.M.editor_atto.EditorPlugin,[],{initializer:function(){var a=[];o.Array.each(e,function(o){var t=M.util.get_string("color_"+o.name,"atto_backcolor");a.push({text:'<div class="coloroption" style="background-color: '+o.color+'" aria-label="'+t+'" title="'+t+'"></div>',callbackArgs:o.color})}),this.addToolbarMenu({icon:"e/text_highlight",overlayWidth:"4",globalItemConfig:{inlineFormat:!0,callback:this._changeStyle},items:a})},_changeStyle:function(o,t){this.get("host").formatSelectionInlineStyle({backgroundColor:t})}})},"@VERSION@");
|
|
@ -59,10 +59,10 @@ Y.namespace('M.atto_backcolor').Button = Y.Base.create('button', Y.M.editor_atto
|
|||
initializer: function() {
|
||||
var items = [];
|
||||
Y.Array.each(colors, function(color) {
|
||||
var colorLabel = M.util.get_string('color_' + color.name, 'atto_backcolor');
|
||||
items.push({
|
||||
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
|
||||
color.color +
|
||||
'"></div>',
|
||||
text: '<div class="coloroption" style="background-color: '
|
||||
+ color.color + '" aria-label="' + colorLabel + '" title="' + colorLabel + '"></div>',
|
||||
callbackArgs: color.color
|
||||
});
|
||||
});
|
||||
|
|
|
@ -57,10 +57,10 @@ Y.namespace('M.atto_backcolor').Button = Y.Base.create('button', Y.M.editor_atto
|
|||
initializer: function() {
|
||||
var items = [];
|
||||
Y.Array.each(colors, function(color) {
|
||||
var colorLabel = M.util.get_string('color_' + color.name, 'atto_backcolor');
|
||||
items.push({
|
||||
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
|
||||
color.color +
|
||||
'"></div>',
|
||||
text: '<div class="coloroption" style="background-color: '
|
||||
+ color.color + '" aria-label="' + colorLabel + '" title="' + colorLabel + '"></div>',
|
||||
callbackArgs: color.color
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,5 +22,11 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['color_white'] = 'White';
|
||||
$string['color_red'] = 'Red';
|
||||
$string['color_yellow'] = 'Yellow';
|
||||
$string['color_green'] = 'Green';
|
||||
$string['color_blue'] = 'Blue';
|
||||
$string['color_black'] = 'Black';
|
||||
$string['pluginname'] = 'Font colour';
|
||||
$string['privacy:metadata'] = 'The atto_fontcolor plugin does not store any personal data.';
|
||||
|
|
41
lib/editor/atto/plugins/fontcolor/lib.php
Normal file
41
lib/editor/atto/plugins/fontcolor/lib.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Atto text editor integration version file.
|
||||
*
|
||||
* @package atto_fontcolor
|
||||
* @copyright 2021 Huong Nguyen <huongn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise the js strings required for this module.
|
||||
*/
|
||||
function atto_fontcolor_strings_for_js() {
|
||||
global $PAGE;
|
||||
|
||||
$PAGE->requires->strings_for_js([
|
||||
'color_white',
|
||||
'color_red',
|
||||
'color_yellow',
|
||||
'color_green',
|
||||
'color_blue',
|
||||
'color_black'
|
||||
], 'atto_fontcolor');
|
||||
}
|
|
@ -1,3 +1,26 @@
|
|||
.atto_fontcolor_button .dropdown-menu {
|
||||
min-width: inherit;
|
||||
}
|
||||
|
||||
.atto_fontcolor_button .dropdown-menu .atto_menuentry {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.atto_fontcolor_button .dropdown-menu .atto_menuentry a[role=menuitem] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.atto_fontcolor_button .dropdown-menu .atto_menuentry a[role=menuitem]:hover,
|
||||
.atto_fontcolor_button .dropdown-menu .atto_menuentry a[role=menuitem]:focus {
|
||||
box-shadow: #0f6fc5 0 0 3px 1px;
|
||||
}
|
||||
|
||||
.atto_fontcolor_button .dropdown-menu .coloroption {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
float: left;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ Y.namespace('M.atto_fontcolor').Button = Y.Base.create('button', Y.M.editor_atto
|
|||
initializer: function() {
|
||||
var items = [];
|
||||
Y.Array.each(colors, function(color) {
|
||||
var colorLabel = M.util.get_string('color_' + color.name, 'atto_fontcolor');
|
||||
items.push({
|
||||
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
|
||||
color.color +
|
||||
'"></div>',
|
||||
text: '<div class="coloroption" style="background-color: '
|
||||
+ color.color + '" aria-label="' + colorLabel + '" title="' + colorLabel + '"></div>',
|
||||
callbackArgs: color.color,
|
||||
callback: this._changeStyle
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
YUI.add("moodle-atto_fontcolor-button",function(o,t){var e=[{name:"white",color:"#FFFFFF"},{name:"red",color:"#EF4540"},{name:"yellow",color:"#FFCF35"},{name:"green",color:"#98CA3E"},{name:"blue",color:"#7D9FD3"},{name:"black",color:"#333333"}];o.namespace("M.atto_fontcolor").Button=o.Base.create("button",o.M.editor_atto.EditorPlugin,[],{initializer:function(){var t=[];o.Array.each(e,function(o){t.push({text:'<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: '+o.color+'"></div>',callbackArgs:o.color,callback:this._changeStyle})}),this.addToolbarMenu({icon:"e/text_color",overlayWidth:"4",menuColor:"#333333",globalItemConfig:{inlineFormat:!0,callback:this._changeStyle},items:t})},_changeStyle:function(o,t){this.get("host").formatSelectionInlineStyle({color:t})}})},"@VERSION@");
|
||||
YUI.add("moodle-atto_fontcolor-button",function(o,t){var e=[{name:"white",color:"#FFFFFF"},{name:"red",color:"#EF4540"},{name:"yellow",color:"#FFCF35"},{name:"green",color:"#98CA3E"},{name:"blue",color:"#7D9FD3"},{name:"black",color:"#333333"}];o.namespace("M.atto_fontcolor").Button=o.Base.create("button",o.M.editor_atto.EditorPlugin,[],{initializer:function(){var l=[];o.Array.each(e,function(o){var t=M.util.get_string("color_"+o.name,"atto_fontcolor");l.push({text:'<div class="coloroption" style="background-color: '+o.color+'" aria-label="'+t+'" title="'+t+'"></div>',callbackArgs:o.color,callback:this._changeStyle})}),this.addToolbarMenu({icon:"e/text_color",overlayWidth:"4",menuColor:"#333333",globalItemConfig:{inlineFormat:!0,callback:this._changeStyle},items:l})},_changeStyle:function(o,t){this.get("host").formatSelectionInlineStyle({color:t})}})},"@VERSION@");
|
|
@ -59,10 +59,10 @@ Y.namespace('M.atto_fontcolor').Button = Y.Base.create('button', Y.M.editor_atto
|
|||
initializer: function() {
|
||||
var items = [];
|
||||
Y.Array.each(colors, function(color) {
|
||||
var colorLabel = M.util.get_string('color_' + color.name, 'atto_fontcolor');
|
||||
items.push({
|
||||
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
|
||||
color.color +
|
||||
'"></div>',
|
||||
text: '<div class="coloroption" style="background-color: '
|
||||
+ color.color + '" aria-label="' + colorLabel + '" title="' + colorLabel + '"></div>',
|
||||
callbackArgs: color.color,
|
||||
callback: this._changeStyle
|
||||
});
|
||||
|
|
|
@ -57,10 +57,10 @@ Y.namespace('M.atto_fontcolor').Button = Y.Base.create('button', Y.M.editor_atto
|
|||
initializer: function() {
|
||||
var items = [];
|
||||
Y.Array.each(colors, function(color) {
|
||||
var colorLabel = M.util.get_string('color_' + color.name, 'atto_fontcolor');
|
||||
items.push({
|
||||
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
|
||||
color.color +
|
||||
'"></div>',
|
||||
text: '<div class="coloroption" style="background-color: '
|
||||
+ color.color + '" aria-label="' + colorLabel + '" title="' + colorLabel + '"></div>',
|
||||
callbackArgs: color.color,
|
||||
callback: this._changeStyle
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue