279328614c5ee8a0077295a0ff7814a24d723922
[acontent.git] / docs / include / jscripts / tiny_mce / themes / advanced / js / source_editor.js
1 tinyMCEPopup.requireLangPack();\r
2 tinyMCEPopup.onInit.add(onLoadInit);\r
3 \r
4 function saveContent() {\r
5         tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});\r
6         tinyMCEPopup.close();\r
7 }\r
8 \r
9 function onLoadInit() {\r
10         tinyMCEPopup.resizeToInnerSize();\r
11 \r
12         // Remove Gecko spellchecking\r
13         if (tinymce.isGecko)\r
14                 document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");\r
15 \r
16         document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});\r
17 \r
18         if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {\r
19                 setWrap('soft');\r
20                 document.getElementById('wraped').checked = true;\r
21         }\r
22 \r
23         resizeInputs();\r
24 }\r
25 \r
26 function setWrap(val) {\r
27         var v, n, s = document.getElementById('htmlSource');\r
28 \r
29         s.wrap = val;\r
30 \r
31         if (!tinymce.isIE) {\r
32                 v = s.value;\r
33                 n = s.cloneNode(false);\r
34                 n.setAttribute("wrap", val);\r
35                 s.parentNode.replaceChild(n, s);\r
36                 n.value = v;\r
37         }\r
38 }\r
39 \r
40 function toggleWordWrap(elm) {\r
41         if (elm.checked)\r
42                 setWrap('soft');\r
43         else\r
44                 setWrap('off');\r
45 }\r
46 \r
47 var wHeight=0, wWidth=0, owHeight=0, owWidth=0;\r
48 \r
49 function resizeInputs() {\r
50         var el = document.getElementById('htmlSource');\r
51 \r
52         if (!tinymce.isIE) {\r
53                  wHeight = self.innerHeight - 65;\r
54                  wWidth = self.innerWidth - 16;\r
55         } else {\r
56                  wHeight = document.body.clientHeight - 70;\r
57                  wWidth = document.body.clientWidth - 16;\r
58         }\r
59 \r
60         el.style.height = Math.abs(wHeight) + 'px';\r
61         el.style.width  = Math.abs(wWidth) + 'px';\r
62 }\r