plugin.js 36 KB

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