diff options
Diffstat (limited to 'library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js')
-rw-r--r--[-rwxr-xr-x] | library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js b/library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js index 279328614..dd5e366fa 100755..100644 --- a/library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js +++ b/library/tinymce/jscripts/tiny_mce/themes/advanced/js/source_editor.js @@ -16,7 +16,7 @@ function onLoadInit() { document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
- setWrap('soft');
+ turnWrapOn();
document.getElementById('wraped').checked = true;
}
@@ -37,26 +37,42 @@ function setWrap(val) { }
}
-function toggleWordWrap(elm) {
- if (elm.checked)
- setWrap('soft');
- else
- setWrap('off');
+function setWhiteSpaceCss(value) {
+ var el = document.getElementById('htmlSource');
+ tinymce.DOM.setStyle(el, 'white-space', value);
}
-var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+function turnWrapOff() {
+ if (tinymce.isWebKit) {
+ setWhiteSpaceCss('pre');
+ } else {
+ setWrap('off');
+ }
+}
-function resizeInputs() {
- var el = document.getElementById('htmlSource');
+function turnWrapOn() {
+ if (tinymce.isWebKit) {
+ setWhiteSpaceCss('pre-wrap');
+ } else {
+ setWrap('soft');
+ }
+}
- if (!tinymce.isIE) {
- wHeight = self.innerHeight - 65;
- wWidth = self.innerWidth - 16;
+function toggleWordWrap(elm) {
+ if (elm.checked) {
+ turnWrapOn();
} else {
- wHeight = document.body.clientHeight - 70;
- wWidth = document.body.clientWidth - 16;
+ turnWrapOff();
}
+}
+
+function resizeInputs() {
+ var vp = tinyMCEPopup.dom.getViewPort(window), el;
- el.style.height = Math.abs(wHeight) + 'px';
- el.style.width = Math.abs(wWidth) + 'px';
+ el = document.getElementById('htmlSource');
+
+ if (el) {
+ el.style.width = (vp.w - 20) + 'px';
+ el.style.height = (vp.h - 65) + 'px';
+ }
}
|