plugin.js 35 KB

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