summaryrefslogtreecommitdiff
path: root/plugins/aspell/plugin.js
blob: 6ced98fafee392e9305c134ca7c616b1cb4871b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Aspell plug-in for CKeditor 3.0
 * Ported from FCKeditor 2.x by Christian Boisjoli, SilenceIT
 * Requires toolbar, aspell
 */

CKEDITOR.plugins.add('aspell', {
	init: function (editor) {
		// Create dialog-based command named "aspell"
		editor.addCommand('aspell', new CKEDITOR.dialogCommand('aspell'));
		
		// Add button to toolbar. Not sure why only that name works for me.
		editor.ui.addButton('SpellCheck', {
			label: editor.lang.spellCheck.toolbar,
			command: 'aspell'
		});
		
		// Add link dialog code
		CKEDITOR.dialog.add('aspell', this.path + 'dialogs/aspell.js');
		
		// Add CSS
		var aspellCSS = document.createElement('link');
		aspellCSS.setAttribute( 'rel', 'stylesheet');
		aspellCSS.setAttribute('type', 'text/css');
		aspellCSS.setAttribute('href', this.path+'aspell.css');
		document.getElementsByTagName("head")[0].appendChild(aspellCSS);
		delete aspellCSS;
	},
	requires: ['toolbar']
});