PageRenderTime 70ms CodeModel.GetById 28ms app.highlight 5ms RepoModel.GetById 35ms app.codeStats 0ms

/static/scripts/tiny_mce/themes/advanced/js/source_editor.js

http://n23.googlecode.com/
JavaScript | 62 lines | 47 code | 14 blank | 1 comment | 6 complexity | 2fcdcb37221fc2123e08967deddce77f MD5 | raw file
 1tinyMCEPopup.requireLangPack();
 2tinyMCEPopup.onInit.add(onLoadInit);
 3
 4function saveContent() {
 5	tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value);
 6	tinyMCEPopup.close();
 7}
 8
 9function onLoadInit() {
10	tinyMCEPopup.resizeToInnerSize();
11
12	// Remove Gecko spellchecking
13	if (tinymce.isGecko)
14		document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
15
16	document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent();
17
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
26function 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
40function toggleWordWrap(elm) {
41	if (elm.checked)
42		setWrap('soft');
43	else
44		setWrap('off');
45}
46
47var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
48
49function resizeInputs() {
50	var el = document.getElementById('htmlSource');
51
52	if (!tinymce.isIE) {
53		 wHeight = self.innerHeight - 65;
54		 wWidth = self.innerWidth - 16;
55	} else {
56		 wHeight = document.body.clientHeight - 70;
57		 wWidth = document.body.clientWidth - 16;
58	}
59
60	el.style.height = Math.abs(wHeight) + 'px';
61	el.style.width  = Math.abs(wWidth) + 'px';
62}