Skip to content

Commit

Permalink
Merge branch 'MDL-40668-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Aug 13, 2013
2 parents 4dca09b + 0c0dfa8 commit 387d040
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 530 deletions.
2 changes: 1 addition & 1 deletion course/moodleform_mod.php
Expand Up @@ -821,7 +821,7 @@ function add_intro_editor($required=false, $customlabel=null) {
$label = is_null($customlabel) ? get_string('moduleintro') : $customlabel;

$mform->addElement('editor', 'introeditor', $label, array('rows' => 10), array('maxfiles' => EDITOR_UNLIMITED_FILES,
'noclean' => true, 'context' => $this->context, 'collapsed' => true));
'noclean' => true, 'context' => $this->context));
$mform->setType('introeditor', PARAM_RAW); // no XSS prevention here, users must be trusted
if ($required) {
$mform->addRule('introeditor', get_string('required'), 'required', null, 'client');
Expand Down
2 changes: 0 additions & 2 deletions lang/en/form.php
Expand Up @@ -41,7 +41,6 @@
$string['err_required'] = 'You must supply a value here.';
$string['general'] = 'General';
$string['hideadvanced'] = 'Hide advanced';
$string['hideeditortoolbar'] = 'Hide editing tools';
$string['hour'] = 'Hour';
$string['minute'] = 'Minute';
$string['miscellaneoussettings'] = 'Miscellaneous settings';
Expand All @@ -60,7 +59,6 @@
$string['showadvanced'] = 'Show advanced';
$string['showless'] = 'Show less...';
$string['showmore'] = 'Show more...';
$string['showeditortoolbar'] = 'Show editing tools';
$string['somefieldsrequired'] = 'There are required fields in this form marked {$a}.';
$string['time'] = 'Time';
$string['timeunit'] = 'Time unit';
Expand Down
19 changes: 0 additions & 19 deletions lib/editor/tinymce/lib.php
Expand Up @@ -109,7 +109,6 @@ public function use_editor($elementid, array $options=null, $fpoptions=null) {
if ($fpoptions) {
$PAGE->requires->js_init_call('M.editor_tinymce.init_filepicker', array($elementid, $fpoptions), true);
}
$this->initialise_collapse_js();
}

protected function get_init_params($elementid, array $options=null) {
Expand Down Expand Up @@ -276,22 +275,4 @@ public function get_tinymce_base_url() {
return new moodle_url("$CFG->httpswwwroot/lib/editor/tinymce/tiny_mce/$this->version/");
}

/**
* Initialise javascript form elements
* @return void
*/
public function initialise_collapse_js() {
global $PAGE;
// This method is called for every editor instance. Ensure it's only run once.
// Static is a clunky solution but the best we could find to keep everything simple and encapsulated.
static $isinitialised;
if ($isinitialised) {
return;
}

// Initialise language strings.
$PAGE->requires->strings_for_js(array('hideeditortoolbar', 'showeditortoolbar'), 'form');
$PAGE->requires->yui_module('moodle-editor_tinymce-collapse', 'M.editor_collapse.init');
$isinitialised = true;
}
}
4 changes: 2 additions & 2 deletions lib/editor/tinymce/plugins/pdw/readme_moodle.txt
Expand Up @@ -12,6 +12,6 @@ Upgrade procedure:
2/ bump up version.php
3/ update lib/thirdpartylibs.xml
4/ reimplement patch in MDL-23646
5/ add in "DOM.setStyle(ifr, 'width',DOM.getSize(ifrcon).w); // Resize iframe" (without quotes)
5/ reimplement patch in MDL-40668
6/ add in "DOM.setStyle(ifr, 'width',DOM.getSize(ifrcon).w); // Resize iframe" (without quotes)
after "DOM.setStyle(ifr, 'height',DOM.getSize(ifr).h + dy); // Resize iframe"
5/ reminify the js manually (I used uglifyjs)
13 changes: 9 additions & 4 deletions lib/editor/tinymce/plugins/pdw/tinymce/editor_plugin.js
Expand Up @@ -156,10 +156,15 @@
_resizeIframe : function(ed, tb_id, dy) {
var ifr = ed.getContentAreaContainer().firstChild;
var ifrcon = ed.getContentAreaContainer();

DOM.setStyle(ifr, 'height',DOM.getSize(ifr).h + dy); // Resize iframe
DOM.setStyle(ifr, 'width',DOM.getSize(ifrcon).w); // Resize iframe
ed.theme.deltaHeight += dy; // For resize cookie
var textarea = DOM.get(ed.id);
var rows = textarea ? textarea.getAttribute('rows') : 3;

// For very small text areas - allow the editable region to be smaller than the size of the toolbars.
if (rows >= 3) {
DOM.setStyle(ifr, 'height',DOM.getSize(ifr).h + dy); // Resize iframe
DOM.setStyle(ifr, 'width',DOM.getSize(ifrcon).w); // Resize iframe
ed.theme.deltaHeight += dy; // For resize cookie
}
},

/**
Expand Down
16 changes: 0 additions & 16 deletions lib/editor/tinymce/styles.css
@@ -1,19 +1,3 @@
.mform .felement.feditor .toggle_editor_toolbar {
background: #EEEEEE;
border-color: #BBBBBB;
border-radius: 4px 4px 0 0;
border-style: solid solid none;
border-width: 1px 1px 0;
display: inline-block;
font-size: 0.7em;
padding: 3px 6px;
}
.mform .felement.feditor .toggle_editor_toolbar:hover {
text-decoration: underline;
color: red;
cursor: pointer;
}

@media (max-width: 480px) {
.mceToolbar td {
float: left;
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 387d040

Please sign in to comment.