jodit
Version:
Jodit is awesome and usefully wysiwyg editor with filebrowser
264 lines (255 loc) • 3.35 kB
text/typescript
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2020 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { Config } from '../../config';
import { IControlType, IJodit } from '../../types';
import { Alert } from '../../modules/dialog';
declare module '../../config' {
interface Config {
specialCharacters: string[];
usePopupForSpecialCharacters: boolean;
}
}
Config.prototype.usePopupForSpecialCharacters = false;
Config.prototype.specialCharacters = [
'!',
'"',
'#',
'$',
'%',
'&',
"'",
'(',
')',
'*',
'+',
'-',
'.',
'/',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
':',
';',
'<',
'=',
'>',
'?',
'@',
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z',
'[',
']',
'^',
'_',
'`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
'{',
'|',
'}',
'~',
'€',
'‘',
'’',
'“',
'”',
'–',
'—',
'¡',
'¢',
'£',
'¤',
'¥',
'¦',
'§',
'¨',
'©',
'ª',
'«',
'»',
'¬',
'®',
'¯',
'°',
'²',
'³',
'´',
'µ',
'¶',
'·',
'¸',
'¹',
'º',
'¼',
'½',
'¾',
'¿',
'À',
'Á',
'Â',
'Ã',
'Ä',
'Å',
'Æ',
'Ç',
'È',
'É',
'Ê',
'Ë',
'Ì',
'Í',
'Î',
'Ï',
'Ð',
'Ñ',
'Ò',
'Ó',
'Ô',
'Õ',
'Ö',
'×',
'Ø',
'Ù',
'Ú',
'Û',
'Ü',
'Ý',
'Þ',
'ß',
'à',
'á',
'â',
'ã',
'ä',
'å',
'æ',
'ç',
'è',
'é',
'ê',
'ë',
'ì',
'í',
'î',
'ï',
'ð',
'ñ',
'ò',
'ó',
'ô',
'õ',
'ö',
'÷',
'ø',
'ù',
'ú',
'û',
'ü',
'ý',
'þ',
'ÿ',
'Œ',
'œ',
'Ŵ',
'Ŷ',
'ŵ',
'ŷ',
'‚',
'‛',
'„',
'…',
'™',
'►',
'•',
'→',
'⇒',
'⇔',
'♦',
'≈'
];
Config.prototype.controls.symbol = {
icon: 'omega',
hotkeys: ['ctrl+shift+i', 'cmd+shift+i'],
tooltip: 'Insert Special Character',
popup: (editor: IJodit, current, control, close): any => {
const container: HTMLElement | undefined = editor.e.fire(
'generateSpecialCharactersTable.symbols'
);
if (container) {
if (editor.o.usePopupForSpecialCharacters) {
const box = editor.c.div();
box.classList.add('jodit-symbols');
box.appendChild(container);
editor.e.on(container, 'close_dialog', close);
return box;
} else {
Alert(
container,
editor.i18n('Select Special Character'),
undefined,
'jodit-symbols'
).bindDestruct(editor);
const a = container.querySelector('a');
a && a.focus();
}
}
}
} as IControlType;