Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js (révision 7077)
+++ typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js (copie de travail)
@@ -34,46 +34,296 @@
* TYPO3 SVN ID: $Id$
*/
CharacterMap = HTMLArea.Plugin.extend({
-
constructor : function(editor, pluginName) {
this.base(editor, pluginName);
},
-
/*
* This function gets called by the class constructor
*/
configurePlugin : function(editor) {
-
/*
* Registering plugin "About" information
*/
var pluginInformation = {
- version : "1.3",
- developer : "Holger Hees, Bernhard Pfeifer, Stanislas Rolland",
- developerUrl : "http://www.fructifor.ca/",
- copyrightOwner : "Holger Hees, Bernhard Pfeifer, Stanislas Rolland",
- sponsor : "System Concept GmbH, Bernhard Pfeifer, Fructifor Inc.",
- sponsorUrl : "http://www.fructifor.ca/",
- license : "GPL"
+ version : '2.0',
+ developer : 'Holger Hees, Bernhard Pfeifer, Stanislas Rolland',
+ developerUrl : 'http://www.sjbr.ca/',
+ copyrightOwner : 'Holger Hees, Bernhard Pfeifer, Stanislas Rolland',
+ sponsor : 'System Concept GmbH, Bernhard Pfeifer, SJBR',
+ sponsorUrl : 'http://www.sjbr.ca/',
+ license : 'GPL'
};
this.registerPluginInformation(pluginInformation);
-
/*
* Registering the button
*/
- var buttonId = "InsertCharacter";
+ var buttonId = 'InsertCharacter';
var buttonConfiguration = {
id : buttonId,
- tooltip : this.localize(buttonId + "-Tooltip"),
- action : "onButtonPress",
+ tooltip : this.localize(buttonId + '-Tooltip'),
+ action : 'onButtonPress',
dialog : true
};
this.registerButton(buttonConfiguration);
return true;
},
-
/*
+ * Character maps
+ */
+ maps: {
+ general: [
+ [' ', ' '],
+ ['À', 'À'],
+ ['à', 'à'],
+ ['Á', 'Á'],
+ ['á', 'á'],
+ ['Â', 'Â'],
+ ['â', 'â'],
+ ['Ã', 'Ã'],
+ ['ã', 'ã'],
+ ['Ä', 'Ä'],
+ ['ä', 'ä'],
+ ['Å', 'Å'],
+ ['å', 'å'],
+ ['Æ', 'Æ'],
+ ['æ', 'æ'],
+ ['ª', 'ª'],
+ ['Ç', 'Ç'],
+ ['ç', 'ç'],
+ ['Ð', 'Ð'],
+ ['ð', 'ð'],
+ ['È', 'È'],
+ ['è', 'è'],
+ ['É', 'É'],
+ ['é', 'é'],
+ ['Ê', 'Ê'],
+ ['ê', 'ê'],
+ ['Ë', 'Ë'],
+ ['ë', 'ë'],
+ ['Ì', 'Ì'],
+ ['ì', 'ì'],
+ ['Í', 'Í'],
+ ['í', 'í'],
+ ['Î', 'Î'],
+ ['î', 'î'],
+ ['Ï', 'Ï'],
+ ['ï', 'ï'],
+ ['Ñ', 'Ñ'],
+ ['ñ', 'ñ'],
+ ['Ò', 'Ò'],
+ ['ò', 'ò'],
+ ['Ó', 'Ó'],
+ ['ó', 'ó'],
+ ['Ô', 'Ô'],
+ ['ô', 'ô'],
+ ['Õ', 'Õ'],
+ ['õ', 'õ'],
+ ['Ö', 'Ö'],
+ ['ö', 'ö'],
+ ['Ø', 'Ø'],
+ ['ø', 'ø'],
+ ['Œ', 'Œ'],
+ ['œ', 'œ'],
+ ['º', 'º'],
+ ['Š', 'Š'],
+ ['š', 'š'],
+ ['ß', 'ß'],
+ ['Þ', 'Þ'],
+ ['þ', 'þ'],
+ ['Ù', 'Ù'],
+ ['ù', 'ù'],
+ ['Ú', 'Ú'],
+ ['ú', 'ú'],
+ ['Û', 'Û'],
+ ['û', 'û'],
+ ['Ü', 'Ü'],
+ ['ü', 'ü'],
+ ['Ý', 'Ý'],
+ ['ý', 'ý'],
+ ['Ÿ', 'Ÿ'],
+ ['ÿ', 'ÿ'],
+ ['´', '´'],
+ ['ˆ', 'ˆ'],
+ ['˜', '˜'],
+ ['¨', '¨'],
+ ['¸', '¸'],
+ ['–', '–'],
+ ['—', '—'],
+ ['‘', '‘'],
+ ['’', '’'],
+ ['‚', '‚'],
+ ['“', '“'],
+ ['”', '”'],
+ ['„', '„'],
+ ['‹', '‹'],
+ ['›', '›'],
+ ['«', '«'],
+ ['»', '»'],
+ ['"', '"'],
+ ['…', '…'],
+ ['¿', '¿'],
+ ['¡', '¡'],
+ ['•', '•'],
+ ['†', '†'],
+ ['‡', '‡'],
+ ['¦', '¦'],
+ ['¶', '¶'],
+ ['§', '§'],
+ ['◊', '◊'],
+ ['@', '@'],
+ ['©', '©'],
+ ['®', '®'],
+ ['™', '™'],
+ ['¤', '¤'],
+ ['¢', '¢'],
+ ['€', '€'],
+ ['£', '£'],
+ ['¥', '¥'],
+ [' ', ' '],
+ [' ', ' '],
+ [' ', ' '],
+ ['', '‍'],
+ ['', '‌']
+ ],
+ mathematical: [
+ ['−', '−'],
+ ['±', '±'],
+ ['×', '×'],
+ ['÷', '÷'],
+ ['√', '√'],
+ ['⋅', '⋅'],
+ ['⊗', '⊗'],
+ ['∗', '∗'],
+ ['≥', '≥'],
+ ['≤', '≤'],
+ ['≠', '≠'],
+ ['≈', '≈'],
+ ['∼', '∼'],
+ ['∝', '∝'],
+ ['°', '°'],
+ ['′', '′'],
+ ['″', '″'],
+ ['µ', 'µ'],
+ ['∠', '∠'],
+ ['⊥', '⊥'],
+ ['‰', '‰'],
+ ['⁄', '⁄'],
+ ['¼', '¼'],
+ ['½', '½'],
+ ['¾', '¾'],
+ ['¹', '¹'],
+ ['²', '²'],
+ ['³', '³'],
+ ['¬', '¬'],
+ ['∧', '∧'],
+ ['∨', '∨'],
+ ['∴', '∴'],
+ ['≅', '≅'],
+ ['∈', '∈'],
+ ['∋', '∋'],
+ ['∉', '∉'],
+ ['⊂', '⊂'],
+ ['⊆', '⊆'],
+ ['⊄', '⊄'],
+ ['⊃', '⊃'],
+ ['⊇', '⊇'],
+ ['∩', '∩'],
+ ['∪', '∪'],
+ ['⊕', '⊕'],
+ ['∇', '∇'],
+ ['∅', '∅'],
+ ['≡', '≡'],
+ ['∑', '∑'],
+ ['∏', '∏'],
+ ['℘', '℘'],
+ ['∃', '∃'],
+ ['∀', '∀'],
+ ['∞', '∞'],
+ ['ℵ', 'ℵ'],
+ ['ℜ', 'ℜ'],
+ ['ℑ', 'ℑ'],
+ ['ƒ', 'ƒ'],
+ ['∫', '∫'],
+ ['∂', '∂'],
+ ['Α', 'Α'],
+ ['α', 'α'],
+ ['Β', 'Β'],
+ ['β', 'β'],
+ ['Γ', 'Γ'],
+ ['γ', 'γ'],
+ ['Δ', 'Δ'],
+ ['δ', 'δ'],
+ ['Ε', 'Ε'],
+ ['ε', 'ε'],
+ ['Ζ', 'Ζ'],
+ ['ζ', 'ζ'],
+ ['Η', 'Η'],
+ ['η', 'η'],
+ ['Θ', 'Θ'],
+ ['θ', 'θ'],
+ ['ϑ', 'ϑ'],
+ ['Ι', 'Ι'],
+ ['ι', 'ι'],
+ ['Κ', 'Κ'],
+ ['κ', 'κ'],
+ ['Λ', 'Λ'],
+ ['λ', 'λ'],
+ ['Μ', 'Μ'],
+ ['μ', 'μ'],
+ ['Ν', 'Ν'],
+ ['ν', 'ν'],
+ ['Ξ', 'Ξ'],
+ ['ξ', 'ξ'],
+ ['Ο', 'Ο'],
+ ['ο', 'ο'],
+ ['Π', 'Π'],
+ ['π', 'π'],
+ ['ϖ', 'ϖ'],
+ ['Ρ', 'Ρ'],
+ ['ρ', 'ρ'],
+ ['Σ', 'Σ'],
+ ['σ', 'σ'],
+ ['ς', 'ς'],
+ ['Τ', 'Τ'],
+ ['τ', 'τ'],
+ ['Υ', 'Υ'],
+ ['ϒ', 'ϒ'],
+ ['υ', 'υ'],
+ ['Φ', 'Φ'],
+ ['φ', 'φ'],
+ ['Χ', 'Χ'],
+ ['χ', 'χ'],
+ ['Ψ', 'Ψ'],
+ ['ψ', 'ψ'],
+ ['Ω', 'Ω'],
+ ['ω', 'ω'],
+ [' ', ' ']
+ ],
+ graphical: [
+ ['↵', '↵'],
+ ['↑', '↑'],
+ ['↓', '↓'],
+ ['←', '←'],
+ ['→', '→'],
+ ['↔', '↔'],
+ ['⇑', '⇑'],
+ ['⇓', '⇓'],
+ ['⇐', '⇐'],
+ ['⇒', '⇒'],
+ ['⇔', '⇔'],
+ [' ', ' '],
+ [' ', ' '],
+ [' ', ' '],
+ [' ', ' '],
+ [' ', ' '],
+ ['♣', '♣'],
+ ['♦', '♦'],
+ ['♥', '♥'],
+ ['♠', '♠']
+ ]
+ },
+ /*
* This function gets called when the button was pressed.
*
* @param object editor: the editor instance
@@ -81,36 +331,128 @@
*
* @return boolean false if action is completed
*/
- onButtonPress : function(editor, id) {
- this.dialog = this.openDialog("InsertCharacter", this.makeUrlFromPopupName("select_character"), "insertCharacter", null, {width:485, height:330});
+ onButtonPress: function (editor, id) {
+ // Could be a button or its hotkey
+ var buttonId = this.translateHotKey(id);
+ buttonId = buttonId ? buttonId : id;
+ this.openDialogue(
+ buttonId,
+ 'Insert special character',
+ this.getWindowDimensions({width:462, height:330}, buttonId),
+ this.buildTabItems()
+ );
return false;
},
-
/*
+ * Open the dialogue window
+ *
+ * @param string buttonId: the button id
+ * @param string title: the window title
+ * @param integer dimensions: the opening width of the window
+ * @param object tabItems: the configuration of the tabbed panel
+ * @param function handler: handler when the OK button if clicked
+ *
+ * @return void
+ */
+ openDialogue: function (buttonId, title, dimensions, tabItems, handler) {
+ this.dialog = new Ext.Window({
+ title: this.localize(title),
+ cls: 'htmlarea-window',
+ border: false,
+ width: dimensions.width,
+ height: 'auto',
+ // As of ExtJS 3.1, JS error with IE when the window is resizable
+ resizable: !Ext.isIE,
+ iconCls: buttonId,
+ listeners: {
+ close: {
+ fn: this.onClose,
+ scope: this
+ }
+ },
+ items: {
+ xtype: 'tabpanel',
+ activeTab: 0,
+ listeners: {
+ activate: {
+ fn: this.resetFocus,
+ scope: this
+ },
+ tabchange: {
+ fn: this.syncHeight,
+ scope: this
+ }
+ },
+ items: tabItems
+ },
+ buttons: [
+ this.buildButtonConfig('Cancel', this.onCancel)
+ ]
+ });
+ this.show();
+ },
+ /*
+ * Build the configuration of the the tab items
+ *
+ * @return array the configuration array of tab items
+ */
+ buildTabItems: function () {
+ var tabItems = [];
+ Ext.iterate(this.maps, function (id, map) {
+ tabItems.push({
+ xtype: 'box',
+ cls: 'character-map',
+ title: this.localize(id),
+ itemId: id,
+ tpl: new Ext.XTemplate(
+ '