includes/clientside/tinymce/themes/advanced/jscripts/source_editor.js
changeset 335 67bd3121a12e
parent 334 c72b545f1304
child 336 bfa2e9c23f03
equal deleted inserted replaced
334:c72b545f1304 335:67bd3121a12e
     1 function saveContent() {
       
     2 	tinyMCE.setContent(document.getElementById('htmlSource').value);
       
     3 	tinyMCE.closeWindow(window);
       
     4 }
       
     5 
       
     6 function onLoadInit() {
       
     7 	tinyMCEPopup.resizeToInnerSize();
       
     8 
       
     9 	// Remove Gecko spellchecking
       
    10 	if (tinyMCE.isGecko)
       
    11 		document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
       
    12 
       
    13 	document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'));
       
    14 
       
    15 	resizeInputs();
       
    16 
       
    17 	if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
       
    18 		setWrap('soft');
       
    19 		document.getElementById('wraped').checked = true;
       
    20 	}
       
    21 }
       
    22 
       
    23 function setWrap(val) {
       
    24 	var s = document.getElementById('htmlSource');
       
    25 
       
    26 	s.wrap = val;
       
    27 
       
    28 	if (tinyMCE.isGecko || tinyMCE.isOpera) {
       
    29 		var v = s.value;
       
    30 		var n = s.cloneNode(false);
       
    31 		n.setAttribute("wrap", val);
       
    32 		s.parentNode.replaceChild(n, s);
       
    33 		n.value = v;
       
    34 	}
       
    35 }
       
    36 
       
    37 function toggleWordWrap(elm) {
       
    38 	if (elm.checked)
       
    39 		setWrap('soft');
       
    40 	else
       
    41 		setWrap('off');
       
    42 }
       
    43 
       
    44 var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
       
    45 
       
    46 function resizeInputs() {
       
    47 	var el = document.getElementById('htmlSource');
       
    48 
       
    49 	if (!tinyMCE.isMSIE) {
       
    50 		 wHeight = self.innerHeight - 60;
       
    51 		 wWidth = self.innerWidth - 16;
       
    52 	} else {
       
    53 		 wHeight = document.body.clientHeight - 60;
       
    54 		 wWidth = document.body.clientWidth - 16;
       
    55 	}
       
    56 
       
    57 	el.style.height = Math.abs(wHeight) + 'px';
       
    58 	el.style.width  = Math.abs(wWidth) + 'px';
       
    59 }