v1.0
只读模式 group, 分享 评论更多问题 博客标签总是存在一个
This commit is contained in:
74
public/tinymce/plugins/charmap/plugin.js
Normal file → Executable file
74
public/tinymce/plugins/charmap/plugin.js
Normal file → Executable file
@ -13,7 +13,7 @@
|
||||
tinymce.PluginManager.add('charmap', function(editor) {
|
||||
var charmap = [
|
||||
['160', 'no-break space'],
|
||||
['38', 'ampersand'],
|
||||
['173', 'soft hyphen'],
|
||||
['34', 'quotation mark'],
|
||||
// finance
|
||||
['162', 'cent sign'],
|
||||
@ -225,9 +225,9 @@ tinymce.PluginManager.add('charmap', function(editor) {
|
||||
['969', 'omega'],
|
||||
// symbols
|
||||
['8501', 'alef symbol'],
|
||||
['982', 'pi symbol'],
|
||||
['982', 'pi symbol'],
|
||||
['8476', 'real part symbol'],
|
||||
['978', 'upsilon - hook symbol'],
|
||||
['978', 'upsilon - hook symbol'],
|
||||
['8472', 'Weierstrass p'],
|
||||
['8465', 'imaginary part'],
|
||||
// arrows
|
||||
@ -269,8 +269,7 @@ tinymce.PluginManager.add('charmap', function(editor) {
|
||||
['8204', 'zero width non-joiner'],
|
||||
['8205', 'zero width joiner'],
|
||||
['8206', 'left-to-right mark'],
|
||||
['8207', 'right-to-left mark'],
|
||||
['173', 'soft hyphen']
|
||||
['8207', 'right-to-left mark']
|
||||
];
|
||||
|
||||
function showDialog() {
|
||||
@ -289,15 +288,20 @@ tinymce.PluginManager.add('charmap', function(editor) {
|
||||
gridHtml = '<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';
|
||||
|
||||
var width = 25;
|
||||
for (y = 0; y < 10; y++) {
|
||||
var height = Math.ceil(charmap.length / width);
|
||||
for (y = 0; y < height; y++) {
|
||||
gridHtml += '<tr>';
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
var chr = charmap[y * width + x];
|
||||
var id = 'g' + (y * width + x);
|
||||
var index = y * width + x;
|
||||
if (index < charmap.length) {
|
||||
var chr = charmap[index];
|
||||
|
||||
gridHtml += '<td title="' + chr[1] + '"><div id="' + id + '" tabIndex="-1">' +
|
||||
(chr ? String.fromCharCode(parseInt(chr[0], 10)) : ' ') + '</div></td>';
|
||||
gridHtml += '<td title="' + chr[1] + '"><div tabindex="-1" title="' + chr[1] + '" role="button">' +
|
||||
(chr ? String.fromCharCode(parseInt(chr[0], 10)) : ' ') + '</div></td>';
|
||||
} else {
|
||||
gridHtml += '<td />';
|
||||
}
|
||||
}
|
||||
|
||||
gridHtml += '</tr>';
|
||||
@ -310,15 +314,25 @@ tinymce.PluginManager.add('charmap', function(editor) {
|
||||
html: gridHtml,
|
||||
onclick: function(e) {
|
||||
var target = e.target;
|
||||
if (target.nodeName == 'DIV') {
|
||||
editor.execCommand('mceInsertContent', false, target.firstChild.nodeValue);
|
||||
if (/^(TD|DIV)$/.test(target.nodeName)) {
|
||||
if (getParentTd(target).firstChild) {
|
||||
editor.execCommand('mceInsertContent', false, tinymce.trim(target.innerText || target.textContent));
|
||||
|
||||
if (!e.ctrlKey) {
|
||||
win.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onmouseover: function(e) {
|
||||
var td = getParentTd(e.target);
|
||||
|
||||
if (td) {
|
||||
if (td && td.firstChild) {
|
||||
win.find('#preview').text(td.firstChild.firstChild.data);
|
||||
win.find('#previewTitle').text(td.title);
|
||||
} else {
|
||||
win.find('#preview').text(' ');
|
||||
win.find('#previewTitle').text(' ');
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -330,13 +344,33 @@ tinymce.PluginManager.add('charmap', function(editor) {
|
||||
items: [
|
||||
charMapPanel,
|
||||
{
|
||||
type: 'label',
|
||||
name: 'preview',
|
||||
text: ' ',
|
||||
style: 'font-size: 40px; text-align: center',
|
||||
border: 1,
|
||||
minWidth: 100,
|
||||
minHeight: 80
|
||||
type: 'container',
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
minWidth: 160,
|
||||
minHeight: 160,
|
||||
items: [
|
||||
{
|
||||
type: 'label',
|
||||
name: 'preview',
|
||||
text: ' ',
|
||||
style: 'font-size: 40px; text-align: center',
|
||||
border: 1,
|
||||
minWidth: 140,
|
||||
minHeight: 80
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: 'previewTitle',
|
||||
text: ' ',
|
||||
style: 'text-align: center',
|
||||
border: 1,
|
||||
minWidth: 140,
|
||||
minHeight: 80
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
buttons: [
|
||||
|
2
public/tinymce/plugins/charmap/plugin.min.js
vendored
Normal file → Executable file
2
public/tinymce/plugins/charmap/plugin.min.js
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user