includes/clientside/tinymce/plugins/spellchecker/editor_plugin_src.js
author Dan
Thu, 10 Apr 2008 07:58:56 -0400
changeset 529 7803c9db3506
parent 476 f26a69c40431
child 543 dffcbfbc4e59
permissions -rw-r--r--
Implemented security logging for plugin management
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
476
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     1
/**
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     2
 * $Id: editor_plugin_src.js 425 2007-11-21 15:17:39Z spocke $
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     3
 *
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     4
 * @author Moxiecode
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     5
 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     6
 */
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     7
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     8
(function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
     9
	var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    10
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    11
	tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    12
		getInfo : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    13
			return {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    14
				longname : 'Spellchecker',
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    15
				author : 'Moxiecode Systems AB',
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    16
				authorurl : 'http://tinymce.moxiecode.com',
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    17
				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    18
				version : tinymce.majorVersion + "." + tinymce.minorVersion
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    19
			};
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    20
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    21
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    22
		init : function(ed, url) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    23
			var t = this, cm;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    24
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    25
			t.url = url;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    26
			t.editor = ed;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    27
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    28
			// Register commands
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    29
			ed.addCommand('mceSpellCheck', function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    30
				if (!t.active) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    31
					ed.setProgressState(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    32
					t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    33
						if (r.length > 0) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    34
							t.active = 1;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    35
							t._markWords(r);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    36
							ed.setProgressState(0);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    37
							ed.nodeChanged();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    38
						} else {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    39
							ed.setProgressState(0);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    40
							ed.windowManager.alert('spellchecker.no_mpell');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    41
						}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    42
					});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    43
				} else
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    44
					t._done();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    45
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    46
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    47
			ed.onInit.add(function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    48
				ed.dom.loadCSS(url + '/css/content.css');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    49
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    50
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    51
			ed.onClick.add(t._showMenu, t);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    52
			ed.onContextMenu.add(t._showMenu, t);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    53
			ed.onBeforeGetContent.add(function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    54
				if (t.active)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    55
					t._removeWords();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    56
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    57
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    58
			ed.onNodeChange.add(function(ed, cm) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    59
				cm.setActive('spellchecker', t.active);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    60
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    61
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    62
			ed.onSetContent.add(function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    63
				t._done();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    64
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    65
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    66
			ed.onBeforeGetContent.add(function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    67
				t._done();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    68
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    69
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    70
			ed.onBeforeExecCommand.add(function(ed, cmd) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    71
				if (cmd == 'mceFullScreen')
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    72
					t._done();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    73
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    74
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    75
			// Find selected language
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    76
			t.languages = {};
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    77
			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) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    78
				if (k.indexOf('+') === 0) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    79
					k = k.substring(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    80
					t.selectedLang = v;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    81
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    82
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    83
				t.languages[k] = v;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    84
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    85
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    86
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    87
		createControl : function(n, cm) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    88
			var t = this, c, ed = t.editor;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    89
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    90
			if (n == 'spellchecker') {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    91
				c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    92
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    93
				c.onRenderMenu.add(function(c, m) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    94
					m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    95
					each(t.languages, function(v, k) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    96
						var o = {icon : 1}, mi;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    97
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    98
						o.onclick = function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
    99
							mi.setSelected(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   100
							t.selectedItem.setSelected(0);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   101
							t.selectedItem = mi;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   102
							t.selectedLang = v;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   103
						};
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   104
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   105
						o.title = k;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   106
						mi = m.add(o);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   107
						mi.setSelected(v == t.selectedLang);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   108
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   109
						if (v == t.selectedLang)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   110
							t.selectedItem = mi;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   111
					})
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   112
				});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   113
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   114
				return c;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   115
			}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   116
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   117
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   118
		// Internal functions
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   119
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   120
		_walk : function(n, f) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   121
			var d = this.editor.getDoc(), w;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   122
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   123
			if (d.createTreeWalker) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   124
				w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   125
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   126
				while ((n = w.nextNode()) != null)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   127
					f.call(this, n);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   128
			} else
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   129
				tinymce.walk(n, f, 'childNodes');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   130
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   131
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   132
		_getSeparators : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   133
			var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   134
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   135
			// Build word separator regexp
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   136
			for (i=0; i<str.length; i++)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   137
				re += '\\' + str.charAt(i);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   138
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   139
			return re;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   140
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   141
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   142
		_getWords : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   143
			var ed = this.editor, wl = [], tx = '', lo = {};
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   144
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   145
			// Get area text
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   146
			this._walk(ed.getBody(), function(n) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   147
				if (n.nodeType == 3)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   148
					tx += n.nodeValue + ' ';
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   149
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   150
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   151
			// Split words by separator
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   152
			tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   153
			tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   154
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   155
			// Build word array and remove duplicates
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   156
			each(tx.split(' '), function(v) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   157
				if (!lo[v]) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   158
					wl.push(v);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   159
					lo[v] = 1;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   160
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   161
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   162
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   163
			return wl;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   164
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   165
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   166
		_removeWords : function(w) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   167
			var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   168
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   169
			each(dom.select('span').reverse(), function(n) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   170
				if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   171
					if (!w || dom.decode(n.innerHTML) == w)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   172
						dom.remove(n, 1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   173
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   174
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   175
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   176
			se.moveToBookmark(b);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   177
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   178
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   179
		_markWords : function(wl) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   180
			var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = [];
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   181
			var se = ed.selection, b = se.getBookmark();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   182
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   183
			each(wl, function(v) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   184
				w += (w ? '|' : '') + v;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   185
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   186
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   187
			r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   188
			r2 = new RegExp('^(' + w + ')', 'g');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   189
			r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   190
			r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   191
			r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   192
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   193
			// Collect all text nodes
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   194
			this._walk(this.editor.getBody(), function(n) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   195
				if (n.nodeType == 3) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   196
					nl.push(n);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   197
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   198
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   199
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   200
			// Wrap incorrect words in spans
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   201
			each(nl, function(n) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   202
				var v;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   203
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   204
				if (n.nodeType == 3) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   205
					v = n.nodeValue;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   206
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   207
					if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   208
						v = dom.encode(v);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   209
						v = v.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   210
						v = v.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   211
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   212
						dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   213
					}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   214
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   215
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   216
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   217
			se.moveToBookmark(b);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   218
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   219
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   220
		_showMenu : function(ed, e) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   221
			var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin());
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   222
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   223
			if (!m) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   224
				p1 = DOM.getPos(ed.getContentAreaContainer());
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   225
				//p2 = DOM.getPos(ed.getContainer());
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   226
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   227
				m = ed.controlManager.createDropMenu('spellcheckermenu', {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   228
					offset_x : p1.x,
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   229
					offset_y : p1.y,
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   230
					'class' : 'noIcons'
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   231
				});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   232
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   233
				t._menu = m;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   234
			}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   235
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   236
			if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   237
				m.removeAll();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   238
				m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   239
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   240
				t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   241
					m.removeAll();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   242
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   243
					if (r.length > 0) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   244
						m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   245
						each(r, function(v) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   246
							m.add({title : v, onclick : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   247
								dom.replace(ed.getDoc().createTextNode(v), e.target);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   248
								t._checkDone();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   249
							}});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   250
						});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   251
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   252
						m.addSeparator();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   253
					} else
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   254
						m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   255
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   256
					m.add({
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   257
						title : 'spellchecker.ignore_word',
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   258
						onclick : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   259
							dom.remove(e.target, 1);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   260
							t._checkDone();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   261
						}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   262
					});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   263
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   264
					m.add({
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   265
						title : 'spellchecker.ignore_words',
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   266
						onclick : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   267
							t._removeWords(dom.decode(e.target.innerHTML));
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   268
							t._checkDone();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   269
						}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   270
					});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   271
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   272
					m.update();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   273
				});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   274
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   275
				ed.selection.select(e.target);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   276
				p1 = dom.getPos(e.target);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   277
				m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   278
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   279
				return tinymce.dom.Event.cancel(e);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   280
			} else
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   281
				m.hideMenu();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   282
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   283
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   284
		_checkDone : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   285
			var t = this, ed = t.editor, dom = ed.dom, o;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   286
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   287
			each(dom.select('span'), function(n) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   288
				if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   289
					o = true;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   290
					return false;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   291
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   292
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   293
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   294
			if (!o)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   295
				t._done();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   296
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   297
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   298
		_done : function() {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   299
			var t = this, la = t.active;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   300
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   301
			t.active = 0;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   302
			t._removeWords();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   303
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   304
			if (t._menu)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   305
				t._menu.hideMenu();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   306
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   307
			if (la)
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   308
				t.editor.nodeChanged();
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   309
		},
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   310
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   311
		_sendRPC : function(m, p, cb) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   312
			var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}");
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   313
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   314
			if (url == '{backend}') {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   315
				t.editor.setProgressState(0);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   316
				alert('Please specify: spellchecker_rpc_url');
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   317
				return;
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   318
			}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   319
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   320
			JSONRequest.sendRPC({
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   321
				url : url,
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   322
				method : m,
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   323
				params : p,
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   324
				success : cb,
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   325
				error : function(e, x) {
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   326
					t.editor.setProgressState(0);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   327
					t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   328
				}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   329
			});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   330
		}
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   331
	});
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   332
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   333
	// Register plugin
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   334
	tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
f26a69c40431 Upgraded to TinyMCE 3.0.3; made editor auto-init again but only on Safari
Dan
parents:
diff changeset
   335
})();