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