]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/themes/advanced/js/charmap.js
WordPress 3.8.3
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / themes / advanced / js / charmap.js
index d9fd8d3271af8b5c36dddb8064635ccfe35074d8..cbb4172bacbbcc3f5067cef36cf09dd47ebfc4d5 100644 (file)
@@ -1,3 +1,13 @@
+/**
+ * charmap.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
 tinyMCEPopup.requireLangPack();
 
 var charmap = [
@@ -163,7 +173,7 @@ var charmap = [
        ['ý',  'ý',  true, 'y - acute'],
        ['þ',   'þ',  true, 'thorn'],
        ['ÿ',    'ÿ',  true, 'y - diaeresis'],
-    ['Α',   'Α',  true, 'Alpha'],
+       ['Α',   'Α',  true, 'Alpha'],
        ['Β',    'Β',  true, 'Beta'],
        ['Γ',   'Γ',  true, 'Gamma'],
        ['Δ',   'Δ',  true, 'Delta'],
@@ -248,8 +258,8 @@ var charmap = [
        ['⌋',  '⌋', false,'right floor'],
        ['⟨',    '〈', false,'left-pointing angle bracket'],
        ['⟩',    '〉', false,'right-pointing angle bracket'],
-       ['◊',     '◊', true,'lozenge'],
-       ['♠',  '♠', false,'black spade suit'],
+       ['◊',     '◊', true, 'lozenge'],
+       ['♠',  '♠', true, 'black spade suit'],
        ['♣',   '♣', true, 'black club suit'],
        ['♥',  '♥', true, 'black heart suit'],
        ['♦',   '♦', true, 'black diamond suit'],
@@ -265,19 +275,46 @@ var charmap = [
 
 tinyMCEPopup.onInit.add(function() {
        tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
+       addKeyboardNavigation();
 });
 
+function addKeyboardNavigation(){
+       var tableElm, cells, settings;
+
+       cells = tinyMCEPopup.dom.select("a.charmaplink", "charmapgroup");
+
+       settings ={
+               root: "charmapgroup",
+               items: cells
+       };
+       cells[0].tabindex=0;
+       tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
+       if (tinymce.isGecko) {
+               cells[0].focus();               
+       } else {
+               setTimeout(function(){
+                       cells[0].focus();
+               }, 100);
+       }
+       tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
+}
+
 function renderCharMapHTML() {
        var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
-       var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
+       var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+
+       '<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + 
+       '"><tr height="' + tdHeight + '">';
        var cols=-1;
 
        for (i=0; i<charmap.length; i++) {
+               var previewCharFn;
+
                if (charmap[i][2]==true) {
                        cols++;
+                       previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';
                        html += ''
                                + '<td class="charmap">'
-                               + '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+                               + '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + ' '+ tinyMCEPopup.editor.translate("advanced_dlg.charmap_usage")+'">'
                                + charmap[i][1]
                                + '</a></td>';
                        if ((cols+1) % charsPerRow == 0)
@@ -291,7 +328,8 @@ function renderCharMapHTML() {
                        html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
        }
 
-       html += '</tr></table>';
+       html += '</tr></table></div>';
+       html = html.replace(/<tr height="20"><\/tr>/g, '');
 
        return html;
 }