Merge branch 'wip-MDL-40648-master' of git://github.com/marinaglancy/moodle
Conflicts: version.php
This commit is contained in:
@@ -38,8 +38,13 @@ class tinymce_dragmath extends editor_tinymce_plugin {
|
||||
}
|
||||
}
|
||||
|
||||
// Add button before 'nonbreaking' in advancedbuttons3.
|
||||
$this->add_button_before($params, 3, 'dragmath', 'nonbreaking');
|
||||
if ($row = $this->find_button($params, 'nonbreaking')) {
|
||||
// Add button before 'nonbreaking'.
|
||||
$this->add_button_before($params, $row, 'dragmath', 'nonbreaking');
|
||||
} else {
|
||||
// If 'nonbreaking' is not found, add button in the end of the last row:
|
||||
$this->add_button_after($params, $this->count_button_rows($params), 'dragmath');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
|
||||
@@ -39,8 +39,13 @@ class tinymce_moodleemoticon extends editor_tinymce_plugin {
|
||||
}
|
||||
}
|
||||
|
||||
// Add button after 'image' in advancedbuttons3.
|
||||
$this->add_button_after($params, 3, 'moodleemoticon', 'image');
|
||||
if ($row = $this->find_button($params, 'image')) {
|
||||
// Add button after 'image'.
|
||||
$this->add_button_after($params, $row, 'moodleemoticon', 'image');
|
||||
} else {
|
||||
// If 'image' is not found, add button in the end of the last row.
|
||||
$this->add_button_after($params, $this->count_button_rows($params), 'moodleemoticon');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
|
||||
@@ -37,14 +37,17 @@ class tinymce_moodlemedia extends editor_tinymce_plugin {
|
||||
}
|
||||
}
|
||||
|
||||
// Add button after emoticon button in advancedbuttons1.
|
||||
$added = $this->add_button_after($params, 1, 'moodlemedia', 'moodleemoticon', false);
|
||||
|
||||
// Note: We know that the emoticon button has already been added, if it
|
||||
// exists, because I set the sort order higher for this. So, if no
|
||||
// emoticon, add after 'image'.
|
||||
if (!$added) {
|
||||
$this->add_button_after($params, 1, 'moodlemedia', 'image');
|
||||
if ($row = $this->find_button($params, 'moodleemoticon')) {
|
||||
// Add button after 'moodleemoticon' icon.
|
||||
$this->add_button_after($params, $row, 'moodlemedia', 'moodleemoticon');
|
||||
} else if ($row = $this->find_button($params, 'image')) {
|
||||
// Note: We know that the plugin emoticon button has already been added
|
||||
// if it is enabled because this plugin has higher sortorder.
|
||||
// Otherwise add after 'image'.
|
||||
$this->add_button_after($params, $row, 'moodlemedia', 'image');
|
||||
} else {
|
||||
// Add this button in the end of the first row (by default 'image' button should be in the first row).
|
||||
$this->add_button_after($params, 1, 'moodlemedia');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
|
||||
@@ -30,8 +30,13 @@ class tinymce_moodlenolink extends editor_tinymce_plugin {
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
|
||||
// Add button after 'unlink' in advancedbuttons1.
|
||||
$this->add_button_after($params, 1, 'moodlenolink', 'unlink');
|
||||
if ($row = $this->find_button($params, 'unlink')) {
|
||||
// Add button after 'unlink'.
|
||||
$this->add_button_after($params, $row, 'moodlenolink', 'unlink');
|
||||
} else {
|
||||
// Add this button in the end of the first row (by default 'unlink' button should be in the first row).
|
||||
$this->add_button_after($params, 1, 'moodlenolink');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
|
||||
@@ -34,10 +34,10 @@ class tinymce_pdw extends editor_tinymce_plugin {
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
|
||||
$rowsnumber = $this->count_rows($params);
|
||||
$rowsnumber = $this->count_button_rows($params);
|
||||
if ($rowsnumber > 1) {
|
||||
// Add button before 'undo' in advancedbuttons1.
|
||||
$this->add_button_before($params, 1, ' | ', '');
|
||||
$this->add_button_before($params, 1, '|', '');
|
||||
$this->add_button_before($params, 1, 'pdw_toggle', '');
|
||||
$params['pdw_toggle_on'] = 1;
|
||||
$params['pdw_toggle_toolbars'] = join(',', range(2, $rowsnumber));
|
||||
@@ -48,19 +48,11 @@ class tinymce_pdw extends editor_tinymce_plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts the number of rows in TinyMCE editor
|
||||
* Gets the order in which to run this plugin
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @return int the maximum existing row number
|
||||
* We need pdw plugin to be added the last, so nothing is added before the button.
|
||||
*/
|
||||
private function count_rows(array &$params) {
|
||||
for($i = 10; $i >= 1; $i--) {
|
||||
$field = 'theme_advanced_buttons' . $i;
|
||||
if (isset($params[$field])) {
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
// This should not happen.
|
||||
return 1;
|
||||
protected function get_sort_order() {
|
||||
return 100000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,10 @@ class tinymce_spellchecker extends editor_tinymce_plugin {
|
||||
// Prevent the built-in spell checker in Firefox, Safari and other sane browsers.
|
||||
unset($params['gecko_spellcheck']);
|
||||
|
||||
// Add button after code button in advancedbuttons3.
|
||||
$added = $this->add_button_after($params, 3, 'spellchecker', 'code', false);
|
||||
if ($row = $this->find_button($params, 'code')) {
|
||||
// Add button after 'code'.
|
||||
$this->add_button_after($params, $row, 'spellchecker', 'code');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
|
||||
Reference in New Issue
Block a user