plugin.js 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696
  1. /**
  2. * Copyright (c) Tiny Technologies, Inc. All rights reserved.
  3. * Licensed under the LGPL or a commercial license.
  4. * For LGPL see License.txt in the project root for license information.
  5. * For commercial licenses see https://www.tiny.cloud/
  6. *
  7. * Version: 5.10.2 (2021-11-17)
  8. */
  9. (function () {
  10. 'use strict';
  11. var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');
  12. var fireInsertCustomChar = function (editor, chr) {
  13. return editor.fire('insertCustomChar', { chr: chr });
  14. };
  15. var insertChar = function (editor, chr) {
  16. var evtChr = fireInsertCustomChar(editor, chr).chr;
  17. editor.execCommand('mceInsertContent', false, evtChr);
  18. };
  19. var typeOf = function (x) {
  20. var t = typeof x;
  21. if (x === null) {
  22. return 'null';
  23. } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
  24. return 'array';
  25. } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
  26. return 'string';
  27. } else {
  28. return t;
  29. }
  30. };
  31. var isType = function (type) {
  32. return function (value) {
  33. return typeOf(value) === type;
  34. };
  35. };
  36. var eq = function (t) {
  37. return function (a) {
  38. return t === a;
  39. };
  40. };
  41. var isArray$1 = isType('array');
  42. var isNull = eq(null);
  43. var noop = function () {
  44. };
  45. var constant = function (value) {
  46. return function () {
  47. return value;
  48. };
  49. };
  50. var identity = function (x) {
  51. return x;
  52. };
  53. var never = constant(false);
  54. var always = constant(true);
  55. var none = function () {
  56. return NONE;
  57. };
  58. var NONE = function () {
  59. var call = function (thunk) {
  60. return thunk();
  61. };
  62. var id = identity;
  63. var me = {
  64. fold: function (n, _s) {
  65. return n();
  66. },
  67. isSome: never,
  68. isNone: always,
  69. getOr: id,
  70. getOrThunk: call,
  71. getOrDie: function (msg) {
  72. throw new Error(msg || 'error: getOrDie called on none.');
  73. },
  74. getOrNull: constant(null),
  75. getOrUndefined: constant(undefined),
  76. or: id,
  77. orThunk: call,
  78. map: none,
  79. each: noop,
  80. bind: none,
  81. exists: never,
  82. forall: always,
  83. filter: function () {
  84. return none();
  85. },
  86. toArray: function () {
  87. return [];
  88. },
  89. toString: constant('none()')
  90. };
  91. return me;
  92. }();
  93. var some = function (a) {
  94. var constant_a = constant(a);
  95. var self = function () {
  96. return me;
  97. };
  98. var bind = function (f) {
  99. return f(a);
  100. };
  101. var me = {
  102. fold: function (n, s) {
  103. return s(a);
  104. },
  105. isSome: always,
  106. isNone: never,
  107. getOr: constant_a,
  108. getOrThunk: constant_a,
  109. getOrDie: constant_a,
  110. getOrNull: constant_a,
  111. getOrUndefined: constant_a,
  112. or: self,
  113. orThunk: self,
  114. map: function (f) {
  115. return some(f(a));
  116. },
  117. each: function (f) {
  118. f(a);
  119. },
  120. bind: bind,
  121. exists: bind,
  122. forall: bind,
  123. filter: function (f) {
  124. return f(a) ? me : NONE;
  125. },
  126. toArray: function () {
  127. return [a];
  128. },
  129. toString: function () {
  130. return 'some(' + a + ')';
  131. }
  132. };
  133. return me;
  134. };
  135. var from = function (value) {
  136. return value === null || value === undefined ? NONE : some(value);
  137. };
  138. var Optional = {
  139. some: some,
  140. none: none,
  141. from: from
  142. };
  143. var nativePush = Array.prototype.push;
  144. var map = function (xs, f) {
  145. var len = xs.length;
  146. var r = new Array(len);
  147. for (var i = 0; i < len; i++) {
  148. var x = xs[i];
  149. r[i] = f(x, i);
  150. }
  151. return r;
  152. };
  153. var each = function (xs, f) {
  154. for (var i = 0, len = xs.length; i < len; i++) {
  155. var x = xs[i];
  156. f(x, i);
  157. }
  158. };
  159. var findUntil = function (xs, pred, until) {
  160. for (var i = 0, len = xs.length; i < len; i++) {
  161. var x = xs[i];
  162. if (pred(x, i)) {
  163. return Optional.some(x);
  164. } else if (until(x, i)) {
  165. break;
  166. }
  167. }
  168. return Optional.none();
  169. };
  170. var find = function (xs, pred) {
  171. return findUntil(xs, pred, never);
  172. };
  173. var flatten = function (xs) {
  174. var r = [];
  175. for (var i = 0, len = xs.length; i < len; ++i) {
  176. if (!isArray$1(xs[i])) {
  177. throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
  178. }
  179. nativePush.apply(r, xs[i]);
  180. }
  181. return r;
  182. };
  183. var bind = function (xs, f) {
  184. return flatten(map(xs, f));
  185. };
  186. var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
  187. var getCharMap$1 = function (editor) {
  188. return editor.getParam('charmap');
  189. };
  190. var getCharMapAppend = function (editor) {
  191. return editor.getParam('charmap_append');
  192. };
  193. var isArray = global$1.isArray;
  194. var UserDefined = 'User Defined';
  195. var getDefaultCharMap = function () {
  196. return [
  197. {
  198. name: 'Currency',
  199. characters: [
  200. [
  201. 36,
  202. 'dollar sign'
  203. ],
  204. [
  205. 162,
  206. 'cent sign'
  207. ],
  208. [
  209. 8364,
  210. 'euro sign'
  211. ],
  212. [
  213. 163,
  214. 'pound sign'
  215. ],
  216. [
  217. 165,
  218. 'yen sign'
  219. ],
  220. [
  221. 164,
  222. 'currency sign'
  223. ],
  224. [
  225. 8352,
  226. 'euro-currency sign'
  227. ],
  228. [
  229. 8353,
  230. 'colon sign'
  231. ],
  232. [
  233. 8354,
  234. 'cruzeiro sign'
  235. ],
  236. [
  237. 8355,
  238. 'french franc sign'
  239. ],
  240. [
  241. 8356,
  242. 'lira sign'
  243. ],
  244. [
  245. 8357,
  246. 'mill sign'
  247. ],
  248. [
  249. 8358,
  250. 'naira sign'
  251. ],
  252. [
  253. 8359,
  254. 'peseta sign'
  255. ],
  256. [
  257. 8360,
  258. 'rupee sign'
  259. ],
  260. [
  261. 8361,
  262. 'won sign'
  263. ],
  264. [
  265. 8362,
  266. 'new sheqel sign'
  267. ],
  268. [
  269. 8363,
  270. 'dong sign'
  271. ],
  272. [
  273. 8365,
  274. 'kip sign'
  275. ],
  276. [
  277. 8366,
  278. 'tugrik sign'
  279. ],
  280. [
  281. 8367,
  282. 'drachma sign'
  283. ],
  284. [
  285. 8368,
  286. 'german penny symbol'
  287. ],
  288. [
  289. 8369,
  290. 'peso sign'
  291. ],
  292. [
  293. 8370,
  294. 'guarani sign'
  295. ],
  296. [
  297. 8371,
  298. 'austral sign'
  299. ],
  300. [
  301. 8372,
  302. 'hryvnia sign'
  303. ],
  304. [
  305. 8373,
  306. 'cedi sign'
  307. ],
  308. [
  309. 8374,
  310. 'livre tournois sign'
  311. ],
  312. [
  313. 8375,
  314. 'spesmilo sign'
  315. ],
  316. [
  317. 8376,
  318. 'tenge sign'
  319. ],
  320. [
  321. 8377,
  322. 'indian rupee sign'
  323. ],
  324. [
  325. 8378,
  326. 'turkish lira sign'
  327. ],
  328. [
  329. 8379,
  330. 'nordic mark sign'
  331. ],
  332. [
  333. 8380,
  334. 'manat sign'
  335. ],
  336. [
  337. 8381,
  338. 'ruble sign'
  339. ],
  340. [
  341. 20870,
  342. 'yen character'
  343. ],
  344. [
  345. 20803,
  346. 'yuan character'
  347. ],
  348. [
  349. 22291,
  350. 'yuan character, in hong kong and taiwan'
  351. ],
  352. [
  353. 22278,
  354. 'yen/yuan character variant one'
  355. ]
  356. ]
  357. },
  358. {
  359. name: 'Text',
  360. characters: [
  361. [
  362. 169,
  363. 'copyright sign'
  364. ],
  365. [
  366. 174,
  367. 'registered sign'
  368. ],
  369. [
  370. 8482,
  371. 'trade mark sign'
  372. ],
  373. [
  374. 8240,
  375. 'per mille sign'
  376. ],
  377. [
  378. 181,
  379. 'micro sign'
  380. ],
  381. [
  382. 183,
  383. 'middle dot'
  384. ],
  385. [
  386. 8226,
  387. 'bullet'
  388. ],
  389. [
  390. 8230,
  391. 'three dot leader'
  392. ],
  393. [
  394. 8242,
  395. 'minutes / feet'
  396. ],
  397. [
  398. 8243,
  399. 'seconds / inches'
  400. ],
  401. [
  402. 167,
  403. 'section sign'
  404. ],
  405. [
  406. 182,
  407. 'paragraph sign'
  408. ],
  409. [
  410. 223,
  411. 'sharp s / ess-zed'
  412. ]
  413. ]
  414. },
  415. {
  416. name: 'Quotations',
  417. characters: [
  418. [
  419. 8249,
  420. 'single left-pointing angle quotation mark'
  421. ],
  422. [
  423. 8250,
  424. 'single right-pointing angle quotation mark'
  425. ],
  426. [
  427. 171,
  428. 'left pointing guillemet'
  429. ],
  430. [
  431. 187,
  432. 'right pointing guillemet'
  433. ],
  434. [
  435. 8216,
  436. 'left single quotation mark'
  437. ],
  438. [
  439. 8217,
  440. 'right single quotation mark'
  441. ],
  442. [
  443. 8220,
  444. 'left double quotation mark'
  445. ],
  446. [
  447. 8221,
  448. 'right double quotation mark'
  449. ],
  450. [
  451. 8218,
  452. 'single low-9 quotation mark'
  453. ],
  454. [
  455. 8222,
  456. 'double low-9 quotation mark'
  457. ],
  458. [
  459. 60,
  460. 'less-than sign'
  461. ],
  462. [
  463. 62,
  464. 'greater-than sign'
  465. ],
  466. [
  467. 8804,
  468. 'less-than or equal to'
  469. ],
  470. [
  471. 8805,
  472. 'greater-than or equal to'
  473. ],
  474. [
  475. 8211,
  476. 'en dash'
  477. ],
  478. [
  479. 8212,
  480. 'em dash'
  481. ],
  482. [
  483. 175,
  484. 'macron'
  485. ],
  486. [
  487. 8254,
  488. 'overline'
  489. ],
  490. [
  491. 164,
  492. 'currency sign'
  493. ],
  494. [
  495. 166,
  496. 'broken bar'
  497. ],
  498. [
  499. 168,
  500. 'diaeresis'
  501. ],
  502. [
  503. 161,
  504. 'inverted exclamation mark'
  505. ],
  506. [
  507. 191,
  508. 'turned question mark'
  509. ],
  510. [
  511. 710,
  512. 'circumflex accent'
  513. ],
  514. [
  515. 732,
  516. 'small tilde'
  517. ],
  518. [
  519. 176,
  520. 'degree sign'
  521. ],
  522. [
  523. 8722,
  524. 'minus sign'
  525. ],
  526. [
  527. 177,
  528. 'plus-minus sign'
  529. ],
  530. [
  531. 247,
  532. 'division sign'
  533. ],
  534. [
  535. 8260,
  536. 'fraction slash'
  537. ],
  538. [
  539. 215,
  540. 'multiplication sign'
  541. ],
  542. [
  543. 185,
  544. 'superscript one'
  545. ],
  546. [
  547. 178,
  548. 'superscript two'
  549. ],
  550. [
  551. 179,
  552. 'superscript three'
  553. ],
  554. [
  555. 188,
  556. 'fraction one quarter'
  557. ],
  558. [
  559. 189,
  560. 'fraction one half'
  561. ],
  562. [
  563. 190,
  564. 'fraction three quarters'
  565. ]
  566. ]
  567. },
  568. {
  569. name: 'Mathematical',
  570. characters: [
  571. [
  572. 402,
  573. 'function / florin'
  574. ],
  575. [
  576. 8747,
  577. 'integral'
  578. ],
  579. [
  580. 8721,
  581. 'n-ary sumation'
  582. ],
  583. [
  584. 8734,
  585. 'infinity'
  586. ],
  587. [
  588. 8730,
  589. 'square root'
  590. ],
  591. [
  592. 8764,
  593. 'similar to'
  594. ],
  595. [
  596. 8773,
  597. 'approximately equal to'
  598. ],
  599. [
  600. 8776,
  601. 'almost equal to'
  602. ],
  603. [
  604. 8800,
  605. 'not equal to'
  606. ],
  607. [
  608. 8801,
  609. 'identical to'
  610. ],
  611. [
  612. 8712,
  613. 'element of'
  614. ],
  615. [
  616. 8713,
  617. 'not an element of'
  618. ],
  619. [
  620. 8715,
  621. 'contains as member'
  622. ],
  623. [
  624. 8719,
  625. 'n-ary product'
  626. ],
  627. [
  628. 8743,
  629. 'logical and'
  630. ],
  631. [
  632. 8744,
  633. 'logical or'
  634. ],
  635. [
  636. 172,
  637. 'not sign'
  638. ],
  639. [
  640. 8745,
  641. 'intersection'
  642. ],
  643. [
  644. 8746,
  645. 'union'
  646. ],
  647. [
  648. 8706,
  649. 'partial differential'
  650. ],
  651. [
  652. 8704,
  653. 'for all'
  654. ],
  655. [
  656. 8707,
  657. 'there exists'
  658. ],
  659. [
  660. 8709,
  661. 'diameter'
  662. ],
  663. [
  664. 8711,
  665. 'backward difference'
  666. ],
  667. [
  668. 8727,
  669. 'asterisk operator'
  670. ],
  671. [
  672. 8733,
  673. 'proportional to'
  674. ],
  675. [
  676. 8736,
  677. 'angle'
  678. ]
  679. ]
  680. },
  681. {
  682. name: 'Extended Latin',
  683. characters: [
  684. [
  685. 192,
  686. 'A - grave'
  687. ],
  688. [
  689. 193,
  690. 'A - acute'
  691. ],
  692. [
  693. 194,
  694. 'A - circumflex'
  695. ],
  696. [
  697. 195,
  698. 'A - tilde'
  699. ],
  700. [
  701. 196,
  702. 'A - diaeresis'
  703. ],
  704. [
  705. 197,
  706. 'A - ring above'
  707. ],
  708. [
  709. 256,
  710. 'A - macron'
  711. ],
  712. [
  713. 198,
  714. 'ligature AE'
  715. ],
  716. [
  717. 199,
  718. 'C - cedilla'
  719. ],
  720. [
  721. 200,
  722. 'E - grave'
  723. ],
  724. [
  725. 201,
  726. 'E - acute'
  727. ],
  728. [
  729. 202,
  730. 'E - circumflex'
  731. ],
  732. [
  733. 203,
  734. 'E - diaeresis'
  735. ],
  736. [
  737. 274,
  738. 'E - macron'
  739. ],
  740. [
  741. 204,
  742. 'I - grave'
  743. ],
  744. [
  745. 205,
  746. 'I - acute'
  747. ],
  748. [
  749. 206,
  750. 'I - circumflex'
  751. ],
  752. [
  753. 207,
  754. 'I - diaeresis'
  755. ],
  756. [
  757. 298,
  758. 'I - macron'
  759. ],
  760. [
  761. 208,
  762. 'ETH'
  763. ],
  764. [
  765. 209,
  766. 'N - tilde'
  767. ],
  768. [
  769. 210,
  770. 'O - grave'
  771. ],
  772. [
  773. 211,
  774. 'O - acute'
  775. ],
  776. [
  777. 212,
  778. 'O - circumflex'
  779. ],
  780. [
  781. 213,
  782. 'O - tilde'
  783. ],
  784. [
  785. 214,
  786. 'O - diaeresis'
  787. ],
  788. [
  789. 216,
  790. 'O - slash'
  791. ],
  792. [
  793. 332,
  794. 'O - macron'
  795. ],
  796. [
  797. 338,
  798. 'ligature OE'
  799. ],
  800. [
  801. 352,
  802. 'S - caron'
  803. ],
  804. [
  805. 217,
  806. 'U - grave'
  807. ],
  808. [
  809. 218,
  810. 'U - acute'
  811. ],
  812. [
  813. 219,
  814. 'U - circumflex'
  815. ],
  816. [
  817. 220,
  818. 'U - diaeresis'
  819. ],
  820. [
  821. 362,
  822. 'U - macron'
  823. ],
  824. [
  825. 221,
  826. 'Y - acute'
  827. ],
  828. [
  829. 376,
  830. 'Y - diaeresis'
  831. ],
  832. [
  833. 562,
  834. 'Y - macron'
  835. ],
  836. [
  837. 222,
  838. 'THORN'
  839. ],
  840. [
  841. 224,
  842. 'a - grave'
  843. ],
  844. [
  845. 225,
  846. 'a - acute'
  847. ],
  848. [
  849. 226,
  850. 'a - circumflex'
  851. ],
  852. [
  853. 227,
  854. 'a - tilde'
  855. ],
  856. [
  857. 228,
  858. 'a - diaeresis'
  859. ],
  860. [
  861. 229,
  862. 'a - ring above'
  863. ],
  864. [
  865. 257,
  866. 'a - macron'
  867. ],
  868. [
  869. 230,
  870. 'ligature ae'
  871. ],
  872. [
  873. 231,
  874. 'c - cedilla'
  875. ],
  876. [
  877. 232,
  878. 'e - grave'
  879. ],
  880. [
  881. 233,
  882. 'e - acute'
  883. ],
  884. [
  885. 234,
  886. 'e - circumflex'
  887. ],
  888. [
  889. 235,
  890. 'e - diaeresis'
  891. ],
  892. [
  893. 275,
  894. 'e - macron'
  895. ],
  896. [
  897. 236,
  898. 'i - grave'
  899. ],
  900. [
  901. 237,
  902. 'i - acute'
  903. ],
  904. [
  905. 238,
  906. 'i - circumflex'
  907. ],
  908. [
  909. 239,
  910. 'i - diaeresis'
  911. ],
  912. [
  913. 299,
  914. 'i - macron'
  915. ],
  916. [
  917. 240,
  918. 'eth'
  919. ],
  920. [
  921. 241,
  922. 'n - tilde'
  923. ],
  924. [
  925. 242,
  926. 'o - grave'
  927. ],
  928. [
  929. 243,
  930. 'o - acute'
  931. ],
  932. [
  933. 244,
  934. 'o - circumflex'
  935. ],
  936. [
  937. 245,
  938. 'o - tilde'
  939. ],
  940. [
  941. 246,
  942. 'o - diaeresis'
  943. ],
  944. [
  945. 248,
  946. 'o slash'
  947. ],
  948. [
  949. 333,
  950. 'o macron'
  951. ],
  952. [
  953. 339,
  954. 'ligature oe'
  955. ],
  956. [
  957. 353,
  958. 's - caron'
  959. ],
  960. [
  961. 249,
  962. 'u - grave'
  963. ],
  964. [
  965. 250,
  966. 'u - acute'
  967. ],
  968. [
  969. 251,
  970. 'u - circumflex'
  971. ],
  972. [
  973. 252,
  974. 'u - diaeresis'
  975. ],
  976. [
  977. 363,
  978. 'u - macron'
  979. ],
  980. [
  981. 253,
  982. 'y - acute'
  983. ],
  984. [
  985. 254,
  986. 'thorn'
  987. ],
  988. [
  989. 255,
  990. 'y - diaeresis'
  991. ],
  992. [
  993. 563,
  994. 'y - macron'
  995. ],
  996. [
  997. 913,
  998. 'Alpha'
  999. ],
  1000. [
  1001. 914,
  1002. 'Beta'
  1003. ],
  1004. [
  1005. 915,
  1006. 'Gamma'
  1007. ],
  1008. [
  1009. 916,
  1010. 'Delta'
  1011. ],
  1012. [
  1013. 917,
  1014. 'Epsilon'
  1015. ],
  1016. [
  1017. 918,
  1018. 'Zeta'
  1019. ],
  1020. [
  1021. 919,
  1022. 'Eta'
  1023. ],
  1024. [
  1025. 920,
  1026. 'Theta'
  1027. ],
  1028. [
  1029. 921,
  1030. 'Iota'
  1031. ],
  1032. [
  1033. 922,
  1034. 'Kappa'
  1035. ],
  1036. [
  1037. 923,
  1038. 'Lambda'
  1039. ],
  1040. [
  1041. 924,
  1042. 'Mu'
  1043. ],
  1044. [
  1045. 925,
  1046. 'Nu'
  1047. ],
  1048. [
  1049. 926,
  1050. 'Xi'
  1051. ],
  1052. [
  1053. 927,
  1054. 'Omicron'
  1055. ],
  1056. [
  1057. 928,
  1058. 'Pi'
  1059. ],
  1060. [
  1061. 929,
  1062. 'Rho'
  1063. ],
  1064. [
  1065. 931,
  1066. 'Sigma'
  1067. ],
  1068. [
  1069. 932,
  1070. 'Tau'
  1071. ],
  1072. [
  1073. 933,
  1074. 'Upsilon'
  1075. ],
  1076. [
  1077. 934,
  1078. 'Phi'
  1079. ],
  1080. [
  1081. 935,
  1082. 'Chi'
  1083. ],
  1084. [
  1085. 936,
  1086. 'Psi'
  1087. ],
  1088. [
  1089. 937,
  1090. 'Omega'
  1091. ],
  1092. [
  1093. 945,
  1094. 'alpha'
  1095. ],
  1096. [
  1097. 946,
  1098. 'beta'
  1099. ],
  1100. [
  1101. 947,
  1102. 'gamma'
  1103. ],
  1104. [
  1105. 948,
  1106. 'delta'
  1107. ],
  1108. [
  1109. 949,
  1110. 'epsilon'
  1111. ],
  1112. [
  1113. 950,
  1114. 'zeta'
  1115. ],
  1116. [
  1117. 951,
  1118. 'eta'
  1119. ],
  1120. [
  1121. 952,
  1122. 'theta'
  1123. ],
  1124. [
  1125. 953,
  1126. 'iota'
  1127. ],
  1128. [
  1129. 954,
  1130. 'kappa'
  1131. ],
  1132. [
  1133. 955,
  1134. 'lambda'
  1135. ],
  1136. [
  1137. 956,
  1138. 'mu'
  1139. ],
  1140. [
  1141. 957,
  1142. 'nu'
  1143. ],
  1144. [
  1145. 958,
  1146. 'xi'
  1147. ],
  1148. [
  1149. 959,
  1150. 'omicron'
  1151. ],
  1152. [
  1153. 960,
  1154. 'pi'
  1155. ],
  1156. [
  1157. 961,
  1158. 'rho'
  1159. ],
  1160. [
  1161. 962,
  1162. 'final sigma'
  1163. ],
  1164. [
  1165. 963,
  1166. 'sigma'
  1167. ],
  1168. [
  1169. 964,
  1170. 'tau'
  1171. ],
  1172. [
  1173. 965,
  1174. 'upsilon'
  1175. ],
  1176. [
  1177. 966,
  1178. 'phi'
  1179. ],
  1180. [
  1181. 967,
  1182. 'chi'
  1183. ],
  1184. [
  1185. 968,
  1186. 'psi'
  1187. ],
  1188. [
  1189. 969,
  1190. 'omega'
  1191. ]
  1192. ]
  1193. },
  1194. {
  1195. name: 'Symbols',
  1196. characters: [
  1197. [
  1198. 8501,
  1199. 'alef symbol'
  1200. ],
  1201. [
  1202. 982,
  1203. 'pi symbol'
  1204. ],
  1205. [
  1206. 8476,
  1207. 'real part symbol'
  1208. ],
  1209. [
  1210. 978,
  1211. 'upsilon - hook symbol'
  1212. ],
  1213. [
  1214. 8472,
  1215. 'Weierstrass p'
  1216. ],
  1217. [
  1218. 8465,
  1219. 'imaginary part'
  1220. ]
  1221. ]
  1222. },
  1223. {
  1224. name: 'Arrows',
  1225. characters: [
  1226. [
  1227. 8592,
  1228. 'leftwards arrow'
  1229. ],
  1230. [
  1231. 8593,
  1232. 'upwards arrow'
  1233. ],
  1234. [
  1235. 8594,
  1236. 'rightwards arrow'
  1237. ],
  1238. [
  1239. 8595,
  1240. 'downwards arrow'
  1241. ],
  1242. [
  1243. 8596,
  1244. 'left right arrow'
  1245. ],
  1246. [
  1247. 8629,
  1248. 'carriage return'
  1249. ],
  1250. [
  1251. 8656,
  1252. 'leftwards double arrow'
  1253. ],
  1254. [
  1255. 8657,
  1256. 'upwards double arrow'
  1257. ],
  1258. [
  1259. 8658,
  1260. 'rightwards double arrow'
  1261. ],
  1262. [
  1263. 8659,
  1264. 'downwards double arrow'
  1265. ],
  1266. [
  1267. 8660,
  1268. 'left right double arrow'
  1269. ],
  1270. [
  1271. 8756,
  1272. 'therefore'
  1273. ],
  1274. [
  1275. 8834,
  1276. 'subset of'
  1277. ],
  1278. [
  1279. 8835,
  1280. 'superset of'
  1281. ],
  1282. [
  1283. 8836,
  1284. 'not a subset of'
  1285. ],
  1286. [
  1287. 8838,
  1288. 'subset of or equal to'
  1289. ],
  1290. [
  1291. 8839,
  1292. 'superset of or equal to'
  1293. ],
  1294. [
  1295. 8853,
  1296. 'circled plus'
  1297. ],
  1298. [
  1299. 8855,
  1300. 'circled times'
  1301. ],
  1302. [
  1303. 8869,
  1304. 'perpendicular'
  1305. ],
  1306. [
  1307. 8901,
  1308. 'dot operator'
  1309. ],
  1310. [
  1311. 8968,
  1312. 'left ceiling'
  1313. ],
  1314. [
  1315. 8969,
  1316. 'right ceiling'
  1317. ],
  1318. [
  1319. 8970,
  1320. 'left floor'
  1321. ],
  1322. [
  1323. 8971,
  1324. 'right floor'
  1325. ],
  1326. [
  1327. 9001,
  1328. 'left-pointing angle bracket'
  1329. ],
  1330. [
  1331. 9002,
  1332. 'right-pointing angle bracket'
  1333. ],
  1334. [
  1335. 9674,
  1336. 'lozenge'
  1337. ],
  1338. [
  1339. 9824,
  1340. 'black spade suit'
  1341. ],
  1342. [
  1343. 9827,
  1344. 'black club suit'
  1345. ],
  1346. [
  1347. 9829,
  1348. 'black heart suit'
  1349. ],
  1350. [
  1351. 9830,
  1352. 'black diamond suit'
  1353. ],
  1354. [
  1355. 8194,
  1356. 'en space'
  1357. ],
  1358. [
  1359. 8195,
  1360. 'em space'
  1361. ],
  1362. [
  1363. 8201,
  1364. 'thin space'
  1365. ],
  1366. [
  1367. 8204,
  1368. 'zero width non-joiner'
  1369. ],
  1370. [
  1371. 8205,
  1372. 'zero width joiner'
  1373. ],
  1374. [
  1375. 8206,
  1376. 'left-to-right mark'
  1377. ],
  1378. [
  1379. 8207,
  1380. 'right-to-left mark'
  1381. ]
  1382. ]
  1383. }
  1384. ];
  1385. };
  1386. var charmapFilter = function (charmap) {
  1387. return global$1.grep(charmap, function (item) {
  1388. return isArray(item) && item.length === 2;
  1389. });
  1390. };
  1391. var getCharsFromSetting = function (settingValue) {
  1392. if (isArray(settingValue)) {
  1393. return charmapFilter(settingValue);
  1394. }
  1395. if (typeof settingValue === 'function') {
  1396. return settingValue();
  1397. }
  1398. return [];
  1399. };
  1400. var extendCharMap = function (editor, charmap) {
  1401. var userCharMap = getCharMap$1(editor);
  1402. if (userCharMap) {
  1403. charmap = [{
  1404. name: UserDefined,
  1405. characters: getCharsFromSetting(userCharMap)
  1406. }];
  1407. }
  1408. var userCharMapAppend = getCharMapAppend(editor);
  1409. if (userCharMapAppend) {
  1410. var userDefinedGroup = global$1.grep(charmap, function (cg) {
  1411. return cg.name === UserDefined;
  1412. });
  1413. if (userDefinedGroup.length) {
  1414. userDefinedGroup[0].characters = [].concat(userDefinedGroup[0].characters).concat(getCharsFromSetting(userCharMapAppend));
  1415. return charmap;
  1416. }
  1417. return charmap.concat({
  1418. name: UserDefined,
  1419. characters: getCharsFromSetting(userCharMapAppend)
  1420. });
  1421. }
  1422. return charmap;
  1423. };
  1424. var getCharMap = function (editor) {
  1425. var groups = extendCharMap(editor, getDefaultCharMap());
  1426. return groups.length > 1 ? [{
  1427. name: 'All',
  1428. characters: bind(groups, function (g) {
  1429. return g.characters;
  1430. })
  1431. }].concat(groups) : groups;
  1432. };
  1433. var get = function (editor) {
  1434. var getCharMap$1 = function () {
  1435. return getCharMap(editor);
  1436. };
  1437. var insertChar$1 = function (chr) {
  1438. insertChar(editor, chr);
  1439. };
  1440. return {
  1441. getCharMap: getCharMap$1,
  1442. insertChar: insertChar$1
  1443. };
  1444. };
  1445. var Cell = function (initial) {
  1446. var value = initial;
  1447. var get = function () {
  1448. return value;
  1449. };
  1450. var set = function (v) {
  1451. value = v;
  1452. };
  1453. return {
  1454. get: get,
  1455. set: set
  1456. };
  1457. };
  1458. var last = function (fn, rate) {
  1459. var timer = null;
  1460. var cancel = function () {
  1461. if (!isNull(timer)) {
  1462. clearTimeout(timer);
  1463. timer = null;
  1464. }
  1465. };
  1466. var throttle = function () {
  1467. var args = [];
  1468. for (var _i = 0; _i < arguments.length; _i++) {
  1469. args[_i] = arguments[_i];
  1470. }
  1471. cancel();
  1472. timer = setTimeout(function () {
  1473. timer = null;
  1474. fn.apply(null, args);
  1475. }, rate);
  1476. };
  1477. return {
  1478. cancel: cancel,
  1479. throttle: throttle
  1480. };
  1481. };
  1482. var nativeFromCodePoint = String.fromCodePoint;
  1483. var contains = function (str, substr) {
  1484. return str.indexOf(substr) !== -1;
  1485. };
  1486. var fromCodePoint = function () {
  1487. var codePoints = [];
  1488. for (var _i = 0; _i < arguments.length; _i++) {
  1489. codePoints[_i] = arguments[_i];
  1490. }
  1491. if (nativeFromCodePoint) {
  1492. return nativeFromCodePoint.apply(void 0, codePoints);
  1493. } else {
  1494. var codeUnits = [];
  1495. var codeLen = 0;
  1496. var result = '';
  1497. for (var index = 0, len = codePoints.length; index !== len; ++index) {
  1498. var codePoint = +codePoints[index];
  1499. if (!(codePoint < 1114111 && codePoint >>> 0 === codePoint)) {
  1500. throw RangeError('Invalid code point: ' + codePoint);
  1501. }
  1502. if (codePoint <= 65535) {
  1503. codeLen = codeUnits.push(codePoint);
  1504. } else {
  1505. codePoint -= 65536;
  1506. codeLen = codeUnits.push((codePoint >> 10) + 55296, codePoint % 1024 + 56320);
  1507. }
  1508. if (codeLen >= 16383) {
  1509. result += String.fromCharCode.apply(null, codeUnits);
  1510. codeUnits.length = 0;
  1511. }
  1512. }
  1513. return result + String.fromCharCode.apply(null, codeUnits);
  1514. }
  1515. };
  1516. var charMatches = function (charCode, name, lowerCasePattern) {
  1517. if (contains(fromCodePoint(charCode).toLowerCase(), lowerCasePattern)) {
  1518. return true;
  1519. } else {
  1520. return contains(name.toLowerCase(), lowerCasePattern) || contains(name.toLowerCase().replace(/\s+/g, ''), lowerCasePattern);
  1521. }
  1522. };
  1523. var scan = function (group, pattern) {
  1524. var matches = [];
  1525. var lowerCasePattern = pattern.toLowerCase();
  1526. each(group.characters, function (g) {
  1527. if (charMatches(g[0], g[1], lowerCasePattern)) {
  1528. matches.push(g);
  1529. }
  1530. });
  1531. return map(matches, function (m) {
  1532. return {
  1533. text: m[1],
  1534. value: fromCodePoint(m[0]),
  1535. icon: fromCodePoint(m[0])
  1536. };
  1537. });
  1538. };
  1539. var patternName = 'pattern';
  1540. var open = function (editor, charMap) {
  1541. var makeGroupItems = function () {
  1542. return [
  1543. {
  1544. label: 'Search',
  1545. type: 'input',
  1546. name: patternName
  1547. },
  1548. {
  1549. type: 'collection',
  1550. name: 'results'
  1551. }
  1552. ];
  1553. };
  1554. var makeTabs = function () {
  1555. return map(charMap, function (charGroup) {
  1556. return {
  1557. title: charGroup.name,
  1558. name: charGroup.name,
  1559. items: makeGroupItems()
  1560. };
  1561. });
  1562. };
  1563. var makePanel = function () {
  1564. return {
  1565. type: 'panel',
  1566. items: makeGroupItems()
  1567. };
  1568. };
  1569. var makeTabPanel = function () {
  1570. return {
  1571. type: 'tabpanel',
  1572. tabs: makeTabs()
  1573. };
  1574. };
  1575. var currentTab = charMap.length === 1 ? Cell(UserDefined) : Cell('All');
  1576. var scanAndSet = function (dialogApi, pattern) {
  1577. find(charMap, function (group) {
  1578. return group.name === currentTab.get();
  1579. }).each(function (f) {
  1580. var items = scan(f, pattern);
  1581. dialogApi.setData({ results: items });
  1582. });
  1583. };
  1584. var SEARCH_DELAY = 40;
  1585. var updateFilter = last(function (dialogApi) {
  1586. var pattern = dialogApi.getData().pattern;
  1587. scanAndSet(dialogApi, pattern);
  1588. }, SEARCH_DELAY);
  1589. var body = charMap.length === 1 ? makePanel() : makeTabPanel();
  1590. var initialData = {
  1591. pattern: '',
  1592. results: scan(charMap[0], '')
  1593. };
  1594. var bridgeSpec = {
  1595. title: 'Special Character',
  1596. size: 'normal',
  1597. body: body,
  1598. buttons: [{
  1599. type: 'cancel',
  1600. name: 'close',
  1601. text: 'Close',
  1602. primary: true
  1603. }],
  1604. initialData: initialData,
  1605. onAction: function (api, details) {
  1606. if (details.name === 'results') {
  1607. insertChar(editor, details.value);
  1608. api.close();
  1609. }
  1610. },
  1611. onTabChange: function (dialogApi, details) {
  1612. currentTab.set(details.newTabName);
  1613. updateFilter.throttle(dialogApi);
  1614. },
  1615. onChange: function (dialogApi, changeData) {
  1616. if (changeData.name === patternName) {
  1617. updateFilter.throttle(dialogApi);
  1618. }
  1619. }
  1620. };
  1621. var dialogApi = editor.windowManager.open(bridgeSpec);
  1622. dialogApi.focus(patternName);
  1623. };
  1624. var register$1 = function (editor, charMap) {
  1625. editor.addCommand('mceShowCharmap', function () {
  1626. open(editor, charMap);
  1627. });
  1628. };
  1629. var global = tinymce.util.Tools.resolve('tinymce.util.Promise');
  1630. var init = function (editor, all) {
  1631. editor.ui.registry.addAutocompleter('charmap', {
  1632. ch: ':',
  1633. columns: 'auto',
  1634. minChars: 2,
  1635. fetch: function (pattern, _maxResults) {
  1636. return new global(function (resolve, _reject) {
  1637. resolve(scan(all, pattern));
  1638. });
  1639. },
  1640. onAction: function (autocompleteApi, rng, value) {
  1641. editor.selection.setRng(rng);
  1642. editor.insertContent(value);
  1643. autocompleteApi.hide();
  1644. }
  1645. });
  1646. };
  1647. var register = function (editor) {
  1648. editor.ui.registry.addButton('charmap', {
  1649. icon: 'insert-character',
  1650. tooltip: 'Special character',
  1651. onAction: function () {
  1652. return editor.execCommand('mceShowCharmap');
  1653. }
  1654. });
  1655. editor.ui.registry.addMenuItem('charmap', {
  1656. icon: 'insert-character',
  1657. text: 'Special character...',
  1658. onAction: function () {
  1659. return editor.execCommand('mceShowCharmap');
  1660. }
  1661. });
  1662. };
  1663. function Plugin () {
  1664. global$2.add('charmap', function (editor) {
  1665. var charMap = getCharMap(editor);
  1666. register$1(editor, charMap);
  1667. register(editor);
  1668. init(editor, charMap[0]);
  1669. return get(editor);
  1670. });
  1671. }
  1672. Plugin();
  1673. }());