mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-42684 TinyMCE: Correct widths on screens with narrow fieldsets
This commit is contained in:
parent
b8a598ad65
commit
0b11609944
@ -156,31 +156,37 @@
|
||||
_resizeIframe : function(ed, tb_id, dy) {
|
||||
var ifr = ed.getContentAreaContainer().firstChild;
|
||||
var ultcon = ed.getContainer().parentNode; //Ultimate parent container
|
||||
var parcon = ed.getContainer(); //Parent container
|
||||
var tablecon = ed.getContainer().childNodes[1]; // Table container
|
||||
var textarea = DOM.get(ed.id);
|
||||
var rows = textarea ? textarea.getAttribute('rows') : 3;
|
||||
|
||||
// This set of changes addresses MDL-42481.
|
||||
// Moodle collapses form sections by setting display to none on the fcontainer element.
|
||||
// In order to calculate the offsetWidth, the iframe must be visible within the DOM, otherwise it's offsetWidth is
|
||||
// calculate as 0px.
|
||||
// We attempt to find any collapsed element, uncollapse them, then calculate the width and height, and finally
|
||||
// collapse them again.
|
||||
var collapsedContainer = DOM.getParent(ifr, 'fieldset.collapsed');
|
||||
if (collapsedContainer) {
|
||||
DOM.removeClass(collapsedContainer, 'collapsed');
|
||||
}
|
||||
// For very small text areas - allow the editable region to be smaller than the size of the toolbars.
|
||||
if (rows >= 3) {
|
||||
// This set of changes addresses MDL-42481.
|
||||
// Moodle collapses form sections by setting display to none on the fcontainer element.
|
||||
// In order to calculate the offsetWidth, the iframe must be visible within the DOM, otherwise it's offsetWidth is
|
||||
// calculate as 0px.
|
||||
// We attempt to find any collapsed element, uncollapse them, then calculate the width and height, and finally
|
||||
// collapse them again.
|
||||
var collapsedContainer = DOM.getParent(ifr, 'fieldset.collapsed');
|
||||
if (collapsedContainer) {
|
||||
DOM.removeClass(collapsedContainer, 'collapsed');
|
||||
}
|
||||
|
||||
DOM.setStyle(ifr, 'height',DOM.getSize(ifr).h + dy); // Resize iframe
|
||||
DOM.setStyle(textarea, 'width',DOM.getSize(ultcon).w);
|
||||
DOM.setStyle(ifr, 'width',DOM.getSize(ultcon).w); // Resize iframe
|
||||
ed.theme.deltaHeight += dy; // For resize cookie
|
||||
}
|
||||
|
||||
if (collapsedContainer) {
|
||||
// We have a collapsedContainer, so collapse it again.
|
||||
DOM.addClass(collapsedContainer, 'collapsed');
|
||||
}
|
||||
// Set all the containers to the same width
|
||||
DOM.setStyle(textarea, 'width',DOM.getSize(ultcon).w);
|
||||
DOM.setStyle(parcon, 'width',DOM.getSize(ultcon).w);
|
||||
DOM.setStyle(tablecon, 'width',DOM.getSize(ultcon).w);
|
||||
DOM.setStyle(ifr, 'width',DOM.getSize(ultcon).w);
|
||||
|
||||
|
||||
if (collapsedContainer) {
|
||||
// We have a collapsedContainer, so collapse it again.
|
||||
DOM.addClass(collapsedContainer, 'collapsed');
|
||||
}
|
||||
|
||||
},
|
||||
@ -205,3 +211,4 @@
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('pdw', tinymce.plugins.pdw);
|
||||
})();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user