Mercurial > public > sg101
annotate static/js/tiny_mce/themes/advanced/js/source_editor.js @ 1167:41f530c80517
V3 forums: forgot to commit new post form template.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 27 Aug 2017 17:05:08 -0500 |
parents | 6c182ceb7147 |
children |
rev | line source |
---|---|
bgneal@312 | 1 tinyMCEPopup.requireLangPack(); |
bgneal@312 | 2 tinyMCEPopup.onInit.add(onLoadInit); |
bgneal@312 | 3 |
bgneal@312 | 4 function saveContent() { |
bgneal@312 | 5 tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true}); |
bgneal@312 | 6 tinyMCEPopup.close(); |
bgneal@312 | 7 } |
bgneal@312 | 8 |
bgneal@312 | 9 function onLoadInit() { |
bgneal@312 | 10 tinyMCEPopup.resizeToInnerSize(); |
bgneal@312 | 11 |
bgneal@312 | 12 // Remove Gecko spellchecking |
bgneal@312 | 13 if (tinymce.isGecko) |
bgneal@312 | 14 document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck"); |
bgneal@312 | 15 |
bgneal@312 | 16 document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true}); |
bgneal@312 | 17 |
bgneal@312 | 18 if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) { |
bgneal@312 | 19 setWrap('soft'); |
bgneal@312 | 20 document.getElementById('wraped').checked = true; |
bgneal@312 | 21 } |
bgneal@312 | 22 |
bgneal@312 | 23 resizeInputs(); |
bgneal@312 | 24 } |
bgneal@312 | 25 |
bgneal@312 | 26 function setWrap(val) { |
bgneal@312 | 27 var v, n, s = document.getElementById('htmlSource'); |
bgneal@312 | 28 |
bgneal@312 | 29 s.wrap = val; |
bgneal@312 | 30 |
bgneal@312 | 31 if (!tinymce.isIE) { |
bgneal@312 | 32 v = s.value; |
bgneal@312 | 33 n = s.cloneNode(false); |
bgneal@312 | 34 n.setAttribute("wrap", val); |
bgneal@312 | 35 s.parentNode.replaceChild(n, s); |
bgneal@312 | 36 n.value = v; |
bgneal@312 | 37 } |
bgneal@312 | 38 } |
bgneal@312 | 39 |
bgneal@312 | 40 function toggleWordWrap(elm) { |
bgneal@312 | 41 if (elm.checked) |
bgneal@312 | 42 setWrap('soft'); |
bgneal@312 | 43 else |
bgneal@312 | 44 setWrap('off'); |
bgneal@312 | 45 } |
bgneal@312 | 46 |
bgneal@442 | 47 function resizeInputs() { |
bgneal@442 | 48 var vp = tinyMCEPopup.dom.getViewPort(window), el; |
bgneal@312 | 49 |
bgneal@442 | 50 el = document.getElementById('htmlSource'); |
bgneal@312 | 51 |
bgneal@442 | 52 if (el) { |
bgneal@442 | 53 el.style.width = (vp.w - 20) + 'px'; |
bgneal@442 | 54 el.style.height = (vp.h - 65) + 'px'; |
bgneal@312 | 55 } |
bgneal@312 | 56 } |