thomascube
2011-04-20 a9251be2f09fb5f18a85d201c67668c70980efe3
commit | author | age
d9344f 1 tinyMCEPopup.requireLangPack();
S 2 tinyMCEPopup.onInit.add(onLoadInit);
3
4 function saveContent() {
29da64 5     tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
d9344f 6     tinyMCEPopup.close();
S 7 }
8
9 function onLoadInit() {
10     tinyMCEPopup.resizeToInnerSize();
11
12     // Remove Gecko spellchecking
13     if (tinymce.isGecko)
14         document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
15
29da64 16     document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
d9344f 17
S 18     if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
19         setWrap('soft');
20         document.getElementById('wraped').checked = true;
21     }
22
23     resizeInputs();
24 }
25
26 function setWrap(val) {
27     var v, n, s = document.getElementById('htmlSource');
28
29     s.wrap = val;
30
31     if (!tinymce.isIE) {
32         v = s.value;
33         n = s.cloneNode(false);
34         n.setAttribute("wrap", val);
35         s.parentNode.replaceChild(n, s);
36         n.value = v;
37     }
38 }
39
40 function toggleWordWrap(elm) {
41     if (elm.checked)
42         setWrap('soft');
43     else
44         setWrap('off');
45 }
46
47 function resizeInputs() {
a9251b 48     var vp = tinyMCEPopup.dom.getViewPort(window), el;
d9344f 49
a9251b 50     el = document.getElementById('htmlSource');
T 51
52     if (el) {
53         el.style.width = (vp.w - 20) + 'px';
54         el.style.height = (vp.h - 65) + 'px';
d9344f 55     }
S 56 }