mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-08-27 04:56:05 +02:00
API CHANGE Moved jsparty/tinymce_ssmacron to cms/javascript/tinymce_ssmacron git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92612 467b73ca-7a2a-4603-9d3b-597d59a354a9
72 lines
2.4 KiB
JavaScript
72 lines
2.4 KiB
JavaScript
tinyMCEPopup.requireLangPack();
|
|
|
|
var charmap = [
|
|
['Ā', 'Ā', true, 'A - macron'],
|
|
['Ē', 'Ē', true, 'E - macron'],
|
|
['Ī', 'Ī', true, 'I - macron'],
|
|
['Ō', 'Ō', true, 'O - macron'],
|
|
['Ū', 'Ū', true, 'U - macron'],
|
|
['ā', 'ā', true, 'a - macron'],
|
|
['ē', 'ē', true, 'e - macron'],
|
|
['ī', 'ī', true, 'i - macron'],
|
|
['ō', 'ō', true, 'o - macron'],
|
|
['ū', 'ū', true, 'u - macron']
|
|
];
|
|
|
|
tinyMCEPopup.onInit.add(function() {
|
|
tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
|
|
});
|
|
|
|
function renderCharMapHTML() {
|
|
var charsPerRow = 5, tdWidth=20, tdHeight=20, i;
|
|
var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
|
|
var cols=-1;
|
|
|
|
for (i=0; i<charmap.length; i++) {
|
|
if (charmap[i][2]==true) {
|
|
cols++;
|
|
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] + '">'
|
|
+ charmap[i][1]
|
|
+ '</a></td>';
|
|
if ((cols+1) % charsPerRow == 0)
|
|
html += '</tr><tr height="' + tdHeight + '">';
|
|
}
|
|
}
|
|
|
|
if (cols % charsPerRow > 0) {
|
|
var padd = charsPerRow - (cols % charsPerRow);
|
|
for (var i=0; i<padd-1; i++)
|
|
html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"> </td>';
|
|
}
|
|
|
|
html += '</tr></table>';
|
|
|
|
return html;
|
|
}
|
|
|
|
function insertChar(chr) {
|
|
tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
|
|
|
|
// Refocus in window
|
|
if (tinyMCEPopup.isWindow)
|
|
window.focus();
|
|
|
|
tinyMCEPopup.editor.focus();
|
|
tinyMCEPopup.close();
|
|
}
|
|
|
|
function previewChar(codeA, codeB, codeN) {
|
|
var elmV = document.getElementById('codeV');
|
|
var elmN = document.getElementById('codeN');
|
|
|
|
if (codeA=='#160;') {
|
|
elmV.innerHTML = '__';
|
|
} else {
|
|
elmV.innerHTML = '&' + codeA;
|
|
}
|
|
|
|
elmN.innerHTML = codeN;
|
|
}
|