includes/clientside/tinymce/themes/advanced/js/source_editor.js
changeset 1344 dc96d6c5cd1e
parent 1343 2a31905a567d
child 1345 1de01205143b
equal deleted inserted replaced
1343:2a31905a567d 1344:dc96d6c5cd1e
     1 tinyMCEPopup.requireLangPack();
       
     2 tinyMCEPopup.onInit.add(onLoadInit);
       
     3 
       
     4 function saveContent() {
       
     5 	tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
       
     6 	tinyMCEPopup.close();
       
     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 
       
    16 	document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
       
    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 
       
    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 var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
       
    48 
       
    49 function 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 }