Changeset 4ca10b8 in github


Ignore:
Timestamp:
Aug 15, 2008 5:47:31 PM (5 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
ded7139
Parents:
d4c01ca
Message:

Enable spellchecker for HTML editor

Files:
10 added
7 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r5d2b7fd r4ca10b8  
    77- Better fix for skipping untagged responses (#1485261) 
    88- Added pspell support patch by Kris Steinhoff (#1483960) 
     9- Enable spellchecker for HTML editor (#1485114) 
    910 
    10112008/08/09 (alec) 
  • bin/html2text.php

    r47124c22 r4ca10b8  
    77 
    88header('Content-Type: text/plain; charset=UTF-8'); 
    9 print html_entity_decode($converter->get_text(), ENT_COMPAT, 'UTF-8'); 
     9print html_entity_decode(trim($converter->get_text()), ENT_COMPAT, 'UTF-8'); 
    1010 
    1111?> 
  • program/js/app.js

    rac5d15d r4ca10b8  
    196196            this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); }; 
    197197            this.set_spellcheck_state('ready'); 
     198            if (rcube_find_object('_is_html').value == '1') 
     199              this.display_spellcheck_controls(false); 
    198200            } 
    199201          if (this.env.drafts_mailbox) 
     
    205207 
    206208        if (this.env.messagecount  
    207             && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox  
    208                 || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter))  
    209                 || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter)))) 
     209            && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox  
     210              || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter))  
     211              || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter)))) 
    210212          this.enable_command('purge', true); 
    211213 
     
    856858         
    857859      case 'spellcheck': 
    858         if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) 
    859           { 
     860        if (window.tinyMCE && tinyMCE.get('compose-body')) { 
     861          tinyMCE.execCommand('mceSpellCheck', true); 
     862        } 
     863        else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) { 
    860864          this.env.spellcheck.spellCheck(this.env.spellcheck.check_link); 
    861865          this.set_spellcheck_state('checking'); 
    862           } 
     866        } 
    863867        break; 
    864868 
     
    19001904 
    19011905    // check for empty body 
    1902     if ((!window.tinyMCE || !tinyMCE.get('compose-body')) 
    1903         && input_message.value == '' 
    1904         && !confirm(this.get_label('nobodywarning'))) 
     1906    if ((!window.tinyMCE || !tinyMCE.get('compose-body')) && input_message.value == '' && !confirm(this.get_label('nobodywarning'))) 
    19051907      { 
    19061908      input_message.focus(); 
    19071909      return false; 
    19081910      } 
    1909     else if (window.tinyMCE && tinyMCE.get('compose-body') 
    1910         && !tinyMCE.get('compose-body').getContent() 
    1911         && !confirm(this.get_label('nobodywarning'))) 
     1911    else if (window.tinyMCE && tinyMCE.get('compose-body') && !tinyMCE.get('compose-body').getContent() && !confirm(this.get_label('nobodywarning'))) 
    19121912      { 
    19131913      tinyMCE.get('compose-body').focus(); 
     
    19181918    }; 
    19191919 
     1920  this.display_spellcheck_controls = function(vis) 
     1921  { 
     1922    if (this.env.spellcheck) { 
     1923      this.env.spellcheck.check_link.style.visibility = vis ? 'visible' : 'hidden'; 
     1924      this.env.spellcheck.switch_lan_pic.style.visibility = vis ? 'visible' : 'hidden'; 
     1925    } 
     1926  }; 
    19201927 
    19211928  this.set_spellcheck_state = function(s) 
  • program/js/editor.js

    r94e38bb r4ca10b8  
    1616// Initialize the message editor 
    1717 
    18 function rcmail_editor_init(skin_path, editor_lang) 
    19   { 
    20   tinyMCE.init({ mode : "textareas", 
    21                  editor_selector : "mce_editor", 
    22                  accessibility_focus : false, 
    23                  apply_source_formatting : true, 
    24                  theme : "advanced", 
    25                  language : editor_lang, 
    26                  plugins : "emotions,media,nonbreaking,table,searchreplace,visualchars,directionality", 
    27                  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,undo,redo,image,media,ltr,rtl", 
    28                  theme_advanced_buttons2 : "", 
    29                  theme_advanced_buttons3 : "", 
    30                  theme_advanced_toolbar_location : "top", 
    31                  theme_advanced_toolbar_align : "left", 
    32                  extended_valid_elements : "font[face|size|color|style],span[id|class|align|style]", 
    33                  content_css : skin_path + "/editor_content.css", 
    34                  external_image_list_url : "program/js/editor_images.js", 
    35                  rc_client: rcube_webmail_client 
    36                }); 
    37   } 
     18function rcmail_editor_init(skin_path, editor_lang, spellcheck) 
     19{ 
     20  tinyMCE.init({  
     21    mode : "textareas", 
     22    editor_selector : "mce_editor", 
     23    accessibility_focus : false, 
     24    apply_source_formatting : true, 
     25    theme : "advanced", 
     26    language : editor_lang, 
     27    plugins : "emotions,media,nonbreaking,table,searchreplace,visualchars,directionality" + (spellcheck ? ",spellchecker" : ""), 
     28    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", 
     29    theme_advanced_buttons2 : "", 
     30    theme_advanced_buttons3 : "", 
     31    theme_advanced_toolbar_location : "top", 
     32    theme_advanced_toolbar_align : "left", 
     33    extended_valid_elements : "font[face|size|color|style],span[id|class|align|style]", 
     34    content_css : skin_path + "/editor_content.css", 
     35    external_image_list_url : "program/js/editor_images.js", 
     36    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"), 
     37    rc_client: rcube_webmail_client 
     38  }); 
     39} 
    3840 
    3941// Toggle between the HTML and Plain Text editors 
     
    6466    tinyMCE.execCommand('mceAddControl', true, 'compose-body'); 
    6567    htmlFlag.value = "1"; 
     68    rcmail.display_spellcheck_controls(false); 
    6669    } 
    6770  else 
     
    7376    tinyMCE.execCommand('mceRemoveControl', true, 'compose-body'); 
    7477    htmlFlag.value = "0"; 
     78    rcmail.display_spellcheck_controls(true); 
    7579    } 
    7680  } 
     
    8387  http_request.oncomplete = function(o) { rcmail_set_text_value(o); }; 
    8488  var url = rcmail.env.bin_path+'html2text.php'; 
    85   console.log('HTTP request: ' + url); 
     89  //console.log('HTTP request: ' + url); 
    8690  http_request.POST(url, htmlText, 'application/octet-stream'); 
    8791  } 
  • program/js/tiny_mce/plugins/spellchecker/editor_plugin.js

    rd9344fc r4ca10b8  
    1 (function(){var JSONRequest=tinymce.util.JSONRequest,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.SpellcheckerPlugin',{getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',version:tinymce.majorVersion+"."+tinymce.minorVersion};},init:function(ed,url){var t=this,cm;t.url=url;t.editor=ed;ed.addCommand('mceSpellCheck',function(){if(!t.active){ed.setProgressState(1);t._sendRPC('checkWords',[t.selectedLang,t._getWords()],function(r){if(r.length>0){t.active=1;t._markWords(r);ed.setProgressState(0);ed.nodeChanged();}else{ed.setProgressState(0);ed.windowManager.alert('spellchecker.no_mpell');}});}else t._done();});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+'/css/content.css');});ed.onClick.add(t._showMenu,t);ed.onContextMenu.add(t._showMenu,t);ed.onBeforeGetContent.add(function(){if(t.active)t._removeWords();});ed.onNodeChange.add(function(ed,cm){cm.setActive('spellchecker',t.active);});ed.onSetContent.add(function(){t._done();});ed.onBeforeGetContent.add(function(){t._done();});ed.onBeforeExecCommand.add(function(ed,cmd){if(cmd=='mceFullScreen')t._done();});t.languages={};each(ed.getParam('spellchecker_languages','+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv','hash'),function(v,k){if(k.indexOf('+')===0){k=k.substring(1);t.selectedLang=v;}t.languages[k]=v;});},createControl:function(n,cm){var t=this,c,ed=t.editor;if(n=='spellchecker'){c=cm.createSplitButton(n,{title:'spellchecker.desc',cmd:'mceSpellCheck',scope:t});c.onRenderMenu.add(function(c,m){m.add({title:'spellchecker.langs','class':'mceMenuItemTitle'}).setDisabled(1);each(t.languages,function(v,k){var o={icon:1},mi;o.onclick=function(){mi.setSelected(1);t.selectedItem.setSelected(0);t.selectedItem=mi;t.selectedLang=v;};o.title=k;mi=m.add(o);mi.setSelected(v==t.selectedLang);if(v==t.selectedLang)t.selectedItem=mi;})});return c;}},_walk:function(n,f){var d=this.editor.getDoc(),w;if(d.createTreeWalker){w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while((n=w.nextNode())!=null)f.call(this,n);}else tinymce.walk(n,f,'childNodes');},_getSeparators:function(){var re='',i,str=this.editor.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ\u201d\u201c');for(i=0;i<str.length;i++)re+='\\'+str.charAt(i);return re;},_getWords:function(){var ed=this.editor,wl=[],tx='',lo={};this._walk(ed.getBody(),function(n){if(n.nodeType==3)tx+=n.nodeValue+' ';});tx=tx.replace(new RegExp('([0-9]|['+this._getSeparators()+'])','g'),' ');tx=tinymce.trim(tx.replace(/(\s+)/g,' '));each(tx.split(' '),function(v){if(!lo[v]){wl.push(v);lo[v]=1;}});return wl;},_removeWords:function(w){var ed=this.editor,dom=ed.dom,se=ed.selection,b=se.getBookmark();each(dom.select('span').reverse(),function(n){if(n&&(dom.hasClass(n,'mceItemHiddenSpellWord')||dom.hasClass(n,'mceItemHidden'))){if(!w||dom.decode(n.innerHTML)==w)dom.remove(n,1);}});se.moveToBookmark(b);},_markWords:function(wl){var r1,r2,r3,r4,r5,w='',ed=this.editor,re=this._getSeparators(),dom=ed.dom,nl=[];var se=ed.selection,b=se.getBookmark();each(wl,function(v){w+=(w?'|':'')+v;});r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');this._walk(this.editor.getBody(),function(n){if(n.nodeType==3){nl.push(n);}});each(nl,function(n){var v;if(n.nodeType==3){v=n.nodeValue;if(r1.test(v)||r2.test(v)||r3.test(v)||r4.test(v)){v=dom.encode(v);v=v.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');v=v.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');dom.replace(dom.create('span',{'class':'mceItemHidden'},v),n);}}});se.moveToBookmark(b);},_showMenu:function(ed,e){var t=this,ed=t.editor,m=t._menu,p1,dom=ed.dom,vp=dom.getViewPort(ed.getWin());if(!m){p1=DOM.getPos(ed.getContentAreaContainer());m=ed.controlManager.createDropMenu('spellcheckermenu',{offset_x:p1.x,offset_y:p1.y,'class':'mceNoIcons'});t._menu=m;}if(dom.hasClass(e.target,'mceItemHiddenSpellWord')){m.removeAll();m.add({title:'spellchecker.wait','class':'mceMenuItemTitle'}).setDisabled(1);t._sendRPC('getSuggestions',[t.selectedLang,dom.decode(e.target.innerHTML)],function(r){m.removeAll();if(r.length>0){m.add({title:'spellchecker.sug','class':'mceMenuItemTitle'}).setDisabled(1);each(r,function(v){m.add({title:v,onclick:function(){dom.replace(ed.getDoc().createTextNode(v),e.target);t._checkDone();}});});m.addSeparator();}else m.add({title:'spellchecker.no_sug','class':'mceMenuItemTitle'}).setDisabled(1);m.add({title:'spellchecker.ignore_word',onclick:function(){dom.remove(e.target,1);t._checkDone();}});m.add({title:'spellchecker.ignore_words',onclick:function(){t._removeWords(dom.decode(e.target.innerHTML));t._checkDone();}});m.update();});ed.selection.select(e.target);p1=dom.getPos(e.target);m.showMenu(p1.x,p1.y+e.target.offsetHeight-vp.y);return tinymce.dom.Event.cancel(e);}else m.hideMenu();},_checkDone:function(){var t=this,ed=t.editor,dom=ed.dom,o;each(dom.select('span'),function(n){if(n&&dom.hasClass(n,'mceItemHiddenSpellWord')){o=true;return false;}});if(!o)t._done();},_done:function(){var t=this,la=t.active;if(t.active){t.active=0;t._removeWords();if(t._menu)t._menu.hideMenu();if(la)t.editor.nodeChanged();}},_sendRPC:function(m,p,cb){var t=this,url=t.editor.getParam("spellchecker_rpc_url","{backend}");if(url=='{backend}'){t.editor.setProgressState(0);alert('Please specify: spellchecker_rpc_url');return;}JSONRequest.sendRPC({url:url,method:m,params:p,success:cb,error:function(e,x){t.editor.setProgressState(0);t.editor.windowManager.alert(e.errstr||('Error response: '+x.responseText));}});}});tinymce.PluginManager.add('spellchecker',tinymce.plugins.SpellcheckerPlugin);})(); 
     1(function(){var JSONRequest=tinymce.util.JSONRequest,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.SpellcheckerPlugin',{getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',version:"2.0.2"};},init:function(ed,url){var t=this,cm;t.url=url;t.editor=ed;ed.addCommand('mceSpellCheck',function(){if(!t.active){ed.setProgressState(1);t._sendRPC('checkWords',[t.selectedLang,t._getWords()],function(r){if(r.length>0){t.active=1;t._markWords(r);ed.setProgressState(0);ed.nodeChanged();}else{ed.setProgressState(0);ed.windowManager.alert('spellchecker.no_mpell');}});}else t._done();});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+'/css/content.css');});ed.onClick.add(t._showMenu,t);ed.onContextMenu.add(t._showMenu,t);ed.onBeforeGetContent.add(function(){if(t.active)t._removeWords();});ed.onNodeChange.add(function(ed,cm){cm.setActive('spellchecker',t.active);});ed.onSetContent.add(function(){t._done();});ed.onBeforeGetContent.add(function(){t._done();});ed.onBeforeExecCommand.add(function(ed,cmd){if(cmd=='mceFullScreen')t._done();});t.languages={};each(ed.getParam('spellchecker_languages','+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv','hash'),function(v,k){if(k.indexOf('+')===0){k=k.substring(1);t.selectedLang=v;}t.languages[k]=v;});},createControl:function(n,cm){var t=this,c,ed=t.editor;if(n=='spellchecker'){c=cm.createSplitButton(n,{title:'spellchecker.desc',cmd:'mceSpellCheck',scope:t});c.onRenderMenu.add(function(c,m){m.add({title:'spellchecker.langs','class':'mceMenuItemTitle'}).setDisabled(1);each(t.languages,function(v,k){var o={icon:1},mi;o.onclick=function(){mi.setSelected(1);t.selectedItem.setSelected(0);t.selectedItem=mi;t.selectedLang=v;};o.title=k;mi=m.add(o);mi.setSelected(v==t.selectedLang);if(v==t.selectedLang)t.selectedItem=mi;})});return c;}},_walk:function(n,f){var d=this.editor.getDoc(),w;if(d.createTreeWalker){w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while((n=w.nextNode())!=null)f.call(this,n);}else tinymce.walk(n,f,'childNodes');},_getSeparators:function(){var re='',i,str=this.editor.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ\u201d\u201c');for(i=0;i<str.length;i++)re+='\\'+str.charAt(i);return re;},_getWords:function(){var ed=this.editor,wl=[],tx='',lo={};this._walk(ed.getBody(),function(n){if(n.nodeType==3)tx+=n.nodeValue+' ';});tx=tx.replace(new RegExp('([0-9]|['+this._getSeparators()+'])','g'),' ');tx=tinymce.trim(tx.replace(/(\s+)/g,' '));each(tx.split(' '),function(v){if(!lo[v]){wl.push(v);lo[v]=1;}});return wl;},_removeWords:function(w){var ed=this.editor,dom=ed.dom,se=ed.selection,b=se.getBookmark();each(dom.select('span').reverse(),function(n){if(n&&(dom.hasClass(n,'mceItemHiddenSpellWord')||dom.hasClass(n,'mceItemHidden'))){if(!w||dom.decode(n.innerHTML)==w)dom.remove(n,1);}});se.moveToBookmark(b);},_markWords:function(wl){var r1,r2,r3,r4,r5,w='',ed=this.editor,re=this._getSeparators(),dom=ed.dom,nl=[];var se=ed.selection,b=se.getBookmark();each(wl,function(v){w+=(w?'|':'')+v;});r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');this._walk(this.editor.getBody(),function(n){if(n.nodeType==3){nl.push(n);}});each(nl,function(n){var v;if(n.nodeType==3){v=n.nodeValue;if(r1.test(v)||r2.test(v)||r3.test(v)||r4.test(v)){v=dom.encode(v);v=v.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');v=v.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');dom.replace(dom.create('span',{'class':'mceItemHidden'},v),n);}}});se.moveToBookmark(b);},_showMenu:function(ed,e){var t=this,ed=t.editor,m=t._menu,p1,dom=ed.dom,vp=dom.getViewPort(ed.getWin());if(!m){p1=DOM.getPos(ed.getContentAreaContainer());m=ed.controlManager.createDropMenu('spellcheckermenu',{offset_x:p1.x,offset_y:p1.y,'class':'mceNoIcons'});t._menu=m;}if(dom.hasClass(e.target,'mceItemHiddenSpellWord')){m.removeAll();m.add({title:'spellchecker.wait','class':'mceMenuItemTitle'}).setDisabled(1);t._sendRPC('getSuggestions',[t.selectedLang,dom.decode(e.target.innerHTML)],function(r){m.removeAll();if(r.length>0){m.add({title:'spellchecker.sug','class':'mceMenuItemTitle'}).setDisabled(1);each(r,function(v){m.add({title:v,onclick:function(){dom.replace(ed.getDoc().createTextNode(v),e.target);t._checkDone();}});});m.addSeparator();}else m.add({title:'spellchecker.no_sug','class':'mceMenuItemTitle'}).setDisabled(1);m.add({title:'spellchecker.ignore_word',onclick:function(){dom.remove(e.target,1);t._checkDone();}});m.add({title:'spellchecker.ignore_words',onclick:function(){t._removeWords(dom.decode(e.target.innerHTML));t._checkDone();}});m.update();});ed.selection.select(e.target);p1=dom.getPos(e.target);m.showMenu(p1.x,p1.y+e.target.offsetHeight-vp.y);return tinymce.dom.Event.cancel(e);}else m.hideMenu();},_checkDone:function(){var t=this,ed=t.editor,dom=ed.dom,o;each(dom.select('span'),function(n){if(n&&dom.hasClass(n,'mceItemHiddenSpellWord')){o=true;return false;}});if(!o)t._done();},_done:function(){var t=this,la=t.active;if(t.active){t.active=0;t._removeWords();if(t._menu)t._menu.hideMenu();if(la)t.editor.nodeChanged();}},_sendRPC:function(m,p,cb){var t=this,url=t.editor.getParam("spellchecker_rpc_url",this.url+'/rpc.php');if(url=='{backend}'){t.editor.setProgressState(0);alert('Please specify: spellchecker_rpc_url');return;}JSONRequest.sendRPC({url:url,method:m,params:p,success:cb,error:function(e,x){t.editor.setProgressState(0);t.editor.windowManager.alert(e.errstr||('Error response: '+x.responseText));}});}});tinymce.PluginManager.add('spellchecker',tinymce.plugins.SpellcheckerPlugin);})(); 
  • program/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js

    rd9344fc r4ca10b8  
    1616                                authorurl : 'http://tinymce.moxiecode.com', 
    1717                                infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker', 
    18                                 version : tinymce.majorVersion + "." + tinymce.minorVersion 
     18                                version : "2.0.2" 
    1919                        }; 
    2020                }, 
     
    313313 
    314314                _sendRPC : function(m, p, cb) { 
    315                         var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}"); 
     315                        var t = this, url = t.editor.getParam("spellchecker_rpc_url", this.url+'/rpc.php'); 
    316316 
    317317                        if (url == '{backend}') { 
  • program/steps/mail/compose.inc

    rfaf8766 r4ca10b8  
    383383  $OUTPUT->include_script('tiny_mce/tiny_mce.js'); 
    384384  $OUTPUT->include_script("editor.js"); 
    385   $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.$tinylang.'");'); 
     385  $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.JQ($tinylang).'", '.intval($CONFIG['enable_spellcheck']).');'); 
    386386 
    387387  $out = $form_start ? "$form_start\n" : ''; 
     
    403403 
    404404  // include GoogieSpell 
    405   if (!empty($CONFIG['enable_spellcheck']) && !$isHtml) 
    406     { 
    407     $lang_set = ''; 
    408     if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) 
    409       $lang_set = "googie.setLanguages(".array2js($CONFIG['spellcheck_languages']).");\n"; 
     405  if (!empty($CONFIG['enable_spellcheck'])) { 
     406    $googie_lang_set = $editor_lang_set = ''; 
     407    if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) { 
     408      $googie_lang_set = "googie.setLanguages(".json_serialize($CONFIG['spellcheck_languages']).");\n"; 
     409      foreach ($CONFIG['spellcheck_languages'] as $key => $name) 
     410        $editor_lang_set .= ($editor_lang_set ? ',' : '') . ($key == $tinylang ? '+' : '') . JQ($name).'='.JQ($key); 
     411    } 
    410412     
    411413    $OUTPUT->include_script('googiespell.js'); 
     
    426428      JQ(Q(rcube_label('revertto'))), 
    427429      JQ(Q(rcube_label('nospellerrors'))), 
    428       $lang_set, 
     430      $googie_lang_set, 
    429431      substr($_SESSION['language'], 0, 2), 
    430432      $attrib['id'], 
     
    432434 
    433435    rcube_add_label('checking'); 
    434     } 
     436    $OUTPUT->set_env('spellcheck_langs', $editor_lang_set); 
     437  } 
    435438  
    436439  $out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>'; 
Note: See TracChangeset for help on using the changeset viewer.