/** * @author Shea Frederick - http://www.vinylfox.com * @class Ext.ux.form.HtmlEditor.SpecialCharacters * @extends Ext.util.Observable *
A plugin that creates a button on the HtmlEditor for inserting special characters.
*/ Ext.ux.form.HtmlEditor.SpecialCharacters = Ext.extend(Ext.util.Observable, { // SpecialCharacters language text langTitle : 'Insert Special Character', langInsert : 'Insert', langCancel : 'Cancel', /** * @cfg {Array} specialChars * An array of additional characters to display for user selection. Uses numeric portion of the ASCII HTML Character Code only. For example, to use the Copyright symbol, which is © we would just specify 169 (ie: specialChars:[169]). */ specialChars: [153], /** * @cfg {Array} charRange * Two numbers specifying a range of ASCII HTML Characters to display for user selection. Defaults to [160, 256]. */ charRange: [160, 256], // private chars: [], // private init: function(cmp){ this.cmp = cmp; this.cmp.on('render', this.onRender, this); }, // private onRender: function(){ var cmp = this.cmp; var btn = this.cmp.getToolbar().addButton({ iconCls: 'x-edit-char', handler: function(){ if (!this.chars.length) { if (this.specialChars.length) { Ext.each(this.specialChars, function(c, i){ this.chars[i] = ['' + c + ';']; }, this); } for (i = this.charRange[0]; i < this.charRange[1]; i++) { this.chars.push(['' + i + ';']); } } var charStore = new Ext.data.ArrayStore({ fields: ['char'], data: this.chars }); this.charWindow = new Ext.Window({ title: this.langTitle, width: 436, autoHeight: true, layout: 'fit', items: [{ xtype: 'dataview', store: charStore, ref: 'charView', autoHeight: true, multiSelect: true, tpl: new Ext.XTemplate('