plugin.js 34 KB

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