The version of vichan running on lainchan.org
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

11007 líneas
409KB

  1. /*!
  2. * Quill Editor v1.2.6
  3. * https://quilljs.com/
  4. * Copyright (c) 2014, Jason Chen
  5. * Copyright (c) 2013, salesforce.com
  6. */
  7. (function webpackUniversalModuleDefinition(root, factory) {
  8. if(typeof exports === 'object' && typeof module === 'object')
  9. module.exports = factory();
  10. else if(typeof define === 'function' && define.amd)
  11. define([], factory);
  12. else if(typeof exports === 'object')
  13. exports["Quill"] = factory();
  14. else
  15. root["Quill"] = factory();
  16. })(this, function() {
  17. return /******/ (function(modules) { // webpackBootstrap
  18. /******/ // The module cache
  19. /******/ var installedModules = {};
  20. /******/
  21. /******/ // The require function
  22. /******/ function __webpack_require__(moduleId) {
  23. /******/
  24. /******/ // Check if module is in cache
  25. /******/ if(installedModules[moduleId]) {
  26. /******/ return installedModules[moduleId].exports;
  27. /******/ }
  28. /******/ // Create a new module (and put it into the cache)
  29. /******/ var module = installedModules[moduleId] = {
  30. /******/ i: moduleId,
  31. /******/ l: false,
  32. /******/ exports: {}
  33. /******/ };
  34. /******/
  35. /******/ // Execute the module function
  36. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37. /******/
  38. /******/ // Flag the module as loaded
  39. /******/ module.l = true;
  40. /******/
  41. /******/ // Return the exports of the module
  42. /******/ return module.exports;
  43. /******/ }
  44. /******/
  45. /******/
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __webpack_require__.m = modules;
  48. /******/
  49. /******/ // expose the module cache
  50. /******/ __webpack_require__.c = installedModules;
  51. /******/
  52. /******/ // identity function for calling harmony imports with the correct context
  53. /******/ __webpack_require__.i = function(value) { return value; };
  54. /******/
  55. /******/ // define getter function for harmony exports
  56. /******/ __webpack_require__.d = function(exports, name, getter) {
  57. /******/ if(!__webpack_require__.o(exports, name)) {
  58. /******/ Object.defineProperty(exports, name, {
  59. /******/ configurable: false,
  60. /******/ enumerable: true,
  61. /******/ get: getter
  62. /******/ });
  63. /******/ }
  64. /******/ };
  65. /******/
  66. /******/ // getDefaultExport function for compatibility with non-harmony modules
  67. /******/ __webpack_require__.n = function(module) {
  68. /******/ var getter = module && module.__esModule ?
  69. /******/ function getDefault() { return module['default']; } :
  70. /******/ function getModuleExports() { return module; };
  71. /******/ __webpack_require__.d(getter, 'a', getter);
  72. /******/ return getter;
  73. /******/ };
  74. /******/
  75. /******/ // Object.prototype.hasOwnProperty.call
  76. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  77. /******/
  78. /******/ // __webpack_public_path__
  79. /******/ __webpack_require__.p = "";
  80. /******/
  81. /******/ // Load entry module and return exports
  82. /******/ return __webpack_require__(__webpack_require__.s = 137);
  83. /******/ })
  84. /************************************************************************/
  85. /******/ ([
  86. /* 0 */
  87. /***/ (function(module, exports, __webpack_require__) {
  88. "use strict";
  89. Object.defineProperty(exports, "__esModule", { value: true });
  90. var container_1 = __webpack_require__(21);
  91. var format_1 = __webpack_require__(22);
  92. var leaf_1 = __webpack_require__(23);
  93. var scroll_1 = __webpack_require__(59);
  94. var inline_1 = __webpack_require__(58);
  95. var block_1 = __webpack_require__(56);
  96. var embed_1 = __webpack_require__(57);
  97. var text_1 = __webpack_require__(60);
  98. var attributor_1 = __webpack_require__(13);
  99. var class_1 = __webpack_require__(32);
  100. var style_1 = __webpack_require__(34);
  101. var store_1 = __webpack_require__(33);
  102. var Registry = __webpack_require__(1);
  103. var Parchment = {
  104. Scope: Registry.Scope,
  105. create: Registry.create,
  106. find: Registry.find,
  107. query: Registry.query,
  108. register: Registry.register,
  109. Container: container_1.default,
  110. Format: format_1.default,
  111. Leaf: leaf_1.default,
  112. Embed: embed_1.default,
  113. Scroll: scroll_1.default,
  114. Block: block_1.default,
  115. Inline: inline_1.default,
  116. Text: text_1.default,
  117. Attributor: {
  118. Attribute: attributor_1.default,
  119. Class: class_1.default,
  120. Style: style_1.default,
  121. Store: store_1.default
  122. }
  123. };
  124. exports.default = Parchment;
  125. /***/ }),
  126. /* 1 */
  127. /***/ (function(module, exports, __webpack_require__) {
  128. "use strict";
  129. var __extends = (this && this.__extends) || (function () {
  130. var extendStatics = Object.setPrototypeOf ||
  131. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  132. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  133. return function (d, b) {
  134. extendStatics(d, b);
  135. function __() { this.constructor = d; }
  136. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  137. };
  138. })();
  139. Object.defineProperty(exports, "__esModule", { value: true });
  140. var ParchmentError = (function (_super) {
  141. __extends(ParchmentError, _super);
  142. function ParchmentError(message) {
  143. var _this = this;
  144. message = '[Parchment] ' + message;
  145. _this = _super.call(this, message) || this;
  146. _this.message = message;
  147. _this.name = _this.constructor.name;
  148. return _this;
  149. }
  150. return ParchmentError;
  151. }(Error));
  152. exports.ParchmentError = ParchmentError;
  153. var attributes = {};
  154. var classes = {};
  155. var tags = {};
  156. var types = {};
  157. exports.DATA_KEY = '__blot';
  158. var Scope;
  159. (function (Scope) {
  160. Scope[Scope["TYPE"] = 3] = "TYPE";
  161. Scope[Scope["LEVEL"] = 12] = "LEVEL";
  162. Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
  163. Scope[Scope["BLOT"] = 14] = "BLOT";
  164. Scope[Scope["INLINE"] = 7] = "INLINE";
  165. Scope[Scope["BLOCK"] = 11] = "BLOCK";
  166. Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
  167. Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
  168. Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
  169. Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
  170. Scope[Scope["ANY"] = 15] = "ANY";
  171. })(Scope = exports.Scope || (exports.Scope = {}));
  172. ;
  173. function create(input, value) {
  174. var match = query(input);
  175. if (match == null) {
  176. throw new ParchmentError("Unable to create " + input + " blot");
  177. }
  178. var BlotClass = match;
  179. var node = (input instanceof Node || input['nodeType'] === Node.TEXT_NODE) ?
  180. input :
  181. BlotClass.create(value);
  182. return new BlotClass(node, value);
  183. }
  184. exports.create = create;
  185. function find(node, bubble) {
  186. if (bubble === void 0) { bubble = false; }
  187. if (node == null)
  188. return null;
  189. if (node[exports.DATA_KEY] != null)
  190. return node[exports.DATA_KEY].blot;
  191. if (bubble)
  192. return find(node.parentNode, bubble);
  193. return null;
  194. }
  195. exports.find = find;
  196. function query(query, scope) {
  197. if (scope === void 0) { scope = Scope.ANY; }
  198. var match;
  199. if (typeof query === 'string') {
  200. match = types[query] || attributes[query];
  201. }
  202. else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
  203. match = types['text'];
  204. }
  205. else if (typeof query === 'number') {
  206. if (query & Scope.LEVEL & Scope.BLOCK) {
  207. match = types['block'];
  208. }
  209. else if (query & Scope.LEVEL & Scope.INLINE) {
  210. match = types['inline'];
  211. }
  212. }
  213. else if (query instanceof HTMLElement) {
  214. var names = (query.getAttribute('class') || '').split(/\s+/);
  215. for (var i in names) {
  216. match = classes[names[i]];
  217. if (match)
  218. break;
  219. }
  220. match = match || tags[query.tagName];
  221. }
  222. if (match == null)
  223. return null;
  224. if ((scope & Scope.LEVEL & match.scope) && (scope & Scope.TYPE & match.scope))
  225. return match;
  226. return null;
  227. }
  228. exports.query = query;
  229. function register() {
  230. var Definitions = [];
  231. for (var _i = 0; _i < arguments.length; _i++) {
  232. Definitions[_i] = arguments[_i];
  233. }
  234. if (Definitions.length > 1) {
  235. return Definitions.map(function (d) {
  236. return register(d);
  237. });
  238. }
  239. var Definition = Definitions[0];
  240. if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
  241. throw new ParchmentError('Invalid definition');
  242. }
  243. else if (Definition.blotName === 'abstract') {
  244. throw new ParchmentError('Cannot register abstract class');
  245. }
  246. types[Definition.blotName || Definition.attrName] = Definition;
  247. if (typeof Definition.keyName === 'string') {
  248. attributes[Definition.keyName] = Definition;
  249. }
  250. else {
  251. if (Definition.className != null) {
  252. classes[Definition.className] = Definition;
  253. }
  254. if (Definition.tagName != null) {
  255. if (Array.isArray(Definition.tagName)) {
  256. Definition.tagName = Definition.tagName.map(function (tagName) {
  257. return tagName.toUpperCase();
  258. });
  259. }
  260. else {
  261. Definition.tagName = Definition.tagName.toUpperCase();
  262. }
  263. var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
  264. tagNames.forEach(function (tag) {
  265. if (tags[tag] == null || Definition.className == null) {
  266. tags[tag] = Definition;
  267. }
  268. });
  269. }
  270. }
  271. return Definition;
  272. }
  273. exports.register = register;
  274. /***/ }),
  275. /* 2 */
  276. /***/ (function(module, exports, __webpack_require__) {
  277. var diff = __webpack_require__(54);
  278. var equal = __webpack_require__(11);
  279. var extend = __webpack_require__(3);
  280. var op = __webpack_require__(20);
  281. var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
  282. var Delta = function (ops) {
  283. // Assume we are given a well formed ops
  284. if (Array.isArray(ops)) {
  285. this.ops = ops;
  286. } else if (ops != null && Array.isArray(ops.ops)) {
  287. this.ops = ops.ops;
  288. } else {
  289. this.ops = [];
  290. }
  291. };
  292. Delta.prototype.insert = function (text, attributes) {
  293. var newOp = {};
  294. if (text.length === 0) return this;
  295. newOp.insert = text;
  296. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  297. newOp.attributes = attributes;
  298. }
  299. return this.push(newOp);
  300. };
  301. Delta.prototype['delete'] = function (length) {
  302. if (length <= 0) return this;
  303. return this.push({ 'delete': length });
  304. };
  305. Delta.prototype.retain = function (length, attributes) {
  306. if (length <= 0) return this;
  307. var newOp = { retain: length };
  308. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  309. newOp.attributes = attributes;
  310. }
  311. return this.push(newOp);
  312. };
  313. Delta.prototype.push = function (newOp) {
  314. var index = this.ops.length;
  315. var lastOp = this.ops[index - 1];
  316. newOp = extend(true, {}, newOp);
  317. if (typeof lastOp === 'object') {
  318. if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
  319. this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
  320. return this;
  321. }
  322. // Since it does not matter if we insert before or after deleting at the same index,
  323. // always prefer to insert first
  324. if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
  325. index -= 1;
  326. lastOp = this.ops[index - 1];
  327. if (typeof lastOp !== 'object') {
  328. this.ops.unshift(newOp);
  329. return this;
  330. }
  331. }
  332. if (equal(newOp.attributes, lastOp.attributes)) {
  333. if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
  334. this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
  335. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  336. return this;
  337. } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
  338. this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
  339. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  340. return this;
  341. }
  342. }
  343. }
  344. if (index === this.ops.length) {
  345. this.ops.push(newOp);
  346. } else {
  347. this.ops.splice(index, 0, newOp);
  348. }
  349. return this;
  350. };
  351. Delta.prototype.filter = function (predicate) {
  352. return this.ops.filter(predicate);
  353. };
  354. Delta.prototype.forEach = function (predicate) {
  355. this.ops.forEach(predicate);
  356. };
  357. Delta.prototype.map = function (predicate) {
  358. return this.ops.map(predicate);
  359. };
  360. Delta.prototype.partition = function (predicate) {
  361. var passed = [], failed = [];
  362. this.forEach(function(op) {
  363. var target = predicate(op) ? passed : failed;
  364. target.push(op);
  365. });
  366. return [passed, failed];
  367. };
  368. Delta.prototype.reduce = function (predicate, initial) {
  369. return this.ops.reduce(predicate, initial);
  370. };
  371. Delta.prototype.chop = function () {
  372. var lastOp = this.ops[this.ops.length - 1];
  373. if (lastOp && lastOp.retain && !lastOp.attributes) {
  374. this.ops.pop();
  375. }
  376. return this;
  377. };
  378. Delta.prototype.length = function () {
  379. return this.reduce(function (length, elem) {
  380. return length + op.length(elem);
  381. }, 0);
  382. };
  383. Delta.prototype.slice = function (start, end) {
  384. start = start || 0;
  385. if (typeof end !== 'number') end = Infinity;
  386. var ops = [];
  387. var iter = op.iterator(this.ops);
  388. var index = 0;
  389. while (index < end && iter.hasNext()) {
  390. var nextOp;
  391. if (index < start) {
  392. nextOp = iter.next(start - index);
  393. } else {
  394. nextOp = iter.next(end - index);
  395. ops.push(nextOp);
  396. }
  397. index += op.length(nextOp);
  398. }
  399. return new Delta(ops);
  400. };
  401. Delta.prototype.compose = function (other) {
  402. var thisIter = op.iterator(this.ops);
  403. var otherIter = op.iterator(other.ops);
  404. var delta = new Delta();
  405. while (thisIter.hasNext() || otherIter.hasNext()) {
  406. if (otherIter.peekType() === 'insert') {
  407. delta.push(otherIter.next());
  408. } else if (thisIter.peekType() === 'delete') {
  409. delta.push(thisIter.next());
  410. } else {
  411. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  412. var thisOp = thisIter.next(length);
  413. var otherOp = otherIter.next(length);
  414. if (typeof otherOp.retain === 'number') {
  415. var newOp = {};
  416. if (typeof thisOp.retain === 'number') {
  417. newOp.retain = length;
  418. } else {
  419. newOp.insert = thisOp.insert;
  420. }
  421. // Preserve null when composing with a retain, otherwise remove it for inserts
  422. var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
  423. if (attributes) newOp.attributes = attributes;
  424. delta.push(newOp);
  425. // Other op should be delete, we could be an insert or retain
  426. // Insert + delete cancels out
  427. } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
  428. delta.push(otherOp);
  429. }
  430. }
  431. }
  432. return delta.chop();
  433. };
  434. Delta.prototype.concat = function (other) {
  435. var delta = new Delta(this.ops.slice());
  436. if (other.ops.length > 0) {
  437. delta.push(other.ops[0]);
  438. delta.ops = delta.ops.concat(other.ops.slice(1));
  439. }
  440. return delta;
  441. };
  442. Delta.prototype.diff = function (other, index) {
  443. if (this.ops === other.ops) {
  444. return new Delta();
  445. }
  446. var strings = [this, other].map(function (delta) {
  447. return delta.map(function (op) {
  448. if (op.insert != null) {
  449. return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
  450. }
  451. var prep = (delta === other) ? 'on' : 'with';
  452. throw new Error('diff() called ' + prep + ' non-document');
  453. }).join('');
  454. });
  455. var delta = new Delta();
  456. var diffResult = diff(strings[0], strings[1], index);
  457. var thisIter = op.iterator(this.ops);
  458. var otherIter = op.iterator(other.ops);
  459. diffResult.forEach(function (component) {
  460. var length = component[1].length;
  461. while (length > 0) {
  462. var opLength = 0;
  463. switch (component[0]) {
  464. case diff.INSERT:
  465. opLength = Math.min(otherIter.peekLength(), length);
  466. delta.push(otherIter.next(opLength));
  467. break;
  468. case diff.DELETE:
  469. opLength = Math.min(length, thisIter.peekLength());
  470. thisIter.next(opLength);
  471. delta['delete'](opLength);
  472. break;
  473. case diff.EQUAL:
  474. opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
  475. var thisOp = thisIter.next(opLength);
  476. var otherOp = otherIter.next(opLength);
  477. if (equal(thisOp.insert, otherOp.insert)) {
  478. delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
  479. } else {
  480. delta.push(otherOp)['delete'](opLength);
  481. }
  482. break;
  483. }
  484. length -= opLength;
  485. }
  486. });
  487. return delta.chop();
  488. };
  489. Delta.prototype.eachLine = function (predicate, newline) {
  490. newline = newline || '\n';
  491. var iter = op.iterator(this.ops);
  492. var line = new Delta();
  493. var i = 0;
  494. while (iter.hasNext()) {
  495. if (iter.peekType() !== 'insert') return;
  496. var thisOp = iter.peek();
  497. var start = op.length(thisOp) - iter.peekLength();
  498. var index = typeof thisOp.insert === 'string' ?
  499. thisOp.insert.indexOf(newline, start) - start : -1;
  500. if (index < 0) {
  501. line.push(iter.next());
  502. } else if (index > 0) {
  503. line.push(iter.next(index));
  504. } else {
  505. if (predicate(line, iter.next(1).attributes || {}, i) === false) {
  506. return;
  507. }
  508. i += 1;
  509. line = new Delta();
  510. }
  511. }
  512. if (line.length() > 0) {
  513. predicate(line, {}, i);
  514. }
  515. };
  516. Delta.prototype.transform = function (other, priority) {
  517. priority = !!priority;
  518. if (typeof other === 'number') {
  519. return this.transformPosition(other, priority);
  520. }
  521. var thisIter = op.iterator(this.ops);
  522. var otherIter = op.iterator(other.ops);
  523. var delta = new Delta();
  524. while (thisIter.hasNext() || otherIter.hasNext()) {
  525. if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
  526. delta.retain(op.length(thisIter.next()));
  527. } else if (otherIter.peekType() === 'insert') {
  528. delta.push(otherIter.next());
  529. } else {
  530. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  531. var thisOp = thisIter.next(length);
  532. var otherOp = otherIter.next(length);
  533. if (thisOp['delete']) {
  534. // Our delete either makes their delete redundant or removes their retain
  535. continue;
  536. } else if (otherOp['delete']) {
  537. delta.push(otherOp);
  538. } else {
  539. // We retain either their retain or insert
  540. delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
  541. }
  542. }
  543. }
  544. return delta.chop();
  545. };
  546. Delta.prototype.transformPosition = function (index, priority) {
  547. priority = !!priority;
  548. var thisIter = op.iterator(this.ops);
  549. var offset = 0;
  550. while (thisIter.hasNext() && offset <= index) {
  551. var length = thisIter.peekLength();
  552. var nextType = thisIter.peekType();
  553. thisIter.next();
  554. if (nextType === 'delete') {
  555. index -= Math.min(length, index - offset);
  556. continue;
  557. } else if (nextType === 'insert' && (offset < index || !priority)) {
  558. index += length;
  559. }
  560. offset += length;
  561. }
  562. return index;
  563. };
  564. module.exports = Delta;
  565. /***/ }),
  566. /* 3 */
  567. /***/ (function(module, exports) {
  568. 'use strict';
  569. var hasOwn = Object.prototype.hasOwnProperty;
  570. var toStr = Object.prototype.toString;
  571. var isArray = function isArray(arr) {
  572. if (typeof Array.isArray === 'function') {
  573. return Array.isArray(arr);
  574. }
  575. return toStr.call(arr) === '[object Array]';
  576. };
  577. var isPlainObject = function isPlainObject(obj) {
  578. if (!obj || toStr.call(obj) !== '[object Object]') {
  579. return false;
  580. }
  581. var hasOwnConstructor = hasOwn.call(obj, 'constructor');
  582. var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
  583. // Not own constructor property must be Object
  584. if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
  585. return false;
  586. }
  587. // Own properties are enumerated firstly, so to speed up,
  588. // if last one is own, then all properties are own.
  589. var key;
  590. for (key in obj) { /**/ }
  591. return typeof key === 'undefined' || hasOwn.call(obj, key);
  592. };
  593. module.exports = function extend() {
  594. var options, name, src, copy, copyIsArray, clone;
  595. var target = arguments[0];
  596. var i = 1;
  597. var length = arguments.length;
  598. var deep = false;
  599. // Handle a deep copy situation
  600. if (typeof target === 'boolean') {
  601. deep = target;
  602. target = arguments[1] || {};
  603. // skip the boolean and the target
  604. i = 2;
  605. }
  606. if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
  607. target = {};
  608. }
  609. for (; i < length; ++i) {
  610. options = arguments[i];
  611. // Only deal with non-null/undefined values
  612. if (options != null) {
  613. // Extend the base object
  614. for (name in options) {
  615. src = target[name];
  616. copy = options[name];
  617. // Prevent never-ending loop
  618. if (target !== copy) {
  619. // Recurse if we're merging plain objects or arrays
  620. if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
  621. if (copyIsArray) {
  622. copyIsArray = false;
  623. clone = src && isArray(src) ? src : [];
  624. } else {
  625. clone = src && isPlainObject(src) ? src : {};
  626. }
  627. // Never move original objects, clone them
  628. target[name] = extend(deep, clone, copy);
  629. // Don't bring in undefined values
  630. } else if (typeof copy !== 'undefined') {
  631. target[name] = copy;
  632. }
  633. }
  634. }
  635. }
  636. }
  637. // Return the modified object
  638. return target;
  639. };
  640. /***/ }),
  641. /* 4 */
  642. /***/ (function(module, exports, __webpack_require__) {
  643. "use strict";
  644. Object.defineProperty(exports, "__esModule", {
  645. value: true
  646. });
  647. exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
  648. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  649. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  650. var _extend = __webpack_require__(3);
  651. var _extend2 = _interopRequireDefault(_extend);
  652. var _quillDelta = __webpack_require__(2);
  653. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  654. var _parchment = __webpack_require__(0);
  655. var _parchment2 = _interopRequireDefault(_parchment);
  656. var _break = __webpack_require__(17);
  657. var _break2 = _interopRequireDefault(_break);
  658. var _embed = __webpack_require__(7);
  659. var _embed2 = _interopRequireDefault(_embed);
  660. var _inline = __webpack_require__(8);
  661. var _inline2 = _interopRequireDefault(_inline);
  662. var _text = __webpack_require__(12);
  663. var _text2 = _interopRequireDefault(_text);
  664. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  665. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  666. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  667. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  668. var NEWLINE_LENGTH = 1;
  669. var BlockEmbed = function (_Embed) {
  670. _inherits(BlockEmbed, _Embed);
  671. function BlockEmbed() {
  672. _classCallCheck(this, BlockEmbed);
  673. return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
  674. }
  675. _createClass(BlockEmbed, [{
  676. key: 'attach',
  677. value: function attach() {
  678. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
  679. this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
  680. }
  681. }, {
  682. key: 'delta',
  683. value: function delta() {
  684. return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
  685. }
  686. }, {
  687. key: 'format',
  688. value: function format(name, value) {
  689. var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
  690. if (attribute != null) {
  691. this.attributes.attribute(attribute, value);
  692. }
  693. }
  694. }, {
  695. key: 'formatAt',
  696. value: function formatAt(index, length, name, value) {
  697. this.format(name, value);
  698. }
  699. }, {
  700. key: 'insertAt',
  701. value: function insertAt(index, value, def) {
  702. if (typeof value === 'string' && value.endsWith('\n')) {
  703. var block = _parchment2.default.create(Block.blotName);
  704. this.parent.insertBefore(block, index === 0 ? this : this.next);
  705. block.insertAt(0, value.slice(0, -1));
  706. } else {
  707. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
  708. }
  709. }
  710. }]);
  711. return BlockEmbed;
  712. }(_embed2.default);
  713. BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
  714. // It is important for cursor behavior BlockEmbeds use tags that are block level elements
  715. var Block = function (_Parchment$Block) {
  716. _inherits(Block, _Parchment$Block);
  717. function Block(domNode) {
  718. _classCallCheck(this, Block);
  719. var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
  720. _this2.cache = {};
  721. return _this2;
  722. }
  723. _createClass(Block, [{
  724. key: 'delta',
  725. value: function delta() {
  726. if (this.cache.delta == null) {
  727. this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
  728. if (leaf.length() === 0) {
  729. return delta;
  730. } else {
  731. return delta.insert(leaf.value(), bubbleFormats(leaf));
  732. }
  733. }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
  734. }
  735. return this.cache.delta;
  736. }
  737. }, {
  738. key: 'deleteAt',
  739. value: function deleteAt(index, length) {
  740. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
  741. this.cache = {};
  742. }
  743. }, {
  744. key: 'formatAt',
  745. value: function formatAt(index, length, name, value) {
  746. if (length <= 0) return;
  747. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  748. if (index + length === this.length()) {
  749. this.format(name, value);
  750. }
  751. } else {
  752. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
  753. }
  754. this.cache = {};
  755. }
  756. }, {
  757. key: 'insertAt',
  758. value: function insertAt(index, value, def) {
  759. if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
  760. if (value.length === 0) return;
  761. var lines = value.split('\n');
  762. var text = lines.shift();
  763. if (text.length > 0) {
  764. if (index < this.length() - 1 || this.children.tail == null) {
  765. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
  766. } else {
  767. this.children.tail.insertAt(this.children.tail.length(), text);
  768. }
  769. this.cache = {};
  770. }
  771. var block = this;
  772. lines.reduce(function (index, line) {
  773. block = block.split(index, true);
  774. block.insertAt(0, line);
  775. return line.length;
  776. }, index + text.length);
  777. }
  778. }, {
  779. key: 'insertBefore',
  780. value: function insertBefore(blot, ref) {
  781. var head = this.children.head;
  782. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
  783. if (head instanceof _break2.default) {
  784. head.remove();
  785. }
  786. this.cache = {};
  787. }
  788. }, {
  789. key: 'length',
  790. value: function length() {
  791. if (this.cache.length == null) {
  792. this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
  793. }
  794. return this.cache.length;
  795. }
  796. }, {
  797. key: 'moveChildren',
  798. value: function moveChildren(target, ref) {
  799. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
  800. this.cache = {};
  801. }
  802. }, {
  803. key: 'optimize',
  804. value: function optimize() {
  805. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this);
  806. this.cache = {};
  807. }
  808. }, {
  809. key: 'path',
  810. value: function path(index) {
  811. return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
  812. }
  813. }, {
  814. key: 'removeChild',
  815. value: function removeChild(child) {
  816. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
  817. this.cache = {};
  818. }
  819. }, {
  820. key: 'split',
  821. value: function split(index) {
  822. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  823. if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
  824. var clone = this.clone();
  825. if (index === 0) {
  826. this.parent.insertBefore(clone, this);
  827. return this;
  828. } else {
  829. this.parent.insertBefore(clone, this.next);
  830. return clone;
  831. }
  832. } else {
  833. var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
  834. this.cache = {};
  835. return next;
  836. }
  837. }
  838. }]);
  839. return Block;
  840. }(_parchment2.default.Block);
  841. Block.blotName = 'block';
  842. Block.tagName = 'P';
  843. Block.defaultChild = 'break';
  844. Block.allowedChildren = [_inline2.default, _embed2.default, _text2.default];
  845. function bubbleFormats(blot) {
  846. var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  847. if (blot == null) return formats;
  848. if (typeof blot.formats === 'function') {
  849. formats = (0, _extend2.default)(formats, blot.formats());
  850. }
  851. if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
  852. return formats;
  853. }
  854. return bubbleFormats(blot.parent, formats);
  855. }
  856. exports.bubbleFormats = bubbleFormats;
  857. exports.BlockEmbed = BlockEmbed;
  858. exports.default = Block;
  859. /***/ }),
  860. /* 5 */
  861. /***/ (function(module, exports, __webpack_require__) {
  862. "use strict";
  863. Object.defineProperty(exports, "__esModule", {
  864. value: true
  865. });
  866. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  867. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  868. var _eventemitter = __webpack_require__(53);
  869. var _eventemitter2 = _interopRequireDefault(_eventemitter);
  870. var _logger = __webpack_require__(10);
  871. var _logger2 = _interopRequireDefault(_logger);
  872. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  873. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  874. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  875. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  876. var debug = (0, _logger2.default)('quill:events');
  877. var Emitter = function (_EventEmitter) {
  878. _inherits(Emitter, _EventEmitter);
  879. function Emitter() {
  880. _classCallCheck(this, Emitter);
  881. var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
  882. _this.on('error', debug.error);
  883. return _this;
  884. }
  885. _createClass(Emitter, [{
  886. key: 'emit',
  887. value: function emit() {
  888. debug.log.apply(debug, arguments);
  889. _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
  890. }
  891. }]);
  892. return Emitter;
  893. }(_eventemitter2.default);
  894. Emitter.events = {
  895. EDITOR_CHANGE: 'editor-change',
  896. SCROLL_BEFORE_UPDATE: 'scroll-before-update',
  897. SCROLL_OPTIMIZE: 'scroll-optimize',
  898. SCROLL_UPDATE: 'scroll-update',
  899. SELECTION_CHANGE: 'selection-change',
  900. TEXT_CHANGE: 'text-change'
  901. };
  902. Emitter.sources = {
  903. API: 'api',
  904. SILENT: 'silent',
  905. USER: 'user'
  906. };
  907. exports.default = Emitter;
  908. /***/ }),
  909. /* 6 */
  910. /***/ (function(module, exports, __webpack_require__) {
  911. "use strict";
  912. Object.defineProperty(exports, "__esModule", {
  913. value: true
  914. });
  915. exports.default = exports.overload = exports.expandConfig = undefined;
  916. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  917. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  918. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  919. __webpack_require__(44);
  920. var _quillDelta = __webpack_require__(2);
  921. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  922. var _editor = __webpack_require__(14);
  923. var _editor2 = _interopRequireDefault(_editor);
  924. var _emitter3 = __webpack_require__(5);
  925. var _emitter4 = _interopRequireDefault(_emitter3);
  926. var _module = __webpack_require__(9);
  927. var _module2 = _interopRequireDefault(_module);
  928. var _parchment = __webpack_require__(0);
  929. var _parchment2 = _interopRequireDefault(_parchment);
  930. var _selection = __webpack_require__(15);
  931. var _selection2 = _interopRequireDefault(_selection);
  932. var _extend = __webpack_require__(3);
  933. var _extend2 = _interopRequireDefault(_extend);
  934. var _logger = __webpack_require__(10);
  935. var _logger2 = _interopRequireDefault(_logger);
  936. var _theme = __webpack_require__(30);
  937. var _theme2 = _interopRequireDefault(_theme);
  938. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  939. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  940. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  941. var debug = (0, _logger2.default)('quill');
  942. var Quill = function () {
  943. _createClass(Quill, null, [{
  944. key: 'debug',
  945. value: function debug(limit) {
  946. if (limit === true) {
  947. limit = 'log';
  948. }
  949. _logger2.default.level(limit);
  950. }
  951. }, {
  952. key: 'find',
  953. value: function find(node) {
  954. return node.__quill || _parchment2.default.find(node);
  955. }
  956. }, {
  957. key: 'import',
  958. value: function _import(name) {
  959. if (this.imports[name] == null) {
  960. debug.error('Cannot import ' + name + '. Are you sure it was registered?');
  961. }
  962. return this.imports[name];
  963. }
  964. }, {
  965. key: 'register',
  966. value: function register(path, target) {
  967. var _this = this;
  968. var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  969. if (typeof path !== 'string') {
  970. var name = path.attrName || path.blotName;
  971. if (typeof name === 'string') {
  972. // register(Blot | Attributor, overwrite)
  973. this.register('formats/' + name, path, target);
  974. } else {
  975. Object.keys(path).forEach(function (key) {
  976. _this.register(key, path[key], target);
  977. });
  978. }
  979. } else {
  980. if (this.imports[path] != null && !overwrite) {
  981. debug.warn('Overwriting ' + path + ' with', target);
  982. }
  983. this.imports[path] = target;
  984. if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
  985. _parchment2.default.register(target);
  986. } else if (path.startsWith('modules') && typeof target.register === 'function') {
  987. target.register();
  988. }
  989. }
  990. }
  991. }]);
  992. function Quill(container) {
  993. var _this2 = this;
  994. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  995. _classCallCheck(this, Quill);
  996. this.options = expandConfig(container, options);
  997. this.container = this.options.container;
  998. if (this.container == null) {
  999. return debug.error('Invalid Quill container', container);
  1000. }
  1001. if (this.options.debug) {
  1002. Quill.debug(this.options.debug);
  1003. }
  1004. var html = this.container.innerHTML.trim();
  1005. this.container.classList.add('ql-container');
  1006. this.container.innerHTML = '';
  1007. this.container.__quill = this;
  1008. this.root = this.addContainer('ql-editor');
  1009. this.root.classList.add('ql-blank');
  1010. this.root.setAttribute('data-gramm', false);
  1011. this.scrollingContainer = this.options.scrollingContainer || this.root;
  1012. this.emitter = new _emitter4.default();
  1013. this.scroll = _parchment2.default.create(this.root, {
  1014. emitter: this.emitter,
  1015. scrollingContainer: this.scrollingContainer,
  1016. whitelist: this.options.formats
  1017. });
  1018. this.editor = new _editor2.default(this.scroll);
  1019. this.selection = new _selection2.default(this.scroll, this.emitter);
  1020. this.theme = new this.options.theme(this, this.options);
  1021. this.keyboard = this.theme.addModule('keyboard');
  1022. this.clipboard = this.theme.addModule('clipboard');
  1023. this.history = this.theme.addModule('history');
  1024. this.theme.init();
  1025. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
  1026. if (type === _emitter4.default.events.TEXT_CHANGE) {
  1027. _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
  1028. }
  1029. });
  1030. this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
  1031. var range = _this2.selection.lastRange;
  1032. var index = range && range.length === 0 ? range.index : undefined;
  1033. modify.call(_this2, function () {
  1034. return _this2.editor.update(null, mutations, index);
  1035. }, source);
  1036. });
  1037. var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
  1038. this.setContents(contents);
  1039. this.history.clear();
  1040. if (this.options.placeholder) {
  1041. this.root.setAttribute('data-placeholder', this.options.placeholder);
  1042. }
  1043. if (this.options.readOnly) {
  1044. this.disable();
  1045. }
  1046. }
  1047. _createClass(Quill, [{
  1048. key: 'addContainer',
  1049. value: function addContainer(container) {
  1050. var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1051. if (typeof container === 'string') {
  1052. var className = container;
  1053. container = document.createElement('div');
  1054. container.classList.add(className);
  1055. }
  1056. this.container.insertBefore(container, refNode);
  1057. return container;
  1058. }
  1059. }, {
  1060. key: 'blur',
  1061. value: function blur() {
  1062. this.selection.setRange(null);
  1063. }
  1064. }, {
  1065. key: 'deleteText',
  1066. value: function deleteText(index, length, source) {
  1067. var _this3 = this;
  1068. var _overload = overload(index, length, source);
  1069. var _overload2 = _slicedToArray(_overload, 4);
  1070. index = _overload2[0];
  1071. length = _overload2[1];
  1072. source = _overload2[3];
  1073. return modify.call(this, function () {
  1074. return _this3.editor.deleteText(index, length);
  1075. }, source, index, -1 * length);
  1076. }
  1077. }, {
  1078. key: 'disable',
  1079. value: function disable() {
  1080. this.enable(false);
  1081. }
  1082. }, {
  1083. key: 'enable',
  1084. value: function enable() {
  1085. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  1086. this.scroll.enable(enabled);
  1087. this.container.classList.toggle('ql-disabled', !enabled);
  1088. }
  1089. }, {
  1090. key: 'focus',
  1091. value: function focus() {
  1092. var scrollTop = this.scrollingContainer.scrollTop;
  1093. this.selection.focus();
  1094. this.scrollingContainer.scrollTop = scrollTop;
  1095. this.selection.scrollIntoView();
  1096. }
  1097. }, {
  1098. key: 'format',
  1099. value: function format(name, value) {
  1100. var _this4 = this;
  1101. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  1102. return modify.call(this, function () {
  1103. var range = _this4.getSelection(true);
  1104. var change = new _quillDelta2.default();
  1105. if (range == null) {
  1106. return change;
  1107. } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  1108. change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
  1109. } else if (range.length === 0) {
  1110. _this4.selection.format(name, value);
  1111. return change;
  1112. } else {
  1113. change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
  1114. }
  1115. _this4.setSelection(range, _emitter4.default.sources.SILENT);
  1116. return change;
  1117. }, source);
  1118. }
  1119. }, {
  1120. key: 'formatLine',
  1121. value: function formatLine(index, length, name, value, source) {
  1122. var _this5 = this;
  1123. var formats = void 0;
  1124. var _overload3 = overload(index, length, name, value, source);
  1125. var _overload4 = _slicedToArray(_overload3, 4);
  1126. index = _overload4[0];
  1127. length = _overload4[1];
  1128. formats = _overload4[2];
  1129. source = _overload4[3];
  1130. return modify.call(this, function () {
  1131. return _this5.editor.formatLine(index, length, formats);
  1132. }, source, index, 0);
  1133. }
  1134. }, {
  1135. key: 'formatText',
  1136. value: function formatText(index, length, name, value, source) {
  1137. var _this6 = this;
  1138. var formats = void 0;
  1139. var _overload5 = overload(index, length, name, value, source);
  1140. var _overload6 = _slicedToArray(_overload5, 4);
  1141. index = _overload6[0];
  1142. length = _overload6[1];
  1143. formats = _overload6[2];
  1144. source = _overload6[3];
  1145. return modify.call(this, function () {
  1146. return _this6.editor.formatText(index, length, formats);
  1147. }, source, index, 0);
  1148. }
  1149. }, {
  1150. key: 'getBounds',
  1151. value: function getBounds(index) {
  1152. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1153. var bounds = void 0;
  1154. if (typeof index === 'number') {
  1155. bounds = this.selection.getBounds(index, length);
  1156. } else {
  1157. bounds = this.selection.getBounds(index.index, index.length);
  1158. }
  1159. var containerBounds = this.container.getBoundingClientRect();
  1160. return {
  1161. bottom: bounds.bottom - containerBounds.top,
  1162. height: bounds.height,
  1163. left: bounds.left - containerBounds.left,
  1164. right: bounds.right - containerBounds.left,
  1165. top: bounds.top - containerBounds.top,
  1166. width: bounds.width
  1167. };
  1168. }
  1169. }, {
  1170. key: 'getContents',
  1171. value: function getContents() {
  1172. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1173. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1174. var _overload7 = overload(index, length);
  1175. var _overload8 = _slicedToArray(_overload7, 2);
  1176. index = _overload8[0];
  1177. length = _overload8[1];
  1178. return this.editor.getContents(index, length);
  1179. }
  1180. }, {
  1181. key: 'getFormat',
  1182. value: function getFormat() {
  1183. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection();
  1184. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1185. if (typeof index === 'number') {
  1186. return this.editor.getFormat(index, length);
  1187. } else {
  1188. return this.editor.getFormat(index.index, index.length);
  1189. }
  1190. }
  1191. }, {
  1192. key: 'getIndex',
  1193. value: function getIndex(blot) {
  1194. return blot.offset(this.scroll);
  1195. }
  1196. }, {
  1197. key: 'getLength',
  1198. value: function getLength() {
  1199. return this.scroll.length();
  1200. }
  1201. }, {
  1202. key: 'getLeaf',
  1203. value: function getLeaf(index) {
  1204. return this.scroll.leaf(index);
  1205. }
  1206. }, {
  1207. key: 'getLine',
  1208. value: function getLine(index) {
  1209. return this.scroll.line(index);
  1210. }
  1211. }, {
  1212. key: 'getLines',
  1213. value: function getLines() {
  1214. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1215. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  1216. if (typeof index !== 'number') {
  1217. return this.scroll.lines(index.index, index.length);
  1218. } else {
  1219. return this.scroll.lines(index, length);
  1220. }
  1221. }
  1222. }, {
  1223. key: 'getModule',
  1224. value: function getModule(name) {
  1225. return this.theme.modules[name];
  1226. }
  1227. }, {
  1228. key: 'getSelection',
  1229. value: function getSelection() {
  1230. var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1231. if (focus) this.focus();
  1232. this.update(); // Make sure we access getRange with editor in consistent state
  1233. return this.selection.getRange()[0];
  1234. }
  1235. }, {
  1236. key: 'getText',
  1237. value: function getText() {
  1238. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1239. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1240. var _overload9 = overload(index, length);
  1241. var _overload10 = _slicedToArray(_overload9, 2);
  1242. index = _overload10[0];
  1243. length = _overload10[1];
  1244. return this.editor.getText(index, length);
  1245. }
  1246. }, {
  1247. key: 'hasFocus',
  1248. value: function hasFocus() {
  1249. return this.selection.hasFocus();
  1250. }
  1251. }, {
  1252. key: 'insertEmbed',
  1253. value: function insertEmbed(index, embed, value) {
  1254. var _this7 = this;
  1255. var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
  1256. return modify.call(this, function () {
  1257. return _this7.editor.insertEmbed(index, embed, value);
  1258. }, source, index);
  1259. }
  1260. }, {
  1261. key: 'insertText',
  1262. value: function insertText(index, text, name, value, source) {
  1263. var _this8 = this;
  1264. var formats = void 0;
  1265. var _overload11 = overload(index, 0, name, value, source);
  1266. var _overload12 = _slicedToArray(_overload11, 4);
  1267. index = _overload12[0];
  1268. formats = _overload12[2];
  1269. source = _overload12[3];
  1270. return modify.call(this, function () {
  1271. return _this8.editor.insertText(index, text, formats);
  1272. }, source, index, text.length);
  1273. }
  1274. }, {
  1275. key: 'isEnabled',
  1276. value: function isEnabled() {
  1277. return !this.container.classList.contains('ql-disabled');
  1278. }
  1279. }, {
  1280. key: 'off',
  1281. value: function off() {
  1282. return this.emitter.off.apply(this.emitter, arguments);
  1283. }
  1284. }, {
  1285. key: 'on',
  1286. value: function on() {
  1287. return this.emitter.on.apply(this.emitter, arguments);
  1288. }
  1289. }, {
  1290. key: 'once',
  1291. value: function once() {
  1292. return this.emitter.once.apply(this.emitter, arguments);
  1293. }
  1294. }, {
  1295. key: 'pasteHTML',
  1296. value: function pasteHTML(index, html, source) {
  1297. this.clipboard.dangerouslyPasteHTML(index, html, source);
  1298. }
  1299. }, {
  1300. key: 'removeFormat',
  1301. value: function removeFormat(index, length, source) {
  1302. var _this9 = this;
  1303. var _overload13 = overload(index, length, source);
  1304. var _overload14 = _slicedToArray(_overload13, 4);
  1305. index = _overload14[0];
  1306. length = _overload14[1];
  1307. source = _overload14[3];
  1308. return modify.call(this, function () {
  1309. return _this9.editor.removeFormat(index, length);
  1310. }, source, index);
  1311. }
  1312. }, {
  1313. key: 'setContents',
  1314. value: function setContents(delta) {
  1315. var _this10 = this;
  1316. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1317. return modify.call(this, function () {
  1318. delta = new _quillDelta2.default(delta);
  1319. var length = _this10.getLength();
  1320. var deleted = _this10.editor.deleteText(0, length);
  1321. var applied = _this10.editor.applyDelta(delta);
  1322. var lastOp = applied.ops[applied.ops.length - 1];
  1323. if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
  1324. _this10.editor.deleteText(_this10.getLength() - 1, 1);
  1325. applied.delete(1);
  1326. }
  1327. var ret = deleted.compose(applied);
  1328. return ret;
  1329. }, source);
  1330. }
  1331. }, {
  1332. key: 'setSelection',
  1333. value: function setSelection(index, length, source) {
  1334. if (index == null) {
  1335. this.selection.setRange(null, length || Quill.sources.API);
  1336. } else {
  1337. var _overload15 = overload(index, length, source);
  1338. var _overload16 = _slicedToArray(_overload15, 4);
  1339. index = _overload16[0];
  1340. length = _overload16[1];
  1341. source = _overload16[3];
  1342. this.selection.setRange(new _selection.Range(index, length), source);
  1343. }
  1344. if (source !== _emitter4.default.sources.SILENT) {
  1345. this.selection.scrollIntoView();
  1346. }
  1347. }
  1348. }, {
  1349. key: 'setText',
  1350. value: function setText(text) {
  1351. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1352. var delta = new _quillDelta2.default().insert(text);
  1353. return this.setContents(delta, source);
  1354. }
  1355. }, {
  1356. key: 'update',
  1357. value: function update() {
  1358. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  1359. var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
  1360. this.selection.update(source);
  1361. return change;
  1362. }
  1363. }, {
  1364. key: 'updateContents',
  1365. value: function updateContents(delta) {
  1366. var _this11 = this;
  1367. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1368. return modify.call(this, function () {
  1369. delta = new _quillDelta2.default(delta);
  1370. return _this11.editor.applyDelta(delta, source);
  1371. }, source, true);
  1372. }
  1373. }]);
  1374. return Quill;
  1375. }();
  1376. Quill.DEFAULTS = {
  1377. bounds: null,
  1378. formats: null,
  1379. modules: {},
  1380. placeholder: '',
  1381. readOnly: false,
  1382. scrollingContainer: null,
  1383. strict: true,
  1384. theme: 'default'
  1385. };
  1386. Quill.events = _emitter4.default.events;
  1387. Quill.sources = _emitter4.default.sources;
  1388. // eslint-disable-next-line no-undef
  1389. Quill.version = false ? 'dev' : "1.2.6";
  1390. Quill.imports = {
  1391. 'delta': _quillDelta2.default,
  1392. 'parchment': _parchment2.default,
  1393. 'core/module': _module2.default,
  1394. 'core/theme': _theme2.default
  1395. };
  1396. function expandConfig(container, userConfig) {
  1397. userConfig = (0, _extend2.default)(true, {
  1398. container: container,
  1399. modules: {
  1400. clipboard: true,
  1401. keyboard: true,
  1402. history: true
  1403. }
  1404. }, userConfig);
  1405. if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
  1406. userConfig.theme = _theme2.default;
  1407. } else {
  1408. userConfig.theme = Quill.import('themes/' + userConfig.theme);
  1409. if (userConfig.theme == null) {
  1410. throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
  1411. }
  1412. }
  1413. var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
  1414. [themeConfig, userConfig].forEach(function (config) {
  1415. config.modules = config.modules || {};
  1416. Object.keys(config.modules).forEach(function (module) {
  1417. if (config.modules[module] === true) {
  1418. config.modules[module] = {};
  1419. }
  1420. });
  1421. });
  1422. var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
  1423. var moduleConfig = moduleNames.reduce(function (config, name) {
  1424. var moduleClass = Quill.import('modules/' + name);
  1425. if (moduleClass == null) {
  1426. debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
  1427. } else {
  1428. config[name] = moduleClass.DEFAULTS || {};
  1429. }
  1430. return config;
  1431. }, {});
  1432. // Special case toolbar shorthand
  1433. if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
  1434. userConfig.modules.toolbar = {
  1435. container: userConfig.modules.toolbar
  1436. };
  1437. }
  1438. userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
  1439. ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
  1440. if (typeof userConfig[key] === 'string') {
  1441. userConfig[key] = document.querySelector(userConfig[key]);
  1442. }
  1443. });
  1444. userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
  1445. if (userConfig.modules[name]) {
  1446. config[name] = userConfig.modules[name];
  1447. }
  1448. return config;
  1449. }, {});
  1450. return userConfig;
  1451. }
  1452. // Handle selection preservation and TEXT_CHANGE emission
  1453. // common to modification APIs
  1454. function modify(modifier, source, index, shift) {
  1455. if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
  1456. return new _quillDelta2.default();
  1457. }
  1458. var range = index == null ? null : this.getSelection();
  1459. var oldDelta = this.editor.delta;
  1460. var change = modifier();
  1461. if (range != null) {
  1462. if (index === true) index = range.index;
  1463. if (shift == null) {
  1464. range = shiftRange(range, change, source);
  1465. } else if (shift !== 0) {
  1466. range = shiftRange(range, index, shift, source);
  1467. }
  1468. this.setSelection(range, _emitter4.default.sources.SILENT);
  1469. }
  1470. if (change.length() > 0) {
  1471. var _emitter;
  1472. var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
  1473. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  1474. if (source !== _emitter4.default.sources.SILENT) {
  1475. var _emitter2;
  1476. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  1477. }
  1478. }
  1479. return change;
  1480. }
  1481. function overload(index, length, name, value, source) {
  1482. var formats = {};
  1483. if (typeof index.index === 'number' && typeof index.length === 'number') {
  1484. // Allow for throwaway end (used by insertText/insertEmbed)
  1485. if (typeof length !== 'number') {
  1486. source = value, value = name, name = length, length = index.length, index = index.index;
  1487. } else {
  1488. length = index.length, index = index.index;
  1489. }
  1490. } else if (typeof length !== 'number') {
  1491. source = value, value = name, name = length, length = 0;
  1492. }
  1493. // Handle format being object, two format name/value strings or excluded
  1494. if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
  1495. formats = name;
  1496. source = value;
  1497. } else if (typeof name === 'string') {
  1498. if (value != null) {
  1499. formats[name] = value;
  1500. } else {
  1501. source = name;
  1502. }
  1503. }
  1504. // Handle optional source
  1505. source = source || _emitter4.default.sources.API;
  1506. return [index, length, formats, source];
  1507. }
  1508. function shiftRange(range, index, length, source) {
  1509. if (range == null) return null;
  1510. var start = void 0,
  1511. end = void 0;
  1512. if (index instanceof _quillDelta2.default) {
  1513. var _map = [range.index, range.index + range.length].map(function (pos) {
  1514. return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
  1515. });
  1516. var _map2 = _slicedToArray(_map, 2);
  1517. start = _map2[0];
  1518. end = _map2[1];
  1519. } else {
  1520. var _map3 = [range.index, range.index + range.length].map(function (pos) {
  1521. if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
  1522. if (length >= 0) {
  1523. return pos + length;
  1524. } else {
  1525. return Math.max(index, pos + length);
  1526. }
  1527. });
  1528. var _map4 = _slicedToArray(_map3, 2);
  1529. start = _map4[0];
  1530. end = _map4[1];
  1531. }
  1532. return new _selection.Range(start, end - start);
  1533. }
  1534. exports.expandConfig = expandConfig;
  1535. exports.overload = overload;
  1536. exports.default = Quill;
  1537. /***/ }),
  1538. /* 7 */
  1539. /***/ (function(module, exports, __webpack_require__) {
  1540. "use strict";
  1541. Object.defineProperty(exports, "__esModule", {
  1542. value: true
  1543. });
  1544. var _parchment = __webpack_require__(0);
  1545. var _parchment2 = _interopRequireDefault(_parchment);
  1546. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1547. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1548. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1549. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1550. var Embed = function (_Parchment$Embed) {
  1551. _inherits(Embed, _Parchment$Embed);
  1552. function Embed() {
  1553. _classCallCheck(this, Embed);
  1554. return _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).apply(this, arguments));
  1555. }
  1556. return Embed;
  1557. }(_parchment2.default.Embed);
  1558. exports.default = Embed;
  1559. /***/ }),
  1560. /* 8 */
  1561. /***/ (function(module, exports, __webpack_require__) {
  1562. "use strict";
  1563. Object.defineProperty(exports, "__esModule", {
  1564. value: true
  1565. });
  1566. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1567. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1568. var _embed = __webpack_require__(7);
  1569. var _embed2 = _interopRequireDefault(_embed);
  1570. var _text = __webpack_require__(12);
  1571. var _text2 = _interopRequireDefault(_text);
  1572. var _parchment = __webpack_require__(0);
  1573. var _parchment2 = _interopRequireDefault(_parchment);
  1574. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1575. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1576. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1577. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1578. var Inline = function (_Parchment$Inline) {
  1579. _inherits(Inline, _Parchment$Inline);
  1580. function Inline() {
  1581. _classCallCheck(this, Inline);
  1582. return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
  1583. }
  1584. _createClass(Inline, [{
  1585. key: 'formatAt',
  1586. value: function formatAt(index, length, name, value) {
  1587. if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
  1588. var blot = this.isolate(index, length);
  1589. if (value) {
  1590. blot.wrap(name, value);
  1591. }
  1592. } else {
  1593. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
  1594. }
  1595. }
  1596. }, {
  1597. key: 'optimize',
  1598. value: function optimize() {
  1599. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this);
  1600. if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
  1601. var parent = this.parent.isolate(this.offset(), this.length());
  1602. this.moveChildren(parent);
  1603. parent.wrap(this);
  1604. }
  1605. }
  1606. }], [{
  1607. key: 'compare',
  1608. value: function compare(self, other) {
  1609. var selfIndex = Inline.order.indexOf(self);
  1610. var otherIndex = Inline.order.indexOf(other);
  1611. if (selfIndex >= 0 || otherIndex >= 0) {
  1612. return selfIndex - otherIndex;
  1613. } else if (self === other) {
  1614. return 0;
  1615. } else if (self < other) {
  1616. return -1;
  1617. } else {
  1618. return 1;
  1619. }
  1620. }
  1621. }]);
  1622. return Inline;
  1623. }(_parchment2.default.Inline);
  1624. Inline.allowedChildren = [Inline, _embed2.default, _text2.default];
  1625. // Lower index means deeper in the DOM tree, since not found (-1) is for embeds
  1626. Inline.order = ['cursor', 'inline', // Must be lower
  1627. 'code', 'underline', 'strike', 'italic', 'bold', 'script', 'link' // Must be higher
  1628. ];
  1629. exports.default = Inline;
  1630. /***/ }),
  1631. /* 9 */
  1632. /***/ (function(module, exports, __webpack_require__) {
  1633. "use strict";
  1634. Object.defineProperty(exports, "__esModule", {
  1635. value: true
  1636. });
  1637. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1638. var Module = function Module(quill) {
  1639. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1640. _classCallCheck(this, Module);
  1641. this.quill = quill;
  1642. this.options = options;
  1643. };
  1644. Module.DEFAULTS = {};
  1645. exports.default = Module;
  1646. /***/ }),
  1647. /* 10 */
  1648. /***/ (function(module, exports, __webpack_require__) {
  1649. "use strict";
  1650. Object.defineProperty(exports, "__esModule", {
  1651. value: true
  1652. });
  1653. var levels = ['error', 'warn', 'log', 'info'];
  1654. var level = 'warn';
  1655. function debug(method) {
  1656. if (levels.indexOf(method) <= levels.indexOf(level)) {
  1657. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1658. args[_key - 1] = arguments[_key];
  1659. }
  1660. console[method].apply(console, args); // eslint-disable-line no-console
  1661. }
  1662. }
  1663. function namespace(ns) {
  1664. return levels.reduce(function (logger, method) {
  1665. logger[method] = debug.bind(console, method, ns);
  1666. return logger;
  1667. }, {});
  1668. }
  1669. debug.level = namespace.level = function (newLevel) {
  1670. level = newLevel;
  1671. };
  1672. exports.default = namespace;
  1673. /***/ }),
  1674. /* 11 */
  1675. /***/ (function(module, exports, __webpack_require__) {
  1676. var pSlice = Array.prototype.slice;
  1677. var objectKeys = __webpack_require__(52);
  1678. var isArguments = __webpack_require__(51);
  1679. var deepEqual = module.exports = function (actual, expected, opts) {
  1680. if (!opts) opts = {};
  1681. // 7.1. All identical values are equivalent, as determined by ===.
  1682. if (actual === expected) {
  1683. return true;
  1684. } else if (actual instanceof Date && expected instanceof Date) {
  1685. return actual.getTime() === expected.getTime();
  1686. // 7.3. Other pairs that do not both pass typeof value == 'object',
  1687. // equivalence is determined by ==.
  1688. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
  1689. return opts.strict ? actual === expected : actual == expected;
  1690. // 7.4. For all other Object pairs, including Array objects, equivalence is
  1691. // determined by having the same number of owned properties (as verified
  1692. // with Object.prototype.hasOwnProperty.call), the same set of keys
  1693. // (although not necessarily the same order), equivalent values for every
  1694. // corresponding key, and an identical 'prototype' property. Note: this
  1695. // accounts for both named and indexed properties on Arrays.
  1696. } else {
  1697. return objEquiv(actual, expected, opts);
  1698. }
  1699. }
  1700. function isUndefinedOrNull(value) {
  1701. return value === null || value === undefined;
  1702. }
  1703. function isBuffer (x) {
  1704. if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
  1705. if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
  1706. return false;
  1707. }
  1708. if (x.length > 0 && typeof x[0] !== 'number') return false;
  1709. return true;
  1710. }
  1711. function objEquiv(a, b, opts) {
  1712. var i, key;
  1713. if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
  1714. return false;
  1715. // an identical 'prototype' property.
  1716. if (a.prototype !== b.prototype) return false;
  1717. //~~~I've managed to break Object.keys through screwy arguments passing.
  1718. // Converting to array solves the problem.
  1719. if (isArguments(a)) {
  1720. if (!isArguments(b)) {
  1721. return false;
  1722. }
  1723. a = pSlice.call(a);
  1724. b = pSlice.call(b);
  1725. return deepEqual(a, b, opts);
  1726. }
  1727. if (isBuffer(a)) {
  1728. if (!isBuffer(b)) {
  1729. return false;
  1730. }
  1731. if (a.length !== b.length) return false;
  1732. for (i = 0; i < a.length; i++) {
  1733. if (a[i] !== b[i]) return false;
  1734. }
  1735. return true;
  1736. }
  1737. try {
  1738. var ka = objectKeys(a),
  1739. kb = objectKeys(b);
  1740. } catch (e) {//happens when one is a string literal and the other isn't
  1741. return false;
  1742. }
  1743. // having the same number of owned properties (keys incorporates
  1744. // hasOwnProperty)
  1745. if (ka.length != kb.length)
  1746. return false;
  1747. //the same set of keys (although not necessarily the same order),
  1748. ka.sort();
  1749. kb.sort();
  1750. //~~~cheap key test
  1751. for (i = ka.length - 1; i >= 0; i--) {
  1752. if (ka[i] != kb[i])
  1753. return false;
  1754. }
  1755. //equivalent values for every corresponding key, and
  1756. //~~~possibly expensive deep test
  1757. for (i = ka.length - 1; i >= 0; i--) {
  1758. key = ka[i];
  1759. if (!deepEqual(a[key], b[key], opts)) return false;
  1760. }
  1761. return typeof a === typeof b;
  1762. }
  1763. /***/ }),
  1764. /* 12 */
  1765. /***/ (function(module, exports, __webpack_require__) {
  1766. "use strict";
  1767. Object.defineProperty(exports, "__esModule", {
  1768. value: true
  1769. });
  1770. var _parchment = __webpack_require__(0);
  1771. var _parchment2 = _interopRequireDefault(_parchment);
  1772. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1773. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1774. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1775. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1776. var TextBlot = function (_Parchment$Text) {
  1777. _inherits(TextBlot, _Parchment$Text);
  1778. function TextBlot() {
  1779. _classCallCheck(this, TextBlot);
  1780. return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
  1781. }
  1782. return TextBlot;
  1783. }(_parchment2.default.Text);
  1784. exports.default = TextBlot;
  1785. /***/ }),
  1786. /* 13 */
  1787. /***/ (function(module, exports, __webpack_require__) {
  1788. "use strict";
  1789. Object.defineProperty(exports, "__esModule", { value: true });
  1790. var Registry = __webpack_require__(1);
  1791. var Attributor = (function () {
  1792. function Attributor(attrName, keyName, options) {
  1793. if (options === void 0) { options = {}; }
  1794. this.attrName = attrName;
  1795. this.keyName = keyName;
  1796. var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
  1797. if (options.scope != null) {
  1798. // Ignore type bits, force attribute bit
  1799. this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
  1800. }
  1801. else {
  1802. this.scope = Registry.Scope.ATTRIBUTE;
  1803. }
  1804. if (options.whitelist != null)
  1805. this.whitelist = options.whitelist;
  1806. }
  1807. Attributor.keys = function (node) {
  1808. return [].map.call(node.attributes, function (item) {
  1809. return item.name;
  1810. });
  1811. };
  1812. Attributor.prototype.add = function (node, value) {
  1813. if (!this.canAdd(node, value))
  1814. return false;
  1815. node.setAttribute(this.keyName, value);
  1816. return true;
  1817. };
  1818. Attributor.prototype.canAdd = function (node, value) {
  1819. var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
  1820. if (match != null && (this.whitelist == null || this.whitelist.indexOf(value) > -1)) {
  1821. return true;
  1822. }
  1823. return false;
  1824. };
  1825. Attributor.prototype.remove = function (node) {
  1826. node.removeAttribute(this.keyName);
  1827. };
  1828. Attributor.prototype.value = function (node) {
  1829. var value = node.getAttribute(this.keyName);
  1830. return this.canAdd(node, value) ? value : '';
  1831. };
  1832. return Attributor;
  1833. }());
  1834. exports.default = Attributor;
  1835. /***/ }),
  1836. /* 14 */
  1837. /***/ (function(module, exports, __webpack_require__) {
  1838. "use strict";
  1839. Object.defineProperty(exports, "__esModule", {
  1840. value: true
  1841. });
  1842. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1843. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  1844. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1845. var _quillDelta = __webpack_require__(2);
  1846. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  1847. var _op = __webpack_require__(20);
  1848. var _op2 = _interopRequireDefault(_op);
  1849. var _parchment = __webpack_require__(0);
  1850. var _parchment2 = _interopRequireDefault(_parchment);
  1851. var _code = __webpack_require__(16);
  1852. var _code2 = _interopRequireDefault(_code);
  1853. var _cursor = __webpack_require__(25);
  1854. var _cursor2 = _interopRequireDefault(_cursor);
  1855. var _block = __webpack_require__(4);
  1856. var _block2 = _interopRequireDefault(_block);
  1857. var _clone = __webpack_require__(19);
  1858. var _clone2 = _interopRequireDefault(_clone);
  1859. var _deepEqual = __webpack_require__(11);
  1860. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  1861. var _extend = __webpack_require__(3);
  1862. var _extend2 = _interopRequireDefault(_extend);
  1863. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1864. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  1865. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1866. var ASCII = /^[ -~]*$/;
  1867. var Editor = function () {
  1868. function Editor(scroll) {
  1869. _classCallCheck(this, Editor);
  1870. this.scroll = scroll;
  1871. this.delta = this.getDelta();
  1872. }
  1873. _createClass(Editor, [{
  1874. key: 'applyDelta',
  1875. value: function applyDelta(delta) {
  1876. var _this = this;
  1877. var consumeNextNewline = false;
  1878. this.scroll.update();
  1879. var scrollLength = this.scroll.length();
  1880. this.scroll.batch = true;
  1881. delta = normalizeDelta(delta);
  1882. delta.reduce(function (index, op) {
  1883. var length = op.retain || op.delete || op.insert.length || 1;
  1884. var attributes = op.attributes || {};
  1885. if (op.insert != null) {
  1886. if (typeof op.insert === 'string') {
  1887. var text = op.insert;
  1888. if (text.endsWith('\n') && consumeNextNewline) {
  1889. consumeNextNewline = false;
  1890. text = text.slice(0, -1);
  1891. }
  1892. if (index >= scrollLength && !text.endsWith('\n')) {
  1893. consumeNextNewline = true;
  1894. }
  1895. _this.scroll.insertAt(index, text);
  1896. var _scroll$line = _this.scroll.line(index),
  1897. _scroll$line2 = _slicedToArray(_scroll$line, 2),
  1898. line = _scroll$line2[0],
  1899. offset = _scroll$line2[1];
  1900. var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
  1901. if (line instanceof _block2.default) {
  1902. var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
  1903. _line$descendant2 = _slicedToArray(_line$descendant, 1),
  1904. leaf = _line$descendant2[0];
  1905. formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
  1906. }
  1907. attributes = _op2.default.attributes.diff(formats, attributes) || {};
  1908. } else if (_typeof(op.insert) === 'object') {
  1909. var key = Object.keys(op.insert)[0]; // There should only be one key
  1910. if (key == null) return index;
  1911. _this.scroll.insertAt(index, key, op.insert[key]);
  1912. }
  1913. scrollLength += length;
  1914. }
  1915. Object.keys(attributes).forEach(function (name) {
  1916. _this.scroll.formatAt(index, length, name, attributes[name]);
  1917. });
  1918. return index + length;
  1919. }, 0);
  1920. delta.reduce(function (index, op) {
  1921. if (typeof op.delete === 'number') {
  1922. _this.scroll.deleteAt(index, op.delete);
  1923. return index;
  1924. }
  1925. return index + (op.retain || op.insert.length || 1);
  1926. }, 0);
  1927. this.scroll.batch = false;
  1928. this.scroll.optimize();
  1929. return this.update(delta);
  1930. }
  1931. }, {
  1932. key: 'deleteText',
  1933. value: function deleteText(index, length) {
  1934. this.scroll.deleteAt(index, length);
  1935. return this.update(new _quillDelta2.default().retain(index).delete(length));
  1936. }
  1937. }, {
  1938. key: 'formatLine',
  1939. value: function formatLine(index, length) {
  1940. var _this2 = this;
  1941. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  1942. this.scroll.update();
  1943. Object.keys(formats).forEach(function (format) {
  1944. if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
  1945. var lines = _this2.scroll.lines(index, Math.max(length, 1));
  1946. var lengthRemaining = length;
  1947. lines.forEach(function (line) {
  1948. var lineLength = line.length();
  1949. if (!(line instanceof _code2.default)) {
  1950. line.format(format, formats[format]);
  1951. } else {
  1952. var codeIndex = index - line.offset(_this2.scroll);
  1953. var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
  1954. line.formatAt(codeIndex, codeLength, format, formats[format]);
  1955. }
  1956. lengthRemaining -= lineLength;
  1957. });
  1958. });
  1959. this.scroll.optimize();
  1960. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  1961. }
  1962. }, {
  1963. key: 'formatText',
  1964. value: function formatText(index, length) {
  1965. var _this3 = this;
  1966. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  1967. Object.keys(formats).forEach(function (format) {
  1968. _this3.scroll.formatAt(index, length, format, formats[format]);
  1969. });
  1970. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  1971. }
  1972. }, {
  1973. key: 'getContents',
  1974. value: function getContents(index, length) {
  1975. return this.delta.slice(index, index + length);
  1976. }
  1977. }, {
  1978. key: 'getDelta',
  1979. value: function getDelta() {
  1980. return this.scroll.lines().reduce(function (delta, line) {
  1981. return delta.concat(line.delta());
  1982. }, new _quillDelta2.default());
  1983. }
  1984. }, {
  1985. key: 'getFormat',
  1986. value: function getFormat(index) {
  1987. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1988. var lines = [],
  1989. leaves = [];
  1990. if (length === 0) {
  1991. this.scroll.path(index).forEach(function (path) {
  1992. var _path = _slicedToArray(path, 1),
  1993. blot = _path[0];
  1994. if (blot instanceof _block2.default) {
  1995. lines.push(blot);
  1996. } else if (blot instanceof _parchment2.default.Leaf) {
  1997. leaves.push(blot);
  1998. }
  1999. });
  2000. } else {
  2001. lines = this.scroll.lines(index, length);
  2002. leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
  2003. }
  2004. var formatsArr = [lines, leaves].map(function (blots) {
  2005. if (blots.length === 0) return {};
  2006. var formats = (0, _block.bubbleFormats)(blots.shift());
  2007. while (Object.keys(formats).length > 0) {
  2008. var blot = blots.shift();
  2009. if (blot == null) return formats;
  2010. formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
  2011. }
  2012. return formats;
  2013. });
  2014. return _extend2.default.apply(_extend2.default, formatsArr);
  2015. }
  2016. }, {
  2017. key: 'getText',
  2018. value: function getText(index, length) {
  2019. return this.getContents(index, length).filter(function (op) {
  2020. return typeof op.insert === 'string';
  2021. }).map(function (op) {
  2022. return op.insert;
  2023. }).join('');
  2024. }
  2025. }, {
  2026. key: 'insertEmbed',
  2027. value: function insertEmbed(index, embed, value) {
  2028. this.scroll.insertAt(index, embed, value);
  2029. return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
  2030. }
  2031. }, {
  2032. key: 'insertText',
  2033. value: function insertText(index, text) {
  2034. var _this4 = this;
  2035. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2036. text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2037. this.scroll.insertAt(index, text);
  2038. Object.keys(formats).forEach(function (format) {
  2039. _this4.scroll.formatAt(index, text.length, format, formats[format]);
  2040. });
  2041. return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
  2042. }
  2043. }, {
  2044. key: 'isBlank',
  2045. value: function isBlank() {
  2046. if (this.scroll.children.length == 0) return true;
  2047. if (this.scroll.children.length > 1) return false;
  2048. var child = this.scroll.children.head;
  2049. return child.length() <= 1 && Object.keys(child.formats()).length == 0;
  2050. }
  2051. }, {
  2052. key: 'removeFormat',
  2053. value: function removeFormat(index, length) {
  2054. var text = this.getText(index, length);
  2055. var _scroll$line3 = this.scroll.line(index + length),
  2056. _scroll$line4 = _slicedToArray(_scroll$line3, 2),
  2057. line = _scroll$line4[0],
  2058. offset = _scroll$line4[1];
  2059. var suffixLength = 0,
  2060. suffix = new _quillDelta2.default();
  2061. if (line != null) {
  2062. if (!(line instanceof _code2.default)) {
  2063. suffixLength = line.length() - offset;
  2064. } else {
  2065. suffixLength = line.newlineIndex(offset) - offset + 1;
  2066. }
  2067. suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
  2068. }
  2069. var contents = this.getContents(index, length + suffixLength);
  2070. var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
  2071. var delta = new _quillDelta2.default().retain(index).concat(diff);
  2072. return this.applyDelta(delta);
  2073. }
  2074. }, {
  2075. key: 'update',
  2076. value: function update(change) {
  2077. var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2078. var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
  2079. var oldDelta = this.delta;
  2080. if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
  2081. // Optimization for character changes
  2082. var textBlot = _parchment2.default.find(mutations[0].target);
  2083. var formats = (0, _block.bubbleFormats)(textBlot);
  2084. var index = textBlot.offset(this.scroll);
  2085. var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
  2086. var oldText = new _quillDelta2.default().insert(oldValue);
  2087. var newText = new _quillDelta2.default().insert(textBlot.value());
  2088. var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
  2089. change = diffDelta.reduce(function (delta, op) {
  2090. if (op.insert) {
  2091. return delta.insert(op.insert, formats);
  2092. } else {
  2093. return delta.push(op);
  2094. }
  2095. }, new _quillDelta2.default());
  2096. this.delta = oldDelta.compose(change);
  2097. } else {
  2098. this.delta = this.getDelta();
  2099. if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
  2100. change = oldDelta.diff(this.delta, cursorIndex);
  2101. }
  2102. }
  2103. return change;
  2104. }
  2105. }]);
  2106. return Editor;
  2107. }();
  2108. function combineFormats(formats, combined) {
  2109. return Object.keys(combined).reduce(function (merged, name) {
  2110. if (formats[name] == null) return merged;
  2111. if (combined[name] === formats[name]) {
  2112. merged[name] = combined[name];
  2113. } else if (Array.isArray(combined[name])) {
  2114. if (combined[name].indexOf(formats[name]) < 0) {
  2115. merged[name] = combined[name].concat([formats[name]]);
  2116. }
  2117. } else {
  2118. merged[name] = [combined[name], formats[name]];
  2119. }
  2120. return merged;
  2121. }, {});
  2122. }
  2123. function normalizeDelta(delta) {
  2124. return delta.reduce(function (delta, op) {
  2125. if (op.insert === 1) {
  2126. var attributes = (0, _clone2.default)(op.attributes);
  2127. delete attributes['image'];
  2128. return delta.insert({ image: op.attributes.image }, attributes);
  2129. }
  2130. if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
  2131. op = (0, _clone2.default)(op);
  2132. if (op.attributes.list) {
  2133. op.attributes.list = 'ordered';
  2134. } else {
  2135. op.attributes.list = 'bullet';
  2136. delete op.attributes.bullet;
  2137. }
  2138. }
  2139. if (typeof op.insert === 'string') {
  2140. var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2141. return delta.insert(text, op.attributes);
  2142. }
  2143. return delta.push(op);
  2144. }, new _quillDelta2.default());
  2145. }
  2146. exports.default = Editor;
  2147. /***/ }),
  2148. /* 15 */
  2149. /***/ (function(module, exports, __webpack_require__) {
  2150. "use strict";
  2151. Object.defineProperty(exports, "__esModule", {
  2152. value: true
  2153. });
  2154. exports.default = exports.Range = undefined;
  2155. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2156. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2157. var _parchment = __webpack_require__(0);
  2158. var _parchment2 = _interopRequireDefault(_parchment);
  2159. var _clone = __webpack_require__(19);
  2160. var _clone2 = _interopRequireDefault(_clone);
  2161. var _deepEqual = __webpack_require__(11);
  2162. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2163. var _emitter3 = __webpack_require__(5);
  2164. var _emitter4 = _interopRequireDefault(_emitter3);
  2165. var _logger = __webpack_require__(10);
  2166. var _logger2 = _interopRequireDefault(_logger);
  2167. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2168. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  2169. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2170. var debug = (0, _logger2.default)('quill:selection');
  2171. var Range = function Range(index) {
  2172. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2173. _classCallCheck(this, Range);
  2174. this.index = index;
  2175. this.length = length;
  2176. };
  2177. var Selection = function () {
  2178. function Selection(scroll, emitter) {
  2179. var _this = this;
  2180. _classCallCheck(this, Selection);
  2181. this.emitter = emitter;
  2182. this.scroll = scroll;
  2183. this.composing = false;
  2184. this.root = this.scroll.domNode;
  2185. this.root.addEventListener('compositionstart', function () {
  2186. _this.composing = true;
  2187. });
  2188. this.root.addEventListener('compositionend', function () {
  2189. _this.composing = false;
  2190. });
  2191. this.cursor = _parchment2.default.create('cursor', this);
  2192. // savedRange is last non-null range
  2193. this.lastRange = this.savedRange = new Range(0, 0);
  2194. ['keyup', 'mouseup', 'mouseleave', 'touchend', 'touchleave', 'focus', 'blur'].forEach(function (eventName) {
  2195. _this.root.addEventListener(eventName, function () {
  2196. // When range used to be a selection and user click within the selection,
  2197. // the range now being a cursor has not updated yet without setTimeout
  2198. setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 100);
  2199. });
  2200. });
  2201. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
  2202. if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
  2203. _this.update(_emitter4.default.sources.SILENT);
  2204. }
  2205. });
  2206. this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
  2207. if (!_this.hasFocus()) return;
  2208. var native = _this.getNativeRange();
  2209. if (native == null) return;
  2210. if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
  2211. // TODO unclear if this has negative side effects
  2212. _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
  2213. try {
  2214. _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
  2215. } catch (ignored) {}
  2216. });
  2217. });
  2218. this.update(_emitter4.default.sources.SILENT);
  2219. }
  2220. _createClass(Selection, [{
  2221. key: 'focus',
  2222. value: function focus() {
  2223. if (this.hasFocus()) return;
  2224. this.root.focus();
  2225. this.setRange(this.savedRange);
  2226. }
  2227. }, {
  2228. key: 'format',
  2229. value: function format(_format, value) {
  2230. if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
  2231. this.scroll.update();
  2232. var nativeRange = this.getNativeRange();
  2233. if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
  2234. if (nativeRange.start.node !== this.cursor.textNode) {
  2235. var blot = _parchment2.default.find(nativeRange.start.node, false);
  2236. if (blot == null) return;
  2237. // TODO Give blot ability to not split
  2238. if (blot instanceof _parchment2.default.Leaf) {
  2239. var after = blot.split(nativeRange.start.offset);
  2240. blot.parent.insertBefore(this.cursor, after);
  2241. } else {
  2242. blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
  2243. }
  2244. this.cursor.attach();
  2245. }
  2246. this.cursor.format(_format, value);
  2247. this.scroll.optimize();
  2248. this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
  2249. this.update();
  2250. }
  2251. }, {
  2252. key: 'getBounds',
  2253. value: function getBounds(index) {
  2254. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2255. var scrollLength = this.scroll.length();
  2256. index = Math.min(index, scrollLength - 1);
  2257. length = Math.min(index + length, scrollLength - 1) - index;
  2258. var node = void 0,
  2259. _scroll$leaf = this.scroll.leaf(index),
  2260. _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
  2261. leaf = _scroll$leaf2[0],
  2262. offset = _scroll$leaf2[1];
  2263. if (leaf == null) return null;
  2264. var _leaf$position = leaf.position(offset, true);
  2265. var _leaf$position2 = _slicedToArray(_leaf$position, 2);
  2266. node = _leaf$position2[0];
  2267. offset = _leaf$position2[1];
  2268. var range = document.createRange();
  2269. if (length > 0) {
  2270. range.setStart(node, offset);
  2271. var _scroll$leaf3 = this.scroll.leaf(index + length);
  2272. var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
  2273. leaf = _scroll$leaf4[0];
  2274. offset = _scroll$leaf4[1];
  2275. if (leaf == null) return null;
  2276. var _leaf$position3 = leaf.position(offset, true);
  2277. var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
  2278. node = _leaf$position4[0];
  2279. offset = _leaf$position4[1];
  2280. range.setEnd(node, offset);
  2281. return range.getBoundingClientRect();
  2282. } else {
  2283. var side = 'left';
  2284. var rect = void 0;
  2285. if (node instanceof Text) {
  2286. if (offset < node.data.length) {
  2287. range.setStart(node, offset);
  2288. range.setEnd(node, offset + 1);
  2289. } else {
  2290. range.setStart(node, offset - 1);
  2291. range.setEnd(node, offset);
  2292. side = 'right';
  2293. }
  2294. rect = range.getBoundingClientRect();
  2295. } else {
  2296. rect = leaf.domNode.getBoundingClientRect();
  2297. if (offset > 0) side = 'right';
  2298. }
  2299. return {
  2300. bottom: rect.top + rect.height,
  2301. height: rect.height,
  2302. left: rect[side],
  2303. right: rect[side],
  2304. top: rect.top,
  2305. width: 0
  2306. };
  2307. }
  2308. }
  2309. }, {
  2310. key: 'getNativeRange',
  2311. value: function getNativeRange() {
  2312. var selection = document.getSelection();
  2313. if (selection == null || selection.rangeCount <= 0) return null;
  2314. var nativeRange = selection.getRangeAt(0);
  2315. if (nativeRange == null) return null;
  2316. var range = this.normalizeNative(nativeRange);
  2317. debug.info('getNativeRange', range);
  2318. return range;
  2319. }
  2320. }, {
  2321. key: 'getRange',
  2322. value: function getRange() {
  2323. var normalized = this.getNativeRange();
  2324. if (normalized == null) return [null, null];
  2325. var range = this.normalizedToRange(normalized);
  2326. return [range, normalized];
  2327. }
  2328. }, {
  2329. key: 'hasFocus',
  2330. value: function hasFocus() {
  2331. return document.activeElement === this.root;
  2332. }
  2333. }, {
  2334. key: 'normalizedToRange',
  2335. value: function normalizedToRange(range) {
  2336. var _this2 = this;
  2337. var positions = [[range.start.node, range.start.offset]];
  2338. if (!range.native.collapsed) {
  2339. positions.push([range.end.node, range.end.offset]);
  2340. }
  2341. var indexes = positions.map(function (position) {
  2342. var _position = _slicedToArray(position, 2),
  2343. node = _position[0],
  2344. offset = _position[1];
  2345. var blot = _parchment2.default.find(node, true);
  2346. var index = blot.offset(_this2.scroll);
  2347. if (offset === 0) {
  2348. return index;
  2349. } else if (blot instanceof _parchment2.default.Container) {
  2350. return index + blot.length();
  2351. } else {
  2352. return index + blot.index(node, offset);
  2353. }
  2354. });
  2355. var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
  2356. var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
  2357. return new Range(start, end - start);
  2358. }
  2359. }, {
  2360. key: 'normalizeNative',
  2361. value: function normalizeNative(nativeRange) {
  2362. if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
  2363. return null;
  2364. }
  2365. var range = {
  2366. start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
  2367. end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
  2368. native: nativeRange
  2369. };
  2370. [range.start, range.end].forEach(function (position) {
  2371. var node = position.node,
  2372. offset = position.offset;
  2373. while (!(node instanceof Text) && node.childNodes.length > 0) {
  2374. if (node.childNodes.length > offset) {
  2375. node = node.childNodes[offset];
  2376. offset = 0;
  2377. } else if (node.childNodes.length === offset) {
  2378. node = node.lastChild;
  2379. offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
  2380. } else {
  2381. break;
  2382. }
  2383. }
  2384. position.node = node, position.offset = offset;
  2385. });
  2386. return range;
  2387. }
  2388. }, {
  2389. key: 'rangeToNative',
  2390. value: function rangeToNative(range) {
  2391. var _this3 = this;
  2392. var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
  2393. var args = [];
  2394. var scrollLength = this.scroll.length();
  2395. indexes.forEach(function (index, i) {
  2396. index = Math.min(scrollLength - 1, index);
  2397. var node = void 0,
  2398. _scroll$leaf5 = _this3.scroll.leaf(index),
  2399. _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
  2400. leaf = _scroll$leaf6[0],
  2401. offset = _scroll$leaf6[1];
  2402. var _leaf$position5 = leaf.position(offset, i !== 0);
  2403. var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
  2404. node = _leaf$position6[0];
  2405. offset = _leaf$position6[1];
  2406. args.push(node, offset);
  2407. });
  2408. if (args.length < 2) {
  2409. args = args.concat(args);
  2410. }
  2411. return args;
  2412. }
  2413. }, {
  2414. key: 'scrollIntoView',
  2415. value: function scrollIntoView() {
  2416. var range = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.lastRange;
  2417. if (range == null) return;
  2418. var bounds = this.getBounds(range.index, range.length);
  2419. if (bounds == null) return;
  2420. var limit = this.scroll.length() - 1;
  2421. var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
  2422. _scroll$line2 = _slicedToArray(_scroll$line, 1),
  2423. first = _scroll$line2[0];
  2424. var last = first;
  2425. if (range.length > 0) {
  2426. var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
  2427. var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
  2428. last = _scroll$line4[0];
  2429. }
  2430. if (first == null || last == null) return;
  2431. var scroller = this.scroll.scrollingContainer;
  2432. var scrollBounds = scroller.getBoundingClientRect();
  2433. if (bounds.top < scrollBounds.top) {
  2434. scroller.scrollTop -= scrollBounds.top - bounds.top;
  2435. } else if (bounds.bottom > scrollBounds.bottom) {
  2436. scroller.scrollTop += bounds.bottom - scrollBounds.bottom;
  2437. }
  2438. }
  2439. }, {
  2440. key: 'setNativeRange',
  2441. value: function setNativeRange(startNode, startOffset) {
  2442. var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
  2443. var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
  2444. var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  2445. debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
  2446. if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
  2447. return;
  2448. }
  2449. var selection = document.getSelection();
  2450. if (selection == null) return;
  2451. if (startNode != null) {
  2452. if (!this.hasFocus()) this.root.focus();
  2453. var native = (this.getNativeRange() || {}).native;
  2454. if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
  2455. if (startNode.tagName == "BR") {
  2456. startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
  2457. startNode = startNode.parentNode;
  2458. }
  2459. if (endNode.tagName == "BR") {
  2460. endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
  2461. endNode = endNode.parentNode;
  2462. }
  2463. var range = document.createRange();
  2464. range.setStart(startNode, startOffset);
  2465. range.setEnd(endNode, endOffset);
  2466. selection.removeAllRanges();
  2467. selection.addRange(range);
  2468. }
  2469. } else {
  2470. selection.removeAllRanges();
  2471. this.root.blur();
  2472. document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
  2473. }
  2474. }
  2475. }, {
  2476. key: 'setRange',
  2477. value: function setRange(range) {
  2478. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2479. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  2480. if (typeof force === 'string') {
  2481. source = force;
  2482. force = false;
  2483. }
  2484. debug.info('setRange', range);
  2485. if (range != null) {
  2486. var args = this.rangeToNative(range);
  2487. this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
  2488. } else {
  2489. this.setNativeRange(null);
  2490. }
  2491. this.update(source);
  2492. }
  2493. }, {
  2494. key: 'update',
  2495. value: function update() {
  2496. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  2497. var oldRange = this.lastRange;
  2498. var _getRange = this.getRange(),
  2499. _getRange2 = _slicedToArray(_getRange, 2),
  2500. lastRange = _getRange2[0],
  2501. nativeRange = _getRange2[1];
  2502. this.lastRange = lastRange;
  2503. if (this.lastRange != null) {
  2504. this.savedRange = this.lastRange;
  2505. }
  2506. if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
  2507. var _emitter;
  2508. if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
  2509. this.cursor.restore();
  2510. }
  2511. var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
  2512. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  2513. if (source !== _emitter4.default.sources.SILENT) {
  2514. var _emitter2;
  2515. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  2516. }
  2517. }
  2518. }
  2519. }]);
  2520. return Selection;
  2521. }();
  2522. function contains(parent, descendant) {
  2523. try {
  2524. // Firefox inserts inaccessible nodes around video elements
  2525. descendant.parentNode;
  2526. } catch (e) {
  2527. return false;
  2528. }
  2529. // IE11 has bug with Text nodes
  2530. // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
  2531. if (descendant instanceof Text) {
  2532. descendant = descendant.parentNode;
  2533. }
  2534. return parent.contains(descendant);
  2535. }
  2536. exports.Range = Range;
  2537. exports.default = Selection;
  2538. /***/ }),
  2539. /* 16 */
  2540. /***/ (function(module, exports, __webpack_require__) {
  2541. "use strict";
  2542. Object.defineProperty(exports, "__esModule", {
  2543. value: true
  2544. });
  2545. exports.default = exports.Code = undefined;
  2546. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2547. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2548. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2549. var _quillDelta = __webpack_require__(2);
  2550. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  2551. var _parchment = __webpack_require__(0);
  2552. var _parchment2 = _interopRequireDefault(_parchment);
  2553. var _block = __webpack_require__(4);
  2554. var _block2 = _interopRequireDefault(_block);
  2555. var _inline = __webpack_require__(8);
  2556. var _inline2 = _interopRequireDefault(_inline);
  2557. var _text = __webpack_require__(12);
  2558. var _text2 = _interopRequireDefault(_text);
  2559. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2560. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2561. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2562. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2563. var Code = function (_Inline) {
  2564. _inherits(Code, _Inline);
  2565. function Code() {
  2566. _classCallCheck(this, Code);
  2567. return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
  2568. }
  2569. return Code;
  2570. }(_inline2.default);
  2571. Code.blotName = 'code';
  2572. Code.tagName = 'CODE';
  2573. var CodeBlock = function (_Block) {
  2574. _inherits(CodeBlock, _Block);
  2575. function CodeBlock() {
  2576. _classCallCheck(this, CodeBlock);
  2577. return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
  2578. }
  2579. _createClass(CodeBlock, [{
  2580. key: 'delta',
  2581. value: function delta() {
  2582. var _this3 = this;
  2583. var text = this.domNode.textContent;
  2584. if (text.endsWith('\n')) {
  2585. // Should always be true
  2586. text = text.slice(0, -1);
  2587. }
  2588. return text.split('\n').reduce(function (delta, frag) {
  2589. return delta.insert(frag).insert('\n', _this3.formats());
  2590. }, new _quillDelta2.default());
  2591. }
  2592. }, {
  2593. key: 'format',
  2594. value: function format(name, value) {
  2595. if (name === this.statics.blotName && value) return;
  2596. var _descendant = this.descendant(_text2.default, this.length() - 1),
  2597. _descendant2 = _slicedToArray(_descendant, 1),
  2598. text = _descendant2[0];
  2599. if (text != null) {
  2600. text.deleteAt(text.length() - 1, 1);
  2601. }
  2602. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
  2603. }
  2604. }, {
  2605. key: 'formatAt',
  2606. value: function formatAt(index, length, name, value) {
  2607. if (length === 0) return;
  2608. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
  2609. return;
  2610. }
  2611. var nextNewline = this.newlineIndex(index);
  2612. if (nextNewline < 0 || nextNewline >= index + length) return;
  2613. var prevNewline = this.newlineIndex(index, true) + 1;
  2614. var isolateLength = nextNewline - prevNewline + 1;
  2615. var blot = this.isolate(prevNewline, isolateLength);
  2616. var next = blot.next;
  2617. blot.format(name, value);
  2618. if (next instanceof CodeBlock) {
  2619. next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
  2620. }
  2621. }
  2622. }, {
  2623. key: 'insertAt',
  2624. value: function insertAt(index, value, def) {
  2625. if (def != null) return;
  2626. var _descendant3 = this.descendant(_text2.default, index),
  2627. _descendant4 = _slicedToArray(_descendant3, 2),
  2628. text = _descendant4[0],
  2629. offset = _descendant4[1];
  2630. text.insertAt(offset, value);
  2631. }
  2632. }, {
  2633. key: 'length',
  2634. value: function length() {
  2635. var length = this.domNode.textContent.length;
  2636. if (!this.domNode.textContent.endsWith('\n')) {
  2637. return length + 1;
  2638. }
  2639. return length;
  2640. }
  2641. }, {
  2642. key: 'newlineIndex',
  2643. value: function newlineIndex(searchIndex) {
  2644. var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2645. if (!reverse) {
  2646. var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
  2647. return offset > -1 ? searchIndex + offset : -1;
  2648. } else {
  2649. return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
  2650. }
  2651. }
  2652. }, {
  2653. key: 'optimize',
  2654. value: function optimize() {
  2655. if (!this.domNode.textContent.endsWith('\n')) {
  2656. this.appendChild(_parchment2.default.create('text', '\n'));
  2657. }
  2658. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this);
  2659. var next = this.next;
  2660. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
  2661. next.optimize();
  2662. next.moveChildren(this);
  2663. next.remove();
  2664. }
  2665. }
  2666. }, {
  2667. key: 'replace',
  2668. value: function replace(target) {
  2669. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
  2670. [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
  2671. var blot = _parchment2.default.find(node);
  2672. if (blot == null) {
  2673. node.parentNode.removeChild(node);
  2674. } else if (blot instanceof _parchment2.default.Embed) {
  2675. blot.remove();
  2676. } else {
  2677. blot.unwrap();
  2678. }
  2679. });
  2680. }
  2681. }], [{
  2682. key: 'create',
  2683. value: function create(value) {
  2684. var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
  2685. domNode.setAttribute('spellcheck', false);
  2686. return domNode;
  2687. }
  2688. }, {
  2689. key: 'formats',
  2690. value: function formats() {
  2691. return true;
  2692. }
  2693. }]);
  2694. return CodeBlock;
  2695. }(_block2.default);
  2696. CodeBlock.blotName = 'code-block';
  2697. CodeBlock.tagName = 'PRE';
  2698. CodeBlock.TAB = ' ';
  2699. exports.Code = Code;
  2700. exports.default = CodeBlock;
  2701. /***/ }),
  2702. /* 17 */
  2703. /***/ (function(module, exports, __webpack_require__) {
  2704. "use strict";
  2705. Object.defineProperty(exports, "__esModule", {
  2706. value: true
  2707. });
  2708. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2709. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2710. var _embed = __webpack_require__(7);
  2711. var _embed2 = _interopRequireDefault(_embed);
  2712. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2713. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2714. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2715. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2716. var Break = function (_Embed) {
  2717. _inherits(Break, _Embed);
  2718. function Break() {
  2719. _classCallCheck(this, Break);
  2720. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
  2721. }
  2722. _createClass(Break, [{
  2723. key: 'insertInto',
  2724. value: function insertInto(parent, ref) {
  2725. if (parent.children.length === 0) {
  2726. _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
  2727. } else {
  2728. this.remove();
  2729. }
  2730. }
  2731. }, {
  2732. key: 'length',
  2733. value: function length() {
  2734. return 0;
  2735. }
  2736. }, {
  2737. key: 'value',
  2738. value: function value() {
  2739. return '';
  2740. }
  2741. }], [{
  2742. key: 'value',
  2743. value: function value() {
  2744. return undefined;
  2745. }
  2746. }]);
  2747. return Break;
  2748. }(_embed2.default);
  2749. Break.blotName = 'break';
  2750. Break.tagName = 'BR';
  2751. exports.default = Break;
  2752. /***/ }),
  2753. /* 18 */
  2754. /***/ (function(module, exports, __webpack_require__) {
  2755. "use strict";
  2756. Object.defineProperty(exports, "__esModule", {
  2757. value: true
  2758. });
  2759. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2760. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2761. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2762. var _parchment = __webpack_require__(0);
  2763. var _parchment2 = _interopRequireDefault(_parchment);
  2764. var _emitter = __webpack_require__(5);
  2765. var _emitter2 = _interopRequireDefault(_emitter);
  2766. var _block = __webpack_require__(4);
  2767. var _block2 = _interopRequireDefault(_block);
  2768. var _break = __webpack_require__(17);
  2769. var _break2 = _interopRequireDefault(_break);
  2770. var _container = __webpack_require__(24);
  2771. var _container2 = _interopRequireDefault(_container);
  2772. var _code = __webpack_require__(16);
  2773. var _code2 = _interopRequireDefault(_code);
  2774. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2775. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2776. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2777. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2778. function isLine(blot) {
  2779. return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
  2780. }
  2781. var Scroll = function (_Parchment$Scroll) {
  2782. _inherits(Scroll, _Parchment$Scroll);
  2783. function Scroll(domNode, config) {
  2784. _classCallCheck(this, Scroll);
  2785. var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
  2786. _this.emitter = config.emitter;
  2787. _this.scrollingContainer = config.scrollingContainer;
  2788. if (Array.isArray(config.whitelist)) {
  2789. _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
  2790. whitelist[format] = true;
  2791. return whitelist;
  2792. }, {});
  2793. }
  2794. // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
  2795. _this.domNode.addEventListener('DOMNodeInserted', function () {});
  2796. _this.optimize();
  2797. _this.enable();
  2798. return _this;
  2799. }
  2800. _createClass(Scroll, [{
  2801. key: 'deleteAt',
  2802. value: function deleteAt(index, length) {
  2803. var _line = this.line(index),
  2804. _line2 = _slicedToArray(_line, 2),
  2805. first = _line2[0],
  2806. offset = _line2[1];
  2807. var _line3 = this.line(index + length),
  2808. _line4 = _slicedToArray(_line3, 1),
  2809. last = _line4[0];
  2810. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
  2811. if (last != null && first !== last && offset > 0 && !(first instanceof _block.BlockEmbed) && !(last instanceof _block.BlockEmbed)) {
  2812. if (last instanceof _code2.default) {
  2813. last.deleteAt(last.length() - 1, 1);
  2814. }
  2815. var ref = last.children.head instanceof _break2.default ? null : last.children.head;
  2816. first.moveChildren(last, ref);
  2817. first.remove();
  2818. }
  2819. this.optimize();
  2820. }
  2821. }, {
  2822. key: 'enable',
  2823. value: function enable() {
  2824. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  2825. this.domNode.setAttribute('contenteditable', enabled);
  2826. }
  2827. }, {
  2828. key: 'formatAt',
  2829. value: function formatAt(index, length, format, value) {
  2830. if (this.whitelist != null && !this.whitelist[format]) return;
  2831. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
  2832. this.optimize();
  2833. }
  2834. }, {
  2835. key: 'insertAt',
  2836. value: function insertAt(index, value, def) {
  2837. if (def != null && this.whitelist != null && !this.whitelist[value]) return;
  2838. if (index >= this.length()) {
  2839. if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
  2840. var blot = _parchment2.default.create(this.statics.defaultChild);
  2841. this.appendChild(blot);
  2842. if (def == null && value.endsWith('\n')) {
  2843. value = value.slice(0, -1);
  2844. }
  2845. blot.insertAt(0, value, def);
  2846. } else {
  2847. var embed = _parchment2.default.create(value, def);
  2848. this.appendChild(embed);
  2849. }
  2850. } else {
  2851. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
  2852. }
  2853. this.optimize();
  2854. }
  2855. }, {
  2856. key: 'insertBefore',
  2857. value: function insertBefore(blot, ref) {
  2858. if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
  2859. var wrapper = _parchment2.default.create(this.statics.defaultChild);
  2860. wrapper.appendChild(blot);
  2861. blot = wrapper;
  2862. }
  2863. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
  2864. }
  2865. }, {
  2866. key: 'leaf',
  2867. value: function leaf(index) {
  2868. return this.path(index).pop() || [null, -1];
  2869. }
  2870. }, {
  2871. key: 'line',
  2872. value: function line(index) {
  2873. if (index === this.length()) {
  2874. return this.line(index - 1);
  2875. }
  2876. return this.descendant(isLine, index);
  2877. }
  2878. }, {
  2879. key: 'lines',
  2880. value: function lines() {
  2881. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  2882. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  2883. var getLines = function getLines(blot, index, length) {
  2884. var lines = [],
  2885. lengthLeft = length;
  2886. blot.children.forEachAt(index, length, function (child, index, length) {
  2887. if (isLine(child)) {
  2888. lines.push(child);
  2889. } else if (child instanceof _parchment2.default.Container) {
  2890. lines = lines.concat(getLines(child, index, lengthLeft));
  2891. }
  2892. lengthLeft -= length;
  2893. });
  2894. return lines;
  2895. };
  2896. return getLines(this, index, length);
  2897. }
  2898. }, {
  2899. key: 'optimize',
  2900. value: function optimize() {
  2901. var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  2902. if (this.batch === true) return;
  2903. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations);
  2904. if (mutations.length > 0) {
  2905. this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations);
  2906. }
  2907. }
  2908. }, {
  2909. key: 'path',
  2910. value: function path(index) {
  2911. return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
  2912. }
  2913. }, {
  2914. key: 'update',
  2915. value: function update(mutations) {
  2916. if (this.batch === true) return;
  2917. var source = _emitter2.default.sources.USER;
  2918. if (typeof mutations === 'string') {
  2919. source = mutations;
  2920. }
  2921. if (!Array.isArray(mutations)) {
  2922. mutations = this.observer.takeRecords();
  2923. }
  2924. if (mutations.length > 0) {
  2925. this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
  2926. }
  2927. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
  2928. if (mutations.length > 0) {
  2929. this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
  2930. }
  2931. }
  2932. }]);
  2933. return Scroll;
  2934. }(_parchment2.default.Scroll);
  2935. Scroll.blotName = 'scroll';
  2936. Scroll.className = 'ql-editor';
  2937. Scroll.tagName = 'DIV';
  2938. Scroll.defaultChild = 'block';
  2939. Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
  2940. exports.default = Scroll;
  2941. /***/ }),
  2942. /* 19 */
  2943. /***/ (function(module, exports) {
  2944. var clone = (function() {
  2945. 'use strict';
  2946. function _instanceof(obj, type) {
  2947. return type != null && obj instanceof type;
  2948. }
  2949. var nativeMap;
  2950. try {
  2951. nativeMap = Map;
  2952. } catch(_) {
  2953. // maybe a reference error because no `Map`. Give it a dummy value that no
  2954. // value will ever be an instanceof.
  2955. nativeMap = function() {};
  2956. }
  2957. var nativeSet;
  2958. try {
  2959. nativeSet = Set;
  2960. } catch(_) {
  2961. nativeSet = function() {};
  2962. }
  2963. var nativePromise;
  2964. try {
  2965. nativePromise = Promise;
  2966. } catch(_) {
  2967. nativePromise = function() {};
  2968. }
  2969. /**
  2970. * Clones (copies) an Object using deep copying.
  2971. *
  2972. * This function supports circular references by default, but if you are certain
  2973. * there are no circular references in your object, you can save some CPU time
  2974. * by calling clone(obj, false).
  2975. *
  2976. * Caution: if `circular` is false and `parent` contains circular references,
  2977. * your program may enter an infinite loop and crash.
  2978. *
  2979. * @param `parent` - the object to be cloned
  2980. * @param `circular` - set to true if the object to be cloned may contain
  2981. * circular references. (optional - true by default)
  2982. * @param `depth` - set to a number if the object is only to be cloned to
  2983. * a particular depth. (optional - defaults to Infinity)
  2984. * @param `prototype` - sets the prototype to be used when cloning an object.
  2985. * (optional - defaults to parent prototype).
  2986. * @param `includeNonEnumerable` - set to true if the non-enumerable properties
  2987. * should be cloned as well. Non-enumerable properties on the prototype
  2988. * chain will be ignored. (optional - false by default)
  2989. */
  2990. function clone(parent, circular, depth, prototype, includeNonEnumerable) {
  2991. if (typeof circular === 'object') {
  2992. depth = circular.depth;
  2993. prototype = circular.prototype;
  2994. includeNonEnumerable = circular.includeNonEnumerable;
  2995. circular = circular.circular;
  2996. }
  2997. // maintain two arrays for circular references, where corresponding parents
  2998. // and children have the same index
  2999. var allParents = [];
  3000. var allChildren = [];
  3001. var useBuffer = typeof Buffer != 'undefined';
  3002. if (typeof circular == 'undefined')
  3003. circular = true;
  3004. if (typeof depth == 'undefined')
  3005. depth = Infinity;
  3006. // recurse this function so we don't reset allParents and allChildren
  3007. function _clone(parent, depth) {
  3008. // cloning null always returns null
  3009. if (parent === null)
  3010. return null;
  3011. if (depth === 0)
  3012. return parent;
  3013. var child;
  3014. var proto;
  3015. if (typeof parent != 'object') {
  3016. return parent;
  3017. }
  3018. if (_instanceof(parent, nativeMap)) {
  3019. child = new nativeMap();
  3020. } else if (_instanceof(parent, nativeSet)) {
  3021. child = new nativeSet();
  3022. } else if (_instanceof(parent, nativePromise)) {
  3023. child = new nativePromise(function (resolve, reject) {
  3024. parent.then(function(value) {
  3025. resolve(_clone(value, depth - 1));
  3026. }, function(err) {
  3027. reject(_clone(err, depth - 1));
  3028. });
  3029. });
  3030. } else if (clone.__isArray(parent)) {
  3031. child = [];
  3032. } else if (clone.__isRegExp(parent)) {
  3033. child = new RegExp(parent.source, __getRegExpFlags(parent));
  3034. if (parent.lastIndex) child.lastIndex = parent.lastIndex;
  3035. } else if (clone.__isDate(parent)) {
  3036. child = new Date(parent.getTime());
  3037. } else if (useBuffer && Buffer.isBuffer(parent)) {
  3038. child = new Buffer(parent.length);
  3039. parent.copy(child);
  3040. return child;
  3041. } else if (_instanceof(parent, Error)) {
  3042. child = Object.create(parent);
  3043. } else {
  3044. if (typeof prototype == 'undefined') {
  3045. proto = Object.getPrototypeOf(parent);
  3046. child = Object.create(proto);
  3047. }
  3048. else {
  3049. child = Object.create(prototype);
  3050. proto = prototype;
  3051. }
  3052. }
  3053. if (circular) {
  3054. var index = allParents.indexOf(parent);
  3055. if (index != -1) {
  3056. return allChildren[index];
  3057. }
  3058. allParents.push(parent);
  3059. allChildren.push(child);
  3060. }
  3061. if (_instanceof(parent, nativeMap)) {
  3062. parent.forEach(function(value, key) {
  3063. var keyChild = _clone(key, depth - 1);
  3064. var valueChild = _clone(value, depth - 1);
  3065. child.set(keyChild, valueChild);
  3066. });
  3067. }
  3068. if (_instanceof(parent, nativeSet)) {
  3069. parent.forEach(function(value) {
  3070. var entryChild = _clone(value, depth - 1);
  3071. child.add(entryChild);
  3072. });
  3073. }
  3074. for (var i in parent) {
  3075. var attrs;
  3076. if (proto) {
  3077. attrs = Object.getOwnPropertyDescriptor(proto, i);
  3078. }
  3079. if (attrs && attrs.set == null) {
  3080. continue;
  3081. }
  3082. child[i] = _clone(parent[i], depth - 1);
  3083. }
  3084. if (Object.getOwnPropertySymbols) {
  3085. var symbols = Object.getOwnPropertySymbols(parent);
  3086. for (var i = 0; i < symbols.length; i++) {
  3087. // Don't need to worry about cloning a symbol because it is a primitive,
  3088. // like a number or string.
  3089. var symbol = symbols[i];
  3090. var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
  3091. if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
  3092. continue;
  3093. }
  3094. child[symbol] = _clone(parent[symbol], depth - 1);
  3095. if (!descriptor.enumerable) {
  3096. Object.defineProperty(child, symbol, {
  3097. enumerable: false
  3098. });
  3099. }
  3100. }
  3101. }
  3102. if (includeNonEnumerable) {
  3103. var allPropertyNames = Object.getOwnPropertyNames(parent);
  3104. for (var i = 0; i < allPropertyNames.length; i++) {
  3105. var propertyName = allPropertyNames[i];
  3106. var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
  3107. if (descriptor && descriptor.enumerable) {
  3108. continue;
  3109. }
  3110. child[propertyName] = _clone(parent[propertyName], depth - 1);
  3111. Object.defineProperty(child, propertyName, {
  3112. enumerable: false
  3113. });
  3114. }
  3115. }
  3116. return child;
  3117. }
  3118. return _clone(parent, depth);
  3119. }
  3120. /**
  3121. * Simple flat clone using prototype, accepts only objects, usefull for property
  3122. * override on FLAT configuration object (no nested props).
  3123. *
  3124. * USE WITH CAUTION! This may not behave as you wish if you do not know how this
  3125. * works.
  3126. */
  3127. clone.clonePrototype = function clonePrototype(parent) {
  3128. if (parent === null)
  3129. return null;
  3130. var c = function () {};
  3131. c.prototype = parent;
  3132. return new c();
  3133. };
  3134. // private utility functions
  3135. function __objToStr(o) {
  3136. return Object.prototype.toString.call(o);
  3137. }
  3138. clone.__objToStr = __objToStr;
  3139. function __isDate(o) {
  3140. return typeof o === 'object' && __objToStr(o) === '[object Date]';
  3141. }
  3142. clone.__isDate = __isDate;
  3143. function __isArray(o) {
  3144. return typeof o === 'object' && __objToStr(o) === '[object Array]';
  3145. }
  3146. clone.__isArray = __isArray;
  3147. function __isRegExp(o) {
  3148. return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
  3149. }
  3150. clone.__isRegExp = __isRegExp;
  3151. function __getRegExpFlags(re) {
  3152. var flags = '';
  3153. if (re.global) flags += 'g';
  3154. if (re.ignoreCase) flags += 'i';
  3155. if (re.multiline) flags += 'm';
  3156. return flags;
  3157. }
  3158. clone.__getRegExpFlags = __getRegExpFlags;
  3159. return clone;
  3160. })();
  3161. if (typeof module === 'object' && module.exports) {
  3162. module.exports = clone;
  3163. }
  3164. /***/ }),
  3165. /* 20 */
  3166. /***/ (function(module, exports, __webpack_require__) {
  3167. var equal = __webpack_require__(11);
  3168. var extend = __webpack_require__(3);
  3169. var lib = {
  3170. attributes: {
  3171. compose: function (a, b, keepNull) {
  3172. if (typeof a !== 'object') a = {};
  3173. if (typeof b !== 'object') b = {};
  3174. var attributes = extend(true, {}, b);
  3175. if (!keepNull) {
  3176. attributes = Object.keys(attributes).reduce(function (copy, key) {
  3177. if (attributes[key] != null) {
  3178. copy[key] = attributes[key];
  3179. }
  3180. return copy;
  3181. }, {});
  3182. }
  3183. for (var key in a) {
  3184. if (a[key] !== undefined && b[key] === undefined) {
  3185. attributes[key] = a[key];
  3186. }
  3187. }
  3188. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3189. },
  3190. diff: function(a, b) {
  3191. if (typeof a !== 'object') a = {};
  3192. if (typeof b !== 'object') b = {};
  3193. var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
  3194. if (!equal(a[key], b[key])) {
  3195. attributes[key] = b[key] === undefined ? null : b[key];
  3196. }
  3197. return attributes;
  3198. }, {});
  3199. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3200. },
  3201. transform: function (a, b, priority) {
  3202. if (typeof a !== 'object') return b;
  3203. if (typeof b !== 'object') return undefined;
  3204. if (!priority) return b; // b simply overwrites us without priority
  3205. var attributes = Object.keys(b).reduce(function (attributes, key) {
  3206. if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
  3207. return attributes;
  3208. }, {});
  3209. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3210. }
  3211. },
  3212. iterator: function (ops) {
  3213. return new Iterator(ops);
  3214. },
  3215. length: function (op) {
  3216. if (typeof op['delete'] === 'number') {
  3217. return op['delete'];
  3218. } else if (typeof op.retain === 'number') {
  3219. return op.retain;
  3220. } else {
  3221. return typeof op.insert === 'string' ? op.insert.length : 1;
  3222. }
  3223. }
  3224. };
  3225. function Iterator(ops) {
  3226. this.ops = ops;
  3227. this.index = 0;
  3228. this.offset = 0;
  3229. };
  3230. Iterator.prototype.hasNext = function () {
  3231. return this.peekLength() < Infinity;
  3232. };
  3233. Iterator.prototype.next = function (length) {
  3234. if (!length) length = Infinity;
  3235. var nextOp = this.ops[this.index];
  3236. if (nextOp) {
  3237. var offset = this.offset;
  3238. var opLength = lib.length(nextOp)
  3239. if (length >= opLength - offset) {
  3240. length = opLength - offset;
  3241. this.index += 1;
  3242. this.offset = 0;
  3243. } else {
  3244. this.offset += length;
  3245. }
  3246. if (typeof nextOp['delete'] === 'number') {
  3247. return { 'delete': length };
  3248. } else {
  3249. var retOp = {};
  3250. if (nextOp.attributes) {
  3251. retOp.attributes = nextOp.attributes;
  3252. }
  3253. if (typeof nextOp.retain === 'number') {
  3254. retOp.retain = length;
  3255. } else if (typeof nextOp.insert === 'string') {
  3256. retOp.insert = nextOp.insert.substr(offset, length);
  3257. } else {
  3258. // offset should === 0, length should === 1
  3259. retOp.insert = nextOp.insert;
  3260. }
  3261. return retOp;
  3262. }
  3263. } else {
  3264. return { retain: Infinity };
  3265. }
  3266. };
  3267. Iterator.prototype.peek = function () {
  3268. return this.ops[this.index];
  3269. };
  3270. Iterator.prototype.peekLength = function () {
  3271. if (this.ops[this.index]) {
  3272. // Should never return 0 if our index is being managed correctly
  3273. return lib.length(this.ops[this.index]) - this.offset;
  3274. } else {
  3275. return Infinity;
  3276. }
  3277. };
  3278. Iterator.prototype.peekType = function () {
  3279. if (this.ops[this.index]) {
  3280. if (typeof this.ops[this.index]['delete'] === 'number') {
  3281. return 'delete';
  3282. } else if (typeof this.ops[this.index].retain === 'number') {
  3283. return 'retain';
  3284. } else {
  3285. return 'insert';
  3286. }
  3287. }
  3288. return 'retain';
  3289. };
  3290. module.exports = lib;
  3291. /***/ }),
  3292. /* 21 */
  3293. /***/ (function(module, exports, __webpack_require__) {
  3294. "use strict";
  3295. var __extends = (this && this.__extends) || (function () {
  3296. var extendStatics = Object.setPrototypeOf ||
  3297. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3298. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3299. return function (d, b) {
  3300. extendStatics(d, b);
  3301. function __() { this.constructor = d; }
  3302. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3303. };
  3304. })();
  3305. Object.defineProperty(exports, "__esModule", { value: true });
  3306. var linked_list_1 = __webpack_require__(61);
  3307. var shadow_1 = __webpack_require__(35);
  3308. var Registry = __webpack_require__(1);
  3309. var ContainerBlot = (function (_super) {
  3310. __extends(ContainerBlot, _super);
  3311. function ContainerBlot() {
  3312. return _super !== null && _super.apply(this, arguments) || this;
  3313. }
  3314. ContainerBlot.prototype.appendChild = function (other) {
  3315. this.insertBefore(other);
  3316. };
  3317. ContainerBlot.prototype.attach = function () {
  3318. var _this = this;
  3319. _super.prototype.attach.call(this);
  3320. this.children = new linked_list_1.default();
  3321. // Need to be reversed for if DOM nodes already in order
  3322. [].slice.call(this.domNode.childNodes).reverse().forEach(function (node) {
  3323. try {
  3324. var child = makeBlot(node);
  3325. _this.insertBefore(child, _this.children.head);
  3326. }
  3327. catch (err) {
  3328. if (err instanceof Registry.ParchmentError)
  3329. return;
  3330. else
  3331. throw err;
  3332. }
  3333. });
  3334. };
  3335. ContainerBlot.prototype.deleteAt = function (index, length) {
  3336. if (index === 0 && length === this.length()) {
  3337. return this.remove();
  3338. }
  3339. this.children.forEachAt(index, length, function (child, offset, length) {
  3340. child.deleteAt(offset, length);
  3341. });
  3342. };
  3343. ContainerBlot.prototype.descendant = function (criteria, index) {
  3344. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  3345. if ((criteria.blotName == null && criteria(child)) ||
  3346. (criteria.blotName != null && child instanceof criteria)) {
  3347. return [child, offset];
  3348. }
  3349. else if (child instanceof ContainerBlot) {
  3350. return child.descendant(criteria, offset);
  3351. }
  3352. else {
  3353. return [null, -1];
  3354. }
  3355. };
  3356. ContainerBlot.prototype.descendants = function (criteria, index, length) {
  3357. if (index === void 0) { index = 0; }
  3358. if (length === void 0) { length = Number.MAX_VALUE; }
  3359. var descendants = [], lengthLeft = length;
  3360. this.children.forEachAt(index, length, function (child, index, length) {
  3361. if ((criteria.blotName == null && criteria(child)) ||
  3362. (criteria.blotName != null && child instanceof criteria)) {
  3363. descendants.push(child);
  3364. }
  3365. if (child instanceof ContainerBlot) {
  3366. descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
  3367. }
  3368. lengthLeft -= length;
  3369. });
  3370. return descendants;
  3371. };
  3372. ContainerBlot.prototype.detach = function () {
  3373. this.children.forEach(function (child) {
  3374. child.detach();
  3375. });
  3376. _super.prototype.detach.call(this);
  3377. };
  3378. ContainerBlot.prototype.formatAt = function (index, length, name, value) {
  3379. this.children.forEachAt(index, length, function (child, offset, length) {
  3380. child.formatAt(offset, length, name, value);
  3381. });
  3382. };
  3383. ContainerBlot.prototype.insertAt = function (index, value, def) {
  3384. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  3385. if (child) {
  3386. child.insertAt(offset, value, def);
  3387. }
  3388. else {
  3389. var blot = (def == null) ? Registry.create('text', value) : Registry.create(value, def);
  3390. this.appendChild(blot);
  3391. }
  3392. };
  3393. ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
  3394. if (this.statics.allowedChildren != null && !this.statics.allowedChildren.some(function (child) {
  3395. return childBlot instanceof child;
  3396. })) {
  3397. throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
  3398. }
  3399. childBlot.insertInto(this, refBlot);
  3400. };
  3401. ContainerBlot.prototype.length = function () {
  3402. return this.children.reduce(function (memo, child) {
  3403. return memo + child.length();
  3404. }, 0);
  3405. };
  3406. ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
  3407. this.children.forEach(function (child) {
  3408. targetParent.insertBefore(child, refNode);
  3409. });
  3410. };
  3411. ContainerBlot.prototype.optimize = function () {
  3412. _super.prototype.optimize.call(this);
  3413. if (this.children.length === 0) {
  3414. if (this.statics.defaultChild != null) {
  3415. var child = Registry.create(this.statics.defaultChild);
  3416. this.appendChild(child);
  3417. child.optimize();
  3418. }
  3419. else {
  3420. this.remove();
  3421. }
  3422. }
  3423. };
  3424. ContainerBlot.prototype.path = function (index, inclusive) {
  3425. if (inclusive === void 0) { inclusive = false; }
  3426. var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
  3427. var position = [[this, index]];
  3428. if (child instanceof ContainerBlot) {
  3429. return position.concat(child.path(offset, inclusive));
  3430. }
  3431. else if (child != null) {
  3432. position.push([child, offset]);
  3433. }
  3434. return position;
  3435. };
  3436. ContainerBlot.prototype.removeChild = function (child) {
  3437. this.children.remove(child);
  3438. };
  3439. ContainerBlot.prototype.replace = function (target) {
  3440. if (target instanceof ContainerBlot) {
  3441. target.moveChildren(this);
  3442. }
  3443. _super.prototype.replace.call(this, target);
  3444. };
  3445. ContainerBlot.prototype.split = function (index, force) {
  3446. if (force === void 0) { force = false; }
  3447. if (!force) {
  3448. if (index === 0)
  3449. return this;
  3450. if (index === this.length())
  3451. return this.next;
  3452. }
  3453. var after = this.clone();
  3454. this.parent.insertBefore(after, this.next);
  3455. this.children.forEachAt(index, this.length(), function (child, offset, length) {
  3456. child = child.split(offset, force);
  3457. after.appendChild(child);
  3458. });
  3459. return after;
  3460. };
  3461. ContainerBlot.prototype.unwrap = function () {
  3462. this.moveChildren(this.parent, this.next);
  3463. this.remove();
  3464. };
  3465. ContainerBlot.prototype.update = function (mutations) {
  3466. var _this = this;
  3467. var addedNodes = [], removedNodes = [];
  3468. mutations.forEach(function (mutation) {
  3469. if (mutation.target === _this.domNode && mutation.type === 'childList') {
  3470. addedNodes.push.apply(addedNodes, mutation.addedNodes);
  3471. removedNodes.push.apply(removedNodes, mutation.removedNodes);
  3472. }
  3473. });
  3474. removedNodes.forEach(function (node) {
  3475. // Check node has actually been removed
  3476. // One exception is Chrome does not immediately remove IFRAMEs
  3477. // from DOM but MutationRecord is correct in its reported removal
  3478. if (node.parentNode != null && node.tagName !== 'IFRAME' &&
  3479. (document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY)) {
  3480. return;
  3481. }
  3482. var blot = Registry.find(node);
  3483. if (blot == null)
  3484. return;
  3485. if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
  3486. blot.detach();
  3487. }
  3488. });
  3489. addedNodes.filter(function (node) {
  3490. return node.parentNode == _this.domNode;
  3491. }).sort(function (a, b) {
  3492. if (a === b)
  3493. return 0;
  3494. if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
  3495. return 1;
  3496. }
  3497. return -1;
  3498. }).forEach(function (node) {
  3499. var refBlot = null;
  3500. if (node.nextSibling != null) {
  3501. refBlot = Registry.find(node.nextSibling);
  3502. }
  3503. var blot = makeBlot(node);
  3504. if (blot.next != refBlot || blot.next == null) {
  3505. if (blot.parent != null) {
  3506. blot.parent.removeChild(_this);
  3507. }
  3508. _this.insertBefore(blot, refBlot);
  3509. }
  3510. });
  3511. };
  3512. return ContainerBlot;
  3513. }(shadow_1.default));
  3514. function makeBlot(node) {
  3515. var blot = Registry.find(node);
  3516. if (blot == null) {
  3517. try {
  3518. blot = Registry.create(node);
  3519. }
  3520. catch (e) {
  3521. blot = Registry.create(Registry.Scope.INLINE);
  3522. [].slice.call(node.childNodes).forEach(function (child) {
  3523. blot.domNode.appendChild(child);
  3524. });
  3525. node.parentNode.replaceChild(blot.domNode, node);
  3526. blot.attach();
  3527. }
  3528. }
  3529. return blot;
  3530. }
  3531. exports.default = ContainerBlot;
  3532. /***/ }),
  3533. /* 22 */
  3534. /***/ (function(module, exports, __webpack_require__) {
  3535. "use strict";
  3536. var __extends = (this && this.__extends) || (function () {
  3537. var extendStatics = Object.setPrototypeOf ||
  3538. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3539. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3540. return function (d, b) {
  3541. extendStatics(d, b);
  3542. function __() { this.constructor = d; }
  3543. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3544. };
  3545. })();
  3546. Object.defineProperty(exports, "__esModule", { value: true });
  3547. var attributor_1 = __webpack_require__(13);
  3548. var store_1 = __webpack_require__(33);
  3549. var container_1 = __webpack_require__(21);
  3550. var Registry = __webpack_require__(1);
  3551. var FormatBlot = (function (_super) {
  3552. __extends(FormatBlot, _super);
  3553. function FormatBlot() {
  3554. return _super !== null && _super.apply(this, arguments) || this;
  3555. }
  3556. FormatBlot.formats = function (domNode) {
  3557. if (typeof this.tagName === 'string') {
  3558. return true;
  3559. }
  3560. else if (Array.isArray(this.tagName)) {
  3561. return domNode.tagName.toLowerCase();
  3562. }
  3563. return undefined;
  3564. };
  3565. FormatBlot.prototype.attach = function () {
  3566. _super.prototype.attach.call(this);
  3567. this.attributes = new store_1.default(this.domNode);
  3568. };
  3569. FormatBlot.prototype.format = function (name, value) {
  3570. var format = Registry.query(name);
  3571. if (format instanceof attributor_1.default) {
  3572. this.attributes.attribute(format, value);
  3573. }
  3574. else if (value) {
  3575. if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
  3576. this.replaceWith(name, value);
  3577. }
  3578. }
  3579. };
  3580. FormatBlot.prototype.formats = function () {
  3581. var formats = this.attributes.values();
  3582. var format = this.statics.formats(this.domNode);
  3583. if (format != null) {
  3584. formats[this.statics.blotName] = format;
  3585. }
  3586. return formats;
  3587. };
  3588. FormatBlot.prototype.replaceWith = function (name, value) {
  3589. var replacement = _super.prototype.replaceWith.call(this, name, value);
  3590. this.attributes.copy(replacement);
  3591. return replacement;
  3592. };
  3593. FormatBlot.prototype.update = function (mutations) {
  3594. var _this = this;
  3595. _super.prototype.update.call(this, mutations);
  3596. if (mutations.some(function (mutation) {
  3597. return mutation.target === _this.domNode && mutation.type === 'attributes';
  3598. })) {
  3599. this.attributes.build();
  3600. }
  3601. };
  3602. FormatBlot.prototype.wrap = function (name, value) {
  3603. var wrapper = _super.prototype.wrap.call(this, name, value);
  3604. if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
  3605. this.attributes.move(wrapper);
  3606. }
  3607. return wrapper;
  3608. };
  3609. return FormatBlot;
  3610. }(container_1.default));
  3611. exports.default = FormatBlot;
  3612. /***/ }),
  3613. /* 23 */
  3614. /***/ (function(module, exports, __webpack_require__) {
  3615. "use strict";
  3616. var __extends = (this && this.__extends) || (function () {
  3617. var extendStatics = Object.setPrototypeOf ||
  3618. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3619. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3620. return function (d, b) {
  3621. extendStatics(d, b);
  3622. function __() { this.constructor = d; }
  3623. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3624. };
  3625. })();
  3626. Object.defineProperty(exports, "__esModule", { value: true });
  3627. var shadow_1 = __webpack_require__(35);
  3628. var Registry = __webpack_require__(1);
  3629. var LeafBlot = (function (_super) {
  3630. __extends(LeafBlot, _super);
  3631. function LeafBlot() {
  3632. return _super !== null && _super.apply(this, arguments) || this;
  3633. }
  3634. LeafBlot.value = function (domNode) {
  3635. return true;
  3636. };
  3637. LeafBlot.prototype.index = function (node, offset) {
  3638. if (node !== this.domNode)
  3639. return -1;
  3640. return Math.min(offset, 1);
  3641. };
  3642. LeafBlot.prototype.position = function (index, inclusive) {
  3643. var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
  3644. if (index > 0)
  3645. offset += 1;
  3646. return [this.parent.domNode, offset];
  3647. };
  3648. LeafBlot.prototype.value = function () {
  3649. return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
  3650. var _a;
  3651. };
  3652. return LeafBlot;
  3653. }(shadow_1.default));
  3654. LeafBlot.scope = Registry.Scope.INLINE_BLOT;
  3655. exports.default = LeafBlot;
  3656. /***/ }),
  3657. /* 24 */
  3658. /***/ (function(module, exports, __webpack_require__) {
  3659. "use strict";
  3660. Object.defineProperty(exports, "__esModule", {
  3661. value: true
  3662. });
  3663. var _parchment = __webpack_require__(0);
  3664. var _parchment2 = _interopRequireDefault(_parchment);
  3665. var _block = __webpack_require__(4);
  3666. var _block2 = _interopRequireDefault(_block);
  3667. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3668. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3669. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3670. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3671. var Container = function (_Parchment$Container) {
  3672. _inherits(Container, _Parchment$Container);
  3673. function Container() {
  3674. _classCallCheck(this, Container);
  3675. return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
  3676. }
  3677. return Container;
  3678. }(_parchment2.default.Container);
  3679. Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
  3680. exports.default = Container;
  3681. /***/ }),
  3682. /* 25 */
  3683. /***/ (function(module, exports, __webpack_require__) {
  3684. "use strict";
  3685. Object.defineProperty(exports, "__esModule", {
  3686. value: true
  3687. });
  3688. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3689. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3690. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3691. var _parchment = __webpack_require__(0);
  3692. var _parchment2 = _interopRequireDefault(_parchment);
  3693. var _embed = __webpack_require__(7);
  3694. var _embed2 = _interopRequireDefault(_embed);
  3695. var _text = __webpack_require__(12);
  3696. var _text2 = _interopRequireDefault(_text);
  3697. var _emitter = __webpack_require__(5);
  3698. var _emitter2 = _interopRequireDefault(_emitter);
  3699. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3700. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3701. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3702. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3703. var Cursor = function (_Embed) {
  3704. _inherits(Cursor, _Embed);
  3705. _createClass(Cursor, null, [{
  3706. key: 'value',
  3707. value: function value() {
  3708. return undefined;
  3709. }
  3710. }]);
  3711. function Cursor(domNode, selection) {
  3712. _classCallCheck(this, Cursor);
  3713. var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
  3714. _this.selection = selection;
  3715. _this.textNode = document.createTextNode(Cursor.CONTENTS);
  3716. _this.domNode.appendChild(_this.textNode);
  3717. _this._length = 0;
  3718. return _this;
  3719. }
  3720. _createClass(Cursor, [{
  3721. key: 'detach',
  3722. value: function detach() {
  3723. // super.detach() will also clear domNode.__blot
  3724. if (this.parent != null) this.parent.removeChild(this);
  3725. }
  3726. }, {
  3727. key: 'format',
  3728. value: function format(name, value) {
  3729. if (this._length !== 0) {
  3730. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
  3731. }
  3732. var target = this,
  3733. index = 0;
  3734. while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
  3735. index += target.offset(target.parent);
  3736. target = target.parent;
  3737. }
  3738. if (target != null) {
  3739. this._length = Cursor.CONTENTS.length;
  3740. target.optimize();
  3741. target.formatAt(index, Cursor.CONTENTS.length, name, value);
  3742. this._length = 0;
  3743. }
  3744. }
  3745. }, {
  3746. key: 'index',
  3747. value: function index(node, offset) {
  3748. if (node === this.textNode) return 0;
  3749. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
  3750. }
  3751. }, {
  3752. key: 'length',
  3753. value: function length() {
  3754. return this._length;
  3755. }
  3756. }, {
  3757. key: 'position',
  3758. value: function position() {
  3759. return [this.textNode, this.textNode.data.length];
  3760. }
  3761. }, {
  3762. key: 'remove',
  3763. value: function remove() {
  3764. _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
  3765. this.parent = null;
  3766. }
  3767. }, {
  3768. key: 'restore',
  3769. value: function restore() {
  3770. var _this2 = this;
  3771. if (this.selection.composing) return;
  3772. if (this.parent == null) return;
  3773. var textNode = this.textNode;
  3774. var range = this.selection.getNativeRange();
  3775. var restoreText = void 0,
  3776. start = void 0,
  3777. end = void 0;
  3778. if (range != null && range.start.node === textNode && range.end.node === textNode) {
  3779. var _ref = [textNode, range.start.offset, range.end.offset];
  3780. restoreText = _ref[0];
  3781. start = _ref[1];
  3782. end = _ref[2];
  3783. }
  3784. // Link format will insert text outside of anchor tag
  3785. while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
  3786. this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
  3787. }
  3788. if (this.textNode.data !== Cursor.CONTENTS) {
  3789. var text = this.textNode.data.split(Cursor.CONTENTS).join('');
  3790. if (this.next instanceof _text2.default) {
  3791. restoreText = this.next.domNode;
  3792. this.next.insertAt(0, text);
  3793. this.textNode.data = Cursor.CONTENTS;
  3794. } else {
  3795. this.textNode.data = text;
  3796. this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
  3797. this.textNode = document.createTextNode(Cursor.CONTENTS);
  3798. this.domNode.appendChild(this.textNode);
  3799. }
  3800. }
  3801. this.remove();
  3802. if (start == null) return;
  3803. this.selection.emitter.once(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
  3804. var _map = [start, end].map(function (offset) {
  3805. return Math.max(0, Math.min(restoreText.data.length, offset - 1));
  3806. });
  3807. var _map2 = _slicedToArray(_map, 2);
  3808. start = _map2[0];
  3809. end = _map2[1];
  3810. _this2.selection.setNativeRange(restoreText, start, restoreText, end);
  3811. });
  3812. }
  3813. }, {
  3814. key: 'update',
  3815. value: function update(mutations) {
  3816. var _this3 = this;
  3817. mutations.forEach(function (mutation) {
  3818. if (mutation.type === 'characterData' && mutation.target === _this3.textNode) {
  3819. _this3.restore();
  3820. }
  3821. });
  3822. }
  3823. }, {
  3824. key: 'value',
  3825. value: function value() {
  3826. return '';
  3827. }
  3828. }]);
  3829. return Cursor;
  3830. }(_embed2.default);
  3831. Cursor.blotName = 'cursor';
  3832. Cursor.className = 'ql-cursor';
  3833. Cursor.tagName = 'span';
  3834. Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
  3835. exports.default = Cursor;
  3836. /***/ }),
  3837. /* 26 */
  3838. /***/ (function(module, exports, __webpack_require__) {
  3839. "use strict";
  3840. Object.defineProperty(exports, "__esModule", {
  3841. value: true
  3842. });
  3843. exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
  3844. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3845. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3846. var _parchment = __webpack_require__(0);
  3847. var _parchment2 = _interopRequireDefault(_parchment);
  3848. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3849. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3850. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3851. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3852. var ColorAttributor = function (_Parchment$Attributor) {
  3853. _inherits(ColorAttributor, _Parchment$Attributor);
  3854. function ColorAttributor() {
  3855. _classCallCheck(this, ColorAttributor);
  3856. return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
  3857. }
  3858. _createClass(ColorAttributor, [{
  3859. key: 'value',
  3860. value: function value(domNode) {
  3861. var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
  3862. if (!value.startsWith('rgb(')) return value;
  3863. value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
  3864. return '#' + value.split(',').map(function (component) {
  3865. return ('00' + parseInt(component).toString(16)).slice(-2);
  3866. }).join('');
  3867. }
  3868. }]);
  3869. return ColorAttributor;
  3870. }(_parchment2.default.Attributor.Style);
  3871. var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
  3872. scope: _parchment2.default.Scope.INLINE
  3873. });
  3874. var ColorStyle = new ColorAttributor('color', 'color', {
  3875. scope: _parchment2.default.Scope.INLINE
  3876. });
  3877. exports.ColorAttributor = ColorAttributor;
  3878. exports.ColorClass = ColorClass;
  3879. exports.ColorStyle = ColorStyle;
  3880. /***/ }),
  3881. /* 27 */
  3882. /***/ (function(module, exports, __webpack_require__) {
  3883. "use strict";
  3884. Object.defineProperty(exports, "__esModule", {
  3885. value: true
  3886. });
  3887. exports.sanitize = exports.default = undefined;
  3888. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3889. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3890. var _inline = __webpack_require__(8);
  3891. var _inline2 = _interopRequireDefault(_inline);
  3892. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3893. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3894. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3895. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3896. var Link = function (_Inline) {
  3897. _inherits(Link, _Inline);
  3898. function Link() {
  3899. _classCallCheck(this, Link);
  3900. return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
  3901. }
  3902. _createClass(Link, [{
  3903. key: 'format',
  3904. value: function format(name, value) {
  3905. if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
  3906. value = this.constructor.sanitize(value);
  3907. this.domNode.setAttribute('href', value);
  3908. }
  3909. }], [{
  3910. key: 'create',
  3911. value: function create(value) {
  3912. var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
  3913. value = this.sanitize(value);
  3914. node.setAttribute('href', value);
  3915. node.setAttribute('target', '_blank');
  3916. return node;
  3917. }
  3918. }, {
  3919. key: 'formats',
  3920. value: function formats(domNode) {
  3921. return domNode.getAttribute('href');
  3922. }
  3923. }, {
  3924. key: 'sanitize',
  3925. value: function sanitize(url) {
  3926. return _sanitize(url, ['http', 'https', 'mailto']) ? url : this.SANITIZED_URL;
  3927. }
  3928. }]);
  3929. return Link;
  3930. }(_inline2.default);
  3931. Link.blotName = 'link';
  3932. Link.tagName = 'A';
  3933. Link.SANITIZED_URL = 'about:blank';
  3934. function _sanitize(url, protocols) {
  3935. var anchor = document.createElement('a');
  3936. anchor.href = url;
  3937. var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
  3938. return protocols.indexOf(protocol) > -1;
  3939. }
  3940. exports.default = Link;
  3941. exports.sanitize = _sanitize;
  3942. /***/ }),
  3943. /* 28 */
  3944. /***/ (function(module, exports, __webpack_require__) {
  3945. "use strict";
  3946. Object.defineProperty(exports, "__esModule", {
  3947. value: true
  3948. });
  3949. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3950. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3951. var _dropdown = __webpack_require__(88);
  3952. var _dropdown2 = _interopRequireDefault(_dropdown);
  3953. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3954. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3955. var Picker = function () {
  3956. function Picker(select) {
  3957. var _this = this;
  3958. _classCallCheck(this, Picker);
  3959. this.select = select;
  3960. this.container = document.createElement('span');
  3961. this.buildPicker();
  3962. this.select.style.display = 'none';
  3963. this.select.parentNode.insertBefore(this.container, this.select);
  3964. this.label.addEventListener('mousedown', function () {
  3965. _this.container.classList.toggle('ql-expanded');
  3966. });
  3967. this.select.addEventListener('change', this.update.bind(this));
  3968. }
  3969. _createClass(Picker, [{
  3970. key: 'buildItem',
  3971. value: function buildItem(option) {
  3972. var _this2 = this;
  3973. var item = document.createElement('span');
  3974. item.classList.add('ql-picker-item');
  3975. if (option.hasAttribute('value')) {
  3976. item.setAttribute('data-value', option.getAttribute('value'));
  3977. }
  3978. if (option.textContent) {
  3979. item.setAttribute('data-label', option.textContent);
  3980. }
  3981. item.addEventListener('click', function () {
  3982. _this2.selectItem(item, true);
  3983. });
  3984. return item;
  3985. }
  3986. }, {
  3987. key: 'buildLabel',
  3988. value: function buildLabel() {
  3989. var label = document.createElement('span');
  3990. label.classList.add('ql-picker-label');
  3991. label.innerHTML = _dropdown2.default;
  3992. this.container.appendChild(label);
  3993. return label;
  3994. }
  3995. }, {
  3996. key: 'buildOptions',
  3997. value: function buildOptions() {
  3998. var _this3 = this;
  3999. var options = document.createElement('span');
  4000. options.classList.add('ql-picker-options');
  4001. [].slice.call(this.select.options).forEach(function (option) {
  4002. var item = _this3.buildItem(option);
  4003. options.appendChild(item);
  4004. if (option.hasAttribute('selected')) {
  4005. _this3.selectItem(item);
  4006. }
  4007. });
  4008. this.container.appendChild(options);
  4009. }
  4010. }, {
  4011. key: 'buildPicker',
  4012. value: function buildPicker() {
  4013. var _this4 = this;
  4014. [].slice.call(this.select.attributes).forEach(function (item) {
  4015. _this4.container.setAttribute(item.name, item.value);
  4016. });
  4017. this.container.classList.add('ql-picker');
  4018. this.label = this.buildLabel();
  4019. this.buildOptions();
  4020. }
  4021. }, {
  4022. key: 'close',
  4023. value: function close() {
  4024. this.container.classList.remove('ql-expanded');
  4025. }
  4026. }, {
  4027. key: 'selectItem',
  4028. value: function selectItem(item) {
  4029. var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4030. var selected = this.container.querySelector('.ql-selected');
  4031. if (item === selected) return;
  4032. if (selected != null) {
  4033. selected.classList.remove('ql-selected');
  4034. }
  4035. if (item == null) return;
  4036. item.classList.add('ql-selected');
  4037. this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
  4038. if (item.hasAttribute('data-value')) {
  4039. this.label.setAttribute('data-value', item.getAttribute('data-value'));
  4040. } else {
  4041. this.label.removeAttribute('data-value');
  4042. }
  4043. if (item.hasAttribute('data-label')) {
  4044. this.label.setAttribute('data-label', item.getAttribute('data-label'));
  4045. } else {
  4046. this.label.removeAttribute('data-label');
  4047. }
  4048. if (trigger) {
  4049. if (typeof Event === 'function') {
  4050. this.select.dispatchEvent(new Event('change'));
  4051. } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
  4052. // IE11
  4053. var event = document.createEvent('Event');
  4054. event.initEvent('change', true, true);
  4055. this.select.dispatchEvent(event);
  4056. }
  4057. this.close();
  4058. }
  4059. }
  4060. }, {
  4061. key: 'update',
  4062. value: function update() {
  4063. var option = void 0;
  4064. if (this.select.selectedIndex > -1) {
  4065. var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
  4066. option = this.select.options[this.select.selectedIndex];
  4067. this.selectItem(item);
  4068. } else {
  4069. this.selectItem(null);
  4070. }
  4071. var isActive = option != null && option !== this.select.querySelector('option[selected]');
  4072. this.label.classList.toggle('ql-active', isActive);
  4073. }
  4074. }]);
  4075. return Picker;
  4076. }();
  4077. exports.default = Picker;
  4078. /***/ }),
  4079. /* 29 */
  4080. /***/ (function(module, exports, __webpack_require__) {
  4081. "use strict";
  4082. var _parchment = __webpack_require__(0);
  4083. var _parchment2 = _interopRequireDefault(_parchment);
  4084. var _quill = __webpack_require__(6);
  4085. var _quill2 = _interopRequireDefault(_quill);
  4086. var _block = __webpack_require__(4);
  4087. var _block2 = _interopRequireDefault(_block);
  4088. var _break = __webpack_require__(17);
  4089. var _break2 = _interopRequireDefault(_break);
  4090. var _container = __webpack_require__(24);
  4091. var _container2 = _interopRequireDefault(_container);
  4092. var _cursor = __webpack_require__(25);
  4093. var _cursor2 = _interopRequireDefault(_cursor);
  4094. var _embed = __webpack_require__(7);
  4095. var _embed2 = _interopRequireDefault(_embed);
  4096. var _inline = __webpack_require__(8);
  4097. var _inline2 = _interopRequireDefault(_inline);
  4098. var _scroll = __webpack_require__(18);
  4099. var _scroll2 = _interopRequireDefault(_scroll);
  4100. var _text = __webpack_require__(12);
  4101. var _text2 = _interopRequireDefault(_text);
  4102. var _clipboard = __webpack_require__(46);
  4103. var _clipboard2 = _interopRequireDefault(_clipboard);
  4104. var _history = __webpack_require__(42);
  4105. var _history2 = _interopRequireDefault(_history);
  4106. var _keyboard = __webpack_require__(31);
  4107. var _keyboard2 = _interopRequireDefault(_keyboard);
  4108. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4109. _quill2.default.register({
  4110. 'blots/block': _block2.default,
  4111. 'blots/block/embed': _block.BlockEmbed,
  4112. 'blots/break': _break2.default,
  4113. 'blots/container': _container2.default,
  4114. 'blots/cursor': _cursor2.default,
  4115. 'blots/embed': _embed2.default,
  4116. 'blots/inline': _inline2.default,
  4117. 'blots/scroll': _scroll2.default,
  4118. 'blots/text': _text2.default,
  4119. 'modules/clipboard': _clipboard2.default,
  4120. 'modules/history': _history2.default,
  4121. 'modules/keyboard': _keyboard2.default
  4122. });
  4123. _parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
  4124. module.exports = _quill2.default;
  4125. /***/ }),
  4126. /* 30 */
  4127. /***/ (function(module, exports, __webpack_require__) {
  4128. "use strict";
  4129. Object.defineProperty(exports, "__esModule", {
  4130. value: true
  4131. });
  4132. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4133. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4134. var Theme = function () {
  4135. function Theme(quill, options) {
  4136. _classCallCheck(this, Theme);
  4137. this.quill = quill;
  4138. this.options = options;
  4139. this.modules = {};
  4140. }
  4141. _createClass(Theme, [{
  4142. key: 'init',
  4143. value: function init() {
  4144. var _this = this;
  4145. Object.keys(this.options.modules).forEach(function (name) {
  4146. if (_this.modules[name] == null) {
  4147. _this.addModule(name);
  4148. }
  4149. });
  4150. }
  4151. }, {
  4152. key: 'addModule',
  4153. value: function addModule(name) {
  4154. var moduleClass = this.quill.constructor.import('modules/' + name);
  4155. this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
  4156. return this.modules[name];
  4157. }
  4158. }]);
  4159. return Theme;
  4160. }();
  4161. Theme.DEFAULTS = {
  4162. modules: {}
  4163. };
  4164. Theme.themes = {
  4165. 'default': Theme
  4166. };
  4167. exports.default = Theme;
  4168. /***/ }),
  4169. /* 31 */
  4170. /***/ (function(module, exports, __webpack_require__) {
  4171. "use strict";
  4172. Object.defineProperty(exports, "__esModule", {
  4173. value: true
  4174. });
  4175. exports.SHORTKEY = exports.default = undefined;
  4176. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  4177. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  4178. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4179. var _clone = __webpack_require__(19);
  4180. var _clone2 = _interopRequireDefault(_clone);
  4181. var _deepEqual = __webpack_require__(11);
  4182. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  4183. var _extend = __webpack_require__(3);
  4184. var _extend2 = _interopRequireDefault(_extend);
  4185. var _op = __webpack_require__(20);
  4186. var _op2 = _interopRequireDefault(_op);
  4187. var _parchment = __webpack_require__(0);
  4188. var _parchment2 = _interopRequireDefault(_parchment);
  4189. var _quill = __webpack_require__(6);
  4190. var _quill2 = _interopRequireDefault(_quill);
  4191. var _logger = __webpack_require__(10);
  4192. var _logger2 = _interopRequireDefault(_logger);
  4193. var _module = __webpack_require__(9);
  4194. var _module2 = _interopRequireDefault(_module);
  4195. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4196. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4197. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4198. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4199. var debug = (0, _logger2.default)('quill:keyboard');
  4200. var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
  4201. var Keyboard = function (_Module) {
  4202. _inherits(Keyboard, _Module);
  4203. _createClass(Keyboard, null, [{
  4204. key: 'match',
  4205. value: function match(evt, binding) {
  4206. binding = normalize(binding);
  4207. if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
  4208. return !!binding[key] !== evt[key] && binding[key] !== null;
  4209. })) {
  4210. return false;
  4211. }
  4212. return binding.key === (evt.which || evt.keyCode);
  4213. }
  4214. }]);
  4215. function Keyboard(quill, options) {
  4216. _classCallCheck(this, Keyboard);
  4217. var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
  4218. _this.bindings = {};
  4219. Object.keys(_this.options.bindings).forEach(function (name) {
  4220. if (_this.options.bindings[name]) {
  4221. _this.addBinding(_this.options.bindings[name]);
  4222. }
  4223. });
  4224. _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
  4225. _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
  4226. if (/Firefox/i.test(navigator.userAgent)) {
  4227. // Need to handle delete and backspace for Firefox in the general case #1171
  4228. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
  4229. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
  4230. } else {
  4231. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
  4232. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
  4233. }
  4234. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
  4235. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
  4236. _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
  4237. _this.listen();
  4238. return _this;
  4239. }
  4240. _createClass(Keyboard, [{
  4241. key: 'addBinding',
  4242. value: function addBinding(key) {
  4243. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4244. var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4245. var binding = normalize(key);
  4246. if (binding == null || binding.key == null) {
  4247. return debug.warn('Attempted to add invalid keyboard binding', binding);
  4248. }
  4249. if (typeof context === 'function') {
  4250. context = { handler: context };
  4251. }
  4252. if (typeof handler === 'function') {
  4253. handler = { handler: handler };
  4254. }
  4255. binding = (0, _extend2.default)(binding, context, handler);
  4256. this.bindings[binding.key] = this.bindings[binding.key] || [];
  4257. this.bindings[binding.key].push(binding);
  4258. }
  4259. }, {
  4260. key: 'listen',
  4261. value: function listen() {
  4262. var _this2 = this;
  4263. this.quill.root.addEventListener('keydown', function (evt) {
  4264. if (evt.defaultPrevented) return;
  4265. var which = evt.which || evt.keyCode;
  4266. var bindings = (_this2.bindings[which] || []).filter(function (binding) {
  4267. return Keyboard.match(evt, binding);
  4268. });
  4269. if (bindings.length === 0) return;
  4270. var range = _this2.quill.getSelection();
  4271. if (range == null || !_this2.quill.hasFocus()) return;
  4272. var _quill$getLine = _this2.quill.getLine(range.index),
  4273. _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
  4274. line = _quill$getLine2[0],
  4275. offset = _quill$getLine2[1];
  4276. var _quill$getLeaf = _this2.quill.getLeaf(range.index),
  4277. _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
  4278. leafStart = _quill$getLeaf2[0],
  4279. offsetStart = _quill$getLeaf2[1];
  4280. var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
  4281. _ref2 = _slicedToArray(_ref, 2),
  4282. leafEnd = _ref2[0],
  4283. offsetEnd = _ref2[1];
  4284. var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
  4285. var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
  4286. var curContext = {
  4287. collapsed: range.length === 0,
  4288. empty: range.length === 0 && line.length() <= 1,
  4289. format: _this2.quill.getFormat(range),
  4290. offset: offset,
  4291. prefix: prefixText,
  4292. suffix: suffixText
  4293. };
  4294. var prevented = bindings.some(function (binding) {
  4295. if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
  4296. if (binding.empty != null && binding.empty !== curContext.empty) return false;
  4297. if (binding.offset != null && binding.offset !== curContext.offset) return false;
  4298. if (Array.isArray(binding.format)) {
  4299. // any format is present
  4300. if (binding.format.every(function (name) {
  4301. return curContext.format[name] == null;
  4302. })) {
  4303. return false;
  4304. }
  4305. } else if (_typeof(binding.format) === 'object') {
  4306. // all formats must match
  4307. if (!Object.keys(binding.format).every(function (name) {
  4308. if (binding.format[name] === true) return curContext.format[name] != null;
  4309. if (binding.format[name] === false) return curContext.format[name] == null;
  4310. return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
  4311. })) {
  4312. return false;
  4313. }
  4314. }
  4315. if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
  4316. if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
  4317. return binding.handler.call(_this2, range, curContext) !== true;
  4318. });
  4319. if (prevented) {
  4320. evt.preventDefault();
  4321. }
  4322. });
  4323. }
  4324. }]);
  4325. return Keyboard;
  4326. }(_module2.default);
  4327. Keyboard.keys = {
  4328. BACKSPACE: 8,
  4329. TAB: 9,
  4330. ENTER: 13,
  4331. ESCAPE: 27,
  4332. LEFT: 37,
  4333. UP: 38,
  4334. RIGHT: 39,
  4335. DOWN: 40,
  4336. DELETE: 46
  4337. };
  4338. Keyboard.DEFAULTS = {
  4339. bindings: {
  4340. 'bold': makeFormatHandler('bold'),
  4341. 'italic': makeFormatHandler('italic'),
  4342. 'underline': makeFormatHandler('underline'),
  4343. 'indent': {
  4344. // highlight tab or tab at beginning of list, indent or blockquote
  4345. key: Keyboard.keys.TAB,
  4346. format: ['blockquote', 'indent', 'list'],
  4347. handler: function handler(range, context) {
  4348. if (context.collapsed && context.offset !== 0) return true;
  4349. this.quill.format('indent', '+1', _quill2.default.sources.USER);
  4350. }
  4351. },
  4352. 'outdent': {
  4353. key: Keyboard.keys.TAB,
  4354. shiftKey: true,
  4355. format: ['blockquote', 'indent', 'list'],
  4356. // highlight tab or tab at beginning of list, indent or blockquote
  4357. handler: function handler(range, context) {
  4358. if (context.collapsed && context.offset !== 0) return true;
  4359. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  4360. }
  4361. },
  4362. 'outdent backspace': {
  4363. key: Keyboard.keys.BACKSPACE,
  4364. collapsed: true,
  4365. shiftKey: null,
  4366. metaKey: null,
  4367. ctrlKey: null,
  4368. altKey: null,
  4369. format: ['blockquote', 'indent', 'list'],
  4370. offset: 0,
  4371. handler: function handler(range, context) {
  4372. if (context.format.indent != null) {
  4373. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  4374. } else if (context.format.blockquote != null) {
  4375. this.quill.format('blockquote', false, _quill2.default.sources.USER);
  4376. } else if (context.format.list != null) {
  4377. this.quill.format('list', false, _quill2.default.sources.USER);
  4378. }
  4379. }
  4380. },
  4381. 'indent code-block': makeCodeBlockHandler(true),
  4382. 'outdent code-block': makeCodeBlockHandler(false),
  4383. 'remove tab': {
  4384. key: Keyboard.keys.TAB,
  4385. shiftKey: true,
  4386. collapsed: true,
  4387. prefix: /\t$/,
  4388. handler: function handler(range) {
  4389. this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
  4390. }
  4391. },
  4392. 'tab': {
  4393. key: Keyboard.keys.TAB,
  4394. handler: function handler(range, context) {
  4395. if (!context.collapsed) {
  4396. this.quill.scroll.deleteAt(range.index, range.length);
  4397. }
  4398. this.quill.insertText(range.index, '\t', _quill2.default.sources.USER);
  4399. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4400. }
  4401. },
  4402. 'list empty enter': {
  4403. key: Keyboard.keys.ENTER,
  4404. collapsed: true,
  4405. format: ['list'],
  4406. empty: true,
  4407. handler: function handler(range, context) {
  4408. this.quill.format('list', false, _quill2.default.sources.USER);
  4409. if (context.format.indent) {
  4410. this.quill.format('indent', false, _quill2.default.sources.USER);
  4411. }
  4412. }
  4413. },
  4414. 'checklist enter': {
  4415. key: Keyboard.keys.ENTER,
  4416. collapsed: true,
  4417. format: { list: 'checked' },
  4418. handler: function handler(range) {
  4419. this.quill.scroll.insertAt(range.index, '\n');
  4420. var _quill$getLine3 = this.quill.getLine(range.index + 1),
  4421. _quill$getLine4 = _slicedToArray(_quill$getLine3, 1),
  4422. line = _quill$getLine4[0];
  4423. line.format('list', 'unchecked');
  4424. this.quill.update(_quill2.default.sources.USER);
  4425. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4426. this.quill.selection.scrollIntoView();
  4427. }
  4428. },
  4429. 'header enter': {
  4430. key: Keyboard.keys.ENTER,
  4431. collapsed: true,
  4432. format: ['header'],
  4433. suffix: /^$/,
  4434. handler: function handler(range) {
  4435. this.quill.scroll.insertAt(range.index, '\n');
  4436. this.quill.formatText(range.index + 1, 1, 'header', false, _quill2.default.sources.USER);
  4437. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4438. this.quill.selection.scrollIntoView();
  4439. }
  4440. },
  4441. 'list autofill': {
  4442. key: ' ',
  4443. collapsed: true,
  4444. format: { list: false },
  4445. prefix: /^\s*?(1\.|-|\[ ?\]|\[x\])$/,
  4446. handler: function handler(range, context) {
  4447. if (this.quill.scroll.whitelist != null && !this.quill.scroll.whitelist['list']) return true;
  4448. var length = context.prefix.length;
  4449. var value = void 0;
  4450. switch (context.prefix.trim()) {
  4451. case '[]':case '[ ]':
  4452. value = 'unchecked';
  4453. break;
  4454. case '[x]':
  4455. value = 'checked';
  4456. break;
  4457. case '-':
  4458. value = 'bullet';
  4459. break;
  4460. default:
  4461. value = 'ordered';
  4462. }
  4463. this.quill.scroll.deleteAt(range.index - length, length);
  4464. this.quill.formatLine(range.index - length, 1, 'list', value, _quill2.default.sources.USER);
  4465. this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
  4466. }
  4467. },
  4468. 'code exit': {
  4469. key: Keyboard.keys.ENTER,
  4470. collapsed: true,
  4471. format: ['code-block'],
  4472. prefix: /\n\n$/,
  4473. suffix: /^\s+$/,
  4474. handler: function handler(range) {
  4475. this.quill.format('code-block', false, _quill2.default.sources.USER);
  4476. this.quill.deleteText(range.index - 2, 1, _quill2.default.sources.USER);
  4477. }
  4478. }
  4479. }
  4480. };
  4481. function handleBackspace(range, context) {
  4482. if (range.index === 0 || this.quill.getLength() <= 1) return;
  4483. var _quill$getLine5 = this.quill.getLine(range.index),
  4484. _quill$getLine6 = _slicedToArray(_quill$getLine5, 1),
  4485. line = _quill$getLine6[0];
  4486. var formats = {};
  4487. if (context.offset === 0) {
  4488. var _quill$getLine7 = this.quill.getLine(range.index - 1),
  4489. _quill$getLine8 = _slicedToArray(_quill$getLine7, 1),
  4490. prev = _quill$getLine8[0];
  4491. if (prev != null && prev.length() > 1) {
  4492. var curFormats = line.formats();
  4493. var prevFormats = this.quill.getFormat(range.index - 1, 1);
  4494. formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
  4495. }
  4496. }
  4497. // Check for astral symbols
  4498. var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
  4499. this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
  4500. if (Object.keys(formats).length > 0) {
  4501. this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
  4502. }
  4503. this.quill.selection.scrollIntoView();
  4504. }
  4505. function handleDelete(range, context) {
  4506. // Check for astral symbols
  4507. var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
  4508. if (range.index >= this.quill.getLength() - length) return;
  4509. var formats = {},
  4510. nextLength = 0;
  4511. var _quill$getLine9 = this.quill.getLine(range.index),
  4512. _quill$getLine10 = _slicedToArray(_quill$getLine9, 1),
  4513. line = _quill$getLine10[0];
  4514. if (context.offset >= line.length() - 1) {
  4515. var _quill$getLine11 = this.quill.getLine(range.index + 1),
  4516. _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
  4517. next = _quill$getLine12[0];
  4518. if (next) {
  4519. var curFormats = line.formats();
  4520. var nextFormats = this.quill.getFormat(range.index, 1);
  4521. formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
  4522. nextLength = next.length();
  4523. }
  4524. }
  4525. this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
  4526. if (Object.keys(formats).length > 0) {
  4527. this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
  4528. }
  4529. }
  4530. function handleDeleteRange(range) {
  4531. this.quill.deleteText(range, _quill2.default.sources.USER);
  4532. this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
  4533. this.quill.selection.scrollIntoView();
  4534. }
  4535. function handleEnter(range, context) {
  4536. var _this3 = this;
  4537. if (range.length > 0) {
  4538. this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
  4539. }
  4540. var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
  4541. if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
  4542. lineFormats[format] = context.format[format];
  4543. }
  4544. return lineFormats;
  4545. }, {});
  4546. this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
  4547. // Earlier scroll.deleteAt might have messed up our selection,
  4548. // so insertText's built in selection preservation is not reliable
  4549. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4550. this.quill.selection.scrollIntoView();
  4551. Object.keys(context.format).forEach(function (name) {
  4552. if (lineFormats[name] != null) return;
  4553. if (Array.isArray(context.format[name])) return;
  4554. if (name === 'link') return;
  4555. _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
  4556. });
  4557. }
  4558. function makeCodeBlockHandler(indent) {
  4559. return {
  4560. key: Keyboard.keys.TAB,
  4561. shiftKey: !indent,
  4562. format: { 'code-block': true },
  4563. handler: function handler(range) {
  4564. var CodeBlock = _parchment2.default.query('code-block');
  4565. var index = range.index,
  4566. length = range.length;
  4567. var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
  4568. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  4569. block = _quill$scroll$descend2[0],
  4570. offset = _quill$scroll$descend2[1];
  4571. if (block == null) return;
  4572. var scrollIndex = this.quill.getIndex(block);
  4573. var start = block.newlineIndex(offset, true) + 1;
  4574. var end = block.newlineIndex(scrollIndex + offset + length);
  4575. var lines = block.domNode.textContent.slice(start, end).split('\n');
  4576. offset = 0;
  4577. lines.forEach(function (line, i) {
  4578. if (indent) {
  4579. block.insertAt(start + offset, CodeBlock.TAB);
  4580. offset += CodeBlock.TAB.length;
  4581. if (i === 0) {
  4582. index += CodeBlock.TAB.length;
  4583. } else {
  4584. length += CodeBlock.TAB.length;
  4585. }
  4586. } else if (line.startsWith(CodeBlock.TAB)) {
  4587. block.deleteAt(start + offset, CodeBlock.TAB.length);
  4588. offset -= CodeBlock.TAB.length;
  4589. if (i === 0) {
  4590. index -= CodeBlock.TAB.length;
  4591. } else {
  4592. length -= CodeBlock.TAB.length;
  4593. }
  4594. }
  4595. offset += line.length + 1;
  4596. });
  4597. this.quill.update(_quill2.default.sources.USER);
  4598. this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
  4599. }
  4600. };
  4601. }
  4602. function makeFormatHandler(format) {
  4603. return {
  4604. key: format[0].toUpperCase(),
  4605. shortKey: true,
  4606. handler: function handler(range, context) {
  4607. this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
  4608. }
  4609. };
  4610. }
  4611. function normalize(binding) {
  4612. if (typeof binding === 'string' || typeof binding === 'number') {
  4613. return normalize({ key: binding });
  4614. }
  4615. if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
  4616. binding = (0, _clone2.default)(binding, false);
  4617. }
  4618. if (typeof binding.key === 'string') {
  4619. if (Keyboard.keys[binding.key.toUpperCase()] != null) {
  4620. binding.key = Keyboard.keys[binding.key.toUpperCase()];
  4621. } else if (binding.key.length === 1) {
  4622. binding.key = binding.key.toUpperCase().charCodeAt(0);
  4623. } else {
  4624. return null;
  4625. }
  4626. }
  4627. if (binding.shortKey) {
  4628. binding[SHORTKEY] = binding.shortKey;
  4629. delete binding.shortKey;
  4630. }
  4631. return binding;
  4632. }
  4633. exports.default = Keyboard;
  4634. exports.SHORTKEY = SHORTKEY;
  4635. /***/ }),
  4636. /* 32 */
  4637. /***/ (function(module, exports, __webpack_require__) {
  4638. "use strict";
  4639. var __extends = (this && this.__extends) || (function () {
  4640. var extendStatics = Object.setPrototypeOf ||
  4641. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4642. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  4643. return function (d, b) {
  4644. extendStatics(d, b);
  4645. function __() { this.constructor = d; }
  4646. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4647. };
  4648. })();
  4649. Object.defineProperty(exports, "__esModule", { value: true });
  4650. var attributor_1 = __webpack_require__(13);
  4651. function match(node, prefix) {
  4652. var className = node.getAttribute('class') || '';
  4653. return className.split(/\s+/).filter(function (name) {
  4654. return name.indexOf(prefix + "-") === 0;
  4655. });
  4656. }
  4657. var ClassAttributor = (function (_super) {
  4658. __extends(ClassAttributor, _super);
  4659. function ClassAttributor() {
  4660. return _super !== null && _super.apply(this, arguments) || this;
  4661. }
  4662. ClassAttributor.keys = function (node) {
  4663. return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
  4664. return name.split('-').slice(0, -1).join('-');
  4665. });
  4666. };
  4667. ClassAttributor.prototype.add = function (node, value) {
  4668. if (!this.canAdd(node, value))
  4669. return false;
  4670. this.remove(node);
  4671. node.classList.add(this.keyName + "-" + value);
  4672. return true;
  4673. };
  4674. ClassAttributor.prototype.remove = function (node) {
  4675. var matches = match(node, this.keyName);
  4676. matches.forEach(function (name) {
  4677. node.classList.remove(name);
  4678. });
  4679. if (node.classList.length === 0) {
  4680. node.removeAttribute('class');
  4681. }
  4682. };
  4683. ClassAttributor.prototype.value = function (node) {
  4684. var result = match(node, this.keyName)[0] || '';
  4685. var value = result.slice(this.keyName.length + 1); // +1 for hyphen
  4686. return this.canAdd(node, value) ? value : '';
  4687. };
  4688. return ClassAttributor;
  4689. }(attributor_1.default));
  4690. exports.default = ClassAttributor;
  4691. /***/ }),
  4692. /* 33 */
  4693. /***/ (function(module, exports, __webpack_require__) {
  4694. "use strict";
  4695. Object.defineProperty(exports, "__esModule", { value: true });
  4696. var attributor_1 = __webpack_require__(13);
  4697. var class_1 = __webpack_require__(32);
  4698. var style_1 = __webpack_require__(34);
  4699. var Registry = __webpack_require__(1);
  4700. var AttributorStore = (function () {
  4701. function AttributorStore(domNode) {
  4702. this.attributes = {};
  4703. this.domNode = domNode;
  4704. this.build();
  4705. }
  4706. AttributorStore.prototype.attribute = function (attribute, value) {
  4707. if (value) {
  4708. if (attribute.add(this.domNode, value)) {
  4709. if (attribute.value(this.domNode) != null) {
  4710. this.attributes[attribute.attrName] = attribute;
  4711. }
  4712. else {
  4713. delete this.attributes[attribute.attrName];
  4714. }
  4715. }
  4716. }
  4717. else {
  4718. attribute.remove(this.domNode);
  4719. delete this.attributes[attribute.attrName];
  4720. }
  4721. };
  4722. AttributorStore.prototype.build = function () {
  4723. var _this = this;
  4724. this.attributes = {};
  4725. var attributes = attributor_1.default.keys(this.domNode);
  4726. var classes = class_1.default.keys(this.domNode);
  4727. var styles = style_1.default.keys(this.domNode);
  4728. attributes.concat(classes).concat(styles).forEach(function (name) {
  4729. var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
  4730. if (attr instanceof attributor_1.default) {
  4731. _this.attributes[attr.attrName] = attr;
  4732. }
  4733. });
  4734. };
  4735. AttributorStore.prototype.copy = function (target) {
  4736. var _this = this;
  4737. Object.keys(this.attributes).forEach(function (key) {
  4738. var value = _this.attributes[key].value(_this.domNode);
  4739. target.format(key, value);
  4740. });
  4741. };
  4742. AttributorStore.prototype.move = function (target) {
  4743. var _this = this;
  4744. this.copy(target);
  4745. Object.keys(this.attributes).forEach(function (key) {
  4746. _this.attributes[key].remove(_this.domNode);
  4747. });
  4748. this.attributes = {};
  4749. };
  4750. AttributorStore.prototype.values = function () {
  4751. var _this = this;
  4752. return Object.keys(this.attributes).reduce(function (attributes, name) {
  4753. attributes[name] = _this.attributes[name].value(_this.domNode);
  4754. return attributes;
  4755. }, {});
  4756. };
  4757. return AttributorStore;
  4758. }());
  4759. exports.default = AttributorStore;
  4760. /***/ }),
  4761. /* 34 */
  4762. /***/ (function(module, exports, __webpack_require__) {
  4763. "use strict";
  4764. var __extends = (this && this.__extends) || (function () {
  4765. var extendStatics = Object.setPrototypeOf ||
  4766. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4767. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  4768. return function (d, b) {
  4769. extendStatics(d, b);
  4770. function __() { this.constructor = d; }
  4771. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4772. };
  4773. })();
  4774. Object.defineProperty(exports, "__esModule", { value: true });
  4775. var attributor_1 = __webpack_require__(13);
  4776. function camelize(name) {
  4777. var parts = name.split('-');
  4778. var rest = parts.slice(1).map(function (part) {
  4779. return part[0].toUpperCase() + part.slice(1);
  4780. }).join('');
  4781. return parts[0] + rest;
  4782. }
  4783. var StyleAttributor = (function (_super) {
  4784. __extends(StyleAttributor, _super);
  4785. function StyleAttributor() {
  4786. return _super !== null && _super.apply(this, arguments) || this;
  4787. }
  4788. StyleAttributor.keys = function (node) {
  4789. return (node.getAttribute('style') || '').split(';').map(function (value) {
  4790. var arr = value.split(':');
  4791. return arr[0].trim();
  4792. });
  4793. };
  4794. StyleAttributor.prototype.add = function (node, value) {
  4795. if (!this.canAdd(node, value))
  4796. return false;
  4797. node.style[camelize(this.keyName)] = value;
  4798. return true;
  4799. };
  4800. StyleAttributor.prototype.remove = function (node) {
  4801. node.style[camelize(this.keyName)] = '';
  4802. if (!node.getAttribute('style')) {
  4803. node.removeAttribute('style');
  4804. }
  4805. };
  4806. StyleAttributor.prototype.value = function (node) {
  4807. var value = node.style[camelize(this.keyName)];
  4808. return this.canAdd(node, value) ? value : '';
  4809. };
  4810. return StyleAttributor;
  4811. }(attributor_1.default));
  4812. exports.default = StyleAttributor;
  4813. /***/ }),
  4814. /* 35 */
  4815. /***/ (function(module, exports, __webpack_require__) {
  4816. "use strict";
  4817. Object.defineProperty(exports, "__esModule", { value: true });
  4818. var Registry = __webpack_require__(1);
  4819. var ShadowBlot = (function () {
  4820. function ShadowBlot(domNode) {
  4821. this.domNode = domNode;
  4822. this.attach();
  4823. }
  4824. Object.defineProperty(ShadowBlot.prototype, "statics", {
  4825. // Hack for accessing inherited static methods
  4826. get: function () {
  4827. return this.constructor;
  4828. },
  4829. enumerable: true,
  4830. configurable: true
  4831. });
  4832. ShadowBlot.create = function (value) {
  4833. if (this.tagName == null) {
  4834. throw new Registry.ParchmentError('Blot definition missing tagName');
  4835. }
  4836. var node;
  4837. if (Array.isArray(this.tagName)) {
  4838. if (typeof value === 'string') {
  4839. value = value.toUpperCase();
  4840. if (parseInt(value).toString() === value) {
  4841. value = parseInt(value);
  4842. }
  4843. }
  4844. if (typeof value === 'number') {
  4845. node = document.createElement(this.tagName[value - 1]);
  4846. }
  4847. else if (this.tagName.indexOf(value) > -1) {
  4848. node = document.createElement(value);
  4849. }
  4850. else {
  4851. node = document.createElement(this.tagName[0]);
  4852. }
  4853. }
  4854. else {
  4855. node = document.createElement(this.tagName);
  4856. }
  4857. if (this.className) {
  4858. node.classList.add(this.className);
  4859. }
  4860. return node;
  4861. };
  4862. ShadowBlot.prototype.attach = function () {
  4863. this.domNode[Registry.DATA_KEY] = { blot: this };
  4864. };
  4865. ShadowBlot.prototype.clone = function () {
  4866. var domNode = this.domNode.cloneNode();
  4867. return Registry.create(domNode);
  4868. };
  4869. ShadowBlot.prototype.detach = function () {
  4870. if (this.parent != null)
  4871. this.parent.removeChild(this);
  4872. delete this.domNode[Registry.DATA_KEY];
  4873. };
  4874. ShadowBlot.prototype.deleteAt = function (index, length) {
  4875. var blot = this.isolate(index, length);
  4876. blot.remove();
  4877. };
  4878. ShadowBlot.prototype.formatAt = function (index, length, name, value) {
  4879. var blot = this.isolate(index, length);
  4880. if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
  4881. blot.wrap(name, value);
  4882. }
  4883. else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
  4884. var parent = Registry.create(this.statics.scope);
  4885. blot.wrap(parent);
  4886. parent.format(name, value);
  4887. }
  4888. };
  4889. ShadowBlot.prototype.insertAt = function (index, value, def) {
  4890. var blot = (def == null) ? Registry.create('text', value) : Registry.create(value, def);
  4891. var ref = this.split(index);
  4892. this.parent.insertBefore(blot, ref);
  4893. };
  4894. ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
  4895. if (this.parent != null) {
  4896. this.parent.children.remove(this);
  4897. }
  4898. parentBlot.children.insertBefore(this, refBlot);
  4899. if (refBlot != null) {
  4900. var refDomNode = refBlot.domNode;
  4901. }
  4902. if (this.next == null || this.domNode.nextSibling != refDomNode) {
  4903. parentBlot.domNode.insertBefore(this.domNode, (typeof refDomNode !== 'undefined') ? refDomNode : null);
  4904. }
  4905. this.parent = parentBlot;
  4906. };
  4907. ShadowBlot.prototype.isolate = function (index, length) {
  4908. var target = this.split(index);
  4909. target.split(length);
  4910. return target;
  4911. };
  4912. ShadowBlot.prototype.length = function () {
  4913. return 1;
  4914. };
  4915. ;
  4916. ShadowBlot.prototype.offset = function (root) {
  4917. if (root === void 0) { root = this.parent; }
  4918. if (this.parent == null || this == root)
  4919. return 0;
  4920. return this.parent.children.offset(this) + this.parent.offset(root);
  4921. };
  4922. ShadowBlot.prototype.optimize = function () {
  4923. // TODO clean up once we use WeakMap
  4924. if (this.domNode[Registry.DATA_KEY] != null) {
  4925. delete this.domNode[Registry.DATA_KEY].mutations;
  4926. }
  4927. };
  4928. ShadowBlot.prototype.remove = function () {
  4929. if (this.domNode.parentNode != null) {
  4930. this.domNode.parentNode.removeChild(this.domNode);
  4931. }
  4932. this.detach();
  4933. };
  4934. ShadowBlot.prototype.replace = function (target) {
  4935. if (target.parent == null)
  4936. return;
  4937. target.parent.insertBefore(this, target.next);
  4938. target.remove();
  4939. };
  4940. ShadowBlot.prototype.replaceWith = function (name, value) {
  4941. var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
  4942. replacement.replace(this);
  4943. return replacement;
  4944. };
  4945. ShadowBlot.prototype.split = function (index, force) {
  4946. return index === 0 ? this : this.next;
  4947. };
  4948. ShadowBlot.prototype.update = function (mutations) {
  4949. if (mutations === void 0) { mutations = []; }
  4950. // Nothing to do by default
  4951. };
  4952. ShadowBlot.prototype.wrap = function (name, value) {
  4953. var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
  4954. if (this.parent != null) {
  4955. this.parent.insertBefore(wrapper, this.next);
  4956. }
  4957. wrapper.appendChild(this);
  4958. return wrapper;
  4959. };
  4960. return ShadowBlot;
  4961. }());
  4962. ShadowBlot.blotName = 'abstract';
  4963. exports.default = ShadowBlot;
  4964. /***/ }),
  4965. /* 36 */
  4966. /***/ (function(module, exports, __webpack_require__) {
  4967. "use strict";
  4968. Object.defineProperty(exports, "__esModule", {
  4969. value: true
  4970. });
  4971. exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
  4972. var _parchment = __webpack_require__(0);
  4973. var _parchment2 = _interopRequireDefault(_parchment);
  4974. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4975. var config = {
  4976. scope: _parchment2.default.Scope.BLOCK,
  4977. whitelist: ['right', 'center', 'justify']
  4978. };
  4979. var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
  4980. var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
  4981. var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
  4982. exports.AlignAttribute = AlignAttribute;
  4983. exports.AlignClass = AlignClass;
  4984. exports.AlignStyle = AlignStyle;
  4985. /***/ }),
  4986. /* 37 */
  4987. /***/ (function(module, exports, __webpack_require__) {
  4988. "use strict";
  4989. Object.defineProperty(exports, "__esModule", {
  4990. value: true
  4991. });
  4992. exports.BackgroundStyle = exports.BackgroundClass = undefined;
  4993. var _parchment = __webpack_require__(0);
  4994. var _parchment2 = _interopRequireDefault(_parchment);
  4995. var _color = __webpack_require__(26);
  4996. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4997. var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
  4998. scope: _parchment2.default.Scope.INLINE
  4999. });
  5000. var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
  5001. scope: _parchment2.default.Scope.INLINE
  5002. });
  5003. exports.BackgroundClass = BackgroundClass;
  5004. exports.BackgroundStyle = BackgroundStyle;
  5005. /***/ }),
  5006. /* 38 */
  5007. /***/ (function(module, exports, __webpack_require__) {
  5008. "use strict";
  5009. Object.defineProperty(exports, "__esModule", {
  5010. value: true
  5011. });
  5012. exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
  5013. var _parchment = __webpack_require__(0);
  5014. var _parchment2 = _interopRequireDefault(_parchment);
  5015. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5016. var config = {
  5017. scope: _parchment2.default.Scope.BLOCK,
  5018. whitelist: ['rtl']
  5019. };
  5020. var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
  5021. var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
  5022. var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
  5023. exports.DirectionAttribute = DirectionAttribute;
  5024. exports.DirectionClass = DirectionClass;
  5025. exports.DirectionStyle = DirectionStyle;
  5026. /***/ }),
  5027. /* 39 */
  5028. /***/ (function(module, exports, __webpack_require__) {
  5029. "use strict";
  5030. Object.defineProperty(exports, "__esModule", {
  5031. value: true
  5032. });
  5033. exports.FontClass = exports.FontStyle = undefined;
  5034. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5035. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5036. var _parchment = __webpack_require__(0);
  5037. var _parchment2 = _interopRequireDefault(_parchment);
  5038. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5039. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5040. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5041. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5042. var config = {
  5043. scope: _parchment2.default.Scope.INLINE,
  5044. whitelist: ['serif', 'monospace']
  5045. };
  5046. var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
  5047. var FontStyleAttributor = function (_Parchment$Attributor) {
  5048. _inherits(FontStyleAttributor, _Parchment$Attributor);
  5049. function FontStyleAttributor() {
  5050. _classCallCheck(this, FontStyleAttributor);
  5051. return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
  5052. }
  5053. _createClass(FontStyleAttributor, [{
  5054. key: 'value',
  5055. value: function value(node) {
  5056. return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
  5057. }
  5058. }]);
  5059. return FontStyleAttributor;
  5060. }(_parchment2.default.Attributor.Style);
  5061. var FontStyle = new FontStyleAttributor('font', 'font-family', config);
  5062. exports.FontStyle = FontStyle;
  5063. exports.FontClass = FontClass;
  5064. /***/ }),
  5065. /* 40 */
  5066. /***/ (function(module, exports, __webpack_require__) {
  5067. "use strict";
  5068. Object.defineProperty(exports, "__esModule", {
  5069. value: true
  5070. });
  5071. exports.SizeStyle = exports.SizeClass = undefined;
  5072. var _parchment = __webpack_require__(0);
  5073. var _parchment2 = _interopRequireDefault(_parchment);
  5074. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5075. var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
  5076. scope: _parchment2.default.Scope.INLINE,
  5077. whitelist: ['small', 'large', 'huge']
  5078. });
  5079. var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
  5080. scope: _parchment2.default.Scope.INLINE,
  5081. whitelist: ['10px', '18px', '32px']
  5082. });
  5083. exports.SizeClass = SizeClass;
  5084. exports.SizeStyle = SizeStyle;
  5085. /***/ }),
  5086. /* 41 */
  5087. /***/ (function(module, exports, __webpack_require__) {
  5088. "use strict";
  5089. module.exports = {
  5090. 'align': {
  5091. '': __webpack_require__(79),
  5092. 'center': __webpack_require__(77),
  5093. 'right': __webpack_require__(80),
  5094. 'justify': __webpack_require__(78)
  5095. },
  5096. 'background': __webpack_require__(81),
  5097. 'blockquote': __webpack_require__(82),
  5098. 'bold': __webpack_require__(83),
  5099. 'clean': __webpack_require__(84),
  5100. 'code': __webpack_require__(55),
  5101. 'code-block': __webpack_require__(55),
  5102. 'color': __webpack_require__(85),
  5103. 'direction': {
  5104. '': __webpack_require__(86),
  5105. 'rtl': __webpack_require__(87)
  5106. },
  5107. 'float': {
  5108. 'center': __webpack_require__(89),
  5109. 'full': __webpack_require__(90),
  5110. 'left': __webpack_require__(91),
  5111. 'right': __webpack_require__(92)
  5112. },
  5113. 'formula': __webpack_require__(93),
  5114. 'header': {
  5115. '1': __webpack_require__(95),
  5116. '2': __webpack_require__(94)
  5117. },
  5118. 'italic': __webpack_require__(98),
  5119. 'image': __webpack_require__(96),
  5120. 'indent': {
  5121. '+1': __webpack_require__(97),
  5122. '-1': __webpack_require__(103)
  5123. },
  5124. 'link': __webpack_require__(99),
  5125. 'list': {
  5126. 'ordered': __webpack_require__(102),
  5127. 'bullet': __webpack_require__(100),
  5128. 'check': __webpack_require__(101)
  5129. },
  5130. 'script': {
  5131. 'sub': __webpack_require__(105),
  5132. 'super': __webpack_require__(106)
  5133. },
  5134. 'strike': __webpack_require__(104),
  5135. 'underline': __webpack_require__(107),
  5136. 'video': __webpack_require__(108)
  5137. };
  5138. /***/ }),
  5139. /* 42 */
  5140. /***/ (function(module, exports, __webpack_require__) {
  5141. "use strict";
  5142. Object.defineProperty(exports, "__esModule", {
  5143. value: true
  5144. });
  5145. exports.getLastChangeIndex = exports.default = undefined;
  5146. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5147. var _parchment = __webpack_require__(0);
  5148. var _parchment2 = _interopRequireDefault(_parchment);
  5149. var _quill = __webpack_require__(6);
  5150. var _quill2 = _interopRequireDefault(_quill);
  5151. var _module = __webpack_require__(9);
  5152. var _module2 = _interopRequireDefault(_module);
  5153. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5154. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5155. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5156. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5157. var History = function (_Module) {
  5158. _inherits(History, _Module);
  5159. function History(quill, options) {
  5160. _classCallCheck(this, History);
  5161. var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
  5162. _this.lastRecorded = 0;
  5163. _this.ignoreChange = false;
  5164. _this.clear();
  5165. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
  5166. if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
  5167. if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
  5168. _this.record(delta, oldDelta);
  5169. } else {
  5170. _this.transform(delta);
  5171. }
  5172. });
  5173. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
  5174. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
  5175. if (/Win/i.test(navigator.platform)) {
  5176. _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
  5177. }
  5178. return _this;
  5179. }
  5180. _createClass(History, [{
  5181. key: 'change',
  5182. value: function change(source, dest) {
  5183. if (this.stack[source].length === 0) return;
  5184. var delta = this.stack[source].pop();
  5185. this.lastRecorded = 0;
  5186. this.ignoreChange = true;
  5187. this.quill.updateContents(delta[source], _quill2.default.sources.USER);
  5188. this.ignoreChange = false;
  5189. var index = getLastChangeIndex(delta[source]);
  5190. this.quill.setSelection(index);
  5191. this.quill.selection.scrollIntoView();
  5192. this.stack[dest].push(delta);
  5193. }
  5194. }, {
  5195. key: 'clear',
  5196. value: function clear() {
  5197. this.stack = { undo: [], redo: [] };
  5198. }
  5199. }, {
  5200. key: 'record',
  5201. value: function record(changeDelta, oldDelta) {
  5202. if (changeDelta.ops.length === 0) return;
  5203. this.stack.redo = [];
  5204. var undoDelta = this.quill.getContents().diff(oldDelta);
  5205. var timestamp = Date.now();
  5206. if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
  5207. var delta = this.stack.undo.pop();
  5208. undoDelta = undoDelta.compose(delta.undo);
  5209. changeDelta = delta.redo.compose(changeDelta);
  5210. } else {
  5211. this.lastRecorded = timestamp;
  5212. }
  5213. this.stack.undo.push({
  5214. redo: changeDelta,
  5215. undo: undoDelta
  5216. });
  5217. if (this.stack.undo.length > this.options.maxStack) {
  5218. this.stack.undo.shift();
  5219. }
  5220. }
  5221. }, {
  5222. key: 'redo',
  5223. value: function redo() {
  5224. this.change('redo', 'undo');
  5225. }
  5226. }, {
  5227. key: 'transform',
  5228. value: function transform(delta) {
  5229. this.stack.undo.forEach(function (change) {
  5230. change.undo = delta.transform(change.undo, true);
  5231. change.redo = delta.transform(change.redo, true);
  5232. });
  5233. this.stack.redo.forEach(function (change) {
  5234. change.undo = delta.transform(change.undo, true);
  5235. change.redo = delta.transform(change.redo, true);
  5236. });
  5237. }
  5238. }, {
  5239. key: 'undo',
  5240. value: function undo() {
  5241. this.change('undo', 'redo');
  5242. }
  5243. }]);
  5244. return History;
  5245. }(_module2.default);
  5246. History.DEFAULTS = {
  5247. delay: 1000,
  5248. maxStack: 100,
  5249. userOnly: false
  5250. };
  5251. function endsWithNewlineChange(delta) {
  5252. var lastOp = delta.ops[delta.ops.length - 1];
  5253. if (lastOp == null) return false;
  5254. if (lastOp.insert != null) {
  5255. return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
  5256. }
  5257. if (lastOp.attributes != null) {
  5258. return Object.keys(lastOp.attributes).some(function (attr) {
  5259. return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
  5260. });
  5261. }
  5262. return false;
  5263. }
  5264. function getLastChangeIndex(delta) {
  5265. var deleteLength = delta.reduce(function (length, op) {
  5266. length += op.delete || 0;
  5267. return length;
  5268. }, 0);
  5269. var changeIndex = delta.length() - deleteLength;
  5270. if (endsWithNewlineChange(delta)) {
  5271. changeIndex -= 1;
  5272. }
  5273. return changeIndex;
  5274. }
  5275. exports.default = History;
  5276. exports.getLastChangeIndex = getLastChangeIndex;
  5277. /***/ }),
  5278. /* 43 */
  5279. /***/ (function(module, exports, __webpack_require__) {
  5280. "use strict";
  5281. Object.defineProperty(exports, "__esModule", {
  5282. value: true
  5283. });
  5284. exports.default = exports.BaseTooltip = undefined;
  5285. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5286. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5287. var _extend = __webpack_require__(3);
  5288. var _extend2 = _interopRequireDefault(_extend);
  5289. var _quillDelta = __webpack_require__(2);
  5290. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  5291. var _emitter = __webpack_require__(5);
  5292. var _emitter2 = _interopRequireDefault(_emitter);
  5293. var _keyboard = __webpack_require__(31);
  5294. var _keyboard2 = _interopRequireDefault(_keyboard);
  5295. var _theme = __webpack_require__(30);
  5296. var _theme2 = _interopRequireDefault(_theme);
  5297. var _colorPicker = __webpack_require__(48);
  5298. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  5299. var _iconPicker = __webpack_require__(49);
  5300. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  5301. var _picker = __webpack_require__(28);
  5302. var _picker2 = _interopRequireDefault(_picker);
  5303. var _tooltip = __webpack_require__(50);
  5304. var _tooltip2 = _interopRequireDefault(_tooltip);
  5305. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5306. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5307. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5308. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5309. var ALIGNS = [false, 'center', 'right', 'justify'];
  5310. var COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
  5311. var FONTS = [false, 'serif', 'monospace'];
  5312. var HEADERS = ['1', '2', '3', false];
  5313. var SIZES = ['small', false, 'large', 'huge'];
  5314. var BaseTheme = function (_Theme) {
  5315. _inherits(BaseTheme, _Theme);
  5316. function BaseTheme(quill, options) {
  5317. _classCallCheck(this, BaseTheme);
  5318. var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
  5319. var listener = function listener(e) {
  5320. if (!document.body.contains(quill.root)) {
  5321. return document.body.removeEventListener('click', listener);
  5322. }
  5323. if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
  5324. _this.tooltip.hide();
  5325. }
  5326. if (_this.pickers != null) {
  5327. _this.pickers.forEach(function (picker) {
  5328. if (!picker.container.contains(e.target)) {
  5329. picker.close();
  5330. }
  5331. });
  5332. }
  5333. };
  5334. document.body.addEventListener('click', listener);
  5335. return _this;
  5336. }
  5337. _createClass(BaseTheme, [{
  5338. key: 'addModule',
  5339. value: function addModule(name) {
  5340. var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
  5341. if (name === 'toolbar') {
  5342. this.extendToolbar(module);
  5343. }
  5344. return module;
  5345. }
  5346. }, {
  5347. key: 'buildButtons',
  5348. value: function buildButtons(buttons, icons) {
  5349. buttons.forEach(function (button) {
  5350. var className = button.getAttribute('class') || '';
  5351. className.split(/\s+/).forEach(function (name) {
  5352. if (!name.startsWith('ql-')) return;
  5353. name = name.slice('ql-'.length);
  5354. if (icons[name] == null) return;
  5355. if (name === 'direction') {
  5356. button.innerHTML = icons[name][''] + icons[name]['rtl'];
  5357. } else if (typeof icons[name] === 'string') {
  5358. button.innerHTML = icons[name];
  5359. } else {
  5360. var value = button.value || '';
  5361. if (value != null && icons[name][value]) {
  5362. button.innerHTML = icons[name][value];
  5363. }
  5364. }
  5365. });
  5366. });
  5367. }
  5368. }, {
  5369. key: 'buildPickers',
  5370. value: function buildPickers(selects, icons) {
  5371. var _this2 = this;
  5372. this.pickers = selects.map(function (select) {
  5373. if (select.classList.contains('ql-align')) {
  5374. if (select.querySelector('option') == null) {
  5375. fillSelect(select, ALIGNS);
  5376. }
  5377. return new _iconPicker2.default(select, icons.align);
  5378. } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
  5379. var format = select.classList.contains('ql-background') ? 'background' : 'color';
  5380. if (select.querySelector('option') == null) {
  5381. fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
  5382. }
  5383. return new _colorPicker2.default(select, icons[format]);
  5384. } else {
  5385. if (select.querySelector('option') == null) {
  5386. if (select.classList.contains('ql-font')) {
  5387. fillSelect(select, FONTS);
  5388. } else if (select.classList.contains('ql-header')) {
  5389. fillSelect(select, HEADERS);
  5390. } else if (select.classList.contains('ql-size')) {
  5391. fillSelect(select, SIZES);
  5392. }
  5393. }
  5394. return new _picker2.default(select);
  5395. }
  5396. });
  5397. var update = function update() {
  5398. _this2.pickers.forEach(function (picker) {
  5399. picker.update();
  5400. });
  5401. };
  5402. this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
  5403. }
  5404. }]);
  5405. return BaseTheme;
  5406. }(_theme2.default);
  5407. BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
  5408. modules: {
  5409. toolbar: {
  5410. handlers: {
  5411. formula: function formula() {
  5412. this.quill.theme.tooltip.edit('formula');
  5413. },
  5414. image: function image() {
  5415. var _this3 = this;
  5416. var fileInput = this.container.querySelector('input.ql-image[type=file]');
  5417. if (fileInput == null) {
  5418. fileInput = document.createElement('input');
  5419. fileInput.setAttribute('type', 'file');
  5420. fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
  5421. fileInput.classList.add('ql-image');
  5422. fileInput.addEventListener('change', function () {
  5423. if (fileInput.files != null && fileInput.files[0] != null) {
  5424. var reader = new FileReader();
  5425. reader.onload = function (e) {
  5426. var range = _this3.quill.getSelection(true);
  5427. _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
  5428. fileInput.value = "";
  5429. };
  5430. reader.readAsDataURL(fileInput.files[0]);
  5431. }
  5432. });
  5433. this.container.appendChild(fileInput);
  5434. }
  5435. fileInput.click();
  5436. },
  5437. video: function video() {
  5438. this.quill.theme.tooltip.edit('video');
  5439. }
  5440. }
  5441. }
  5442. }
  5443. });
  5444. var BaseTooltip = function (_Tooltip) {
  5445. _inherits(BaseTooltip, _Tooltip);
  5446. function BaseTooltip(quill, boundsContainer) {
  5447. _classCallCheck(this, BaseTooltip);
  5448. var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
  5449. _this4.textbox = _this4.root.querySelector('input[type="text"]');
  5450. _this4.listen();
  5451. return _this4;
  5452. }
  5453. _createClass(BaseTooltip, [{
  5454. key: 'listen',
  5455. value: function listen() {
  5456. var _this5 = this;
  5457. this.textbox.addEventListener('keydown', function (event) {
  5458. if (_keyboard2.default.match(event, 'enter')) {
  5459. _this5.save();
  5460. event.preventDefault();
  5461. } else if (_keyboard2.default.match(event, 'escape')) {
  5462. _this5.cancel();
  5463. event.preventDefault();
  5464. }
  5465. });
  5466. }
  5467. }, {
  5468. key: 'cancel',
  5469. value: function cancel() {
  5470. this.hide();
  5471. }
  5472. }, {
  5473. key: 'edit',
  5474. value: function edit() {
  5475. var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
  5476. var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  5477. this.root.classList.remove('ql-hidden');
  5478. this.root.classList.add('ql-editing');
  5479. if (preview != null) {
  5480. this.textbox.value = preview;
  5481. } else if (mode !== this.root.getAttribute('data-mode')) {
  5482. this.textbox.value = '';
  5483. }
  5484. this.position(this.quill.getBounds(this.quill.selection.savedRange));
  5485. this.textbox.select();
  5486. this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
  5487. this.root.setAttribute('data-mode', mode);
  5488. }
  5489. }, {
  5490. key: 'restoreFocus',
  5491. value: function restoreFocus() {
  5492. var scrollTop = this.quill.scrollingContainer.scrollTop;
  5493. this.quill.focus();
  5494. this.quill.scrollingContainer.scrollTop = scrollTop;
  5495. }
  5496. }, {
  5497. key: 'save',
  5498. value: function save() {
  5499. var value = this.textbox.value;
  5500. switch (this.root.getAttribute('data-mode')) {
  5501. case 'link':
  5502. {
  5503. var scrollTop = this.quill.root.scrollTop;
  5504. if (this.linkRange) {
  5505. this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
  5506. delete this.linkRange;
  5507. } else {
  5508. this.restoreFocus();
  5509. this.quill.format('link', value, _emitter2.default.sources.USER);
  5510. }
  5511. this.quill.root.scrollTop = scrollTop;
  5512. break;
  5513. }
  5514. case 'video':
  5515. {
  5516. value = extractVideoUrl(value);
  5517. } // eslint-disable-next-line no-fallthrough
  5518. case 'formula':
  5519. {
  5520. if (!value) break;
  5521. var range = this.quill.getSelection(true);
  5522. if (range != null) {
  5523. var index = range.index + range.length;
  5524. this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
  5525. if (this.root.getAttribute('data-mode') === 'formula') {
  5526. this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
  5527. }
  5528. this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
  5529. }
  5530. break;
  5531. }
  5532. default:
  5533. }
  5534. this.textbox.value = '';
  5535. this.hide();
  5536. }
  5537. }]);
  5538. return BaseTooltip;
  5539. }(_tooltip2.default);
  5540. function extractVideoUrl(url) {
  5541. var match = url.match(/^(https?):\/\/(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(https?):\/\/(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);
  5542. if (match) {
  5543. return match[1] + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
  5544. }
  5545. if (match = url.match(/^(https?):\/\/(?:www\.)?vimeo\.com\/(\d+)/)) {
  5546. // eslint-disable-line no-cond-assign
  5547. return match[1] + '://player.vimeo.com/video/' + match[2] + '/';
  5548. }
  5549. return url;
  5550. }
  5551. function fillSelect(select, values) {
  5552. var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  5553. values.forEach(function (value) {
  5554. var option = document.createElement('option');
  5555. if (value === defaultValue) {
  5556. option.setAttribute('selected', 'selected');
  5557. } else {
  5558. option.setAttribute('value', value);
  5559. }
  5560. select.appendChild(option);
  5561. });
  5562. }
  5563. exports.BaseTooltip = BaseTooltip;
  5564. exports.default = BaseTheme;
  5565. /***/ }),
  5566. /* 44 */
  5567. /***/ (function(module, exports, __webpack_require__) {
  5568. "use strict";
  5569. var elem = document.createElement('div');
  5570. elem.classList.toggle('test-class', false);
  5571. if (elem.classList.contains('test-class')) {
  5572. var _toggle = DOMTokenList.prototype.toggle;
  5573. DOMTokenList.prototype.toggle = function (token, force) {
  5574. if (arguments.length > 1 && !this.contains(token) === !force) {
  5575. return force;
  5576. } else {
  5577. return _toggle.call(this, token);
  5578. }
  5579. };
  5580. }
  5581. if (!String.prototype.startsWith) {
  5582. String.prototype.startsWith = function (searchString, position) {
  5583. position = position || 0;
  5584. return this.substr(position, searchString.length) === searchString;
  5585. };
  5586. }
  5587. if (!String.prototype.endsWith) {
  5588. String.prototype.endsWith = function (searchString, position) {
  5589. var subjectString = this.toString();
  5590. if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
  5591. position = subjectString.length;
  5592. }
  5593. position -= searchString.length;
  5594. var lastIndex = subjectString.indexOf(searchString, position);
  5595. return lastIndex !== -1 && lastIndex === position;
  5596. };
  5597. }
  5598. if (!Array.prototype.find) {
  5599. Object.defineProperty(Array.prototype, "find", {
  5600. value: function value(predicate) {
  5601. if (this === null) {
  5602. throw new TypeError('Array.prototype.find called on null or undefined');
  5603. }
  5604. if (typeof predicate !== 'function') {
  5605. throw new TypeError('predicate must be a function');
  5606. }
  5607. var list = Object(this);
  5608. var length = list.length >>> 0;
  5609. var thisArg = arguments[1];
  5610. var value;
  5611. for (var i = 0; i < length; i++) {
  5612. value = list[i];
  5613. if (predicate.call(thisArg, value, i, list)) {
  5614. return value;
  5615. }
  5616. }
  5617. return undefined;
  5618. }
  5619. });
  5620. }
  5621. document.addEventListener("DOMContentLoaded", function () {
  5622. // Disable resizing in Firefox
  5623. document.execCommand("enableObjectResizing", false, false);
  5624. // Disable automatic linkifying in IE11
  5625. document.execCommand("autoUrlDetect", false, false);
  5626. });
  5627. /***/ }),
  5628. /* 45 */
  5629. /***/ (function(module, exports, __webpack_require__) {
  5630. "use strict";
  5631. Object.defineProperty(exports, "__esModule", {
  5632. value: true
  5633. });
  5634. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5635. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5636. var _inline = __webpack_require__(8);
  5637. var _inline2 = _interopRequireDefault(_inline);
  5638. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5639. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5640. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5641. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5642. var Bold = function (_Inline) {
  5643. _inherits(Bold, _Inline);
  5644. function Bold() {
  5645. _classCallCheck(this, Bold);
  5646. return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
  5647. }
  5648. _createClass(Bold, [{
  5649. key: 'optimize',
  5650. value: function optimize() {
  5651. _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this);
  5652. if (this.domNode.tagName !== this.statics.tagName[0]) {
  5653. this.replaceWith(this.statics.blotName);
  5654. }
  5655. }
  5656. }], [{
  5657. key: 'create',
  5658. value: function create() {
  5659. return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
  5660. }
  5661. }, {
  5662. key: 'formats',
  5663. value: function formats() {
  5664. return true;
  5665. }
  5666. }]);
  5667. return Bold;
  5668. }(_inline2.default);
  5669. Bold.blotName = 'bold';
  5670. Bold.tagName = ['STRONG', 'B'];
  5671. exports.default = Bold;
  5672. /***/ }),
  5673. /* 46 */
  5674. /***/ (function(module, exports, __webpack_require__) {
  5675. "use strict";
  5676. Object.defineProperty(exports, "__esModule", {
  5677. value: true
  5678. });
  5679. exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
  5680. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5681. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  5682. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5683. var _extend2 = __webpack_require__(3);
  5684. var _extend3 = _interopRequireDefault(_extend2);
  5685. var _quillDelta = __webpack_require__(2);
  5686. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  5687. var _parchment = __webpack_require__(0);
  5688. var _parchment2 = _interopRequireDefault(_parchment);
  5689. var _quill = __webpack_require__(6);
  5690. var _quill2 = _interopRequireDefault(_quill);
  5691. var _logger = __webpack_require__(10);
  5692. var _logger2 = _interopRequireDefault(_logger);
  5693. var _module = __webpack_require__(9);
  5694. var _module2 = _interopRequireDefault(_module);
  5695. var _align = __webpack_require__(36);
  5696. var _background = __webpack_require__(37);
  5697. var _color = __webpack_require__(26);
  5698. var _direction = __webpack_require__(38);
  5699. var _font = __webpack_require__(39);
  5700. var _size = __webpack_require__(40);
  5701. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5702. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  5703. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  5704. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5705. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5706. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5707. var debug = (0, _logger2.default)('quill:clipboard');
  5708. var DOM_KEY = '__ql-matcher';
  5709. var CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];
  5710. var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
  5711. memo[attr.keyName] = attr;
  5712. return memo;
  5713. }, {});
  5714. var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
  5715. memo[attr.keyName] = attr;
  5716. return memo;
  5717. }, {});
  5718. var Clipboard = function (_Module) {
  5719. _inherits(Clipboard, _Module);
  5720. function Clipboard(quill, options) {
  5721. _classCallCheck(this, Clipboard);
  5722. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
  5723. _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
  5724. _this.container = _this.quill.addContainer('ql-clipboard');
  5725. _this.container.setAttribute('contenteditable', true);
  5726. _this.container.setAttribute('tabindex', -1);
  5727. _this.matchers = [];
  5728. CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (pair) {
  5729. _this.addMatcher.apply(_this, _toConsumableArray(pair));
  5730. });
  5731. return _this;
  5732. }
  5733. _createClass(Clipboard, [{
  5734. key: 'addMatcher',
  5735. value: function addMatcher(selector, matcher) {
  5736. this.matchers.push([selector, matcher]);
  5737. }
  5738. }, {
  5739. key: 'convert',
  5740. value: function convert(html) {
  5741. if (typeof html === 'string') {
  5742. this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
  5743. }
  5744. var _prepareMatching = this.prepareMatching(),
  5745. _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
  5746. elementMatchers = _prepareMatching2[0],
  5747. textMatchers = _prepareMatching2[1];
  5748. var delta = traverse(this.container, elementMatchers, textMatchers);
  5749. // Remove trailing newline
  5750. if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
  5751. delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
  5752. }
  5753. debug.log('convert', this.container.innerHTML, delta);
  5754. this.container.innerHTML = '';
  5755. return delta;
  5756. }
  5757. }, {
  5758. key: 'dangerouslyPasteHTML',
  5759. value: function dangerouslyPasteHTML(index, html) {
  5760. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
  5761. if (typeof index === 'string') {
  5762. return this.quill.setContents(this.convert(index), html);
  5763. } else {
  5764. var paste = this.convert(html);
  5765. return this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
  5766. }
  5767. }
  5768. }, {
  5769. key: 'onPaste',
  5770. value: function onPaste(e) {
  5771. var _this2 = this;
  5772. if (e.defaultPrevented || !this.quill.isEnabled()) return;
  5773. var range = this.quill.getSelection();
  5774. var delta = new _quillDelta2.default().retain(range.index);
  5775. var scrollTop = this.quill.scrollingContainer.scrollTop;
  5776. this.container.focus();
  5777. setTimeout(function () {
  5778. _this2.quill.selection.update(_quill2.default.sources.SILENT);
  5779. delta = delta.concat(_this2.convert()).delete(range.length);
  5780. _this2.quill.updateContents(delta, _quill2.default.sources.USER);
  5781. // range.length contributes to delta.length()
  5782. _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
  5783. _this2.quill.scrollingContainer.scrollTop = scrollTop;
  5784. _this2.quill.selection.scrollIntoView();
  5785. }, 1);
  5786. }
  5787. }, {
  5788. key: 'prepareMatching',
  5789. value: function prepareMatching() {
  5790. var _this3 = this;
  5791. var elementMatchers = [],
  5792. textMatchers = [];
  5793. this.matchers.forEach(function (pair) {
  5794. var _pair = _slicedToArray(pair, 2),
  5795. selector = _pair[0],
  5796. matcher = _pair[1];
  5797. switch (selector) {
  5798. case Node.TEXT_NODE:
  5799. textMatchers.push(matcher);
  5800. break;
  5801. case Node.ELEMENT_NODE:
  5802. elementMatchers.push(matcher);
  5803. break;
  5804. default:
  5805. [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
  5806. // TODO use weakmap
  5807. node[DOM_KEY] = node[DOM_KEY] || [];
  5808. node[DOM_KEY].push(matcher);
  5809. });
  5810. break;
  5811. }
  5812. });
  5813. return [elementMatchers, textMatchers];
  5814. }
  5815. }]);
  5816. return Clipboard;
  5817. }(_module2.default);
  5818. Clipboard.DEFAULTS = {
  5819. matchers: []
  5820. };
  5821. function applyFormat(delta, format, value) {
  5822. if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
  5823. return Object.keys(format).reduce(function (delta, key) {
  5824. return applyFormat(delta, key, format[key]);
  5825. }, delta);
  5826. } else {
  5827. return delta.reduce(function (delta, op) {
  5828. if (op.attributes && op.attributes[format]) {
  5829. return delta.push(op);
  5830. } else {
  5831. return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
  5832. }
  5833. }, new _quillDelta2.default());
  5834. }
  5835. }
  5836. function computeStyle(node) {
  5837. if (node.nodeType !== Node.ELEMENT_NODE) return {};
  5838. var DOM_KEY = '__ql-computed-style';
  5839. return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
  5840. }
  5841. function deltaEndsWith(delta, text) {
  5842. var endText = "";
  5843. for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
  5844. var op = delta.ops[i];
  5845. if (typeof op.insert !== 'string') break;
  5846. endText = op.insert + endText;
  5847. }
  5848. return endText.slice(-1 * text.length) === text;
  5849. }
  5850. function isLine(node) {
  5851. if (node.childNodes.length === 0) return false; // Exclude embed blocks
  5852. var style = computeStyle(node);
  5853. return ['block', 'list-item'].indexOf(style.display) > -1;
  5854. }
  5855. function traverse(node, elementMatchers, textMatchers) {
  5856. // Post-order
  5857. if (node.nodeType === node.TEXT_NODE) {
  5858. return textMatchers.reduce(function (delta, matcher) {
  5859. return matcher(node, delta);
  5860. }, new _quillDelta2.default());
  5861. } else if (node.nodeType === node.ELEMENT_NODE) {
  5862. return [].reduce.call(node.childNodes || [], function (delta, childNode) {
  5863. var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
  5864. if (childNode.nodeType === node.ELEMENT_NODE) {
  5865. childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
  5866. return matcher(childNode, childrenDelta);
  5867. }, childrenDelta);
  5868. childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
  5869. return matcher(childNode, childrenDelta);
  5870. }, childrenDelta);
  5871. }
  5872. return delta.concat(childrenDelta);
  5873. }, new _quillDelta2.default());
  5874. } else {
  5875. return new _quillDelta2.default();
  5876. }
  5877. }
  5878. function matchAlias(format, node, delta) {
  5879. return applyFormat(delta, format, true);
  5880. }
  5881. function matchAttributor(node, delta) {
  5882. var attributes = _parchment2.default.Attributor.Attribute.keys(node);
  5883. var classes = _parchment2.default.Attributor.Class.keys(node);
  5884. var styles = _parchment2.default.Attributor.Style.keys(node);
  5885. var formats = {};
  5886. attributes.concat(classes).concat(styles).forEach(function (name) {
  5887. var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
  5888. if (attr != null) {
  5889. formats[attr.attrName] = attr.value(node);
  5890. if (formats[attr.attrName]) return;
  5891. }
  5892. attr = ATTRIBUTE_ATTRIBUTORS[name];
  5893. if (attr != null && attr.attrName === name) {
  5894. formats[attr.attrName] = attr.value(node) || undefined;
  5895. }
  5896. attr = STYLE_ATTRIBUTORS[name];
  5897. if (attr != null && attr.attrName === name) {
  5898. attr = STYLE_ATTRIBUTORS[name];
  5899. formats[attr.attrName] = attr.value(node) || undefined;
  5900. }
  5901. });
  5902. if (Object.keys(formats).length > 0) {
  5903. delta = applyFormat(delta, formats);
  5904. }
  5905. return delta;
  5906. }
  5907. function matchBlot(node, delta) {
  5908. var match = _parchment2.default.query(node);
  5909. if (match == null) return delta;
  5910. if (match.prototype instanceof _parchment2.default.Embed) {
  5911. var embed = {};
  5912. var value = match.value(node);
  5913. if (value != null) {
  5914. embed[match.blotName] = value;
  5915. delta = new _quillDelta2.default().insert(embed, match.formats(node));
  5916. }
  5917. } else if (typeof match.formats === 'function') {
  5918. delta = applyFormat(delta, match.blotName, match.formats(node));
  5919. }
  5920. return delta;
  5921. }
  5922. function matchBreak(node, delta) {
  5923. if (!deltaEndsWith(delta, '\n')) {
  5924. delta.insert('\n');
  5925. }
  5926. return delta;
  5927. }
  5928. function matchIgnore() {
  5929. return new _quillDelta2.default();
  5930. }
  5931. function matchIndent(node, delta) {
  5932. var match = _parchment2.default.query(node);
  5933. if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
  5934. return delta;
  5935. }
  5936. var indent = -1,
  5937. parent = node.parentNode;
  5938. while (!parent.classList.contains('ql-clipboard')) {
  5939. if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
  5940. indent += 1;
  5941. }
  5942. parent = parent.parentNode;
  5943. }
  5944. if (indent <= 0) return delta;
  5945. return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
  5946. }
  5947. function matchNewline(node, delta) {
  5948. if (!deltaEndsWith(delta, '\n')) {
  5949. if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
  5950. delta.insert('\n');
  5951. }
  5952. }
  5953. return delta;
  5954. }
  5955. function matchSpacing(node, delta) {
  5956. if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
  5957. var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
  5958. if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
  5959. delta.insert('\n');
  5960. }
  5961. }
  5962. return delta;
  5963. }
  5964. function matchStyles(node, delta) {
  5965. var formats = {};
  5966. var style = node.style || {};
  5967. if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
  5968. formats.italic = true;
  5969. }
  5970. if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
  5971. formats.bold = true;
  5972. }
  5973. if (Object.keys(formats).length > 0) {
  5974. delta = applyFormat(delta, formats);
  5975. }
  5976. if (parseFloat(style.textIndent || 0) > 0) {
  5977. // Could be 0.5in
  5978. delta = new _quillDelta2.default().insert('\t').concat(delta);
  5979. }
  5980. return delta;
  5981. }
  5982. function matchText(node, delta) {
  5983. var text = node.data;
  5984. // Word represents empty line with <o:p>&nbsp;</o:p>
  5985. if (node.parentNode.tagName === 'O:P') {
  5986. return delta.insert(text.trim());
  5987. }
  5988. if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
  5989. return delta;
  5990. }
  5991. if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
  5992. // eslint-disable-next-line func-style
  5993. var replacer = function replacer(collapse, match) {
  5994. match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
  5995. return match.length < 1 && collapse ? ' ' : match;
  5996. };
  5997. text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
  5998. text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
  5999. if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
  6000. text = text.replace(/^\s+/, replacer.bind(replacer, false));
  6001. }
  6002. if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
  6003. text = text.replace(/\s+$/, replacer.bind(replacer, false));
  6004. }
  6005. }
  6006. return delta.insert(text);
  6007. }
  6008. exports.default = Clipboard;
  6009. exports.matchAttributor = matchAttributor;
  6010. exports.matchBlot = matchBlot;
  6011. exports.matchNewline = matchNewline;
  6012. exports.matchSpacing = matchSpacing;
  6013. exports.matchText = matchText;
  6014. /***/ }),
  6015. /* 47 */
  6016. /***/ (function(module, exports, __webpack_require__) {
  6017. "use strict";
  6018. Object.defineProperty(exports, "__esModule", {
  6019. value: true
  6020. });
  6021. exports.addControls = exports.default = undefined;
  6022. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  6023. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6024. var _quillDelta = __webpack_require__(2);
  6025. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  6026. var _parchment = __webpack_require__(0);
  6027. var _parchment2 = _interopRequireDefault(_parchment);
  6028. var _quill = __webpack_require__(6);
  6029. var _quill2 = _interopRequireDefault(_quill);
  6030. var _logger = __webpack_require__(10);
  6031. var _logger2 = _interopRequireDefault(_logger);
  6032. var _module = __webpack_require__(9);
  6033. var _module2 = _interopRequireDefault(_module);
  6034. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6035. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  6036. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6037. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6038. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6039. var debug = (0, _logger2.default)('quill:toolbar');
  6040. var Toolbar = function (_Module) {
  6041. _inherits(Toolbar, _Module);
  6042. function Toolbar(quill, options) {
  6043. _classCallCheck(this, Toolbar);
  6044. var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
  6045. if (Array.isArray(_this.options.container)) {
  6046. var container = document.createElement('div');
  6047. addControls(container, _this.options.container);
  6048. quill.container.parentNode.insertBefore(container, quill.container);
  6049. _this.container = container;
  6050. } else if (typeof _this.options.container === 'string') {
  6051. _this.container = document.querySelector(_this.options.container);
  6052. } else {
  6053. _this.container = _this.options.container;
  6054. }
  6055. if (!(_this.container instanceof HTMLElement)) {
  6056. var _ret;
  6057. return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
  6058. }
  6059. _this.container.classList.add('ql-toolbar');
  6060. _this.controls = [];
  6061. _this.handlers = {};
  6062. Object.keys(_this.options.handlers).forEach(function (format) {
  6063. _this.addHandler(format, _this.options.handlers[format]);
  6064. });
  6065. [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
  6066. _this.attach(input);
  6067. });
  6068. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
  6069. if (type === _quill2.default.events.SELECTION_CHANGE) {
  6070. _this.update(range);
  6071. }
  6072. });
  6073. _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  6074. var _this$quill$selection = _this.quill.selection.getRange(),
  6075. _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
  6076. range = _this$quill$selection2[0]; // quill.getSelection triggers update
  6077. _this.update(range);
  6078. });
  6079. return _this;
  6080. }
  6081. _createClass(Toolbar, [{
  6082. key: 'addHandler',
  6083. value: function addHandler(format, handler) {
  6084. this.handlers[format] = handler;
  6085. }
  6086. }, {
  6087. key: 'attach',
  6088. value: function attach(input) {
  6089. var _this2 = this;
  6090. var format = [].find.call(input.classList, function (className) {
  6091. return className.indexOf('ql-') === 0;
  6092. });
  6093. if (!format) return;
  6094. format = format.slice('ql-'.length);
  6095. if (input.tagName === 'BUTTON') {
  6096. input.setAttribute('type', 'button');
  6097. }
  6098. if (this.handlers[format] == null) {
  6099. if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
  6100. debug.warn('ignoring attaching to disabled format', format, input);
  6101. return;
  6102. }
  6103. if (_parchment2.default.query(format) == null) {
  6104. debug.warn('ignoring attaching to nonexistent format', format, input);
  6105. return;
  6106. }
  6107. }
  6108. var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
  6109. input.addEventListener(eventName, function (e) {
  6110. var value = void 0;
  6111. if (input.tagName === 'SELECT') {
  6112. if (input.selectedIndex < 0) return;
  6113. var selected = input.options[input.selectedIndex];
  6114. if (selected.hasAttribute('selected')) {
  6115. value = false;
  6116. } else {
  6117. value = selected.value || false;
  6118. }
  6119. } else {
  6120. if (input.classList.contains('ql-active')) {
  6121. value = false;
  6122. } else {
  6123. value = input.value || !input.hasAttribute('value');
  6124. }
  6125. e.preventDefault();
  6126. }
  6127. _this2.quill.focus();
  6128. var _quill$selection$getR = _this2.quill.selection.getRange(),
  6129. _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
  6130. range = _quill$selection$getR2[0];
  6131. if (_this2.handlers[format] != null) {
  6132. _this2.handlers[format].call(_this2, value);
  6133. } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
  6134. value = prompt('Enter ' + format);
  6135. if (!value) return;
  6136. _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
  6137. } else {
  6138. _this2.quill.format(format, value, _quill2.default.sources.USER);
  6139. }
  6140. _this2.update(range);
  6141. });
  6142. // TODO use weakmap
  6143. this.controls.push([format, input]);
  6144. }
  6145. }, {
  6146. key: 'update',
  6147. value: function update(range) {
  6148. var formats = range == null ? {} : this.quill.getFormat(range);
  6149. this.controls.forEach(function (pair) {
  6150. var _pair = _slicedToArray(pair, 2),
  6151. format = _pair[0],
  6152. input = _pair[1];
  6153. if (input.tagName === 'SELECT') {
  6154. var option = void 0;
  6155. if (range == null) {
  6156. option = null;
  6157. } else if (formats[format] == null) {
  6158. option = input.querySelector('option[selected]');
  6159. } else if (!Array.isArray(formats[format])) {
  6160. var value = formats[format];
  6161. if (typeof value === 'string') {
  6162. value = value.replace(/\"/g, '\\"');
  6163. }
  6164. option = input.querySelector('option[value="' + value + '"]');
  6165. }
  6166. if (option == null) {
  6167. input.value = ''; // TODO make configurable?
  6168. input.selectedIndex = -1;
  6169. } else {
  6170. option.selected = true;
  6171. }
  6172. } else {
  6173. if (range == null) {
  6174. input.classList.remove('ql-active');
  6175. } else if (input.hasAttribute('value')) {
  6176. // both being null should match (default values)
  6177. // '1' should match with 1 (headers)
  6178. var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
  6179. input.classList.toggle('ql-active', isActive);
  6180. } else {
  6181. input.classList.toggle('ql-active', formats[format] != null);
  6182. }
  6183. }
  6184. });
  6185. }
  6186. }]);
  6187. return Toolbar;
  6188. }(_module2.default);
  6189. Toolbar.DEFAULTS = {};
  6190. function addButton(container, format, value) {
  6191. var input = document.createElement('button');
  6192. input.setAttribute('type', 'button');
  6193. input.classList.add('ql-' + format);
  6194. if (value != null) {
  6195. input.value = value;
  6196. }
  6197. container.appendChild(input);
  6198. }
  6199. function addControls(container, groups) {
  6200. if (!Array.isArray(groups[0])) {
  6201. groups = [groups];
  6202. }
  6203. groups.forEach(function (controls) {
  6204. var group = document.createElement('span');
  6205. group.classList.add('ql-formats');
  6206. controls.forEach(function (control) {
  6207. if (typeof control === 'string') {
  6208. addButton(group, control);
  6209. } else {
  6210. var format = Object.keys(control)[0];
  6211. var value = control[format];
  6212. if (Array.isArray(value)) {
  6213. addSelect(group, format, value);
  6214. } else {
  6215. addButton(group, format, value);
  6216. }
  6217. }
  6218. });
  6219. container.appendChild(group);
  6220. });
  6221. }
  6222. function addSelect(container, format, values) {
  6223. var input = document.createElement('select');
  6224. input.classList.add('ql-' + format);
  6225. values.forEach(function (value) {
  6226. var option = document.createElement('option');
  6227. if (value !== false) {
  6228. option.setAttribute('value', value);
  6229. } else {
  6230. option.setAttribute('selected', 'selected');
  6231. }
  6232. input.appendChild(option);
  6233. });
  6234. container.appendChild(input);
  6235. }
  6236. Toolbar.DEFAULTS = {
  6237. container: null,
  6238. handlers: {
  6239. clean: function clean() {
  6240. var _this3 = this;
  6241. var range = this.quill.getSelection();
  6242. if (range == null) return;
  6243. if (range.length == 0) {
  6244. var formats = this.quill.getFormat();
  6245. Object.keys(formats).forEach(function (name) {
  6246. // Clean functionality in existing apps only clean inline formats
  6247. if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
  6248. _this3.quill.format(name, false);
  6249. }
  6250. });
  6251. } else {
  6252. this.quill.removeFormat(range, _quill2.default.sources.USER);
  6253. }
  6254. },
  6255. direction: function direction(value) {
  6256. var align = this.quill.getFormat()['align'];
  6257. if (value === 'rtl' && align == null) {
  6258. this.quill.format('align', 'right', _quill2.default.sources.USER);
  6259. } else if (!value && align === 'right') {
  6260. this.quill.format('align', false, _quill2.default.sources.USER);
  6261. }
  6262. this.quill.format('direction', value, _quill2.default.sources.USER);
  6263. },
  6264. indent: function indent(value) {
  6265. var range = this.quill.getSelection();
  6266. var formats = this.quill.getFormat(range);
  6267. var indent = parseInt(formats.indent || 0);
  6268. if (value === '+1' || value === '-1') {
  6269. var modifier = value === '+1' ? 1 : -1;
  6270. if (formats.direction === 'rtl') modifier *= -1;
  6271. this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
  6272. }
  6273. },
  6274. link: function link(value) {
  6275. if (value === true) {
  6276. value = prompt('Enter link URL:');
  6277. }
  6278. this.quill.format('link', value, _quill2.default.sources.USER);
  6279. },
  6280. list: function list(value) {
  6281. var range = this.quill.getSelection();
  6282. var formats = this.quill.getFormat(range);
  6283. if (value === 'check') {
  6284. if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
  6285. this.quill.format('list', false, _quill2.default.sources.USER);
  6286. } else {
  6287. this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
  6288. }
  6289. } else {
  6290. this.quill.format('list', value, _quill2.default.sources.USER);
  6291. }
  6292. }
  6293. }
  6294. };
  6295. exports.default = Toolbar;
  6296. exports.addControls = addControls;
  6297. /***/ }),
  6298. /* 48 */
  6299. /***/ (function(module, exports, __webpack_require__) {
  6300. "use strict";
  6301. Object.defineProperty(exports, "__esModule", {
  6302. value: true
  6303. });
  6304. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6305. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  6306. var _picker = __webpack_require__(28);
  6307. var _picker2 = _interopRequireDefault(_picker);
  6308. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6309. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6310. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6311. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6312. var ColorPicker = function (_Picker) {
  6313. _inherits(ColorPicker, _Picker);
  6314. function ColorPicker(select, label) {
  6315. _classCallCheck(this, ColorPicker);
  6316. var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
  6317. _this.label.innerHTML = label;
  6318. _this.container.classList.add('ql-color-picker');
  6319. [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
  6320. item.classList.add('ql-primary');
  6321. });
  6322. return _this;
  6323. }
  6324. _createClass(ColorPicker, [{
  6325. key: 'buildItem',
  6326. value: function buildItem(option) {
  6327. var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
  6328. item.style.backgroundColor = option.getAttribute('value') || '';
  6329. return item;
  6330. }
  6331. }, {
  6332. key: 'selectItem',
  6333. value: function selectItem(item, trigger) {
  6334. _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
  6335. var colorLabel = this.label.querySelector('.ql-color-label');
  6336. var value = item ? item.getAttribute('data-value') || '' : '';
  6337. if (colorLabel) {
  6338. if (colorLabel.tagName === 'line') {
  6339. colorLabel.style.stroke = value;
  6340. } else {
  6341. colorLabel.style.fill = value;
  6342. }
  6343. }
  6344. }
  6345. }]);
  6346. return ColorPicker;
  6347. }(_picker2.default);
  6348. exports.default = ColorPicker;
  6349. /***/ }),
  6350. /* 49 */
  6351. /***/ (function(module, exports, __webpack_require__) {
  6352. "use strict";
  6353. Object.defineProperty(exports, "__esModule", {
  6354. value: true
  6355. });
  6356. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6357. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  6358. var _picker = __webpack_require__(28);
  6359. var _picker2 = _interopRequireDefault(_picker);
  6360. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6361. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6362. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6363. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6364. var IconPicker = function (_Picker) {
  6365. _inherits(IconPicker, _Picker);
  6366. function IconPicker(select, icons) {
  6367. _classCallCheck(this, IconPicker);
  6368. var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
  6369. _this.container.classList.add('ql-icon-picker');
  6370. [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
  6371. item.innerHTML = icons[item.getAttribute('data-value') || ''];
  6372. });
  6373. _this.defaultItem = _this.container.querySelector('.ql-selected');
  6374. _this.selectItem(_this.defaultItem);
  6375. return _this;
  6376. }
  6377. _createClass(IconPicker, [{
  6378. key: 'selectItem',
  6379. value: function selectItem(item, trigger) {
  6380. _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
  6381. item = item || this.defaultItem;
  6382. this.label.innerHTML = item.innerHTML;
  6383. }
  6384. }]);
  6385. return IconPicker;
  6386. }(_picker2.default);
  6387. exports.default = IconPicker;
  6388. /***/ }),
  6389. /* 50 */
  6390. /***/ (function(module, exports, __webpack_require__) {
  6391. "use strict";
  6392. Object.defineProperty(exports, "__esModule", {
  6393. value: true
  6394. });
  6395. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6396. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6397. var Tooltip = function () {
  6398. function Tooltip(quill, boundsContainer) {
  6399. var _this = this;
  6400. _classCallCheck(this, Tooltip);
  6401. this.quill = quill;
  6402. this.boundsContainer = boundsContainer || document.body;
  6403. this.root = quill.addContainer('ql-tooltip');
  6404. this.root.innerHTML = this.constructor.TEMPLATE;
  6405. if (this.quill.root === this.quill.scrollingContainer) {
  6406. this.quill.root.addEventListener('scroll', function () {
  6407. _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
  6408. });
  6409. }
  6410. this.hide();
  6411. }
  6412. _createClass(Tooltip, [{
  6413. key: 'hide',
  6414. value: function hide() {
  6415. this.root.classList.add('ql-hidden');
  6416. }
  6417. }, {
  6418. key: 'position',
  6419. value: function position(reference) {
  6420. var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
  6421. // root.scrollTop should be 0 if scrollContainer !== root
  6422. var top = reference.bottom + this.quill.root.scrollTop;
  6423. this.root.style.left = left + 'px';
  6424. this.root.style.top = top + 'px';
  6425. this.root.classList.remove('ql-flip');
  6426. var containerBounds = this.boundsContainer.getBoundingClientRect();
  6427. var rootBounds = this.root.getBoundingClientRect();
  6428. var shift = 0;
  6429. if (rootBounds.right > containerBounds.right) {
  6430. shift = containerBounds.right - rootBounds.right;
  6431. this.root.style.left = left + shift + 'px';
  6432. }
  6433. if (rootBounds.left < containerBounds.left) {
  6434. shift = containerBounds.left - rootBounds.left;
  6435. this.root.style.left = left + shift + 'px';
  6436. }
  6437. if (rootBounds.bottom > containerBounds.bottom) {
  6438. var height = rootBounds.bottom - rootBounds.top;
  6439. var verticalShift = reference.bottom - reference.top + height;
  6440. this.root.style.top = top - verticalShift + 'px';
  6441. this.root.classList.add('ql-flip');
  6442. }
  6443. return shift;
  6444. }
  6445. }, {
  6446. key: 'show',
  6447. value: function show() {
  6448. this.root.classList.remove('ql-editing');
  6449. this.root.classList.remove('ql-hidden');
  6450. }
  6451. }]);
  6452. return Tooltip;
  6453. }();
  6454. exports.default = Tooltip;
  6455. /***/ }),
  6456. /* 51 */
  6457. /***/ (function(module, exports) {
  6458. var supportsArgumentsClass = (function(){
  6459. return Object.prototype.toString.call(arguments)
  6460. })() == '[object Arguments]';
  6461. exports = module.exports = supportsArgumentsClass ? supported : unsupported;
  6462. exports.supported = supported;
  6463. function supported(object) {
  6464. return Object.prototype.toString.call(object) == '[object Arguments]';
  6465. };
  6466. exports.unsupported = unsupported;
  6467. function unsupported(object){
  6468. return object &&
  6469. typeof object == 'object' &&
  6470. typeof object.length == 'number' &&
  6471. Object.prototype.hasOwnProperty.call(object, 'callee') &&
  6472. !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
  6473. false;
  6474. };
  6475. /***/ }),
  6476. /* 52 */
  6477. /***/ (function(module, exports) {
  6478. exports = module.exports = typeof Object.keys === 'function'
  6479. ? Object.keys : shim;
  6480. exports.shim = shim;
  6481. function shim (obj) {
  6482. var keys = [];
  6483. for (var key in obj) keys.push(key);
  6484. return keys;
  6485. }
  6486. /***/ }),
  6487. /* 53 */
  6488. /***/ (function(module, exports) {
  6489. 'use strict';
  6490. var has = Object.prototype.hasOwnProperty
  6491. , prefix = '~';
  6492. /**
  6493. * Constructor to create a storage for our `EE` objects.
  6494. * An `Events` instance is a plain object whose properties are event names.
  6495. *
  6496. * @constructor
  6497. * @api private
  6498. */
  6499. function Events() {}
  6500. //
  6501. // We try to not inherit from `Object.prototype`. In some engines creating an
  6502. // instance in this way is faster than calling `Object.create(null)` directly.
  6503. // If `Object.create(null)` is not supported we prefix the event names with a
  6504. // character to make sure that the built-in object properties are not
  6505. // overridden or used as an attack vector.
  6506. //
  6507. if (Object.create) {
  6508. Events.prototype = Object.create(null);
  6509. //
  6510. // This hack is needed because the `__proto__` property is still inherited in
  6511. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  6512. //
  6513. if (!new Events().__proto__) prefix = false;
  6514. }
  6515. /**
  6516. * Representation of a single event listener.
  6517. *
  6518. * @param {Function} fn The listener function.
  6519. * @param {Mixed} context The context to invoke the listener with.
  6520. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  6521. * @constructor
  6522. * @api private
  6523. */
  6524. function EE(fn, context, once) {
  6525. this.fn = fn;
  6526. this.context = context;
  6527. this.once = once || false;
  6528. }
  6529. /**
  6530. * Minimal `EventEmitter` interface that is molded against the Node.js
  6531. * `EventEmitter` interface.
  6532. *
  6533. * @constructor
  6534. * @api public
  6535. */
  6536. function EventEmitter() {
  6537. this._events = new Events();
  6538. this._eventsCount = 0;
  6539. }
  6540. /**
  6541. * Return an array listing the events for which the emitter has registered
  6542. * listeners.
  6543. *
  6544. * @returns {Array}
  6545. * @api public
  6546. */
  6547. EventEmitter.prototype.eventNames = function eventNames() {
  6548. var names = []
  6549. , events
  6550. , name;
  6551. if (this._eventsCount === 0) return names;
  6552. for (name in (events = this._events)) {
  6553. if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  6554. }
  6555. if (Object.getOwnPropertySymbols) {
  6556. return names.concat(Object.getOwnPropertySymbols(events));
  6557. }
  6558. return names;
  6559. };
  6560. /**
  6561. * Return the listeners registered for a given event.
  6562. *
  6563. * @param {String|Symbol} event The event name.
  6564. * @param {Boolean} exists Only check if there are listeners.
  6565. * @returns {Array|Boolean}
  6566. * @api public
  6567. */
  6568. EventEmitter.prototype.listeners = function listeners(event, exists) {
  6569. var evt = prefix ? prefix + event : event
  6570. , available = this._events[evt];
  6571. if (exists) return !!available;
  6572. if (!available) return [];
  6573. if (available.fn) return [available.fn];
  6574. for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
  6575. ee[i] = available[i].fn;
  6576. }
  6577. return ee;
  6578. };
  6579. /**
  6580. * Calls each of the listeners registered for a given event.
  6581. *
  6582. * @param {String|Symbol} event The event name.
  6583. * @returns {Boolean} `true` if the event had listeners, else `false`.
  6584. * @api public
  6585. */
  6586. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  6587. var evt = prefix ? prefix + event : event;
  6588. if (!this._events[evt]) return false;
  6589. var listeners = this._events[evt]
  6590. , len = arguments.length
  6591. , args
  6592. , i;
  6593. if (listeners.fn) {
  6594. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  6595. switch (len) {
  6596. case 1: return listeners.fn.call(listeners.context), true;
  6597. case 2: return listeners.fn.call(listeners.context, a1), true;
  6598. case 3: return listeners.fn.call(listeners.context, a1, a2), true;
  6599. case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
  6600. case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  6601. case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  6602. }
  6603. for (i = 1, args = new Array(len -1); i < len; i++) {
  6604. args[i - 1] = arguments[i];
  6605. }
  6606. listeners.fn.apply(listeners.context, args);
  6607. } else {
  6608. var length = listeners.length
  6609. , j;
  6610. for (i = 0; i < length; i++) {
  6611. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  6612. switch (len) {
  6613. case 1: listeners[i].fn.call(listeners[i].context); break;
  6614. case 2: listeners[i].fn.call(listeners[i].context, a1); break;
  6615. case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
  6616. case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
  6617. default:
  6618. if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
  6619. args[j - 1] = arguments[j];
  6620. }
  6621. listeners[i].fn.apply(listeners[i].context, args);
  6622. }
  6623. }
  6624. }
  6625. return true;
  6626. };
  6627. /**
  6628. * Add a listener for a given event.
  6629. *
  6630. * @param {String|Symbol} event The event name.
  6631. * @param {Function} fn The listener function.
  6632. * @param {Mixed} [context=this] The context to invoke the listener with.
  6633. * @returns {EventEmitter} `this`.
  6634. * @api public
  6635. */
  6636. EventEmitter.prototype.on = function on(event, fn, context) {
  6637. var listener = new EE(fn, context || this)
  6638. , evt = prefix ? prefix + event : event;
  6639. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  6640. else if (!this._events[evt].fn) this._events[evt].push(listener);
  6641. else this._events[evt] = [this._events[evt], listener];
  6642. return this;
  6643. };
  6644. /**
  6645. * Add a one-time listener for a given event.
  6646. *
  6647. * @param {String|Symbol} event The event name.
  6648. * @param {Function} fn The listener function.
  6649. * @param {Mixed} [context=this] The context to invoke the listener with.
  6650. * @returns {EventEmitter} `this`.
  6651. * @api public
  6652. */
  6653. EventEmitter.prototype.once = function once(event, fn, context) {
  6654. var listener = new EE(fn, context || this, true)
  6655. , evt = prefix ? prefix + event : event;
  6656. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  6657. else if (!this._events[evt].fn) this._events[evt].push(listener);
  6658. else this._events[evt] = [this._events[evt], listener];
  6659. return this;
  6660. };
  6661. /**
  6662. * Remove the listeners of a given event.
  6663. *
  6664. * @param {String|Symbol} event The event name.
  6665. * @param {Function} fn Only remove the listeners that match this function.
  6666. * @param {Mixed} context Only remove the listeners that have this context.
  6667. * @param {Boolean} once Only remove one-time listeners.
  6668. * @returns {EventEmitter} `this`.
  6669. * @api public
  6670. */
  6671. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  6672. var evt = prefix ? prefix + event : event;
  6673. if (!this._events[evt]) return this;
  6674. if (!fn) {
  6675. if (--this._eventsCount === 0) this._events = new Events();
  6676. else delete this._events[evt];
  6677. return this;
  6678. }
  6679. var listeners = this._events[evt];
  6680. if (listeners.fn) {
  6681. if (
  6682. listeners.fn === fn
  6683. && (!once || listeners.once)
  6684. && (!context || listeners.context === context)
  6685. ) {
  6686. if (--this._eventsCount === 0) this._events = new Events();
  6687. else delete this._events[evt];
  6688. }
  6689. } else {
  6690. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  6691. if (
  6692. listeners[i].fn !== fn
  6693. || (once && !listeners[i].once)
  6694. || (context && listeners[i].context !== context)
  6695. ) {
  6696. events.push(listeners[i]);
  6697. }
  6698. }
  6699. //
  6700. // Reset the array, or remove it completely if we have no more listeners.
  6701. //
  6702. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
  6703. else if (--this._eventsCount === 0) this._events = new Events();
  6704. else delete this._events[evt];
  6705. }
  6706. return this;
  6707. };
  6708. /**
  6709. * Remove all listeners, or those of the specified event.
  6710. *
  6711. * @param {String|Symbol} [event] The event name.
  6712. * @returns {EventEmitter} `this`.
  6713. * @api public
  6714. */
  6715. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  6716. var evt;
  6717. if (event) {
  6718. evt = prefix ? prefix + event : event;
  6719. if (this._events[evt]) {
  6720. if (--this._eventsCount === 0) this._events = new Events();
  6721. else delete this._events[evt];
  6722. }
  6723. } else {
  6724. this._events = new Events();
  6725. this._eventsCount = 0;
  6726. }
  6727. return this;
  6728. };
  6729. //
  6730. // Alias methods names because people roll like that.
  6731. //
  6732. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  6733. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  6734. //
  6735. // This function doesn't apply anymore.
  6736. //
  6737. EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
  6738. return this;
  6739. };
  6740. //
  6741. // Expose the prefix.
  6742. //
  6743. EventEmitter.prefixed = prefix;
  6744. //
  6745. // Allow `EventEmitter` to be imported as module namespace.
  6746. //
  6747. EventEmitter.EventEmitter = EventEmitter;
  6748. //
  6749. // Expose the module.
  6750. //
  6751. if ('undefined' !== typeof module) {
  6752. module.exports = EventEmitter;
  6753. }
  6754. /***/ }),
  6755. /* 54 */
  6756. /***/ (function(module, exports) {
  6757. /**
  6758. * This library modifies the diff-patch-match library by Neil Fraser
  6759. * by removing the patch and match functionality and certain advanced
  6760. * options in the diff function. The original license is as follows:
  6761. *
  6762. * ===
  6763. *
  6764. * Diff Match and Patch
  6765. *
  6766. * Copyright 2006 Google Inc.
  6767. * http://code.google.com/p/google-diff-match-patch/
  6768. *
  6769. * Licensed under the Apache License, Version 2.0 (the "License");
  6770. * you may not use this file except in compliance with the License.
  6771. * You may obtain a copy of the License at
  6772. *
  6773. * http://www.apache.org/licenses/LICENSE-2.0
  6774. *
  6775. * Unless required by applicable law or agreed to in writing, software
  6776. * distributed under the License is distributed on an "AS IS" BASIS,
  6777. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  6778. * See the License for the specific language governing permissions and
  6779. * limitations under the License.
  6780. */
  6781. /**
  6782. * The data structure representing a diff is an array of tuples:
  6783. * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
  6784. * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
  6785. */
  6786. var DIFF_DELETE = -1;
  6787. var DIFF_INSERT = 1;
  6788. var DIFF_EQUAL = 0;
  6789. /**
  6790. * Find the differences between two texts. Simplifies the problem by stripping
  6791. * any common prefix or suffix off the texts before diffing.
  6792. * @param {string} text1 Old string to be diffed.
  6793. * @param {string} text2 New string to be diffed.
  6794. * @param {Int} cursor_pos Expected edit position in text1 (optional)
  6795. * @return {Array} Array of diff tuples.
  6796. */
  6797. function diff_main(text1, text2, cursor_pos) {
  6798. // Check for equality (speedup).
  6799. if (text1 == text2) {
  6800. if (text1) {
  6801. return [[DIFF_EQUAL, text1]];
  6802. }
  6803. return [];
  6804. }
  6805. // Check cursor_pos within bounds
  6806. if (cursor_pos < 0 || text1.length < cursor_pos) {
  6807. cursor_pos = null;
  6808. }
  6809. // Trim off common prefix (speedup).
  6810. var commonlength = diff_commonPrefix(text1, text2);
  6811. var commonprefix = text1.substring(0, commonlength);
  6812. text1 = text1.substring(commonlength);
  6813. text2 = text2.substring(commonlength);
  6814. // Trim off common suffix (speedup).
  6815. commonlength = diff_commonSuffix(text1, text2);
  6816. var commonsuffix = text1.substring(text1.length - commonlength);
  6817. text1 = text1.substring(0, text1.length - commonlength);
  6818. text2 = text2.substring(0, text2.length - commonlength);
  6819. // Compute the diff on the middle block.
  6820. var diffs = diff_compute_(text1, text2);
  6821. // Restore the prefix and suffix.
  6822. if (commonprefix) {
  6823. diffs.unshift([DIFF_EQUAL, commonprefix]);
  6824. }
  6825. if (commonsuffix) {
  6826. diffs.push([DIFF_EQUAL, commonsuffix]);
  6827. }
  6828. diff_cleanupMerge(diffs);
  6829. if (cursor_pos != null) {
  6830. diffs = fix_cursor(diffs, cursor_pos);
  6831. }
  6832. return diffs;
  6833. };
  6834. /**
  6835. * Find the differences between two texts. Assumes that the texts do not
  6836. * have any common prefix or suffix.
  6837. * @param {string} text1 Old string to be diffed.
  6838. * @param {string} text2 New string to be diffed.
  6839. * @return {Array} Array of diff tuples.
  6840. */
  6841. function diff_compute_(text1, text2) {
  6842. var diffs;
  6843. if (!text1) {
  6844. // Just add some text (speedup).
  6845. return [[DIFF_INSERT, text2]];
  6846. }
  6847. if (!text2) {
  6848. // Just delete some text (speedup).
  6849. return [[DIFF_DELETE, text1]];
  6850. }
  6851. var longtext = text1.length > text2.length ? text1 : text2;
  6852. var shorttext = text1.length > text2.length ? text2 : text1;
  6853. var i = longtext.indexOf(shorttext);
  6854. if (i != -1) {
  6855. // Shorter text is inside the longer text (speedup).
  6856. diffs = [[DIFF_INSERT, longtext.substring(0, i)],
  6857. [DIFF_EQUAL, shorttext],
  6858. [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
  6859. // Swap insertions for deletions if diff is reversed.
  6860. if (text1.length > text2.length) {
  6861. diffs[0][0] = diffs[2][0] = DIFF_DELETE;
  6862. }
  6863. return diffs;
  6864. }
  6865. if (shorttext.length == 1) {
  6866. // Single character string.
  6867. // After the previous speedup, the character can't be an equality.
  6868. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  6869. }
  6870. // Check to see if the problem can be split in two.
  6871. var hm = diff_halfMatch_(text1, text2);
  6872. if (hm) {
  6873. // A half-match was found, sort out the return data.
  6874. var text1_a = hm[0];
  6875. var text1_b = hm[1];
  6876. var text2_a = hm[2];
  6877. var text2_b = hm[3];
  6878. var mid_common = hm[4];
  6879. // Send both pairs off for separate processing.
  6880. var diffs_a = diff_main(text1_a, text2_a);
  6881. var diffs_b = diff_main(text1_b, text2_b);
  6882. // Merge the results.
  6883. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
  6884. }
  6885. return diff_bisect_(text1, text2);
  6886. };
  6887. /**
  6888. * Find the 'middle snake' of a diff, split the problem in two
  6889. * and return the recursively constructed diff.
  6890. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
  6891. * @param {string} text1 Old string to be diffed.
  6892. * @param {string} text2 New string to be diffed.
  6893. * @return {Array} Array of diff tuples.
  6894. * @private
  6895. */
  6896. function diff_bisect_(text1, text2) {
  6897. // Cache the text lengths to prevent multiple calls.
  6898. var text1_length = text1.length;
  6899. var text2_length = text2.length;
  6900. var max_d = Math.ceil((text1_length + text2_length) / 2);
  6901. var v_offset = max_d;
  6902. var v_length = 2 * max_d;
  6903. var v1 = new Array(v_length);
  6904. var v2 = new Array(v_length);
  6905. // Setting all elements to -1 is faster in Chrome & Firefox than mixing
  6906. // integers and undefined.
  6907. for (var x = 0; x < v_length; x++) {
  6908. v1[x] = -1;
  6909. v2[x] = -1;
  6910. }
  6911. v1[v_offset + 1] = 0;
  6912. v2[v_offset + 1] = 0;
  6913. var delta = text1_length - text2_length;
  6914. // If the total number of characters is odd, then the front path will collide
  6915. // with the reverse path.
  6916. var front = (delta % 2 != 0);
  6917. // Offsets for start and end of k loop.
  6918. // Prevents mapping of space beyond the grid.
  6919. var k1start = 0;
  6920. var k1end = 0;
  6921. var k2start = 0;
  6922. var k2end = 0;
  6923. for (var d = 0; d < max_d; d++) {
  6924. // Walk the front path one step.
  6925. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
  6926. var k1_offset = v_offset + k1;
  6927. var x1;
  6928. if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
  6929. x1 = v1[k1_offset + 1];
  6930. } else {
  6931. x1 = v1[k1_offset - 1] + 1;
  6932. }
  6933. var y1 = x1 - k1;
  6934. while (x1 < text1_length && y1 < text2_length &&
  6935. text1.charAt(x1) == text2.charAt(y1)) {
  6936. x1++;
  6937. y1++;
  6938. }
  6939. v1[k1_offset] = x1;
  6940. if (x1 > text1_length) {
  6941. // Ran off the right of the graph.
  6942. k1end += 2;
  6943. } else if (y1 > text2_length) {
  6944. // Ran off the bottom of the graph.
  6945. k1start += 2;
  6946. } else if (front) {
  6947. var k2_offset = v_offset + delta - k1;
  6948. if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
  6949. // Mirror x2 onto top-left coordinate system.
  6950. var x2 = text1_length - v2[k2_offset];
  6951. if (x1 >= x2) {
  6952. // Overlap detected.
  6953. return diff_bisectSplit_(text1, text2, x1, y1);
  6954. }
  6955. }
  6956. }
  6957. }
  6958. // Walk the reverse path one step.
  6959. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
  6960. var k2_offset = v_offset + k2;
  6961. var x2;
  6962. if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
  6963. x2 = v2[k2_offset + 1];
  6964. } else {
  6965. x2 = v2[k2_offset - 1] + 1;
  6966. }
  6967. var y2 = x2 - k2;
  6968. while (x2 < text1_length && y2 < text2_length &&
  6969. text1.charAt(text1_length - x2 - 1) ==
  6970. text2.charAt(text2_length - y2 - 1)) {
  6971. x2++;
  6972. y2++;
  6973. }
  6974. v2[k2_offset] = x2;
  6975. if (x2 > text1_length) {
  6976. // Ran off the left of the graph.
  6977. k2end += 2;
  6978. } else if (y2 > text2_length) {
  6979. // Ran off the top of the graph.
  6980. k2start += 2;
  6981. } else if (!front) {
  6982. var k1_offset = v_offset + delta - k2;
  6983. if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
  6984. var x1 = v1[k1_offset];
  6985. var y1 = v_offset + x1 - k1_offset;
  6986. // Mirror x2 onto top-left coordinate system.
  6987. x2 = text1_length - x2;
  6988. if (x1 >= x2) {
  6989. // Overlap detected.
  6990. return diff_bisectSplit_(text1, text2, x1, y1);
  6991. }
  6992. }
  6993. }
  6994. }
  6995. }
  6996. // Diff took too long and hit the deadline or
  6997. // number of diffs equals number of characters, no commonality at all.
  6998. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  6999. };
  7000. /**
  7001. * Given the location of the 'middle snake', split the diff in two parts
  7002. * and recurse.
  7003. * @param {string} text1 Old string to be diffed.
  7004. * @param {string} text2 New string to be diffed.
  7005. * @param {number} x Index of split point in text1.
  7006. * @param {number} y Index of split point in text2.
  7007. * @return {Array} Array of diff tuples.
  7008. */
  7009. function diff_bisectSplit_(text1, text2, x, y) {
  7010. var text1a = text1.substring(0, x);
  7011. var text2a = text2.substring(0, y);
  7012. var text1b = text1.substring(x);
  7013. var text2b = text2.substring(y);
  7014. // Compute both diffs serially.
  7015. var diffs = diff_main(text1a, text2a);
  7016. var diffsb = diff_main(text1b, text2b);
  7017. return diffs.concat(diffsb);
  7018. };
  7019. /**
  7020. * Determine the common prefix of two strings.
  7021. * @param {string} text1 First string.
  7022. * @param {string} text2 Second string.
  7023. * @return {number} The number of characters common to the start of each
  7024. * string.
  7025. */
  7026. function diff_commonPrefix(text1, text2) {
  7027. // Quick check for common null cases.
  7028. if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
  7029. return 0;
  7030. }
  7031. // Binary search.
  7032. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  7033. var pointermin = 0;
  7034. var pointermax = Math.min(text1.length, text2.length);
  7035. var pointermid = pointermax;
  7036. var pointerstart = 0;
  7037. while (pointermin < pointermid) {
  7038. if (text1.substring(pointerstart, pointermid) ==
  7039. text2.substring(pointerstart, pointermid)) {
  7040. pointermin = pointermid;
  7041. pointerstart = pointermin;
  7042. } else {
  7043. pointermax = pointermid;
  7044. }
  7045. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  7046. }
  7047. return pointermid;
  7048. };
  7049. /**
  7050. * Determine the common suffix of two strings.
  7051. * @param {string} text1 First string.
  7052. * @param {string} text2 Second string.
  7053. * @return {number} The number of characters common to the end of each string.
  7054. */
  7055. function diff_commonSuffix(text1, text2) {
  7056. // Quick check for common null cases.
  7057. if (!text1 || !text2 ||
  7058. text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
  7059. return 0;
  7060. }
  7061. // Binary search.
  7062. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  7063. var pointermin = 0;
  7064. var pointermax = Math.min(text1.length, text2.length);
  7065. var pointermid = pointermax;
  7066. var pointerend = 0;
  7067. while (pointermin < pointermid) {
  7068. if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
  7069. text2.substring(text2.length - pointermid, text2.length - pointerend)) {
  7070. pointermin = pointermid;
  7071. pointerend = pointermin;
  7072. } else {
  7073. pointermax = pointermid;
  7074. }
  7075. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  7076. }
  7077. return pointermid;
  7078. };
  7079. /**
  7080. * Do the two texts share a substring which is at least half the length of the
  7081. * longer text?
  7082. * This speedup can produce non-minimal diffs.
  7083. * @param {string} text1 First string.
  7084. * @param {string} text2 Second string.
  7085. * @return {Array.<string>} Five element Array, containing the prefix of
  7086. * text1, the suffix of text1, the prefix of text2, the suffix of
  7087. * text2 and the common middle. Or null if there was no match.
  7088. */
  7089. function diff_halfMatch_(text1, text2) {
  7090. var longtext = text1.length > text2.length ? text1 : text2;
  7091. var shorttext = text1.length > text2.length ? text2 : text1;
  7092. if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
  7093. return null; // Pointless.
  7094. }
  7095. /**
  7096. * Does a substring of shorttext exist within longtext such that the substring
  7097. * is at least half the length of longtext?
  7098. * Closure, but does not reference any external variables.
  7099. * @param {string} longtext Longer string.
  7100. * @param {string} shorttext Shorter string.
  7101. * @param {number} i Start index of quarter length substring within longtext.
  7102. * @return {Array.<string>} Five element Array, containing the prefix of
  7103. * longtext, the suffix of longtext, the prefix of shorttext, the suffix
  7104. * of shorttext and the common middle. Or null if there was no match.
  7105. * @private
  7106. */
  7107. function diff_halfMatchI_(longtext, shorttext, i) {
  7108. // Start with a 1/4 length substring at position i as a seed.
  7109. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
  7110. var j = -1;
  7111. var best_common = '';
  7112. var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  7113. while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
  7114. var prefixLength = diff_commonPrefix(longtext.substring(i),
  7115. shorttext.substring(j));
  7116. var suffixLength = diff_commonSuffix(longtext.substring(0, i),
  7117. shorttext.substring(0, j));
  7118. if (best_common.length < suffixLength + prefixLength) {
  7119. best_common = shorttext.substring(j - suffixLength, j) +
  7120. shorttext.substring(j, j + prefixLength);
  7121. best_longtext_a = longtext.substring(0, i - suffixLength);
  7122. best_longtext_b = longtext.substring(i + prefixLength);
  7123. best_shorttext_a = shorttext.substring(0, j - suffixLength);
  7124. best_shorttext_b = shorttext.substring(j + prefixLength);
  7125. }
  7126. }
  7127. if (best_common.length * 2 >= longtext.length) {
  7128. return [best_longtext_a, best_longtext_b,
  7129. best_shorttext_a, best_shorttext_b, best_common];
  7130. } else {
  7131. return null;
  7132. }
  7133. }
  7134. // First check if the second quarter is the seed for a half-match.
  7135. var hm1 = diff_halfMatchI_(longtext, shorttext,
  7136. Math.ceil(longtext.length / 4));
  7137. // Check again based on the third quarter.
  7138. var hm2 = diff_halfMatchI_(longtext, shorttext,
  7139. Math.ceil(longtext.length / 2));
  7140. var hm;
  7141. if (!hm1 && !hm2) {
  7142. return null;
  7143. } else if (!hm2) {
  7144. hm = hm1;
  7145. } else if (!hm1) {
  7146. hm = hm2;
  7147. } else {
  7148. // Both matched. Select the longest.
  7149. hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  7150. }
  7151. // A half-match was found, sort out the return data.
  7152. var text1_a, text1_b, text2_a, text2_b;
  7153. if (text1.length > text2.length) {
  7154. text1_a = hm[0];
  7155. text1_b = hm[1];
  7156. text2_a = hm[2];
  7157. text2_b = hm[3];
  7158. } else {
  7159. text2_a = hm[0];
  7160. text2_b = hm[1];
  7161. text1_a = hm[2];
  7162. text1_b = hm[3];
  7163. }
  7164. var mid_common = hm[4];
  7165. return [text1_a, text1_b, text2_a, text2_b, mid_common];
  7166. };
  7167. /**
  7168. * Reorder and merge like edit sections. Merge equalities.
  7169. * Any edit section can move as long as it doesn't cross an equality.
  7170. * @param {Array} diffs Array of diff tuples.
  7171. */
  7172. function diff_cleanupMerge(diffs) {
  7173. diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
  7174. var pointer = 0;
  7175. var count_delete = 0;
  7176. var count_insert = 0;
  7177. var text_delete = '';
  7178. var text_insert = '';
  7179. var commonlength;
  7180. while (pointer < diffs.length) {
  7181. switch (diffs[pointer][0]) {
  7182. case DIFF_INSERT:
  7183. count_insert++;
  7184. text_insert += diffs[pointer][1];
  7185. pointer++;
  7186. break;
  7187. case DIFF_DELETE:
  7188. count_delete++;
  7189. text_delete += diffs[pointer][1];
  7190. pointer++;
  7191. break;
  7192. case DIFF_EQUAL:
  7193. // Upon reaching an equality, check for prior redundancies.
  7194. if (count_delete + count_insert > 1) {
  7195. if (count_delete !== 0 && count_insert !== 0) {
  7196. // Factor out any common prefixies.
  7197. commonlength = diff_commonPrefix(text_insert, text_delete);
  7198. if (commonlength !== 0) {
  7199. if ((pointer - count_delete - count_insert) > 0 &&
  7200. diffs[pointer - count_delete - count_insert - 1][0] ==
  7201. DIFF_EQUAL) {
  7202. diffs[pointer - count_delete - count_insert - 1][1] +=
  7203. text_insert.substring(0, commonlength);
  7204. } else {
  7205. diffs.splice(0, 0, [DIFF_EQUAL,
  7206. text_insert.substring(0, commonlength)]);
  7207. pointer++;
  7208. }
  7209. text_insert = text_insert.substring(commonlength);
  7210. text_delete = text_delete.substring(commonlength);
  7211. }
  7212. // Factor out any common suffixies.
  7213. commonlength = diff_commonSuffix(text_insert, text_delete);
  7214. if (commonlength !== 0) {
  7215. diffs[pointer][1] = text_insert.substring(text_insert.length -
  7216. commonlength) + diffs[pointer][1];
  7217. text_insert = text_insert.substring(0, text_insert.length -
  7218. commonlength);
  7219. text_delete = text_delete.substring(0, text_delete.length -
  7220. commonlength);
  7221. }
  7222. }
  7223. // Delete the offending records and add the merged ones.
  7224. if (count_delete === 0) {
  7225. diffs.splice(pointer - count_insert,
  7226. count_delete + count_insert, [DIFF_INSERT, text_insert]);
  7227. } else if (count_insert === 0) {
  7228. diffs.splice(pointer - count_delete,
  7229. count_delete + count_insert, [DIFF_DELETE, text_delete]);
  7230. } else {
  7231. diffs.splice(pointer - count_delete - count_insert,
  7232. count_delete + count_insert, [DIFF_DELETE, text_delete],
  7233. [DIFF_INSERT, text_insert]);
  7234. }
  7235. pointer = pointer - count_delete - count_insert +
  7236. (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
  7237. } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
  7238. // Merge this equality with the previous one.
  7239. diffs[pointer - 1][1] += diffs[pointer][1];
  7240. diffs.splice(pointer, 1);
  7241. } else {
  7242. pointer++;
  7243. }
  7244. count_insert = 0;
  7245. count_delete = 0;
  7246. text_delete = '';
  7247. text_insert = '';
  7248. break;
  7249. }
  7250. }
  7251. if (diffs[diffs.length - 1][1] === '') {
  7252. diffs.pop(); // Remove the dummy entry at the end.
  7253. }
  7254. // Second pass: look for single edits surrounded on both sides by equalities
  7255. // which can be shifted sideways to eliminate an equality.
  7256. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
  7257. var changes = false;
  7258. pointer = 1;
  7259. // Intentionally ignore the first and last element (don't need checking).
  7260. while (pointer < diffs.length - 1) {
  7261. if (diffs[pointer - 1][0] == DIFF_EQUAL &&
  7262. diffs[pointer + 1][0] == DIFF_EQUAL) {
  7263. // This is a single edit surrounded by equalities.
  7264. if (diffs[pointer][1].substring(diffs[pointer][1].length -
  7265. diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
  7266. // Shift the edit over the previous equality.
  7267. diffs[pointer][1] = diffs[pointer - 1][1] +
  7268. diffs[pointer][1].substring(0, diffs[pointer][1].length -
  7269. diffs[pointer - 1][1].length);
  7270. diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
  7271. diffs.splice(pointer - 1, 1);
  7272. changes = true;
  7273. } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
  7274. diffs[pointer + 1][1]) {
  7275. // Shift the edit over the next equality.
  7276. diffs[pointer - 1][1] += diffs[pointer + 1][1];
  7277. diffs[pointer][1] =
  7278. diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
  7279. diffs[pointer + 1][1];
  7280. diffs.splice(pointer + 1, 1);
  7281. changes = true;
  7282. }
  7283. }
  7284. pointer++;
  7285. }
  7286. // If shifts were made, the diff needs reordering and another shift sweep.
  7287. if (changes) {
  7288. diff_cleanupMerge(diffs);
  7289. }
  7290. };
  7291. var diff = diff_main;
  7292. diff.INSERT = DIFF_INSERT;
  7293. diff.DELETE = DIFF_DELETE;
  7294. diff.EQUAL = DIFF_EQUAL;
  7295. module.exports = diff;
  7296. /*
  7297. * Modify a diff such that the cursor position points to the start of a change:
  7298. * E.g.
  7299. * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
  7300. * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
  7301. * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
  7302. * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
  7303. *
  7304. * @param {Array} diffs Array of diff tuples
  7305. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7306. * @return {Array} A tuple [cursor location in the modified diff, modified diff]
  7307. */
  7308. function cursor_normalize_diff (diffs, cursor_pos) {
  7309. if (cursor_pos === 0) {
  7310. return [DIFF_EQUAL, diffs];
  7311. }
  7312. for (var current_pos = 0, i = 0; i < diffs.length; i++) {
  7313. var d = diffs[i];
  7314. if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
  7315. var next_pos = current_pos + d[1].length;
  7316. if (cursor_pos === next_pos) {
  7317. return [i + 1, diffs];
  7318. } else if (cursor_pos < next_pos) {
  7319. // copy to prevent side effects
  7320. diffs = diffs.slice();
  7321. // split d into two diff changes
  7322. var split_pos = cursor_pos - current_pos;
  7323. var d_left = [d[0], d[1].slice(0, split_pos)];
  7324. var d_right = [d[0], d[1].slice(split_pos)];
  7325. diffs.splice(i, 1, d_left, d_right);
  7326. return [i + 1, diffs];
  7327. } else {
  7328. current_pos = next_pos;
  7329. }
  7330. }
  7331. }
  7332. throw new Error('cursor_pos is out of bounds!')
  7333. }
  7334. /*
  7335. * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
  7336. *
  7337. * Case 1)
  7338. * Check if a naive shift is possible:
  7339. * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
  7340. * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
  7341. * Case 2)
  7342. * Check if the following shifts are possible:
  7343. * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
  7344. * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
  7345. * ^ ^
  7346. * d d_next
  7347. *
  7348. * @param {Array} diffs Array of diff tuples
  7349. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7350. * @return {Array} Array of diff tuples
  7351. */
  7352. function fix_cursor (diffs, cursor_pos) {
  7353. var norm = cursor_normalize_diff(diffs, cursor_pos);
  7354. var ndiffs = norm[1];
  7355. var cursor_pointer = norm[0];
  7356. var d = ndiffs[cursor_pointer];
  7357. var d_next = ndiffs[cursor_pointer + 1];
  7358. if (d == null) {
  7359. // Text was deleted from end of original string,
  7360. // cursor is now out of bounds in new string
  7361. return diffs;
  7362. } else if (d[0] !== DIFF_EQUAL) {
  7363. // A modification happened at the cursor location.
  7364. // This is the expected outcome, so we can return the original diff.
  7365. return diffs;
  7366. } else {
  7367. if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
  7368. // Case 1)
  7369. // It is possible to perform a naive shift
  7370. ndiffs.splice(cursor_pointer, 2, d_next, d)
  7371. return merge_tuples(ndiffs, cursor_pointer, 2)
  7372. } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
  7373. // Case 2)
  7374. // d[1] is a prefix of d_next[1]
  7375. // We can assume that d_next[0] !== 0, since d[0] === 0
  7376. // Shift edit locations..
  7377. ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
  7378. var suffix = d_next[1].slice(d[1].length);
  7379. if (suffix.length > 0) {
  7380. ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
  7381. }
  7382. return merge_tuples(ndiffs, cursor_pointer, 3)
  7383. } else {
  7384. // Not possible to perform any modification
  7385. return diffs;
  7386. }
  7387. }
  7388. }
  7389. /*
  7390. * Try to merge tuples with their neigbors in a given range.
  7391. * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
  7392. *
  7393. * @param {Array} diffs Array of diff tuples.
  7394. * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
  7395. * @param {Int} length Number of consecutive elements to check.
  7396. * @return {Array} Array of merged diff tuples.
  7397. */
  7398. function merge_tuples (diffs, start, length) {
  7399. // Check from (start-1) to (start+length).
  7400. for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
  7401. if (i + 1 < diffs.length) {
  7402. var left_d = diffs[i];
  7403. var right_d = diffs[i+1];
  7404. if (left_d[0] === right_d[1]) {
  7405. diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
  7406. }
  7407. }
  7408. }
  7409. return diffs;
  7410. }
  7411. /***/ }),
  7412. /* 55 */
  7413. /***/ (function(module, exports) {
  7414. module.exports = "<svg viewbox=\"0 0 18 18\"> <polyline class=\"ql-even ql-stroke\" points=\"5 7 3 9 5 11\"></polyline> <polyline class=\"ql-even ql-stroke\" points=\"13 7 15 9 13 11\"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>";
  7415. /***/ }),
  7416. /* 56 */
  7417. /***/ (function(module, exports, __webpack_require__) {
  7418. "use strict";
  7419. var __extends = (this && this.__extends) || (function () {
  7420. var extendStatics = Object.setPrototypeOf ||
  7421. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7422. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7423. return function (d, b) {
  7424. extendStatics(d, b);
  7425. function __() { this.constructor = d; }
  7426. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7427. };
  7428. })();
  7429. Object.defineProperty(exports, "__esModule", { value: true });
  7430. var format_1 = __webpack_require__(22);
  7431. var Registry = __webpack_require__(1);
  7432. var BlockBlot = (function (_super) {
  7433. __extends(BlockBlot, _super);
  7434. function BlockBlot() {
  7435. return _super !== null && _super.apply(this, arguments) || this;
  7436. }
  7437. BlockBlot.formats = function (domNode) {
  7438. var tagName = Registry.query(BlockBlot.blotName).tagName;
  7439. if (domNode.tagName === tagName)
  7440. return undefined;
  7441. return _super.formats.call(this, domNode);
  7442. };
  7443. BlockBlot.prototype.format = function (name, value) {
  7444. if (Registry.query(name, Registry.Scope.BLOCK) == null) {
  7445. return;
  7446. }
  7447. else if (name === this.statics.blotName && !value) {
  7448. this.replaceWith(BlockBlot.blotName);
  7449. }
  7450. else {
  7451. _super.prototype.format.call(this, name, value);
  7452. }
  7453. };
  7454. BlockBlot.prototype.formatAt = function (index, length, name, value) {
  7455. if (Registry.query(name, Registry.Scope.BLOCK) != null) {
  7456. this.format(name, value);
  7457. }
  7458. else {
  7459. _super.prototype.formatAt.call(this, index, length, name, value);
  7460. }
  7461. };
  7462. BlockBlot.prototype.insertAt = function (index, value, def) {
  7463. if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
  7464. // Insert text or inline
  7465. _super.prototype.insertAt.call(this, index, value, def);
  7466. }
  7467. else {
  7468. var after = this.split(index);
  7469. var blot = Registry.create(value, def);
  7470. after.parent.insertBefore(blot, after);
  7471. }
  7472. };
  7473. BlockBlot.prototype.update = function (mutations) {
  7474. if (navigator.userAgent.match(/Trident/)) {
  7475. this.attach();
  7476. }
  7477. else {
  7478. _super.prototype.update.call(this, mutations);
  7479. }
  7480. };
  7481. return BlockBlot;
  7482. }(format_1.default));
  7483. BlockBlot.blotName = 'block';
  7484. BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
  7485. BlockBlot.tagName = 'P';
  7486. exports.default = BlockBlot;
  7487. /***/ }),
  7488. /* 57 */
  7489. /***/ (function(module, exports, __webpack_require__) {
  7490. "use strict";
  7491. var __extends = (this && this.__extends) || (function () {
  7492. var extendStatics = Object.setPrototypeOf ||
  7493. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7494. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7495. return function (d, b) {
  7496. extendStatics(d, b);
  7497. function __() { this.constructor = d; }
  7498. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7499. };
  7500. })();
  7501. Object.defineProperty(exports, "__esModule", { value: true });
  7502. var leaf_1 = __webpack_require__(23);
  7503. var EmbedBlot = (function (_super) {
  7504. __extends(EmbedBlot, _super);
  7505. function EmbedBlot() {
  7506. return _super !== null && _super.apply(this, arguments) || this;
  7507. }
  7508. EmbedBlot.formats = function (domNode) {
  7509. return undefined;
  7510. };
  7511. EmbedBlot.prototype.format = function (name, value) {
  7512. // super.formatAt wraps, which is what we want in general,
  7513. // but this allows subclasses to overwrite for formats
  7514. // that just apply to particular embeds
  7515. _super.prototype.formatAt.call(this, 0, this.length(), name, value);
  7516. };
  7517. EmbedBlot.prototype.formatAt = function (index, length, name, value) {
  7518. if (index === 0 && length === this.length()) {
  7519. this.format(name, value);
  7520. }
  7521. else {
  7522. _super.prototype.formatAt.call(this, index, length, name, value);
  7523. }
  7524. };
  7525. EmbedBlot.prototype.formats = function () {
  7526. return this.statics.formats(this.domNode);
  7527. };
  7528. return EmbedBlot;
  7529. }(leaf_1.default));
  7530. exports.default = EmbedBlot;
  7531. /***/ }),
  7532. /* 58 */
  7533. /***/ (function(module, exports, __webpack_require__) {
  7534. "use strict";
  7535. var __extends = (this && this.__extends) || (function () {
  7536. var extendStatics = Object.setPrototypeOf ||
  7537. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7538. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7539. return function (d, b) {
  7540. extendStatics(d, b);
  7541. function __() { this.constructor = d; }
  7542. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7543. };
  7544. })();
  7545. Object.defineProperty(exports, "__esModule", { value: true });
  7546. var format_1 = __webpack_require__(22);
  7547. var Registry = __webpack_require__(1);
  7548. // Shallow object comparison
  7549. function isEqual(obj1, obj2) {
  7550. if (Object.keys(obj1).length !== Object.keys(obj2).length)
  7551. return false;
  7552. for (var prop in obj1) {
  7553. if (obj1[prop] !== obj2[prop])
  7554. return false;
  7555. }
  7556. return true;
  7557. }
  7558. var InlineBlot = (function (_super) {
  7559. __extends(InlineBlot, _super);
  7560. function InlineBlot() {
  7561. return _super !== null && _super.apply(this, arguments) || this;
  7562. }
  7563. InlineBlot.formats = function (domNode) {
  7564. if (domNode.tagName === InlineBlot.tagName)
  7565. return undefined;
  7566. return _super.formats.call(this, domNode);
  7567. };
  7568. InlineBlot.prototype.format = function (name, value) {
  7569. var _this = this;
  7570. if (name === this.statics.blotName && !value) {
  7571. this.children.forEach(function (child) {
  7572. if (!(child instanceof format_1.default)) {
  7573. child = child.wrap(InlineBlot.blotName, true);
  7574. }
  7575. _this.attributes.copy(child);
  7576. });
  7577. this.unwrap();
  7578. }
  7579. else {
  7580. _super.prototype.format.call(this, name, value);
  7581. }
  7582. };
  7583. InlineBlot.prototype.formatAt = function (index, length, name, value) {
  7584. if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
  7585. var blot = this.isolate(index, length);
  7586. blot.format(name, value);
  7587. }
  7588. else {
  7589. _super.prototype.formatAt.call(this, index, length, name, value);
  7590. }
  7591. };
  7592. InlineBlot.prototype.optimize = function () {
  7593. _super.prototype.optimize.call(this);
  7594. var formats = this.formats();
  7595. if (Object.keys(formats).length === 0) {
  7596. return this.unwrap(); // unformatted span
  7597. }
  7598. var next = this.next;
  7599. if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
  7600. next.moveChildren(this);
  7601. next.remove();
  7602. }
  7603. };
  7604. return InlineBlot;
  7605. }(format_1.default));
  7606. InlineBlot.blotName = 'inline';
  7607. InlineBlot.scope = Registry.Scope.INLINE_BLOT;
  7608. InlineBlot.tagName = 'SPAN';
  7609. exports.default = InlineBlot;
  7610. /***/ }),
  7611. /* 59 */
  7612. /***/ (function(module, exports, __webpack_require__) {
  7613. "use strict";
  7614. var __extends = (this && this.__extends) || (function () {
  7615. var extendStatics = Object.setPrototypeOf ||
  7616. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7617. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7618. return function (d, b) {
  7619. extendStatics(d, b);
  7620. function __() { this.constructor = d; }
  7621. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7622. };
  7623. })();
  7624. Object.defineProperty(exports, "__esModule", { value: true });
  7625. var container_1 = __webpack_require__(21);
  7626. var Registry = __webpack_require__(1);
  7627. var OBSERVER_CONFIG = {
  7628. attributes: true,
  7629. characterData: true,
  7630. characterDataOldValue: true,
  7631. childList: true,
  7632. subtree: true
  7633. };
  7634. var MAX_OPTIMIZE_ITERATIONS = 100;
  7635. var ScrollBlot = (function (_super) {
  7636. __extends(ScrollBlot, _super);
  7637. function ScrollBlot(node) {
  7638. var _this = _super.call(this, node) || this;
  7639. _this.parent = null;
  7640. _this.observer = new MutationObserver(function (mutations) {
  7641. _this.update(mutations);
  7642. });
  7643. _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
  7644. return _this;
  7645. }
  7646. ScrollBlot.prototype.detach = function () {
  7647. _super.prototype.detach.call(this);
  7648. this.observer.disconnect();
  7649. };
  7650. ScrollBlot.prototype.deleteAt = function (index, length) {
  7651. this.update();
  7652. if (index === 0 && length === this.length()) {
  7653. this.children.forEach(function (child) {
  7654. child.remove();
  7655. });
  7656. }
  7657. else {
  7658. _super.prototype.deleteAt.call(this, index, length);
  7659. }
  7660. };
  7661. ScrollBlot.prototype.formatAt = function (index, length, name, value) {
  7662. this.update();
  7663. _super.prototype.formatAt.call(this, index, length, name, value);
  7664. };
  7665. ScrollBlot.prototype.insertAt = function (index, value, def) {
  7666. this.update();
  7667. _super.prototype.insertAt.call(this, index, value, def);
  7668. };
  7669. ScrollBlot.prototype.optimize = function (mutations) {
  7670. var _this = this;
  7671. if (mutations === void 0) { mutations = []; }
  7672. _super.prototype.optimize.call(this);
  7673. // We must modify mutations directly, cannot make copy and then modify
  7674. var records = [].slice.call(this.observer.takeRecords());
  7675. // Array.push currently seems to be implemented by a non-tail recursive function
  7676. // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
  7677. while (records.length > 0)
  7678. mutations.push(records.pop());
  7679. // TODO use WeakMap
  7680. var mark = function (blot, markParent) {
  7681. if (markParent === void 0) { markParent = true; }
  7682. if (blot == null || blot === _this)
  7683. return;
  7684. if (blot.domNode.parentNode == null)
  7685. return;
  7686. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  7687. blot.domNode[Registry.DATA_KEY].mutations = [];
  7688. }
  7689. if (markParent)
  7690. mark(blot.parent);
  7691. };
  7692. var optimize = function (blot) {
  7693. if (blot.domNode[Registry.DATA_KEY] == null || blot.domNode[Registry.DATA_KEY].mutations == null) {
  7694. return;
  7695. }
  7696. if (blot instanceof container_1.default) {
  7697. blot.children.forEach(optimize);
  7698. }
  7699. blot.optimize();
  7700. };
  7701. var remaining = mutations;
  7702. for (var i = 0; remaining.length > 0; i += 1) {
  7703. if (i >= MAX_OPTIMIZE_ITERATIONS) {
  7704. throw new Error('[Parchment] Maximum optimize iterations reached');
  7705. }
  7706. remaining.forEach(function (mutation) {
  7707. var blot = Registry.find(mutation.target, true);
  7708. if (blot == null)
  7709. return;
  7710. if (blot.domNode === mutation.target) {
  7711. if (mutation.type === 'childList') {
  7712. mark(Registry.find(mutation.previousSibling, false));
  7713. [].forEach.call(mutation.addedNodes, function (node) {
  7714. var child = Registry.find(node, false);
  7715. mark(child, false);
  7716. if (child instanceof container_1.default) {
  7717. child.children.forEach(function (grandChild) {
  7718. mark(grandChild, false);
  7719. });
  7720. }
  7721. });
  7722. }
  7723. else if (mutation.type === 'attributes') {
  7724. mark(blot.prev);
  7725. }
  7726. }
  7727. mark(blot);
  7728. });
  7729. this.children.forEach(optimize);
  7730. remaining = [].slice.call(this.observer.takeRecords());
  7731. records = remaining.slice();
  7732. while (records.length > 0)
  7733. mutations.push(records.pop());
  7734. }
  7735. };
  7736. ScrollBlot.prototype.update = function (mutations) {
  7737. var _this = this;
  7738. mutations = mutations || this.observer.takeRecords();
  7739. // TODO use WeakMap
  7740. mutations.map(function (mutation) {
  7741. var blot = Registry.find(mutation.target, true);
  7742. if (blot == null)
  7743. return;
  7744. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  7745. blot.domNode[Registry.DATA_KEY].mutations = [mutation];
  7746. return blot;
  7747. }
  7748. else {
  7749. blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
  7750. return null;
  7751. }
  7752. }).forEach(function (blot) {
  7753. if (blot == null || blot === _this || blot.domNode[Registry.DATA_KEY] == null)
  7754. return;
  7755. blot.update(blot.domNode[Registry.DATA_KEY].mutations || []);
  7756. });
  7757. if (this.domNode[Registry.DATA_KEY].mutations != null) {
  7758. _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations);
  7759. }
  7760. this.optimize(mutations);
  7761. };
  7762. return ScrollBlot;
  7763. }(container_1.default));
  7764. ScrollBlot.blotName = 'scroll';
  7765. ScrollBlot.defaultChild = 'block';
  7766. ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
  7767. ScrollBlot.tagName = 'DIV';
  7768. exports.default = ScrollBlot;
  7769. /***/ }),
  7770. /* 60 */
  7771. /***/ (function(module, exports, __webpack_require__) {
  7772. "use strict";
  7773. var __extends = (this && this.__extends) || (function () {
  7774. var extendStatics = Object.setPrototypeOf ||
  7775. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7776. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7777. return function (d, b) {
  7778. extendStatics(d, b);
  7779. function __() { this.constructor = d; }
  7780. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7781. };
  7782. })();
  7783. Object.defineProperty(exports, "__esModule", { value: true });
  7784. var leaf_1 = __webpack_require__(23);
  7785. var Registry = __webpack_require__(1);
  7786. var TextBlot = (function (_super) {
  7787. __extends(TextBlot, _super);
  7788. function TextBlot(node) {
  7789. var _this = _super.call(this, node) || this;
  7790. _this.text = _this.statics.value(_this.domNode);
  7791. return _this;
  7792. }
  7793. TextBlot.create = function (value) {
  7794. return document.createTextNode(value);
  7795. };
  7796. TextBlot.value = function (domNode) {
  7797. var text = domNode.data;
  7798. if (text["normalize"])
  7799. text = text["normalize"]();
  7800. return text;
  7801. };
  7802. TextBlot.prototype.deleteAt = function (index, length) {
  7803. this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
  7804. };
  7805. TextBlot.prototype.index = function (node, offset) {
  7806. if (this.domNode === node) {
  7807. return offset;
  7808. }
  7809. return -1;
  7810. };
  7811. TextBlot.prototype.insertAt = function (index, value, def) {
  7812. if (def == null) {
  7813. this.text = this.text.slice(0, index) + value + this.text.slice(index);
  7814. this.domNode.data = this.text;
  7815. }
  7816. else {
  7817. _super.prototype.insertAt.call(this, index, value, def);
  7818. }
  7819. };
  7820. TextBlot.prototype.length = function () {
  7821. return this.text.length;
  7822. };
  7823. TextBlot.prototype.optimize = function () {
  7824. _super.prototype.optimize.call(this);
  7825. this.text = this.statics.value(this.domNode);
  7826. if (this.text.length === 0) {
  7827. this.remove();
  7828. }
  7829. else if (this.next instanceof TextBlot && this.next.prev === this) {
  7830. this.insertAt(this.length(), this.next.value());
  7831. this.next.remove();
  7832. }
  7833. };
  7834. TextBlot.prototype.position = function (index, inclusive) {
  7835. if (inclusive === void 0) { inclusive = false; }
  7836. return [this.domNode, index];
  7837. };
  7838. TextBlot.prototype.split = function (index, force) {
  7839. if (force === void 0) { force = false; }
  7840. if (!force) {
  7841. if (index === 0)
  7842. return this;
  7843. if (index === this.length())
  7844. return this.next;
  7845. }
  7846. var after = Registry.create(this.domNode.splitText(index));
  7847. this.parent.insertBefore(after, this.next);
  7848. this.text = this.statics.value(this.domNode);
  7849. return after;
  7850. };
  7851. TextBlot.prototype.update = function (mutations) {
  7852. var _this = this;
  7853. if (mutations.some(function (mutation) {
  7854. return mutation.type === 'characterData' && mutation.target === _this.domNode;
  7855. })) {
  7856. this.text = this.statics.value(this.domNode);
  7857. }
  7858. };
  7859. TextBlot.prototype.value = function () {
  7860. return this.text;
  7861. };
  7862. return TextBlot;
  7863. }(leaf_1.default));
  7864. TextBlot.blotName = 'text';
  7865. TextBlot.scope = Registry.Scope.INLINE_BLOT;
  7866. exports.default = TextBlot;
  7867. /***/ }),
  7868. /* 61 */
  7869. /***/ (function(module, exports, __webpack_require__) {
  7870. "use strict";
  7871. Object.defineProperty(exports, "__esModule", { value: true });
  7872. var LinkedList = (function () {
  7873. function LinkedList() {
  7874. this.head = this.tail = undefined;
  7875. this.length = 0;
  7876. }
  7877. LinkedList.prototype.append = function () {
  7878. var nodes = [];
  7879. for (var _i = 0; _i < arguments.length; _i++) {
  7880. nodes[_i] = arguments[_i];
  7881. }
  7882. this.insertBefore(nodes[0], undefined);
  7883. if (nodes.length > 1) {
  7884. this.append.apply(this, nodes.slice(1));
  7885. }
  7886. };
  7887. LinkedList.prototype.contains = function (node) {
  7888. var cur, next = this.iterator();
  7889. while (cur = next()) {
  7890. if (cur === node)
  7891. return true;
  7892. }
  7893. return false;
  7894. };
  7895. LinkedList.prototype.insertBefore = function (node, refNode) {
  7896. node.next = refNode;
  7897. if (refNode != null) {
  7898. node.prev = refNode.prev;
  7899. if (refNode.prev != null) {
  7900. refNode.prev.next = node;
  7901. }
  7902. refNode.prev = node;
  7903. if (refNode === this.head) {
  7904. this.head = node;
  7905. }
  7906. }
  7907. else if (this.tail != null) {
  7908. this.tail.next = node;
  7909. node.prev = this.tail;
  7910. this.tail = node;
  7911. }
  7912. else {
  7913. node.prev = undefined;
  7914. this.head = this.tail = node;
  7915. }
  7916. this.length += 1;
  7917. };
  7918. LinkedList.prototype.offset = function (target) {
  7919. var index = 0, cur = this.head;
  7920. while (cur != null) {
  7921. if (cur === target)
  7922. return index;
  7923. index += cur.length();
  7924. cur = cur.next;
  7925. }
  7926. return -1;
  7927. };
  7928. LinkedList.prototype.remove = function (node) {
  7929. if (!this.contains(node))
  7930. return;
  7931. if (node.prev != null)
  7932. node.prev.next = node.next;
  7933. if (node.next != null)
  7934. node.next.prev = node.prev;
  7935. if (node === this.head)
  7936. this.head = node.next;
  7937. if (node === this.tail)
  7938. this.tail = node.prev;
  7939. this.length -= 1;
  7940. };
  7941. LinkedList.prototype.iterator = function (curNode) {
  7942. if (curNode === void 0) { curNode = this.head; }
  7943. // TODO use yield when we can
  7944. return function () {
  7945. var ret = curNode;
  7946. if (curNode != null)
  7947. curNode = curNode.next;
  7948. return ret;
  7949. };
  7950. };
  7951. LinkedList.prototype.find = function (index, inclusive) {
  7952. if (inclusive === void 0) { inclusive = false; }
  7953. var cur, next = this.iterator();
  7954. while (cur = next()) {
  7955. var length = cur.length();
  7956. if (index < length || (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
  7957. return [cur, index];
  7958. }
  7959. index -= length;
  7960. }
  7961. return [null, 0];
  7962. };
  7963. LinkedList.prototype.forEach = function (callback) {
  7964. var cur, next = this.iterator();
  7965. while (cur = next()) {
  7966. callback(cur);
  7967. }
  7968. };
  7969. LinkedList.prototype.forEachAt = function (index, length, callback) {
  7970. if (length <= 0)
  7971. return;
  7972. var _a = this.find(index), startNode = _a[0], offset = _a[1];
  7973. var cur, curIndex = index - offset, next = this.iterator(startNode);
  7974. while ((cur = next()) && curIndex < index + length) {
  7975. var curLength = cur.length();
  7976. if (index > curIndex) {
  7977. callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
  7978. }
  7979. else {
  7980. callback(cur, 0, Math.min(curLength, index + length - curIndex));
  7981. }
  7982. curIndex += curLength;
  7983. }
  7984. };
  7985. LinkedList.prototype.map = function (callback) {
  7986. return this.reduce(function (memo, cur) {
  7987. memo.push(callback(cur));
  7988. return memo;
  7989. }, []);
  7990. };
  7991. LinkedList.prototype.reduce = function (callback, memo) {
  7992. var cur, next = this.iterator();
  7993. while (cur = next()) {
  7994. memo = callback(memo, cur);
  7995. }
  7996. return memo;
  7997. };
  7998. return LinkedList;
  7999. }());
  8000. exports.default = LinkedList;
  8001. /***/ }),
  8002. /* 62 */
  8003. /***/ (function(module, exports, __webpack_require__) {
  8004. "use strict";
  8005. var _core = __webpack_require__(29);
  8006. var _core2 = _interopRequireDefault(_core);
  8007. var _align = __webpack_require__(36);
  8008. var _direction = __webpack_require__(38);
  8009. var _indent = __webpack_require__(67);
  8010. var _blockquote = __webpack_require__(64);
  8011. var _blockquote2 = _interopRequireDefault(_blockquote);
  8012. var _header = __webpack_require__(65);
  8013. var _header2 = _interopRequireDefault(_header);
  8014. var _list = __webpack_require__(69);
  8015. var _list2 = _interopRequireDefault(_list);
  8016. var _background = __webpack_require__(37);
  8017. var _color = __webpack_require__(26);
  8018. var _font = __webpack_require__(39);
  8019. var _size = __webpack_require__(40);
  8020. var _bold = __webpack_require__(45);
  8021. var _bold2 = _interopRequireDefault(_bold);
  8022. var _italic = __webpack_require__(68);
  8023. var _italic2 = _interopRequireDefault(_italic);
  8024. var _link = __webpack_require__(27);
  8025. var _link2 = _interopRequireDefault(_link);
  8026. var _script = __webpack_require__(70);
  8027. var _script2 = _interopRequireDefault(_script);
  8028. var _strike = __webpack_require__(71);
  8029. var _strike2 = _interopRequireDefault(_strike);
  8030. var _underline = __webpack_require__(72);
  8031. var _underline2 = _interopRequireDefault(_underline);
  8032. var _image = __webpack_require__(66);
  8033. var _image2 = _interopRequireDefault(_image);
  8034. var _video = __webpack_require__(73);
  8035. var _video2 = _interopRequireDefault(_video);
  8036. var _code = __webpack_require__(16);
  8037. var _code2 = _interopRequireDefault(_code);
  8038. var _formula = __webpack_require__(74);
  8039. var _formula2 = _interopRequireDefault(_formula);
  8040. var _syntax = __webpack_require__(75);
  8041. var _syntax2 = _interopRequireDefault(_syntax);
  8042. var _toolbar = __webpack_require__(47);
  8043. var _toolbar2 = _interopRequireDefault(_toolbar);
  8044. var _icons = __webpack_require__(41);
  8045. var _icons2 = _interopRequireDefault(_icons);
  8046. var _picker = __webpack_require__(28);
  8047. var _picker2 = _interopRequireDefault(_picker);
  8048. var _colorPicker = __webpack_require__(48);
  8049. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  8050. var _iconPicker = __webpack_require__(49);
  8051. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  8052. var _tooltip = __webpack_require__(50);
  8053. var _tooltip2 = _interopRequireDefault(_tooltip);
  8054. var _bubble = __webpack_require__(76);
  8055. var _bubble2 = _interopRequireDefault(_bubble);
  8056. var _snow = __webpack_require__(63);
  8057. var _snow2 = _interopRequireDefault(_snow);
  8058. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8059. _core2.default.register({
  8060. 'attributors/attribute/direction': _direction.DirectionAttribute,
  8061. 'attributors/class/align': _align.AlignClass,
  8062. 'attributors/class/background': _background.BackgroundClass,
  8063. 'attributors/class/color': _color.ColorClass,
  8064. 'attributors/class/direction': _direction.DirectionClass,
  8065. 'attributors/class/font': _font.FontClass,
  8066. 'attributors/class/size': _size.SizeClass,
  8067. 'attributors/style/align': _align.AlignStyle,
  8068. 'attributors/style/background': _background.BackgroundStyle,
  8069. 'attributors/style/color': _color.ColorStyle,
  8070. 'attributors/style/direction': _direction.DirectionStyle,
  8071. 'attributors/style/font': _font.FontStyle,
  8072. 'attributors/style/size': _size.SizeStyle
  8073. }, true);
  8074. _core2.default.register({
  8075. 'formats/align': _align.AlignClass,
  8076. 'formats/direction': _direction.DirectionClass,
  8077. 'formats/indent': _indent.IndentClass,
  8078. 'formats/background': _background.BackgroundStyle,
  8079. 'formats/color': _color.ColorStyle,
  8080. 'formats/font': _font.FontClass,
  8081. 'formats/size': _size.SizeClass,
  8082. 'formats/blockquote': _blockquote2.default,
  8083. 'formats/code-block': _code2.default,
  8084. 'formats/header': _header2.default,
  8085. 'formats/list': _list2.default,
  8086. 'formats/bold': _bold2.default,
  8087. 'formats/code': _code.Code,
  8088. 'formats/italic': _italic2.default,
  8089. 'formats/link': _link2.default,
  8090. 'formats/script': _script2.default,
  8091. 'formats/strike': _strike2.default,
  8092. 'formats/underline': _underline2.default,
  8093. 'formats/image': _image2.default,
  8094. 'formats/video': _video2.default,
  8095. 'formats/list/item': _list.ListItem,
  8096. 'modules/formula': _formula2.default,
  8097. 'modules/syntax': _syntax2.default,
  8098. 'modules/toolbar': _toolbar2.default,
  8099. 'themes/bubble': _bubble2.default,
  8100. 'themes/snow': _snow2.default,
  8101. 'ui/icons': _icons2.default,
  8102. 'ui/picker': _picker2.default,
  8103. 'ui/icon-picker': _iconPicker2.default,
  8104. 'ui/color-picker': _colorPicker2.default,
  8105. 'ui/tooltip': _tooltip2.default
  8106. }, true);
  8107. module.exports = _core2.default;
  8108. /***/ }),
  8109. /* 63 */
  8110. /***/ (function(module, exports, __webpack_require__) {
  8111. "use strict";
  8112. Object.defineProperty(exports, "__esModule", {
  8113. value: true
  8114. });
  8115. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8116. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8117. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8118. var _extend = __webpack_require__(3);
  8119. var _extend2 = _interopRequireDefault(_extend);
  8120. var _emitter = __webpack_require__(5);
  8121. var _emitter2 = _interopRequireDefault(_emitter);
  8122. var _base = __webpack_require__(43);
  8123. var _base2 = _interopRequireDefault(_base);
  8124. var _link = __webpack_require__(27);
  8125. var _link2 = _interopRequireDefault(_link);
  8126. var _selection = __webpack_require__(15);
  8127. var _icons = __webpack_require__(41);
  8128. var _icons2 = _interopRequireDefault(_icons);
  8129. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8130. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8131. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8132. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8133. var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
  8134. var SnowTheme = function (_BaseTheme) {
  8135. _inherits(SnowTheme, _BaseTheme);
  8136. function SnowTheme(quill, options) {
  8137. _classCallCheck(this, SnowTheme);
  8138. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  8139. options.modules.toolbar.container = TOOLBAR_CONFIG;
  8140. }
  8141. var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
  8142. _this.quill.container.classList.add('ql-snow');
  8143. return _this;
  8144. }
  8145. _createClass(SnowTheme, [{
  8146. key: 'extendToolbar',
  8147. value: function extendToolbar(toolbar) {
  8148. toolbar.container.classList.add('ql-snow');
  8149. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  8150. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  8151. this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
  8152. if (toolbar.container.querySelector('.ql-link')) {
  8153. this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
  8154. toolbar.handlers['link'].call(toolbar, !context.format.link);
  8155. });
  8156. }
  8157. }
  8158. }]);
  8159. return SnowTheme;
  8160. }(_base2.default);
  8161. SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  8162. modules: {
  8163. toolbar: {
  8164. handlers: {
  8165. link: function link(value) {
  8166. if (value) {
  8167. var range = this.quill.getSelection();
  8168. if (range == null || range.length == 0) return;
  8169. var preview = this.quill.getText(range);
  8170. if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
  8171. preview = 'mailto:' + preview;
  8172. }
  8173. var tooltip = this.quill.theme.tooltip;
  8174. tooltip.edit('link', preview);
  8175. } else {
  8176. this.quill.format('link', false);
  8177. }
  8178. }
  8179. }
  8180. }
  8181. }
  8182. });
  8183. var SnowTooltip = function (_BaseTooltip) {
  8184. _inherits(SnowTooltip, _BaseTooltip);
  8185. function SnowTooltip(quill, bounds) {
  8186. _classCallCheck(this, SnowTooltip);
  8187. var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
  8188. _this2.preview = _this2.root.querySelector('a.ql-preview');
  8189. return _this2;
  8190. }
  8191. _createClass(SnowTooltip, [{
  8192. key: 'listen',
  8193. value: function listen() {
  8194. var _this3 = this;
  8195. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
  8196. this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
  8197. if (_this3.root.classList.contains('ql-editing')) {
  8198. _this3.save();
  8199. } else {
  8200. _this3.edit('link', _this3.preview.textContent);
  8201. }
  8202. event.preventDefault();
  8203. });
  8204. this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
  8205. if (_this3.linkRange != null) {
  8206. var range = _this3.linkRange;
  8207. _this3.restoreFocus();
  8208. _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
  8209. delete _this3.linkRange;
  8210. }
  8211. event.preventDefault();
  8212. _this3.hide();
  8213. });
  8214. this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
  8215. if (range == null) return;
  8216. if (range.length === 0 && source === _emitter2.default.sources.USER) {
  8217. var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
  8218. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  8219. link = _quill$scroll$descend2[0],
  8220. offset = _quill$scroll$descend2[1];
  8221. if (link != null) {
  8222. _this3.linkRange = new _selection.Range(range.index - offset, link.length());
  8223. var preview = _link2.default.formats(link.domNode);
  8224. _this3.preview.textContent = preview;
  8225. _this3.preview.setAttribute('href', preview);
  8226. _this3.show();
  8227. _this3.position(_this3.quill.getBounds(_this3.linkRange));
  8228. return;
  8229. }
  8230. } else {
  8231. delete _this3.linkRange;
  8232. }
  8233. _this3.hide();
  8234. });
  8235. }
  8236. }, {
  8237. key: 'show',
  8238. value: function show() {
  8239. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
  8240. this.root.removeAttribute('data-mode');
  8241. }
  8242. }]);
  8243. return SnowTooltip;
  8244. }(_base.BaseTooltip);
  8245. SnowTooltip.TEMPLATE = ['<a class="ql-preview" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
  8246. exports.default = SnowTheme;
  8247. /***/ }),
  8248. /* 64 */
  8249. /***/ (function(module, exports, __webpack_require__) {
  8250. "use strict";
  8251. Object.defineProperty(exports, "__esModule", {
  8252. value: true
  8253. });
  8254. var _block = __webpack_require__(4);
  8255. var _block2 = _interopRequireDefault(_block);
  8256. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8257. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8258. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8259. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8260. var Blockquote = function (_Block) {
  8261. _inherits(Blockquote, _Block);
  8262. function Blockquote() {
  8263. _classCallCheck(this, Blockquote);
  8264. return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
  8265. }
  8266. return Blockquote;
  8267. }(_block2.default);
  8268. Blockquote.blotName = 'blockquote';
  8269. Blockquote.tagName = 'blockquote';
  8270. exports.default = Blockquote;
  8271. /***/ }),
  8272. /* 65 */
  8273. /***/ (function(module, exports, __webpack_require__) {
  8274. "use strict";
  8275. Object.defineProperty(exports, "__esModule", {
  8276. value: true
  8277. });
  8278. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8279. var _block = __webpack_require__(4);
  8280. var _block2 = _interopRequireDefault(_block);
  8281. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8282. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8283. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8284. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8285. var Header = function (_Block) {
  8286. _inherits(Header, _Block);
  8287. function Header() {
  8288. _classCallCheck(this, Header);
  8289. return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
  8290. }
  8291. _createClass(Header, null, [{
  8292. key: 'formats',
  8293. value: function formats(domNode) {
  8294. return this.tagName.indexOf(domNode.tagName) + 1;
  8295. }
  8296. }]);
  8297. return Header;
  8298. }(_block2.default);
  8299. Header.blotName = 'header';
  8300. Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
  8301. exports.default = Header;
  8302. /***/ }),
  8303. /* 66 */
  8304. /***/ (function(module, exports, __webpack_require__) {
  8305. "use strict";
  8306. Object.defineProperty(exports, "__esModule", {
  8307. value: true
  8308. });
  8309. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8310. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8311. var _embed = __webpack_require__(7);
  8312. var _embed2 = _interopRequireDefault(_embed);
  8313. var _link = __webpack_require__(27);
  8314. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8315. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8316. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8317. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8318. var ATTRIBUTES = ['alt', 'height', 'width'];
  8319. var Image = function (_Embed) {
  8320. _inherits(Image, _Embed);
  8321. function Image() {
  8322. _classCallCheck(this, Image);
  8323. return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
  8324. }
  8325. _createClass(Image, [{
  8326. key: 'format',
  8327. value: function format(name, value) {
  8328. if (ATTRIBUTES.indexOf(name) > -1) {
  8329. if (value) {
  8330. this.domNode.setAttribute(name, value);
  8331. } else {
  8332. this.domNode.removeAttribute(name);
  8333. }
  8334. } else {
  8335. _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
  8336. }
  8337. }
  8338. }], [{
  8339. key: 'create',
  8340. value: function create(value) {
  8341. var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
  8342. if (typeof value === 'string') {
  8343. node.setAttribute('src', this.sanitize(value));
  8344. }
  8345. return node;
  8346. }
  8347. }, {
  8348. key: 'formats',
  8349. value: function formats(domNode) {
  8350. return ATTRIBUTES.reduce(function (formats, attribute) {
  8351. if (domNode.hasAttribute(attribute)) {
  8352. formats[attribute] = domNode.getAttribute(attribute);
  8353. }
  8354. return formats;
  8355. }, {});
  8356. }
  8357. }, {
  8358. key: 'match',
  8359. value: function match(url) {
  8360. return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
  8361. );
  8362. }
  8363. }, {
  8364. key: 'sanitize',
  8365. value: function sanitize(url) {
  8366. return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
  8367. }
  8368. }, {
  8369. key: 'value',
  8370. value: function value(domNode) {
  8371. return domNode.getAttribute('src');
  8372. }
  8373. }]);
  8374. return Image;
  8375. }(_embed2.default);
  8376. Image.blotName = 'image';
  8377. Image.tagName = 'IMG';
  8378. exports.default = Image;
  8379. /***/ }),
  8380. /* 67 */
  8381. /***/ (function(module, exports, __webpack_require__) {
  8382. "use strict";
  8383. Object.defineProperty(exports, "__esModule", {
  8384. value: true
  8385. });
  8386. exports.IndentClass = undefined;
  8387. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8388. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8389. var _parchment = __webpack_require__(0);
  8390. var _parchment2 = _interopRequireDefault(_parchment);
  8391. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8392. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8393. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8394. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8395. var IdentAttributor = function (_Parchment$Attributor) {
  8396. _inherits(IdentAttributor, _Parchment$Attributor);
  8397. function IdentAttributor() {
  8398. _classCallCheck(this, IdentAttributor);
  8399. return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
  8400. }
  8401. _createClass(IdentAttributor, [{
  8402. key: 'add',
  8403. value: function add(node, value) {
  8404. if (value === '+1' || value === '-1') {
  8405. var indent = this.value(node) || 0;
  8406. value = value === '+1' ? indent + 1 : indent - 1;
  8407. }
  8408. if (value === 0) {
  8409. this.remove(node);
  8410. return true;
  8411. } else {
  8412. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
  8413. }
  8414. }
  8415. }, {
  8416. key: 'canAdd',
  8417. value: function canAdd(node, value) {
  8418. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, value) || _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, parseInt(value));
  8419. }
  8420. }, {
  8421. key: 'value',
  8422. value: function value(node) {
  8423. return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
  8424. }
  8425. }]);
  8426. return IdentAttributor;
  8427. }(_parchment2.default.Attributor.Class);
  8428. var IndentClass = new IdentAttributor('indent', 'ql-indent', {
  8429. scope: _parchment2.default.Scope.BLOCK,
  8430. whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
  8431. });
  8432. exports.IndentClass = IndentClass;
  8433. /***/ }),
  8434. /* 68 */
  8435. /***/ (function(module, exports, __webpack_require__) {
  8436. "use strict";
  8437. Object.defineProperty(exports, "__esModule", {
  8438. value: true
  8439. });
  8440. var _bold = __webpack_require__(45);
  8441. var _bold2 = _interopRequireDefault(_bold);
  8442. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8443. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8444. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8445. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8446. var Italic = function (_Bold) {
  8447. _inherits(Italic, _Bold);
  8448. function Italic() {
  8449. _classCallCheck(this, Italic);
  8450. return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
  8451. }
  8452. return Italic;
  8453. }(_bold2.default);
  8454. Italic.blotName = 'italic';
  8455. Italic.tagName = ['EM', 'I'];
  8456. exports.default = Italic;
  8457. /***/ }),
  8458. /* 69 */
  8459. /***/ (function(module, exports, __webpack_require__) {
  8460. "use strict";
  8461. Object.defineProperty(exports, "__esModule", {
  8462. value: true
  8463. });
  8464. exports.default = exports.ListItem = undefined;
  8465. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8466. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8467. var _parchment = __webpack_require__(0);
  8468. var _parchment2 = _interopRequireDefault(_parchment);
  8469. var _block = __webpack_require__(4);
  8470. var _block2 = _interopRequireDefault(_block);
  8471. var _container = __webpack_require__(24);
  8472. var _container2 = _interopRequireDefault(_container);
  8473. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8474. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  8475. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8476. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8477. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8478. var ListItem = function (_Block) {
  8479. _inherits(ListItem, _Block);
  8480. function ListItem() {
  8481. _classCallCheck(this, ListItem);
  8482. return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
  8483. }
  8484. _createClass(ListItem, [{
  8485. key: 'format',
  8486. value: function format(name, value) {
  8487. if (name === List.blotName && !value) {
  8488. this.replaceWith(_parchment2.default.create(this.statics.scope));
  8489. } else {
  8490. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
  8491. }
  8492. }
  8493. }, {
  8494. key: 'remove',
  8495. value: function remove() {
  8496. if (this.prev == null && this.next == null) {
  8497. this.parent.remove();
  8498. } else {
  8499. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
  8500. }
  8501. }
  8502. }, {
  8503. key: 'replaceWith',
  8504. value: function replaceWith(name, value) {
  8505. this.parent.isolate(this.offset(this.parent), this.length());
  8506. if (name === this.parent.statics.blotName) {
  8507. this.parent.replaceWith(name, value);
  8508. return this;
  8509. } else {
  8510. this.parent.unwrap();
  8511. return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
  8512. }
  8513. }
  8514. }], [{
  8515. key: 'formats',
  8516. value: function formats(domNode) {
  8517. return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
  8518. }
  8519. }]);
  8520. return ListItem;
  8521. }(_block2.default);
  8522. ListItem.blotName = 'list-item';
  8523. ListItem.tagName = 'LI';
  8524. var List = function (_Container) {
  8525. _inherits(List, _Container);
  8526. _createClass(List, null, [{
  8527. key: 'create',
  8528. value: function create(value) {
  8529. var tagName = value === 'ordered' ? 'OL' : 'UL';
  8530. var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
  8531. if (value === 'checked' || value === 'unchecked') {
  8532. node.setAttribute('data-checked', value === 'checked');
  8533. }
  8534. return node;
  8535. }
  8536. }, {
  8537. key: 'formats',
  8538. value: function formats(domNode) {
  8539. if (domNode.tagName === 'OL') return 'ordered';
  8540. if (domNode.tagName === 'UL') {
  8541. if (domNode.hasAttribute('data-checked')) {
  8542. return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
  8543. } else {
  8544. return 'bullet';
  8545. }
  8546. }
  8547. return undefined;
  8548. }
  8549. }]);
  8550. function List(domNode) {
  8551. _classCallCheck(this, List);
  8552. var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
  8553. domNode.addEventListener('click', function (e) {
  8554. if (e.target.parentNode !== domNode) return;
  8555. var format = _this2.statics.formats(domNode);
  8556. var blot = _parchment2.default.find(e.target);
  8557. if (format === 'checked') {
  8558. blot.format('list', 'unchecked');
  8559. } else if (format === 'unchecked') {
  8560. blot.format('list', 'checked');
  8561. }
  8562. });
  8563. return _this2;
  8564. }
  8565. _createClass(List, [{
  8566. key: 'format',
  8567. value: function format(name, value) {
  8568. if (this.children.length > 0) {
  8569. this.children.tail.format(name, value);
  8570. }
  8571. }
  8572. }, {
  8573. key: 'formats',
  8574. value: function formats() {
  8575. // We don't inherit from FormatBlot
  8576. return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
  8577. }
  8578. }, {
  8579. key: 'insertBefore',
  8580. value: function insertBefore(blot, ref) {
  8581. if (blot instanceof ListItem) {
  8582. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
  8583. } else {
  8584. var index = ref == null ? this.length() : ref.offset(this);
  8585. var after = this.split(index);
  8586. after.parent.insertBefore(blot, after);
  8587. }
  8588. }
  8589. }, {
  8590. key: 'optimize',
  8591. value: function optimize() {
  8592. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this);
  8593. var next = this.next;
  8594. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) {
  8595. next.moveChildren(this);
  8596. next.remove();
  8597. }
  8598. }
  8599. }, {
  8600. key: 'replace',
  8601. value: function replace(target) {
  8602. if (target.statics.blotName !== this.statics.blotName) {
  8603. var item = _parchment2.default.create(this.statics.defaultChild);
  8604. target.moveChildren(item);
  8605. this.appendChild(item);
  8606. }
  8607. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
  8608. }
  8609. }]);
  8610. return List;
  8611. }(_container2.default);
  8612. List.blotName = 'list';
  8613. List.scope = _parchment2.default.Scope.BLOCK_BLOT;
  8614. List.tagName = ['OL', 'UL'];
  8615. List.defaultChild = 'list-item';
  8616. List.allowedChildren = [ListItem];
  8617. exports.ListItem = ListItem;
  8618. exports.default = List;
  8619. /***/ }),
  8620. /* 70 */
  8621. /***/ (function(module, exports, __webpack_require__) {
  8622. "use strict";
  8623. Object.defineProperty(exports, "__esModule", {
  8624. value: true
  8625. });
  8626. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8627. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8628. var _inline = __webpack_require__(8);
  8629. var _inline2 = _interopRequireDefault(_inline);
  8630. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8631. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8632. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8633. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8634. var Script = function (_Inline) {
  8635. _inherits(Script, _Inline);
  8636. function Script() {
  8637. _classCallCheck(this, Script);
  8638. return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
  8639. }
  8640. _createClass(Script, null, [{
  8641. key: 'create',
  8642. value: function create(value) {
  8643. if (value === 'super') {
  8644. return document.createElement('sup');
  8645. } else if (value === 'sub') {
  8646. return document.createElement('sub');
  8647. } else {
  8648. return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
  8649. }
  8650. }
  8651. }, {
  8652. key: 'formats',
  8653. value: function formats(domNode) {
  8654. if (domNode.tagName === 'SUB') return 'sub';
  8655. if (domNode.tagName === 'SUP') return 'super';
  8656. return undefined;
  8657. }
  8658. }]);
  8659. return Script;
  8660. }(_inline2.default);
  8661. Script.blotName = 'script';
  8662. Script.tagName = ['SUB', 'SUP'];
  8663. exports.default = Script;
  8664. /***/ }),
  8665. /* 71 */
  8666. /***/ (function(module, exports, __webpack_require__) {
  8667. "use strict";
  8668. Object.defineProperty(exports, "__esModule", {
  8669. value: true
  8670. });
  8671. var _inline = __webpack_require__(8);
  8672. var _inline2 = _interopRequireDefault(_inline);
  8673. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8674. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8675. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8676. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8677. var Strike = function (_Inline) {
  8678. _inherits(Strike, _Inline);
  8679. function Strike() {
  8680. _classCallCheck(this, Strike);
  8681. return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
  8682. }
  8683. return Strike;
  8684. }(_inline2.default);
  8685. Strike.blotName = 'strike';
  8686. Strike.tagName = 'S';
  8687. exports.default = Strike;
  8688. /***/ }),
  8689. /* 72 */
  8690. /***/ (function(module, exports, __webpack_require__) {
  8691. "use strict";
  8692. Object.defineProperty(exports, "__esModule", {
  8693. value: true
  8694. });
  8695. var _inline = __webpack_require__(8);
  8696. var _inline2 = _interopRequireDefault(_inline);
  8697. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8698. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8699. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8700. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8701. var Underline = function (_Inline) {
  8702. _inherits(Underline, _Inline);
  8703. function Underline() {
  8704. _classCallCheck(this, Underline);
  8705. return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
  8706. }
  8707. return Underline;
  8708. }(_inline2.default);
  8709. Underline.blotName = 'underline';
  8710. Underline.tagName = 'U';
  8711. exports.default = Underline;
  8712. /***/ }),
  8713. /* 73 */
  8714. /***/ (function(module, exports, __webpack_require__) {
  8715. "use strict";
  8716. Object.defineProperty(exports, "__esModule", {
  8717. value: true
  8718. });
  8719. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8720. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8721. var _block = __webpack_require__(4);
  8722. var _link = __webpack_require__(27);
  8723. var _link2 = _interopRequireDefault(_link);
  8724. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8725. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8726. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8727. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8728. var ATTRIBUTES = ['height', 'width'];
  8729. var Video = function (_BlockEmbed) {
  8730. _inherits(Video, _BlockEmbed);
  8731. function Video() {
  8732. _classCallCheck(this, Video);
  8733. return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
  8734. }
  8735. _createClass(Video, [{
  8736. key: 'format',
  8737. value: function format(name, value) {
  8738. if (ATTRIBUTES.indexOf(name) > -1) {
  8739. if (value) {
  8740. this.domNode.setAttribute(name, value);
  8741. } else {
  8742. this.domNode.removeAttribute(name);
  8743. }
  8744. } else {
  8745. _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
  8746. }
  8747. }
  8748. }], [{
  8749. key: 'create',
  8750. value: function create(value) {
  8751. var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
  8752. node.setAttribute('frameborder', '0');
  8753. node.setAttribute('allowfullscreen', true);
  8754. node.setAttribute('src', this.sanitize(value));
  8755. return node;
  8756. }
  8757. }, {
  8758. key: 'formats',
  8759. value: function formats(domNode) {
  8760. return ATTRIBUTES.reduce(function (formats, attribute) {
  8761. if (domNode.hasAttribute(attribute)) {
  8762. formats[attribute] = domNode.getAttribute(attribute);
  8763. }
  8764. return formats;
  8765. }, {});
  8766. }
  8767. }, {
  8768. key: 'sanitize',
  8769. value: function sanitize(url) {
  8770. return _link2.default.sanitize(url);
  8771. }
  8772. }, {
  8773. key: 'value',
  8774. value: function value(domNode) {
  8775. return domNode.getAttribute('src');
  8776. }
  8777. }]);
  8778. return Video;
  8779. }(_block.BlockEmbed);
  8780. Video.blotName = 'video';
  8781. Video.className = 'ql-video';
  8782. Video.tagName = 'IFRAME';
  8783. exports.default = Video;
  8784. /***/ }),
  8785. /* 74 */
  8786. /***/ (function(module, exports, __webpack_require__) {
  8787. "use strict";
  8788. Object.defineProperty(exports, "__esModule", {
  8789. value: true
  8790. });
  8791. exports.default = exports.FormulaBlot = undefined;
  8792. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8793. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8794. var _embed = __webpack_require__(7);
  8795. var _embed2 = _interopRequireDefault(_embed);
  8796. var _quill = __webpack_require__(6);
  8797. var _quill2 = _interopRequireDefault(_quill);
  8798. var _module = __webpack_require__(9);
  8799. var _module2 = _interopRequireDefault(_module);
  8800. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8801. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8802. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8803. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8804. var FormulaBlot = function (_Embed) {
  8805. _inherits(FormulaBlot, _Embed);
  8806. function FormulaBlot() {
  8807. _classCallCheck(this, FormulaBlot);
  8808. return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
  8809. }
  8810. _createClass(FormulaBlot, [{
  8811. key: 'index',
  8812. value: function index() {
  8813. return 1;
  8814. }
  8815. }], [{
  8816. key: 'create',
  8817. value: function create(value) {
  8818. var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
  8819. if (typeof value === 'string') {
  8820. window.katex.render(value, node);
  8821. node.setAttribute('data-value', value);
  8822. }
  8823. node.setAttribute('contenteditable', false);
  8824. return node;
  8825. }
  8826. }, {
  8827. key: 'value',
  8828. value: function value(domNode) {
  8829. return domNode.getAttribute('data-value');
  8830. }
  8831. }]);
  8832. return FormulaBlot;
  8833. }(_embed2.default);
  8834. FormulaBlot.blotName = 'formula';
  8835. FormulaBlot.className = 'ql-formula';
  8836. FormulaBlot.tagName = 'SPAN';
  8837. var Formula = function (_Module) {
  8838. _inherits(Formula, _Module);
  8839. _createClass(Formula, null, [{
  8840. key: 'register',
  8841. value: function register() {
  8842. _quill2.default.register(FormulaBlot, true);
  8843. }
  8844. }]);
  8845. function Formula() {
  8846. _classCallCheck(this, Formula);
  8847. var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
  8848. if (window.katex == null) {
  8849. throw new Error('Formula module requires KaTeX.');
  8850. }
  8851. return _this2;
  8852. }
  8853. return Formula;
  8854. }(_module2.default);
  8855. exports.FormulaBlot = FormulaBlot;
  8856. exports.default = Formula;
  8857. /***/ }),
  8858. /* 75 */
  8859. /***/ (function(module, exports, __webpack_require__) {
  8860. "use strict";
  8861. Object.defineProperty(exports, "__esModule", {
  8862. value: true
  8863. });
  8864. exports.default = exports.CodeToken = exports.CodeBlock = undefined;
  8865. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8866. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8867. var _parchment = __webpack_require__(0);
  8868. var _parchment2 = _interopRequireDefault(_parchment);
  8869. var _quill = __webpack_require__(6);
  8870. var _quill2 = _interopRequireDefault(_quill);
  8871. var _module = __webpack_require__(9);
  8872. var _module2 = _interopRequireDefault(_module);
  8873. var _code = __webpack_require__(16);
  8874. var _code2 = _interopRequireDefault(_code);
  8875. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8876. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8877. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8878. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8879. var SyntaxCodeBlock = function (_CodeBlock) {
  8880. _inherits(SyntaxCodeBlock, _CodeBlock);
  8881. function SyntaxCodeBlock() {
  8882. _classCallCheck(this, SyntaxCodeBlock);
  8883. return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
  8884. }
  8885. _createClass(SyntaxCodeBlock, [{
  8886. key: 'replaceWith',
  8887. value: function replaceWith(block) {
  8888. this.domNode.textContent = this.domNode.textContent;
  8889. this.attach();
  8890. _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
  8891. }
  8892. }, {
  8893. key: 'highlight',
  8894. value: function highlight(_highlight) {
  8895. if (this.cachedHTML !== this.domNode.innerHTML) {
  8896. var text = this.domNode.textContent;
  8897. if (text.trim().length > 0 || this.cachedHTML == null) {
  8898. this.domNode.innerHTML = _highlight(text);
  8899. this.attach();
  8900. }
  8901. this.cachedHTML = this.domNode.innerHTML;
  8902. }
  8903. }
  8904. }]);
  8905. return SyntaxCodeBlock;
  8906. }(_code2.default);
  8907. SyntaxCodeBlock.className = 'ql-syntax';
  8908. var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
  8909. scope: _parchment2.default.Scope.INLINE
  8910. });
  8911. var Syntax = function (_Module) {
  8912. _inherits(Syntax, _Module);
  8913. _createClass(Syntax, null, [{
  8914. key: 'register',
  8915. value: function register() {
  8916. _quill2.default.register(CodeToken, true);
  8917. _quill2.default.register(SyntaxCodeBlock, true);
  8918. }
  8919. }]);
  8920. function Syntax(quill, options) {
  8921. _classCallCheck(this, Syntax);
  8922. var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
  8923. if (typeof _this2.options.highlight !== 'function') {
  8924. throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
  8925. }
  8926. var timer = null;
  8927. _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  8928. if (timer != null) return;
  8929. timer = setTimeout(function () {
  8930. _this2.highlight();
  8931. timer = null;
  8932. }, 100);
  8933. });
  8934. _this2.highlight();
  8935. return _this2;
  8936. }
  8937. _createClass(Syntax, [{
  8938. key: 'highlight',
  8939. value: function highlight() {
  8940. var _this3 = this;
  8941. if (this.quill.selection.composing) return;
  8942. var range = this.quill.getSelection();
  8943. this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
  8944. code.highlight(_this3.options.highlight);
  8945. });
  8946. this.quill.update(_quill2.default.sources.SILENT);
  8947. if (range != null) {
  8948. this.quill.setSelection(range, _quill2.default.sources.SILENT);
  8949. }
  8950. }
  8951. }]);
  8952. return Syntax;
  8953. }(_module2.default);
  8954. Syntax.DEFAULTS = {
  8955. highlight: function () {
  8956. if (window.hljs == null) return null;
  8957. return function (text) {
  8958. var result = window.hljs.highlightAuto(text);
  8959. return result.value;
  8960. };
  8961. }()
  8962. };
  8963. exports.CodeBlock = SyntaxCodeBlock;
  8964. exports.CodeToken = CodeToken;
  8965. exports.default = Syntax;
  8966. /***/ }),
  8967. /* 76 */
  8968. /***/ (function(module, exports, __webpack_require__) {
  8969. "use strict";
  8970. Object.defineProperty(exports, "__esModule", {
  8971. value: true
  8972. });
  8973. exports.default = exports.BubbleTooltip = undefined;
  8974. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8975. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8976. var _extend = __webpack_require__(3);
  8977. var _extend2 = _interopRequireDefault(_extend);
  8978. var _emitter = __webpack_require__(5);
  8979. var _emitter2 = _interopRequireDefault(_emitter);
  8980. var _base = __webpack_require__(43);
  8981. var _base2 = _interopRequireDefault(_base);
  8982. var _selection = __webpack_require__(15);
  8983. var _icons = __webpack_require__(41);
  8984. var _icons2 = _interopRequireDefault(_icons);
  8985. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8986. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8987. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8988. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8989. var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
  8990. var BubbleTheme = function (_BaseTheme) {
  8991. _inherits(BubbleTheme, _BaseTheme);
  8992. function BubbleTheme(quill, options) {
  8993. _classCallCheck(this, BubbleTheme);
  8994. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  8995. options.modules.toolbar.container = TOOLBAR_CONFIG;
  8996. }
  8997. var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
  8998. _this.quill.container.classList.add('ql-bubble');
  8999. return _this;
  9000. }
  9001. _createClass(BubbleTheme, [{
  9002. key: 'extendToolbar',
  9003. value: function extendToolbar(toolbar) {
  9004. this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
  9005. this.tooltip.root.appendChild(toolbar.container);
  9006. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  9007. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  9008. }
  9009. }]);
  9010. return BubbleTheme;
  9011. }(_base2.default);
  9012. BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  9013. modules: {
  9014. toolbar: {
  9015. handlers: {
  9016. link: function link(value) {
  9017. if (!value) {
  9018. this.quill.format('link', false);
  9019. } else {
  9020. this.quill.theme.tooltip.edit();
  9021. }
  9022. }
  9023. }
  9024. }
  9025. }
  9026. });
  9027. var BubbleTooltip = function (_BaseTooltip) {
  9028. _inherits(BubbleTooltip, _BaseTooltip);
  9029. function BubbleTooltip(quill, bounds) {
  9030. _classCallCheck(this, BubbleTooltip);
  9031. var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
  9032. _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
  9033. if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
  9034. if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
  9035. _this2.show();
  9036. // Lock our width so we will expand beyond our offsetParent boundaries
  9037. _this2.root.style.left = '0px';
  9038. _this2.root.style.width = '';
  9039. _this2.root.style.width = _this2.root.offsetWidth + 'px';
  9040. var lines = _this2.quill.getLines(range.index, range.length);
  9041. if (lines.length === 1) {
  9042. _this2.position(_this2.quill.getBounds(range));
  9043. } else {
  9044. var lastLine = lines[lines.length - 1];
  9045. var index = _this2.quill.getIndex(lastLine);
  9046. var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
  9047. var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
  9048. _this2.position(_bounds);
  9049. }
  9050. } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
  9051. _this2.hide();
  9052. }
  9053. });
  9054. return _this2;
  9055. }
  9056. _createClass(BubbleTooltip, [{
  9057. key: 'listen',
  9058. value: function listen() {
  9059. var _this3 = this;
  9060. _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
  9061. this.root.querySelector('.ql-close').addEventListener('click', function () {
  9062. _this3.root.classList.remove('ql-editing');
  9063. });
  9064. this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
  9065. // Let selection be restored by toolbar handlers before repositioning
  9066. setTimeout(function () {
  9067. if (_this3.root.classList.contains('ql-hidden')) return;
  9068. var range = _this3.quill.getSelection();
  9069. if (range != null) {
  9070. _this3.position(_this3.quill.getBounds(range));
  9071. }
  9072. }, 1);
  9073. });
  9074. }
  9075. }, {
  9076. key: 'cancel',
  9077. value: function cancel() {
  9078. this.show();
  9079. }
  9080. }, {
  9081. key: 'position',
  9082. value: function position(reference) {
  9083. var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
  9084. var arrow = this.root.querySelector('.ql-tooltip-arrow');
  9085. arrow.style.marginLeft = '';
  9086. if (shift === 0) return shift;
  9087. arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
  9088. }
  9089. }]);
  9090. return BubbleTooltip;
  9091. }(_base.BaseTooltip);
  9092. BubbleTooltip.TEMPLATE = ['<span class="ql-tooltip-arrow"></span>', '<div class="ql-tooltip-editor">', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-close"></a>', '</div>'].join('');
  9093. exports.BubbleTooltip = BubbleTooltip;
  9094. exports.default = BubbleTheme;
  9095. /***/ }),
  9096. /* 77 */
  9097. /***/ (function(module, exports) {
  9098. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>";
  9099. /***/ }),
  9100. /* 78 */
  9101. /***/ (function(module, exports) {
  9102. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>";
  9103. /***/ }),
  9104. /* 79 */
  9105. /***/ (function(module, exports) {
  9106. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>";
  9107. /***/ }),
  9108. /* 80 */
  9109. /***/ (function(module, exports) {
  9110. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>";
  9111. /***/ }),
  9112. /* 81 */
  9113. /***/ (function(module, exports) {
  9114. module.exports = "<svg viewbox=\"0 0 18 18\"> <g class=\"ql-fill ql-color-label\"> <polygon points=\"6 6.868 6 6 5 6 5 7 5.942 7 6 6.868\"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points=\"6.817 5 6 5 6 6 6.38 6 6.817 5\"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points=\"4 11.439 4 11 3 11 3 12 3.755 12 4 11.439\"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points=\"4.63 10 4 10 4 11 4.192 11 4.63 10\"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points=\"13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174\"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points=\"12 6.868 12 6 11.62 6 12 6.868\"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points=\"12.933 9 13 9 13 8 12.495 8 12.933 9\"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points=\"5.5 13 9 5 12.5 13\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>";
  9115. /***/ }),
  9116. /* 82 */
  9117. /***/ (function(module, exports) {
  9118. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=4 y=5></rect> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=11 y=5></rect> <path class=\"ql-even ql-fill ql-stroke\" d=M7,8c0,4.031-3,5-3,5></path> <path class=\"ql-even ql-fill ql-stroke\" d=M14,8c0,4.031-3,5-3,5></path> </svg>";
  9119. /***/ }),
  9120. /* 83 */
  9121. /***/ (function(module, exports) {
  9122. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>";
  9123. /***/ }),
  9124. /* 84 */
  9125. /***/ (function(module, exports) {
  9126. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>";
  9127. /***/ }),
  9128. /* 85 */
  9129. /***/ (function(module, exports) {
  9130. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-color-label ql-stroke ql-transparent\" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points=\"5.5 11 9 3 12.5 11\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>";
  9131. /***/ }),
  9132. /* 86 */
  9133. /***/ (function(module, exports) {
  9134. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"3 11 5 9 3 7 3 11\"></polygon> <line class=\"ql-stroke ql-fill\" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>";
  9135. /***/ }),
  9136. /* 87 */
  9137. /***/ (function(module, exports) {
  9138. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"15 12 13 10 15 8 15 12\"></polygon> <line class=\"ql-stroke ql-fill\" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>";
  9139. /***/ }),
  9140. /* 88 */
  9141. /***/ (function(module, exports) {
  9142. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=ql-stroke points=\"7 11 9 13 11 11 7 11\"></polygon> <polygon class=ql-stroke points=\"7 7 9 5 11 7 7 7\"></polygon> </svg>";
  9143. /***/ }),
  9144. /* 89 */
  9145. /***/ (function(module, exports) {
  9146. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>";
  9147. /***/ }),
  9148. /* 90 */
  9149. /***/ (function(module, exports) {
  9150. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>";
  9151. /***/ }),
  9152. /* 91 */
  9153. /***/ (function(module, exports) {
  9154. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>";
  9155. /***/ }),
  9156. /* 92 */
  9157. /***/ (function(module, exports) {
  9158. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform=\"translate(24 18) rotate(-180)\"/> </svg>";
  9159. /***/ }),
  9160. /* 93 */
  9161. /***/ (function(module, exports) {
  9162. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>";
  9163. /***/ }),
  9164. /* 94 */
  9165. /***/ (function(module, exports) {
  9166. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=3 y1=4 y2=14></line> <line class=ql-stroke x1=11 x2=11 y1=4 y2=14></line> <line class=ql-stroke x1=11 x2=3 y1=9 y2=9></line> <path class=\"ql-stroke ql-thin\" d=M15.5,14.5h-2c0-.234,1.85-1.076,1.85-2.234a0.959,0.959,0,0,0-1.85-.109></path> </svg>";
  9167. /***/ }),
  9168. /* 95 */
  9169. /***/ (function(module, exports) {
  9170. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=3 y1=4 y2=14></line> <line class=ql-stroke x1=11 x2=11 y1=4 y2=14></line> <line class=ql-stroke x1=11 x2=3 y1=9 y2=9></line> <line class=\"ql-stroke ql-thin\" x1=13.5 x2=15.5 y1=14.5 y2=14.5></line> <path class=ql-fill d=M14.5,15a0.5,0.5,0,0,1-.5-0.5V12.085l-0.276.138A0.5,0.5,0,0,1,13.053,12c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,15,11.5v3A0.5,0.5,0,0,1,14.5,15Z></path> </svg>";
  9171. /***/ }),
  9172. /* 96 */
  9173. /***/ (function(module, exports) {
  9174. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class=\"ql-even ql-fill\" points=\"5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12\"></polyline> </svg>";
  9175. /***/ }),
  9176. /* 97 */
  9177. /***/ (function(module, exports) {
  9178. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=\"ql-fill ql-stroke\" points=\"3 7 3 11 5 9 3 7\"></polyline> </svg>";
  9179. /***/ }),
  9180. /* 98 */
  9181. /***/ (function(module, exports) {
  9182. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>";
  9183. /***/ }),
  9184. /* 99 */
  9185. /***/ (function(module, exports) {
  9186. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class=\"ql-even ql-stroke\" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class=\"ql-even ql-stroke\" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>";
  9187. /***/ }),
  9188. /* 100 */
  9189. /***/ (function(module, exports) {
  9190. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>";
  9191. /***/ }),
  9192. /* 101 */
  9193. /***/ (function(module, exports) {
  9194. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points=\"3 4 4 5 6 3\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points=\"3 14 4 15 6 13\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"3 9 4 10 6 8\"></polyline> </svg>";
  9195. /***/ }),
  9196. /* 102 */
  9197. /***/ (function(module, exports) {
  9198. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class=\"ql-stroke ql-thin\" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class=\"ql-stroke ql-thin\" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class=\"ql-stroke ql-thin\" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>";
  9199. /***/ }),
  9200. /* 103 */
  9201. /***/ (function(module, exports) {
  9202. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"5 7 5 11 3 9 5 7\"></polyline> </svg>";
  9203. /***/ }),
  9204. /* 104 */
  9205. /***/ (function(module, exports) {
  9206. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-stroke ql-thin\" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>";
  9207. /***/ }),
  9208. /* 105 */
  9209. /***/ (function(module, exports) {
  9210. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>";
  9211. /***/ }),
  9212. /* 106 */
  9213. /***/ (function(module, exports) {
  9214. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>";
  9215. /***/ }),
  9216. /* 107 */
  9217. /***/ (function(module, exports) {
  9218. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>";
  9219. /***/ }),
  9220. /* 108 */
  9221. /***/ (function(module, exports) {
  9222. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>";
  9223. /***/ }),
  9224. /* 109 */,
  9225. /* 110 */,
  9226. /* 111 */,
  9227. /* 112 */,
  9228. /* 113 */,
  9229. /* 114 */,
  9230. /* 115 */,
  9231. /* 116 */,
  9232. /* 117 */,
  9233. /* 118 */,
  9234. /* 119 */,
  9235. /* 120 */,
  9236. /* 121 */,
  9237. /* 122 */,
  9238. /* 123 */,
  9239. /* 124 */,
  9240. /* 125 */,
  9241. /* 126 */,
  9242. /* 127 */,
  9243. /* 128 */,
  9244. /* 129 */,
  9245. /* 130 */,
  9246. /* 131 */,
  9247. /* 132 */,
  9248. /* 133 */,
  9249. /* 134 */,
  9250. /* 135 */,
  9251. /* 136 */,
  9252. /* 137 */
  9253. /***/ (function(module, exports, __webpack_require__) {
  9254. module.exports = __webpack_require__(62);
  9255. /***/ })
  9256. /******/ ]);
  9257. });