2 +-----------------------------------------------------------------------+
3 | RoundCube editor js library |
5 | This file is part of the RoundCube web development suite |
6 | Copyright (C) 2006, RoundCube Dev, - Switzerland |
7 | Licensed under the GNU GPL |
9 +-----------------------------------------------------------------------+
10 | Author: Eric Stadtherr <estadtherr@gmail.com> |
11 +-----------------------------------------------------------------------+
13 $Id: editor.js 000 2006-05-18 19:12:28Z roundcube $
16 // Initialize HTML editor
17 function rcmail_editor_init(skin_path, editor_lang, spellcheck, mode)
19 if (mode == 'identity')
20 tinyMCE.init({ mode : 'textareas',
21 editor_selector : 'mce_editor',
22 apply_source_formatting : true,
24 language : editor_lang,
25 content_css : skin_path + '/editor_content.css',
26 theme_advanced_toolbar_location : 'top',
27 theme_advanced_toolbar_align : 'left',
28 theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr,link,unlink,code,forecolor',
29 theme_advanced_buttons2 : ',fontselect,fontsizeselect',
30 theme_advanced_buttons3 : '',
31 gecko_spellcheck : true
36 editor_selector : 'mce_editor',
37 accessibility_focus : false,
38 apply_source_formatting : true,
40 language : editor_lang,
41 plugins : 'emotions,media,nonbreaking,table,searchreplace,visualchars,directionality' + (spellcheck ? ',spellchecker' : ''),
42 theme_advanced_buttons1 : 'bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,link,unlink,emotions,charmap,code,forecolor,backcolor,fontselect,fontsizeselect, separator' + (spellcheck ? ',spellchecker' : '') + ',undo,redo,image,media,ltr,rtl',
43 theme_advanced_buttons2 : '',
44 theme_advanced_buttons3 : '',
45 theme_advanced_toolbar_location : 'top',
46 theme_advanced_toolbar_align : 'left',
47 extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]',
48 content_css : skin_path + '/editor_content.css',
49 external_image_list_url : 'program/js/editor_images.js',
50 spellchecker_languages : (rcmail.env.spellcheck_langs ? rcmail.env.spellcheck_langs : 'Dansk=da,Deutsch=de,+English=en,Espanol=es,Francais=fr,Italiano=it,Nederlands=nl,Polski=pl,Portugues=pt,Suomi=fi,Svenska=sv'),
51 gecko_spellcheck : true,
52 rc_client: rcube_webmail_client,
53 oninit : 'rcmail_editor_callback'
57 // react to real individual tinyMCE editor init
58 function rcmail_editor_callback(editor)
60 var input_from = rcube_find_object('_from');
61 if(input_from && input_from.type=='select-one')
62 rcmail.change_identity(input_from);
65 // switch html/plain mode
66 function rcmail_toggle_editor(ishtml, textAreaId, flagElement)
68 var composeElement = document.getElementById(textAreaId);
73 var existingPlainText = composeElement.value;
74 var htmlText = "<pre>" + existingPlainText + "</pre>";
76 rcmail.display_spellcheck_controls(false);
77 composeElement.value = htmlText;
78 tinyMCE.execCommand('mceAddControl', true, textAreaId);
79 if (flagElement && (flag = rcube_find_object(flagElement)))
84 if (!confirm(rcmail.get_label('editorwarning')))
87 var thisMCE = tinyMCE.get(textAreaId);
88 var existingHtml = thisMCE.getContent();
89 rcmail.html2plain(existingHtml, textAreaId);
90 tinyMCE.execCommand('mceRemoveControl', true, textAreaId);
91 rcmail.display_spellcheck_controls(true);
92 if (flagElement && (flag = rcube_find_object(flagElement)))