MDL-34674 add CTRL+right click hint to tinymce context menus

This commit is contained in:
Petr Škoda
2013-04-16 08:37:21 +02:00
parent 0ac97084fa
commit ca117d1e5b
5 changed files with 116 additions and 1 deletions
@@ -0,0 +1,28 @@
<?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/>.
/**
* Strings for CTRL+Right click helper.
*
* @package tinymce_ctrlhelp
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'CTRL+right click helper';
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
$string['ctrlhelp:desc'] = 'CTRL + right click for more options';
@@ -0,0 +1,35 @@
<?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/>.
defined('MOODLE_INTERNAL') || die();
/**
* CTRL + right click helper
*
* @package tinymce_ctrlhelp
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tinymce_ctrlhelp extends editor_tinymce_plugin {
protected function update_init_params(array &$params, context $context, array $options = null) {
$this->add_js_plugin($params);
}
protected function get_sort_order() {
// We want this plugin to register as the last one in the context menu.
return 66666;
}
}
@@ -0,0 +1,23 @@
(function() {
tinymce.create('tinymce.plugins.CtrlHelpPlugin', {
init : function(ed, url) {
ed.onContextMenu.add(function(ed, e) {
var m = ed.plugins.contextmenu._menu;
m.add({title : 'ctrlhelp.desc', icon : '', cmd : ''});
});
},
getInfo : function() {
return {
longname : 'Moodle CTRL + right click helper plugin',
author : 'Petr Skoda',
authorurl : 'http://skodak.org/',
infourl : 'http://moodle.org',
version : '1.0'
};
}
});
tinymce.PluginManager.add('ctrlhelp', tinymce.plugins.CtrlHelpPlugin);
})();
@@ -0,0 +1,29 @@
<?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/>.
/**
* CTRL + right click helper.
*
* @package tinymce_ctrlhelp
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2013041200;
$plugin->requires = 2013041100;
$plugin->component = 'tinymce_ctrlhelp';
+1 -1
View File
@@ -597,7 +597,7 @@ class plugin_manager {
),
'tinymce' => array(
'dragmath', 'moodleemoticon', 'moodleimage', 'moodlemedia', 'moodlenolink', 'spellchecker',
'ctrlhelp', 'dragmath', 'moodleemoticon', 'moodleimage', 'moodlemedia', 'moodlenolink', 'spellchecker',
),
'theme' => array(