summaryrefslogtreecommitdiff
path: root/site_media/js/tiny_mce/plugins/spellchecker
diff options
context:
space:
mode:
Diffstat (limited to 'site_media/js/tiny_mce/plugins/spellchecker')
-rw-r--r--site_media/js/tiny_mce/plugins/spellchecker/css/content.css1
-rw-r--r--site_media/js/tiny_mce/plugins/spellchecker/editor_plugin.js1
-rw-r--r--site_media/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js417
-rw-r--r--site_media/js/tiny_mce/plugins/spellchecker/img/wline.gifbin46 -> 0 bytes
4 files changed, 0 insertions, 419 deletions
diff --git a/site_media/js/tiny_mce/plugins/spellchecker/css/content.css b/site_media/js/tiny_mce/plugins/spellchecker/css/content.css
deleted file mode 100644
index 24efa02..0000000
--- a/site_media/js/tiny_mce/plugins/spellchecker/css/content.css
+++ /dev/null
@@ -1 +0,0 @@
-.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
diff --git a/site_media/js/tiny_mce/plugins/spellchecker/editor_plugin.js b/site_media/js/tiny_mce/plugins/spellchecker/editor_plugin.js
deleted file mode 100644
index a9ec3b9..0000000
--- a/site_media/js/tiny_mce/plugins/spellchecker/editor_plugin.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=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(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url","{backend}");if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});e.onInit.add(function(){if(e.settings.content_css!==false){e.dom.loadCSS(f+"/css/content.css")}});e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.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(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={},h=[];this._walk(e.getBody(),function(i){if(i.nodeType==3){d+=i.nodeValue+" "}});if(e.getParam("spellchecker_word_pattern")){h=d.match("("+e.getParam("spellchecker_word_pattern")+")","gi")}else{d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));h=d.split(" ")}c(h,function(i){if(!f[i]){g.push(i);f[i]=1}});return g},_removeWords:function(e){var f=this.editor,h=f.dom,g=f.selection,d=g.getBookmark();c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!e||h.decode(i.innerHTML)==e){h.remove(i,1)}}});g.moveToBookmark(d)},_markWords:function(o){var i,h,g,f,e,n="",k=this.editor,p=this._getSeparators(),j=k.dom,d=[];var l=k.selection,m=l.getBookmark();c(o,function(q){n+=(n?"|":"")+q});i=new RegExp("(["+p+"])("+n+")(["+p+"])","g");h=new RegExp("^("+n+")","g");g=new RegExp("("+n+")(["+p+"]?)$","g");f=new RegExp("^("+n+")(["+p+"]?)$","g");e=new RegExp("("+n+")(["+p+"])","g");this._walk(this.editor.getBody(),function(q){if(q.nodeType==3){d.push(q)}});c(d,function(r){var q;if(r.nodeType==3){q=r.nodeValue;if(i.test(q)||h.test(q)||g.test(q)||f.test(q)){q=j.encode(q);q=q.replace(e,'<span class="mceItemHiddenSpellWord">$1</span>$2');q=q.replace(g,'<span class="mceItemHiddenSpellWord">$1</span>$2');j.replace(j.create("span",{"class":"mceItemHidden"},q),r)}}});l.moveToBookmark(m)},_showMenu:function(h,j){var i=this,h=i.editor,d=i._menu,l,k=h.dom,g=k.getViewPort(h.getWin()),f=j.target;j=0;if(!d){l=b.getPos(h.getContentAreaContainer());d=h.controlManager.createDropMenu("spellcheckermenu",{offset_x:l.x,offset_y:l.y,"class":"mceNoIcons"});i._menu=d}if(k.hasClass(f,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);i._sendRPC("getSuggestions",[i.selectedLang,k.decode(f.innerHTML)],function(m){var e;d.removeAll();if(m.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(m,function(n){d.add({title:n,onclick:function(){k.replace(h.getDoc().createTextNode(n),f);i._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}e=i.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var n=f.innerHTML;i._removeWords(k.decode(n));i._checkDone();if(e){h.setProgressState(1);i._sendRPC("ignoreWords",[i.selectedLang,n],function(o){h.setProgressState(0)})}}});if(i.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var n=f.innerHTML;k.remove(f,1);i._checkDone();h.setProgressState(1);i._sendRPC("learnWord",[i.selectedLang,n],function(o){h.setProgressState(0)})}})}d.update()});h.selection.select(f);l=k.getPos(f);d.showMenu(l.x,l.y+f.offsetHeight-g.y);return tinymce.dom.Event.cancel(j)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})(); \ No newline at end of file
diff --git a/site_media/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js b/site_media/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js
deleted file mode 100644
index d8680ba..0000000
--- a/site_media/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js
+++ /dev/null
@@ -1,417 +0,0 @@
-/**
- * editor_plugin_src.js
- *
- * Copyright 2009, Moxiecode Systems AB
- * Released under LGPL License.
- *
- * License: http://tinymce.moxiecode.com/license
- * Contributing: http://tinymce.moxiecode.com/contributing
- */
-
-(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;
- t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}");
-
- if (t.rpcUrl == '{backend}') {
- // Sniff if the browser supports native spellchecking (Don't know of a better way)
- if (tinymce.isIE)
- return;
-
- t.hasSupport = true;
-
- // Disable the context menu when spellchecking is active
- ed.onContextMenu.addToTop(function(ed, e) {
- if (t.active)
- return false;
- });
- }
-
- // Register commands
- ed.addCommand('mceSpellCheck', function() {
- if (t.rpcUrl == '{backend}') {
- // Enable/disable native spellchecker
- t.editor.getBody().spellcheck = t.active = !t.active;
- return;
- }
-
- 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);
-
- if (ed.getParam('spellchecker_report_no_misspellings', true))
- 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();
- });
-
- // Find selected language
- 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') {
- // Use basic button if we use the native spellchecker
- if (t.rpcUrl == '{backend}') {
- // Create simple toggle button if we have native support
- if (t.hasSupport)
- c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
-
- return c;
- }
-
- 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;
- }
- },
-
- // Internal functions
-
- _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');
-
- // Build word separator regexp
- for (i=0; i<str.length; i++)
- re += '\\' + str.charAt(i);
-
- return re;
- },
-
- _getWords : function() {
- var ed = this.editor, wl = [], tx = '', lo = {}, rawWords = [];
-
- // Get area text
- this._walk(ed.getBody(), function(n) {
- if (n.nodeType == 3)
- tx += n.nodeValue + ' ';
- });
-
- // split the text up into individual words
- if (ed.getParam('spellchecker_word_pattern')) {
- // look for words that match the pattern
- rawWords = tx.match('(' + ed.getParam('spellchecker_word_pattern') + ')', 'gi');
- } else {
- // Split words by separator
- tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
- tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
- rawWords = tx.split(' ');
- }
-
- // Build word array and remove duplicates
- each(rawWords, 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');
-
- // Collect all text nodes
- this._walk(this.editor.getBody(), function(n) {
- if (n.nodeType == 3) {
- nl.push(n);
- }
- });
-
- // Wrap incorrect words in spans
- 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()), wordSpan = e.target;
-
- e = 0; // Fixes IE memory leak
-
- if (!m) {
- p1 = DOM.getPos(ed.getContentAreaContainer());
- //p2 = DOM.getPos(ed.getContainer());
-
- m = ed.controlManager.createDropMenu('spellcheckermenu', {
- offset_x : p1.x,
- offset_y : p1.y,
- 'class' : 'mceNoIcons'
- });
-
- t._menu = m;
- }
-
- if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) {
- m.removeAll();
- m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
-
- t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) {
- var ignoreRpc;
-
- 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), wordSpan);
- t._checkDone();
- }});
- });
-
- m.addSeparator();
- } else
- m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
-
- ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
- m.add({
- title : 'spellchecker.ignore_word',
- onclick : function() {
- var word = wordSpan.innerHTML;
-
- dom.remove(wordSpan, 1);
- t._checkDone();
-
- // tell the server if we need to
- if (ignoreRpc) {
- ed.setProgressState(1);
- t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
- ed.setProgressState(0);
- });
- }
- }
- });
-
- m.add({
- title : 'spellchecker.ignore_words',
- onclick : function() {
- var word = wordSpan.innerHTML;
-
- t._removeWords(dom.decode(word));
- t._checkDone();
-
- // tell the server if we need to
- if (ignoreRpc) {
- ed.setProgressState(1);
- t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
- ed.setProgressState(0);
- });
- }
- }
- });
-
-
- if (t.editor.getParam("spellchecker_enable_learn_rpc")) {
- m.add({
- title : 'spellchecker.learn_word',
- onclick : function() {
- var word = wordSpan.innerHTML;
-
- dom.remove(wordSpan, 1);
- t._checkDone();
-
- ed.setProgressState(1);
- t._sendRPC('learnWord', [t.selectedLang, word], function(r) {
- ed.setProgressState(0);
- });
- }
- });
- }
-
- m.update();
- });
-
- ed.selection.select(wordSpan);
- p1 = dom.getPos(wordSpan);
- m.showMenu(p1.x, p1.y + wordSpan.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;
-
- JSONRequest.sendRPC({
- url : t.rpcUrl,
- method : m,
- params : p,
- success : cb,
- error : function(e, x) {
- t.editor.setProgressState(0);
- t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
- }
- });
- }
- });
-
- // Register plugin
- tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
-})();
diff --git a/site_media/js/tiny_mce/plugins/spellchecker/img/wline.gif b/site_media/js/tiny_mce/plugins/spellchecker/img/wline.gif
deleted file mode 100644
index 7d0a4db..0000000
--- a/site_media/js/tiny_mce/plugins/spellchecker/img/wline.gif
+++ /dev/null
Binary files differ