Changeset 4291 for sandbox/2.2.0.2/expressoMail1_2/js/rich_text_editor.js
- Timestamp:
- 05/09/11 17:55:51 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.2.0.2/expressoMail1_2/js/rich_text_editor.js
r4283 r4291 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'; 27 29 if(!Element(this.editor)) 28 30 { … … 31 33 else 32 34 { 33 Element("viewsource_rt_checkbox ").checked=false;35 Element("viewsource_rt_checkbox_" + this.id).checked=false; 34 36 } 35 37 … … 50 52 config_events( iframe, 'onload', function( ) 51 53 { 52 iframe.contentWindow.document.designMode = "on"; 54 if ( iframe.contentWindow.document.body && iframe.contentWindow.document.body.contentEditable ) 55 iframe.contentWindow.document.body.contentEditable = true; 56 53 57 if ( iframe.contentWindow.document.documentElement ){ 54 58 iframe.contentWindow.document.documentElement.style.background = '#fff'; … … 57 61 }); 58 62 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') + '.'); 63 65 64 parentDiv.appendChild(iframe); 66 parentDiv.appendChild(checkbox); 67 parentDiv.appendChild(text); 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; 79 68 80 } 69 81 … … 141 153 } 142 154 } 155 156 157 cRichTextEditor.prototype.plain = function(source) { 158 var html; 159 var editor = document.getElementById( this.editor ); 160 161 if (source) { 162 if (is_ie){ 163 connector.loadScript('html2xhtml'); 164 html = frames[this.editor].document.body; 165 var xhtml = get_xhtml(html, 'en', 'iso-8859-1'); 166 frames[this.editor].document.body.innerText = xhtml; 167 document.getElementById("table_richtext_toolbar").style.visibility="hidden"; 168 } 169 else{ 170 html = document.createTextNode( editor.contentWindow.document.body.innerHTML ); 171 this.table.style.visibility="hidden"; 172 editor.contentWindow.document.body.innerHTML = ''; 173 174 var textarea = document.createElement( 'textarea' ); 175 textarea.style.width = '99%'; 176 textarea.style.height = '300px'; 177 textarea.style.fontSize = '12pt'; 178 textarea.innerHTML = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ); 179 180 editor.style.width = '0px'; 181 editor.style.height = '0px'; 182 editor.style.visibility = 'hidden'; 183 184 editor.parentNode.insertBefore( textarea, editor ); 185 textarea.focus( ); 186 } 187 } else { 188 if (is_ie){ 189 var output = escape(frames[this.editor].document.body.innerText); 190 output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E"); 191 output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E"); 192 frames[this.editor].document.body.innerHTML = unescape(output); 193 document.getElementById("table_richtext_toolbar").style.visibility="visible"; 194 } 195 else{ 196 editor.contentWindow.document.body.innerHTML = editor.previousSibling.value.replace( /\n/g, '<br/>' ); 197 editor.parentNode.removeChild( editor.previousSibling ); 198 199 editor.style.width = '99%'; 200 editor.style.height = '300px'; 201 editor.style.visibility = 'visible'; 202 this.loadEditor( this.id ); 203 } 204 } 205 } 206 207 208 143 209 144 210 cRichTextEditor.prototype.buildEditor = function() {
Note: See TracChangeset
for help on using the changeset viewer.