]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/themes/advanced/js/source_editor.js
Wordpress 3.5
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / themes / advanced / js / source_editor.js
index 9cf6b1a29cdafc3e47cb26b2daaed66a38cc231b..d4179371a025c6cc8703b0e109f3900ad4ac2435 100644 (file)
@@ -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,11 +37,33 @@ function setWrap(val) {
        }
 }
 
-function toggleWordWrap(elm) {
-       if (elm.checked)
-               setWrap('soft');
-       else
+function setWhiteSpaceCss(value) {
+       var el = document.getElementById('htmlSource');
+       tinymce.DOM.setStyle(el, 'white-space', value);
+}
+
+function turnWrapOff() {
+       if (tinymce.isWebKit) {
+               setWhiteSpaceCss('pre');
+       } else {
                setWrap('off');
+       }
+}
+
+function turnWrapOn() {
+       if (tinymce.isWebKit) {
+               setWhiteSpaceCss('pre-wrap');
+       } else {
+               setWrap('soft');
+       }
+}
+
+function toggleWordWrap(elm) {
+       if (elm.checked) {
+               turnWrapOn();
+       } else {
+               turnWrapOff();
+       }
 }
 
 function resizeInputs() {