svncommit
2006-09-23 6649b1f0a5db6160d197a13ca79cfd67fbb02d77
commit | author | age
a0109c 1 function saveContent() {
S 2     tinyMCE.setContent(document.getElementById('htmlSource').value);
3     tinyMCE.closeWindow(window);
4 }
5
6 // Fixes some charcode issues
7 function fixContent(html) {
8 /*    html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
9     html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
10     html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
11     html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
12     return html;
13 }
14
15 function onLoadInit() {
16     tinyMCEPopup.resizeToInnerSize();
17
18     document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
19     resizeInputs();
20
21     if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
22         setWrap('soft');
23         document.forms[0].wraped.checked = true;
24     }
25 }
26
27 function setWrap(val) {
28     var s = document.forms[0].htmlSource;
29
30     s.wrap = val;
31
32     if (tinyMCE.isGecko) {
33         var v = s.value;
34         var n = s.cloneNode(false);
35         n.setAttribute("wrap", val);
36         s.parentNode.replaceChild(n, s);
37         n.value = v;
38     }
39 }
40
41 function toggleWordWrap(elm) {
42     if (elm.checked)
43         setWrap('soft');
44     else
45         setWrap('off');
46 }
47
48 var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
49
50 function resizeInputs() {
51     if (!tinyMCE.isMSIE) {
52          wHeight = self.innerHeight-80;
53          wWidth = self.innerWidth-16;
54     } else {
55          wHeight = document.body.clientHeight - 80;
56          wWidth = document.body.clientWidth - 16;
57     }
58
59     document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
60     document.forms[0].htmlSource.style.width  = Math.abs(wWidth) + 'px';
61 }
62
63 function renderWordWrap() {
64     if (tinyMCE.isMSIE || tinyMCE.isGecko)
65         document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');
66 }