X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/cd3609994b39a094ff7528b93f55631bb213fd7f..5964d2279dc52bdfe105f9bfa17e04337d47a3fa:/wp-includes/js/tinymce/themes/advanced/js/source_editor.js diff --git a/wp-includes/js/tinymce/themes/advanced/js/source_editor.js b/wp-includes/js/tinymce/themes/advanced/js/source_editor.js index 9cf6b1a2..d4179371 100644 --- a/wp-includes/js/tinymce/themes/advanced/js/source_editor.js +++ b/wp-includes/js/tinymce/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,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() {