Changeset 4283 for sandbox/2.2.0.2/expressoMail1_2/js/rich_text_editor.js
- Timestamp:
- 05/09/11 14:42:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.2.0.2/expressoMail1_2/js/rich_text_editor.js
r4281 r4283 25 25 parentDiv.appendChild(this.table); 26 26 27 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id );28 this.table.style.visibility = ( mail_as_plain && mail_as_plain.checked ) ? 'hidden' : 'visible';29 30 27 if(!Element(this.editor)) 31 28 { … … 34 31 else 35 32 { 36 Element( 'viewsource_rt_checkbox_' + this.id).checked=false;33 Element("viewsource_rt_checkbox").checked=false; 37 34 } 38 35 … … 53 50 config_events( iframe, 'onload', function( ) 54 51 { 55 if ( iframe.contentWindow.document.body && iframe.contentWindow.document.body.contentEditable ) 56 iframe.contentWindow.document.body.contentEditable = true; 57 52 iframe.contentWindow.document.designMode = "on"; 58 53 if ( iframe.contentWindow.document.documentElement ){ 59 54 iframe.contentWindow.document.documentElement.style.background = '#fff'; … … 62 57 }); 63 58 59 var checkbox = document.createElement("INPUT"); 60 checkbox.id = 'viewsource_rt_checkbox'; 61 checkbox.type = "checkbox"; 62 checkbox.setAttribute("tabIndex","-1"); 63 checkbox.onclick = function () {RichTextEditor.viewsource(this.checked)}; 64 var text = document.createTextNode(get_lang('View HTML source') + '.'); 64 65 parentDiv.appendChild(iframe); 65 66 var source = document.createElement( 'input' ); 67 source.id = 'viewsource_rt_checkbox_' + this.id; 68 source.type = "checkbox"; 69 source.setAttribute("tabIndex","-1"); 70 source.onclick = function( ) 71 { 72 RichTextEditor.viewsource(this.checked); 73 }; 74 source = parentDiv.appendChild( 75 document.createElement( 'span' ).appendChild( source ).parentNode 76 ).appendChild( 77 document.createTextNode( get_lang( 'View HTML source' ) + '.' ) 78 ).parentNode; 66 parentDiv.appendChild(checkbox); 67 parentDiv.appendChild(text); 79 68 } 80 69 … … 149 138 document.getElementById(this.editor).contentWindow.document.body.innerHTML = html.toString(); 150 139 document.getElementById("table_richtext_toolbar").style.visibility="visible"; 151 }152 }153 }154 155 cRichTextEditor.prototype.plain = function(source) {156 var html;157 var editor = document.getElementById( this.editor );158 159 if (source) {160 if (is_ie){161 connector.loadScript('html2xhtml');162 html = frames[this.editor].document.body;163 var xhtml = get_xhtml(html, 'en', 'iso-8859-1');164 frames[this.editor].document.body.innerText = xhtml;165 document.getElementById("table_richtext_toolbar").style.visibility="hidden";166 }167 else{168 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id );169 170 html = document.createTextNode( editor.contentWindow.document.body.innerHTML );171 html = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ).replace( /^[\n ]+|[\n ]+$/g, '' );172 173 if ( ! mobile_device && html != '' && ! ( mail_as_plain.checked = confirm( 'The text format will be lost.' ) ) )174 return false;175 176 this.table.style.visibility="hidden";177 editor.contentWindow.document.body.innerHTML = '';178 179 var textarea = document.createElement( 'textarea' );180 textarea.style.width = '99%';181 textarea.style.height = '300px';182 textarea.style.fontSize = '12pt';183 textarea.innerHTML = html;184 185 editor.style.width = '0px';186 editor.style.height = '0px';187 editor.style.visibility = 'hidden';188 189 editor.parentNode.insertBefore( textarea, editor );190 textarea.focus( );191 }192 } else {193 if (is_ie){194 var output = escape(frames[this.editor].document.body.innerText);195 output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E");196 output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E");197 frames[this.editor].document.body.innerHTML = unescape(output);198 document.getElementById("table_richtext_toolbar").style.visibility="visible";199 }200 else{201 editor.contentWindow.document.body.innerHTML = editor.previousSibling.value.replace( /\n/g, '<br/>' );202 editor.parentNode.removeChild( editor.previousSibling );203 204 editor.style.width = '99%';205 editor.style.height = '300px';206 editor.style.visibility = 'visible';207 208 this.loadEditor( this.id );209 140 } 210 141 } … … 566 497 form_upload.style.height = "75px"; 567 498 form_upload.innerHTML = get_lang('Select the desired image file')+':<br>'+ 568 '<input name="image_at" maxlength="255" size=" 50" id="inputFile_img" type="file"><br>' +499 '<input name="image_at" maxlength="255" size="40" id="inputFile_img" type="file"><br>' + 569 500 '<input title="' + get_lang('Include') + '" value="' + get_lang('Include') + '"' + 'type="button" onclick="RichTextEditor.addInputFile();"> ' + 570 501 '<input title="' + get_lang('Close') + '" value="' + get_lang('Close') + '"' +
Note: See TracChangeset
for help on using the changeset viewer.