plugin.js 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637
  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. })();