UNPKG

440 kBJavaScriptView Raw
1/*!
2 * Quill Editor v1.3.7
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})(typeof self !== 'undefined' ? self : this, function() {
17return /******/ (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/******/ // define getter function for harmony exports
53/******/ __webpack_require__.d = function(exports, name, getter) {
54/******/ if(!__webpack_require__.o(exports, name)) {
55/******/ Object.defineProperty(exports, name, {
56/******/ configurable: false,
57/******/ enumerable: true,
58/******/ get: getter
59/******/ });
60/******/ }
61/******/ };
62/******/
63/******/ // getDefaultExport function for compatibility with non-harmony modules
64/******/ __webpack_require__.n = function(module) {
65/******/ var getter = module && module.__esModule ?
66/******/ function getDefault() { return module['default']; } :
67/******/ function getModuleExports() { return module; };
68/******/ __webpack_require__.d(getter, 'a', getter);
69/******/ return getter;
70/******/ };
71/******/
72/******/ // Object.prototype.hasOwnProperty.call
73/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
74/******/
75/******/ // __webpack_public_path__
76/******/ __webpack_require__.p = "";
77/******/
78/******/ // Load entry module and return exports
79/******/ return __webpack_require__(__webpack_require__.s = 109);
80/******/ })
81/************************************************************************/
82/******/ ([
83/* 0 */
84/***/ (function(module, exports, __webpack_require__) {
85
86"use strict";
87
88Object.defineProperty(exports, "__esModule", { value: true });
89var container_1 = __webpack_require__(17);
90var format_1 = __webpack_require__(18);
91var leaf_1 = __webpack_require__(19);
92var scroll_1 = __webpack_require__(45);
93var inline_1 = __webpack_require__(46);
94var block_1 = __webpack_require__(47);
95var embed_1 = __webpack_require__(48);
96var text_1 = __webpack_require__(49);
97var attributor_1 = __webpack_require__(12);
98var class_1 = __webpack_require__(32);
99var style_1 = __webpack_require__(33);
100var store_1 = __webpack_require__(31);
101var Registry = __webpack_require__(1);
102var Parchment = {
103 Scope: Registry.Scope,
104 create: Registry.create,
105 find: Registry.find,
106 query: Registry.query,
107 register: Registry.register,
108 Container: container_1.default,
109 Format: format_1.default,
110 Leaf: leaf_1.default,
111 Embed: embed_1.default,
112 Scroll: scroll_1.default,
113 Block: block_1.default,
114 Inline: inline_1.default,
115 Text: text_1.default,
116 Attributor: {
117 Attribute: attributor_1.default,
118 Class: class_1.default,
119 Style: style_1.default,
120 Store: store_1.default,
121 },
122};
123exports.default = Parchment;
124
125
126/***/ }),
127/* 1 */
128/***/ (function(module, exports, __webpack_require__) {
129
130"use strict";
131
132var __extends = (this && this.__extends) || (function () {
133 var extendStatics = Object.setPrototypeOf ||
134 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
135 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
136 return function (d, b) {
137 extendStatics(d, b);
138 function __() { this.constructor = d; }
139 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
140 };
141})();
142Object.defineProperty(exports, "__esModule", { value: true });
143var ParchmentError = /** @class */ (function (_super) {
144 __extends(ParchmentError, _super);
145 function ParchmentError(message) {
146 var _this = this;
147 message = '[Parchment] ' + message;
148 _this = _super.call(this, message) || this;
149 _this.message = message;
150 _this.name = _this.constructor.name;
151 return _this;
152 }
153 return ParchmentError;
154}(Error));
155exports.ParchmentError = ParchmentError;
156var attributes = {};
157var classes = {};
158var tags = {};
159var types = {};
160exports.DATA_KEY = '__blot';
161var Scope;
162(function (Scope) {
163 Scope[Scope["TYPE"] = 3] = "TYPE";
164 Scope[Scope["LEVEL"] = 12] = "LEVEL";
165 Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
166 Scope[Scope["BLOT"] = 14] = "BLOT";
167 Scope[Scope["INLINE"] = 7] = "INLINE";
168 Scope[Scope["BLOCK"] = 11] = "BLOCK";
169 Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
170 Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
171 Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
172 Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
173 Scope[Scope["ANY"] = 15] = "ANY";
174})(Scope = exports.Scope || (exports.Scope = {}));
175function create(input, value) {
176 var match = query(input);
177 if (match == null) {
178 throw new ParchmentError("Unable to create " + input + " blot");
179 }
180 var BlotClass = match;
181 var node =
182 // @ts-ignore
183 input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);
184 return new BlotClass(node, value);
185}
186exports.create = create;
187function find(node, bubble) {
188 if (bubble === void 0) { bubble = false; }
189 if (node == null)
190 return null;
191 // @ts-ignore
192 if (node[exports.DATA_KEY] != null)
193 return node[exports.DATA_KEY].blot;
194 if (bubble)
195 return find(node.parentNode, bubble);
196 return null;
197}
198exports.find = find;
199function query(query, scope) {
200 if (scope === void 0) { scope = Scope.ANY; }
201 var match;
202 if (typeof query === 'string') {
203 match = types[query] || attributes[query];
204 // @ts-ignore
205 }
206 else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
207 match = types['text'];
208 }
209 else if (typeof query === 'number') {
210 if (query & Scope.LEVEL & Scope.BLOCK) {
211 match = types['block'];
212 }
213 else if (query & Scope.LEVEL & Scope.INLINE) {
214 match = types['inline'];
215 }
216 }
217 else if (query instanceof HTMLElement) {
218 var names = (query.getAttribute('class') || '').split(/\s+/);
219 for (var i in names) {
220 match = classes[names[i]];
221 if (match)
222 break;
223 }
224 match = match || tags[query.tagName];
225 }
226 if (match == null)
227 return null;
228 // @ts-ignore
229 if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)
230 return match;
231 return null;
232}
233exports.query = query;
234function register() {
235 var Definitions = [];
236 for (var _i = 0; _i < arguments.length; _i++) {
237 Definitions[_i] = arguments[_i];
238 }
239 if (Definitions.length > 1) {
240 return Definitions.map(function (d) {
241 return register(d);
242 });
243 }
244 var Definition = Definitions[0];
245 if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
246 throw new ParchmentError('Invalid definition');
247 }
248 else if (Definition.blotName === 'abstract') {
249 throw new ParchmentError('Cannot register abstract class');
250 }
251 types[Definition.blotName || Definition.attrName] = Definition;
252 if (typeof Definition.keyName === 'string') {
253 attributes[Definition.keyName] = Definition;
254 }
255 else {
256 if (Definition.className != null) {
257 classes[Definition.className] = Definition;
258 }
259 if (Definition.tagName != null) {
260 if (Array.isArray(Definition.tagName)) {
261 Definition.tagName = Definition.tagName.map(function (tagName) {
262 return tagName.toUpperCase();
263 });
264 }
265 else {
266 Definition.tagName = Definition.tagName.toUpperCase();
267 }
268 var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
269 tagNames.forEach(function (tag) {
270 if (tags[tag] == null || Definition.className == null) {
271 tags[tag] = Definition;
272 }
273 });
274 }
275 }
276 return Definition;
277}
278exports.register = register;
279
280
281/***/ }),
282/* 2 */
283/***/ (function(module, exports, __webpack_require__) {
284
285var diff = __webpack_require__(51);
286var equal = __webpack_require__(11);
287var extend = __webpack_require__(3);
288var op = __webpack_require__(20);
289
290
291var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
292
293
294var Delta = function (ops) {
295 // Assume we are given a well formed ops
296 if (Array.isArray(ops)) {
297 this.ops = ops;
298 } else if (ops != null && Array.isArray(ops.ops)) {
299 this.ops = ops.ops;
300 } else {
301 this.ops = [];
302 }
303};
304
305
306Delta.prototype.insert = function (text, attributes) {
307 var newOp = {};
308 if (text.length === 0) return this;
309 newOp.insert = text;
310 if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
311 newOp.attributes = attributes;
312 }
313 return this.push(newOp);
314};
315
316Delta.prototype['delete'] = function (length) {
317 if (length <= 0) return this;
318 return this.push({ 'delete': length });
319};
320
321Delta.prototype.retain = function (length, attributes) {
322 if (length <= 0) return this;
323 var newOp = { retain: length };
324 if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
325 newOp.attributes = attributes;
326 }
327 return this.push(newOp);
328};
329
330Delta.prototype.push = function (newOp) {
331 var index = this.ops.length;
332 var lastOp = this.ops[index - 1];
333 newOp = extend(true, {}, newOp);
334 if (typeof lastOp === 'object') {
335 if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
336 this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
337 return this;
338 }
339 // Since it does not matter if we insert before or after deleting at the same index,
340 // always prefer to insert first
341 if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
342 index -= 1;
343 lastOp = this.ops[index - 1];
344 if (typeof lastOp !== 'object') {
345 this.ops.unshift(newOp);
346 return this;
347 }
348 }
349 if (equal(newOp.attributes, lastOp.attributes)) {
350 if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
351 this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
352 if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
353 return this;
354 } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
355 this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
356 if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
357 return this;
358 }
359 }
360 }
361 if (index === this.ops.length) {
362 this.ops.push(newOp);
363 } else {
364 this.ops.splice(index, 0, newOp);
365 }
366 return this;
367};
368
369Delta.prototype.chop = function () {
370 var lastOp = this.ops[this.ops.length - 1];
371 if (lastOp && lastOp.retain && !lastOp.attributes) {
372 this.ops.pop();
373 }
374 return this;
375};
376
377Delta.prototype.filter = function (predicate) {
378 return this.ops.filter(predicate);
379};
380
381Delta.prototype.forEach = function (predicate) {
382 this.ops.forEach(predicate);
383};
384
385Delta.prototype.map = function (predicate) {
386 return this.ops.map(predicate);
387};
388
389Delta.prototype.partition = function (predicate) {
390 var passed = [], failed = [];
391 this.forEach(function(op) {
392 var target = predicate(op) ? passed : failed;
393 target.push(op);
394 });
395 return [passed, failed];
396};
397
398Delta.prototype.reduce = function (predicate, initial) {
399 return this.ops.reduce(predicate, initial);
400};
401
402Delta.prototype.changeLength = function () {
403 return this.reduce(function (length, elem) {
404 if (elem.insert) {
405 return length + op.length(elem);
406 } else if (elem.delete) {
407 return length - elem.delete;
408 }
409 return length;
410 }, 0);
411};
412
413Delta.prototype.length = function () {
414 return this.reduce(function (length, elem) {
415 return length + op.length(elem);
416 }, 0);
417};
418
419Delta.prototype.slice = function (start, end) {
420 start = start || 0;
421 if (typeof end !== 'number') end = Infinity;
422 var ops = [];
423 var iter = op.iterator(this.ops);
424 var index = 0;
425 while (index < end && iter.hasNext()) {
426 var nextOp;
427 if (index < start) {
428 nextOp = iter.next(start - index);
429 } else {
430 nextOp = iter.next(end - index);
431 ops.push(nextOp);
432 }
433 index += op.length(nextOp);
434 }
435 return new Delta(ops);
436};
437
438
439Delta.prototype.compose = function (other) {
440 var thisIter = op.iterator(this.ops);
441 var otherIter = op.iterator(other.ops);
442 var ops = [];
443 var firstOther = otherIter.peek();
444 if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {
445 var firstLeft = firstOther.retain;
446 while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {
447 firstLeft -= thisIter.peekLength();
448 ops.push(thisIter.next());
449 }
450 if (firstOther.retain - firstLeft > 0) {
451 otherIter.next(firstOther.retain - firstLeft);
452 }
453 }
454 var delta = new Delta(ops);
455 while (thisIter.hasNext() || otherIter.hasNext()) {
456 if (otherIter.peekType() === 'insert') {
457 delta.push(otherIter.next());
458 } else if (thisIter.peekType() === 'delete') {
459 delta.push(thisIter.next());
460 } else {
461 var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
462 var thisOp = thisIter.next(length);
463 var otherOp = otherIter.next(length);
464 if (typeof otherOp.retain === 'number') {
465 var newOp = {};
466 if (typeof thisOp.retain === 'number') {
467 newOp.retain = length;
468 } else {
469 newOp.insert = thisOp.insert;
470 }
471 // Preserve null when composing with a retain, otherwise remove it for inserts
472 var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
473 if (attributes) newOp.attributes = attributes;
474 delta.push(newOp);
475
476 // Optimization if rest of other is just retain
477 if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {
478 var rest = new Delta(thisIter.rest());
479 return delta.concat(rest).chop();
480 }
481
482 // Other op should be delete, we could be an insert or retain
483 // Insert + delete cancels out
484 } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
485 delta.push(otherOp);
486 }
487 }
488 }
489 return delta.chop();
490};
491
492Delta.prototype.concat = function (other) {
493 var delta = new Delta(this.ops.slice());
494 if (other.ops.length > 0) {
495 delta.push(other.ops[0]);
496 delta.ops = delta.ops.concat(other.ops.slice(1));
497 }
498 return delta;
499};
500
501Delta.prototype.diff = function (other, index) {
502 if (this.ops === other.ops) {
503 return new Delta();
504 }
505 var strings = [this, other].map(function (delta) {
506 return delta.map(function (op) {
507 if (op.insert != null) {
508 return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
509 }
510 var prep = (delta === other) ? 'on' : 'with';
511 throw new Error('diff() called ' + prep + ' non-document');
512 }).join('');
513 });
514 var delta = new Delta();
515 var diffResult = diff(strings[0], strings[1], index);
516 var thisIter = op.iterator(this.ops);
517 var otherIter = op.iterator(other.ops);
518 diffResult.forEach(function (component) {
519 var length = component[1].length;
520 while (length > 0) {
521 var opLength = 0;
522 switch (component[0]) {
523 case diff.INSERT:
524 opLength = Math.min(otherIter.peekLength(), length);
525 delta.push(otherIter.next(opLength));
526 break;
527 case diff.DELETE:
528 opLength = Math.min(length, thisIter.peekLength());
529 thisIter.next(opLength);
530 delta['delete'](opLength);
531 break;
532 case diff.EQUAL:
533 opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
534 var thisOp = thisIter.next(opLength);
535 var otherOp = otherIter.next(opLength);
536 if (equal(thisOp.insert, otherOp.insert)) {
537 delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
538 } else {
539 delta.push(otherOp)['delete'](opLength);
540 }
541 break;
542 }
543 length -= opLength;
544 }
545 });
546 return delta.chop();
547};
548
549Delta.prototype.eachLine = function (predicate, newline) {
550 newline = newline || '\n';
551 var iter = op.iterator(this.ops);
552 var line = new Delta();
553 var i = 0;
554 while (iter.hasNext()) {
555 if (iter.peekType() !== 'insert') return;
556 var thisOp = iter.peek();
557 var start = op.length(thisOp) - iter.peekLength();
558 var index = typeof thisOp.insert === 'string' ?
559 thisOp.insert.indexOf(newline, start) - start : -1;
560 if (index < 0) {
561 line.push(iter.next());
562 } else if (index > 0) {
563 line.push(iter.next(index));
564 } else {
565 if (predicate(line, iter.next(1).attributes || {}, i) === false) {
566 return;
567 }
568 i += 1;
569 line = new Delta();
570 }
571 }
572 if (line.length() > 0) {
573 predicate(line, {}, i);
574 }
575};
576
577Delta.prototype.transform = function (other, priority) {
578 priority = !!priority;
579 if (typeof other === 'number') {
580 return this.transformPosition(other, priority);
581 }
582 var thisIter = op.iterator(this.ops);
583 var otherIter = op.iterator(other.ops);
584 var delta = new Delta();
585 while (thisIter.hasNext() || otherIter.hasNext()) {
586 if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
587 delta.retain(op.length(thisIter.next()));
588 } else if (otherIter.peekType() === 'insert') {
589 delta.push(otherIter.next());
590 } else {
591 var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
592 var thisOp = thisIter.next(length);
593 var otherOp = otherIter.next(length);
594 if (thisOp['delete']) {
595 // Our delete either makes their delete redundant or removes their retain
596 continue;
597 } else if (otherOp['delete']) {
598 delta.push(otherOp);
599 } else {
600 // We retain either their retain or insert
601 delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
602 }
603 }
604 }
605 return delta.chop();
606};
607
608Delta.prototype.transformPosition = function (index, priority) {
609 priority = !!priority;
610 var thisIter = op.iterator(this.ops);
611 var offset = 0;
612 while (thisIter.hasNext() && offset <= index) {
613 var length = thisIter.peekLength();
614 var nextType = thisIter.peekType();
615 thisIter.next();
616 if (nextType === 'delete') {
617 index -= Math.min(length, index - offset);
618 continue;
619 } else if (nextType === 'insert' && (offset < index || !priority)) {
620 index += length;
621 }
622 offset += length;
623 }
624 return index;
625};
626
627
628module.exports = Delta;
629
630
631/***/ }),
632/* 3 */
633/***/ (function(module, exports) {
634
635'use strict';
636
637var hasOwn = Object.prototype.hasOwnProperty;
638var toStr = Object.prototype.toString;
639var defineProperty = Object.defineProperty;
640var gOPD = Object.getOwnPropertyDescriptor;
641
642var isArray = function isArray(arr) {
643 if (typeof Array.isArray === 'function') {
644 return Array.isArray(arr);
645 }
646
647 return toStr.call(arr) === '[object Array]';
648};
649
650var isPlainObject = function isPlainObject(obj) {
651 if (!obj || toStr.call(obj) !== '[object Object]') {
652 return false;
653 }
654
655 var hasOwnConstructor = hasOwn.call(obj, 'constructor');
656 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
657 // Not own constructor property must be Object
658 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
659 return false;
660 }
661
662 // Own properties are enumerated firstly, so to speed up,
663 // if last one is own, then all properties are own.
664 var key;
665 for (key in obj) { /**/ }
666
667 return typeof key === 'undefined' || hasOwn.call(obj, key);
668};
669
670// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
671var setProperty = function setProperty(target, options) {
672 if (defineProperty && options.name === '__proto__') {
673 defineProperty(target, options.name, {
674 enumerable: true,
675 configurable: true,
676 value: options.newValue,
677 writable: true
678 });
679 } else {
680 target[options.name] = options.newValue;
681 }
682};
683
684// Return undefined instead of __proto__ if '__proto__' is not an own property
685var getProperty = function getProperty(obj, name) {
686 if (name === '__proto__') {
687 if (!hasOwn.call(obj, name)) {
688 return void 0;
689 } else if (gOPD) {
690 // In early versions of node, obj['__proto__'] is buggy when obj has
691 // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
692 return gOPD(obj, name).value;
693 }
694 }
695
696 return obj[name];
697};
698
699module.exports = function extend() {
700 var options, name, src, copy, copyIsArray, clone;
701 var target = arguments[0];
702 var i = 1;
703 var length = arguments.length;
704 var deep = false;
705
706 // Handle a deep copy situation
707 if (typeof target === 'boolean') {
708 deep = target;
709 target = arguments[1] || {};
710 // skip the boolean and the target
711 i = 2;
712 }
713 if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
714 target = {};
715 }
716
717 for (; i < length; ++i) {
718 options = arguments[i];
719 // Only deal with non-null/undefined values
720 if (options != null) {
721 // Extend the base object
722 for (name in options) {
723 src = getProperty(target, name);
724 copy = getProperty(options, name);
725
726 // Prevent never-ending loop
727 if (target !== copy) {
728 // Recurse if we're merging plain objects or arrays
729 if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
730 if (copyIsArray) {
731 copyIsArray = false;
732 clone = src && isArray(src) ? src : [];
733 } else {
734 clone = src && isPlainObject(src) ? src : {};
735 }
736
737 // Never move original objects, clone them
738 setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
739
740 // Don't bring in undefined values
741 } else if (typeof copy !== 'undefined') {
742 setProperty(target, { name: name, newValue: copy });
743 }
744 }
745 }
746 }
747 }
748
749 // Return the modified object
750 return target;
751};
752
753
754/***/ }),
755/* 4 */
756/***/ (function(module, exports, __webpack_require__) {
757
758"use strict";
759
760
761Object.defineProperty(exports, "__esModule", {
762 value: true
763});
764exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
765
766var _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; }; }();
767
768var _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); } };
769
770var _extend = __webpack_require__(3);
771
772var _extend2 = _interopRequireDefault(_extend);
773
774var _quillDelta = __webpack_require__(2);
775
776var _quillDelta2 = _interopRequireDefault(_quillDelta);
777
778var _parchment = __webpack_require__(0);
779
780var _parchment2 = _interopRequireDefault(_parchment);
781
782var _break = __webpack_require__(16);
783
784var _break2 = _interopRequireDefault(_break);
785
786var _inline = __webpack_require__(6);
787
788var _inline2 = _interopRequireDefault(_inline);
789
790var _text = __webpack_require__(7);
791
792var _text2 = _interopRequireDefault(_text);
793
794function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
795
796function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
797
798function _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; }
799
800function _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; }
801
802var NEWLINE_LENGTH = 1;
803
804var BlockEmbed = function (_Parchment$Embed) {
805 _inherits(BlockEmbed, _Parchment$Embed);
806
807 function BlockEmbed() {
808 _classCallCheck(this, BlockEmbed);
809
810 return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
811 }
812
813 _createClass(BlockEmbed, [{
814 key: 'attach',
815 value: function attach() {
816 _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
817 this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
818 }
819 }, {
820 key: 'delta',
821 value: function delta() {
822 return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
823 }
824 }, {
825 key: 'format',
826 value: function format(name, value) {
827 var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
828 if (attribute != null) {
829 this.attributes.attribute(attribute, value);
830 }
831 }
832 }, {
833 key: 'formatAt',
834 value: function formatAt(index, length, name, value) {
835 this.format(name, value);
836 }
837 }, {
838 key: 'insertAt',
839 value: function insertAt(index, value, def) {
840 if (typeof value === 'string' && value.endsWith('\n')) {
841 var block = _parchment2.default.create(Block.blotName);
842 this.parent.insertBefore(block, index === 0 ? this : this.next);
843 block.insertAt(0, value.slice(0, -1));
844 } else {
845 _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
846 }
847 }
848 }]);
849
850 return BlockEmbed;
851}(_parchment2.default.Embed);
852
853BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
854// It is important for cursor behavior BlockEmbeds use tags that are block level elements
855
856
857var Block = function (_Parchment$Block) {
858 _inherits(Block, _Parchment$Block);
859
860 function Block(domNode) {
861 _classCallCheck(this, Block);
862
863 var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
864
865 _this2.cache = {};
866 return _this2;
867 }
868
869 _createClass(Block, [{
870 key: 'delta',
871 value: function delta() {
872 if (this.cache.delta == null) {
873 this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
874 if (leaf.length() === 0) {
875 return delta;
876 } else {
877 return delta.insert(leaf.value(), bubbleFormats(leaf));
878 }
879 }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
880 }
881 return this.cache.delta;
882 }
883 }, {
884 key: 'deleteAt',
885 value: function deleteAt(index, length) {
886 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
887 this.cache = {};
888 }
889 }, {
890 key: 'formatAt',
891 value: function formatAt(index, length, name, value) {
892 if (length <= 0) return;
893 if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
894 if (index + length === this.length()) {
895 this.format(name, value);
896 }
897 } else {
898 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
899 }
900 this.cache = {};
901 }
902 }, {
903 key: 'insertAt',
904 value: function insertAt(index, value, def) {
905 if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
906 if (value.length === 0) return;
907 var lines = value.split('\n');
908 var text = lines.shift();
909 if (text.length > 0) {
910 if (index < this.length() - 1 || this.children.tail == null) {
911 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
912 } else {
913 this.children.tail.insertAt(this.children.tail.length(), text);
914 }
915 this.cache = {};
916 }
917 var block = this;
918 lines.reduce(function (index, line) {
919 block = block.split(index, true);
920 block.insertAt(0, line);
921 return line.length;
922 }, index + text.length);
923 }
924 }, {
925 key: 'insertBefore',
926 value: function insertBefore(blot, ref) {
927 var head = this.children.head;
928 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
929 if (head instanceof _break2.default) {
930 head.remove();
931 }
932 this.cache = {};
933 }
934 }, {
935 key: 'length',
936 value: function length() {
937 if (this.cache.length == null) {
938 this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
939 }
940 return this.cache.length;
941 }
942 }, {
943 key: 'moveChildren',
944 value: function moveChildren(target, ref) {
945 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
946 this.cache = {};
947 }
948 }, {
949 key: 'optimize',
950 value: function optimize(context) {
951 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);
952 this.cache = {};
953 }
954 }, {
955 key: 'path',
956 value: function path(index) {
957 return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
958 }
959 }, {
960 key: 'removeChild',
961 value: function removeChild(child) {
962 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
963 this.cache = {};
964 }
965 }, {
966 key: 'split',
967 value: function split(index) {
968 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
969
970 if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
971 var clone = this.clone();
972 if (index === 0) {
973 this.parent.insertBefore(clone, this);
974 return this;
975 } else {
976 this.parent.insertBefore(clone, this.next);
977 return clone;
978 }
979 } else {
980 var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
981 this.cache = {};
982 return next;
983 }
984 }
985 }]);
986
987 return Block;
988}(_parchment2.default.Block);
989
990Block.blotName = 'block';
991Block.tagName = 'P';
992Block.defaultChild = 'break';
993Block.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];
994
995function bubbleFormats(blot) {
996 var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
997
998 if (blot == null) return formats;
999 if (typeof blot.formats === 'function') {
1000 formats = (0, _extend2.default)(formats, blot.formats());
1001 }
1002 if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
1003 return formats;
1004 }
1005 return bubbleFormats(blot.parent, formats);
1006}
1007
1008exports.bubbleFormats = bubbleFormats;
1009exports.BlockEmbed = BlockEmbed;
1010exports.default = Block;
1011
1012/***/ }),
1013/* 5 */
1014/***/ (function(module, exports, __webpack_require__) {
1015
1016"use strict";
1017
1018
1019Object.defineProperty(exports, "__esModule", {
1020 value: true
1021});
1022exports.default = exports.overload = exports.expandConfig = undefined;
1023
1024var _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; };
1025
1026var _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"); } }; }();
1027
1028var _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; }; }();
1029
1030__webpack_require__(50);
1031
1032var _quillDelta = __webpack_require__(2);
1033
1034var _quillDelta2 = _interopRequireDefault(_quillDelta);
1035
1036var _editor = __webpack_require__(14);
1037
1038var _editor2 = _interopRequireDefault(_editor);
1039
1040var _emitter3 = __webpack_require__(8);
1041
1042var _emitter4 = _interopRequireDefault(_emitter3);
1043
1044var _module = __webpack_require__(9);
1045
1046var _module2 = _interopRequireDefault(_module);
1047
1048var _parchment = __webpack_require__(0);
1049
1050var _parchment2 = _interopRequireDefault(_parchment);
1051
1052var _selection = __webpack_require__(15);
1053
1054var _selection2 = _interopRequireDefault(_selection);
1055
1056var _extend = __webpack_require__(3);
1057
1058var _extend2 = _interopRequireDefault(_extend);
1059
1060var _logger = __webpack_require__(10);
1061
1062var _logger2 = _interopRequireDefault(_logger);
1063
1064var _theme = __webpack_require__(34);
1065
1066var _theme2 = _interopRequireDefault(_theme);
1067
1068function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1069
1070function _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; }
1071
1072function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1073
1074var debug = (0, _logger2.default)('quill');
1075
1076var Quill = function () {
1077 _createClass(Quill, null, [{
1078 key: 'debug',
1079 value: function debug(limit) {
1080 if (limit === true) {
1081 limit = 'log';
1082 }
1083 _logger2.default.level(limit);
1084 }
1085 }, {
1086 key: 'find',
1087 value: function find(node) {
1088 return node.__quill || _parchment2.default.find(node);
1089 }
1090 }, {
1091 key: 'import',
1092 value: function _import(name) {
1093 if (this.imports[name] == null) {
1094 debug.error('Cannot import ' + name + '. Are you sure it was registered?');
1095 }
1096 return this.imports[name];
1097 }
1098 }, {
1099 key: 'register',
1100 value: function register(path, target) {
1101 var _this = this;
1102
1103 var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1104
1105 if (typeof path !== 'string') {
1106 var name = path.attrName || path.blotName;
1107 if (typeof name === 'string') {
1108 // register(Blot | Attributor, overwrite)
1109 this.register('formats/' + name, path, target);
1110 } else {
1111 Object.keys(path).forEach(function (key) {
1112 _this.register(key, path[key], target);
1113 });
1114 }
1115 } else {
1116 if (this.imports[path] != null && !overwrite) {
1117 debug.warn('Overwriting ' + path + ' with', target);
1118 }
1119 this.imports[path] = target;
1120 if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
1121 _parchment2.default.register(target);
1122 } else if (path.startsWith('modules') && typeof target.register === 'function') {
1123 target.register();
1124 }
1125 }
1126 }
1127 }]);
1128
1129 function Quill(container) {
1130 var _this2 = this;
1131
1132 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1133
1134 _classCallCheck(this, Quill);
1135
1136 this.options = expandConfig(container, options);
1137 this.container = this.options.container;
1138 if (this.container == null) {
1139 return debug.error('Invalid Quill container', container);
1140 }
1141 if (this.options.debug) {
1142 Quill.debug(this.options.debug);
1143 }
1144 var html = this.container.innerHTML.trim();
1145 this.container.classList.add('ql-container');
1146 this.container.innerHTML = '';
1147 this.container.__quill = this;
1148 this.root = this.addContainer('ql-editor');
1149 this.root.classList.add('ql-blank');
1150 this.root.setAttribute('data-gramm', false);
1151 this.scrollingContainer = this.options.scrollingContainer || this.root;
1152 this.emitter = new _emitter4.default();
1153 this.scroll = _parchment2.default.create(this.root, {
1154 emitter: this.emitter,
1155 whitelist: this.options.formats
1156 });
1157 this.editor = new _editor2.default(this.scroll);
1158 this.selection = new _selection2.default(this.scroll, this.emitter);
1159 this.theme = new this.options.theme(this, this.options);
1160 this.keyboard = this.theme.addModule('keyboard');
1161 this.clipboard = this.theme.addModule('clipboard');
1162 this.history = this.theme.addModule('history');
1163 this.theme.init();
1164 this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
1165 if (type === _emitter4.default.events.TEXT_CHANGE) {
1166 _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
1167 }
1168 });
1169 this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
1170 var range = _this2.selection.lastRange;
1171 var index = range && range.length === 0 ? range.index : undefined;
1172 modify.call(_this2, function () {
1173 return _this2.editor.update(null, mutations, index);
1174 }, source);
1175 });
1176 var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
1177 this.setContents(contents);
1178 this.history.clear();
1179 if (this.options.placeholder) {
1180 this.root.setAttribute('data-placeholder', this.options.placeholder);
1181 }
1182 if (this.options.readOnly) {
1183 this.disable();
1184 }
1185 }
1186
1187 _createClass(Quill, [{
1188 key: 'addContainer',
1189 value: function addContainer(container) {
1190 var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1191
1192 if (typeof container === 'string') {
1193 var className = container;
1194 container = document.createElement('div');
1195 container.classList.add(className);
1196 }
1197 this.container.insertBefore(container, refNode);
1198 return container;
1199 }
1200 }, {
1201 key: 'blur',
1202 value: function blur() {
1203 this.selection.setRange(null);
1204 }
1205 }, {
1206 key: 'deleteText',
1207 value: function deleteText(index, length, source) {
1208 var _this3 = this;
1209
1210 var _overload = overload(index, length, source);
1211
1212 var _overload2 = _slicedToArray(_overload, 4);
1213
1214 index = _overload2[0];
1215 length = _overload2[1];
1216 source = _overload2[3];
1217
1218 return modify.call(this, function () {
1219 return _this3.editor.deleteText(index, length);
1220 }, source, index, -1 * length);
1221 }
1222 }, {
1223 key: 'disable',
1224 value: function disable() {
1225 this.enable(false);
1226 }
1227 }, {
1228 key: 'enable',
1229 value: function enable() {
1230 var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1231
1232 this.scroll.enable(enabled);
1233 this.container.classList.toggle('ql-disabled', !enabled);
1234 }
1235 }, {
1236 key: 'focus',
1237 value: function focus() {
1238 var scrollTop = this.scrollingContainer.scrollTop;
1239 this.selection.focus();
1240 this.scrollingContainer.scrollTop = scrollTop;
1241 this.scrollIntoView();
1242 }
1243 }, {
1244 key: 'format',
1245 value: function format(name, value) {
1246 var _this4 = this;
1247
1248 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
1249
1250 return modify.call(this, function () {
1251 var range = _this4.getSelection(true);
1252 var change = new _quillDelta2.default();
1253 if (range == null) {
1254 return change;
1255 } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
1256 change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
1257 } else if (range.length === 0) {
1258 _this4.selection.format(name, value);
1259 return change;
1260 } else {
1261 change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
1262 }
1263 _this4.setSelection(range, _emitter4.default.sources.SILENT);
1264 return change;
1265 }, source);
1266 }
1267 }, {
1268 key: 'formatLine',
1269 value: function formatLine(index, length, name, value, source) {
1270 var _this5 = this;
1271
1272 var formats = void 0;
1273
1274 var _overload3 = overload(index, length, name, value, source);
1275
1276 var _overload4 = _slicedToArray(_overload3, 4);
1277
1278 index = _overload4[0];
1279 length = _overload4[1];
1280 formats = _overload4[2];
1281 source = _overload4[3];
1282
1283 return modify.call(this, function () {
1284 return _this5.editor.formatLine(index, length, formats);
1285 }, source, index, 0);
1286 }
1287 }, {
1288 key: 'formatText',
1289 value: function formatText(index, length, name, value, source) {
1290 var _this6 = this;
1291
1292 var formats = void 0;
1293
1294 var _overload5 = overload(index, length, name, value, source);
1295
1296 var _overload6 = _slicedToArray(_overload5, 4);
1297
1298 index = _overload6[0];
1299 length = _overload6[1];
1300 formats = _overload6[2];
1301 source = _overload6[3];
1302
1303 return modify.call(this, function () {
1304 return _this6.editor.formatText(index, length, formats);
1305 }, source, index, 0);
1306 }
1307 }, {
1308 key: 'getBounds',
1309 value: function getBounds(index) {
1310 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1311
1312 var bounds = void 0;
1313 if (typeof index === 'number') {
1314 bounds = this.selection.getBounds(index, length);
1315 } else {
1316 bounds = this.selection.getBounds(index.index, index.length);
1317 }
1318 var containerBounds = this.container.getBoundingClientRect();
1319 return {
1320 bottom: bounds.bottom - containerBounds.top,
1321 height: bounds.height,
1322 left: bounds.left - containerBounds.left,
1323 right: bounds.right - containerBounds.left,
1324 top: bounds.top - containerBounds.top,
1325 width: bounds.width
1326 };
1327 }
1328 }, {
1329 key: 'getContents',
1330 value: function getContents() {
1331 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1332 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
1333
1334 var _overload7 = overload(index, length);
1335
1336 var _overload8 = _slicedToArray(_overload7, 2);
1337
1338 index = _overload8[0];
1339 length = _overload8[1];
1340
1341 return this.editor.getContents(index, length);
1342 }
1343 }, {
1344 key: 'getFormat',
1345 value: function getFormat() {
1346 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);
1347 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1348
1349 if (typeof index === 'number') {
1350 return this.editor.getFormat(index, length);
1351 } else {
1352 return this.editor.getFormat(index.index, index.length);
1353 }
1354 }
1355 }, {
1356 key: 'getIndex',
1357 value: function getIndex(blot) {
1358 return blot.offset(this.scroll);
1359 }
1360 }, {
1361 key: 'getLength',
1362 value: function getLength() {
1363 return this.scroll.length();
1364 }
1365 }, {
1366 key: 'getLeaf',
1367 value: function getLeaf(index) {
1368 return this.scroll.leaf(index);
1369 }
1370 }, {
1371 key: 'getLine',
1372 value: function getLine(index) {
1373 return this.scroll.line(index);
1374 }
1375 }, {
1376 key: 'getLines',
1377 value: function getLines() {
1378 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1379 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
1380
1381 if (typeof index !== 'number') {
1382 return this.scroll.lines(index.index, index.length);
1383 } else {
1384 return this.scroll.lines(index, length);
1385 }
1386 }
1387 }, {
1388 key: 'getModule',
1389 value: function getModule(name) {
1390 return this.theme.modules[name];
1391 }
1392 }, {
1393 key: 'getSelection',
1394 value: function getSelection() {
1395 var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1396
1397 if (focus) this.focus();
1398 this.update(); // Make sure we access getRange with editor in consistent state
1399 return this.selection.getRange()[0];
1400 }
1401 }, {
1402 key: 'getText',
1403 value: function getText() {
1404 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1405 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
1406
1407 var _overload9 = overload(index, length);
1408
1409 var _overload10 = _slicedToArray(_overload9, 2);
1410
1411 index = _overload10[0];
1412 length = _overload10[1];
1413
1414 return this.editor.getText(index, length);
1415 }
1416 }, {
1417 key: 'hasFocus',
1418 value: function hasFocus() {
1419 return this.selection.hasFocus();
1420 }
1421 }, {
1422 key: 'insertEmbed',
1423 value: function insertEmbed(index, embed, value) {
1424 var _this7 = this;
1425
1426 var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
1427
1428 return modify.call(this, function () {
1429 return _this7.editor.insertEmbed(index, embed, value);
1430 }, source, index);
1431 }
1432 }, {
1433 key: 'insertText',
1434 value: function insertText(index, text, name, value, source) {
1435 var _this8 = this;
1436
1437 var formats = void 0;
1438
1439 var _overload11 = overload(index, 0, name, value, source);
1440
1441 var _overload12 = _slicedToArray(_overload11, 4);
1442
1443 index = _overload12[0];
1444 formats = _overload12[2];
1445 source = _overload12[3];
1446
1447 return modify.call(this, function () {
1448 return _this8.editor.insertText(index, text, formats);
1449 }, source, index, text.length);
1450 }
1451 }, {
1452 key: 'isEnabled',
1453 value: function isEnabled() {
1454 return !this.container.classList.contains('ql-disabled');
1455 }
1456 }, {
1457 key: 'off',
1458 value: function off() {
1459 return this.emitter.off.apply(this.emitter, arguments);
1460 }
1461 }, {
1462 key: 'on',
1463 value: function on() {
1464 return this.emitter.on.apply(this.emitter, arguments);
1465 }
1466 }, {
1467 key: 'once',
1468 value: function once() {
1469 return this.emitter.once.apply(this.emitter, arguments);
1470 }
1471 }, {
1472 key: 'pasteHTML',
1473 value: function pasteHTML(index, html, source) {
1474 this.clipboard.dangerouslyPasteHTML(index, html, source);
1475 }
1476 }, {
1477 key: 'removeFormat',
1478 value: function removeFormat(index, length, source) {
1479 var _this9 = this;
1480
1481 var _overload13 = overload(index, length, source);
1482
1483 var _overload14 = _slicedToArray(_overload13, 4);
1484
1485 index = _overload14[0];
1486 length = _overload14[1];
1487 source = _overload14[3];
1488
1489 return modify.call(this, function () {
1490 return _this9.editor.removeFormat(index, length);
1491 }, source, index);
1492 }
1493 }, {
1494 key: 'scrollIntoView',
1495 value: function scrollIntoView() {
1496 this.selection.scrollIntoView(this.scrollingContainer);
1497 }
1498 }, {
1499 key: 'setContents',
1500 value: function setContents(delta) {
1501 var _this10 = this;
1502
1503 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1504
1505 return modify.call(this, function () {
1506 delta = new _quillDelta2.default(delta);
1507 var length = _this10.getLength();
1508 var deleted = _this10.editor.deleteText(0, length);
1509 var applied = _this10.editor.applyDelta(delta);
1510 var lastOp = applied.ops[applied.ops.length - 1];
1511 if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
1512 _this10.editor.deleteText(_this10.getLength() - 1, 1);
1513 applied.delete(1);
1514 }
1515 var ret = deleted.compose(applied);
1516 return ret;
1517 }, source);
1518 }
1519 }, {
1520 key: 'setSelection',
1521 value: function setSelection(index, length, source) {
1522 if (index == null) {
1523 this.selection.setRange(null, length || Quill.sources.API);
1524 } else {
1525 var _overload15 = overload(index, length, source);
1526
1527 var _overload16 = _slicedToArray(_overload15, 4);
1528
1529 index = _overload16[0];
1530 length = _overload16[1];
1531 source = _overload16[3];
1532
1533 this.selection.setRange(new _selection.Range(index, length), source);
1534 if (source !== _emitter4.default.sources.SILENT) {
1535 this.selection.scrollIntoView(this.scrollingContainer);
1536 }
1537 }
1538 }
1539 }, {
1540 key: 'setText',
1541 value: function setText(text) {
1542 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1543
1544 var delta = new _quillDelta2.default().insert(text);
1545 return this.setContents(delta, source);
1546 }
1547 }, {
1548 key: 'update',
1549 value: function update() {
1550 var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
1551
1552 var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
1553 this.selection.update(source);
1554 return change;
1555 }
1556 }, {
1557 key: 'updateContents',
1558 value: function updateContents(delta) {
1559 var _this11 = this;
1560
1561 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1562
1563 return modify.call(this, function () {
1564 delta = new _quillDelta2.default(delta);
1565 return _this11.editor.applyDelta(delta, source);
1566 }, source, true);
1567 }
1568 }]);
1569
1570 return Quill;
1571}();
1572
1573Quill.DEFAULTS = {
1574 bounds: null,
1575 formats: null,
1576 modules: {},
1577 placeholder: '',
1578 readOnly: false,
1579 scrollingContainer: null,
1580 strict: true,
1581 theme: 'default'
1582};
1583Quill.events = _emitter4.default.events;
1584Quill.sources = _emitter4.default.sources;
1585// eslint-disable-next-line no-undef
1586Quill.version = false ? 'dev' : "1.3.7";
1587
1588Quill.imports = {
1589 'delta': _quillDelta2.default,
1590 'parchment': _parchment2.default,
1591 'core/module': _module2.default,
1592 'core/theme': _theme2.default
1593};
1594
1595function expandConfig(container, userConfig) {
1596 userConfig = (0, _extend2.default)(true, {
1597 container: container,
1598 modules: {
1599 clipboard: true,
1600 keyboard: true,
1601 history: true
1602 }
1603 }, userConfig);
1604 if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
1605 userConfig.theme = _theme2.default;
1606 } else {
1607 userConfig.theme = Quill.import('themes/' + userConfig.theme);
1608 if (userConfig.theme == null) {
1609 throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
1610 }
1611 }
1612 var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
1613 [themeConfig, userConfig].forEach(function (config) {
1614 config.modules = config.modules || {};
1615 Object.keys(config.modules).forEach(function (module) {
1616 if (config.modules[module] === true) {
1617 config.modules[module] = {};
1618 }
1619 });
1620 });
1621 var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
1622 var moduleConfig = moduleNames.reduce(function (config, name) {
1623 var moduleClass = Quill.import('modules/' + name);
1624 if (moduleClass == null) {
1625 debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
1626 } else {
1627 config[name] = moduleClass.DEFAULTS || {};
1628 }
1629 return config;
1630 }, {});
1631 // Special case toolbar shorthand
1632 if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
1633 userConfig.modules.toolbar = {
1634 container: userConfig.modules.toolbar
1635 };
1636 }
1637 userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
1638 ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
1639 if (typeof userConfig[key] === 'string') {
1640 userConfig[key] = document.querySelector(userConfig[key]);
1641 }
1642 });
1643 userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
1644 if (userConfig.modules[name]) {
1645 config[name] = userConfig.modules[name];
1646 }
1647 return config;
1648 }, {});
1649 return userConfig;
1650}
1651
1652// Handle selection preservation and TEXT_CHANGE emission
1653// common to modification APIs
1654function modify(modifier, source, index, shift) {
1655 if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
1656 return new _quillDelta2.default();
1657 }
1658 var range = index == null ? null : this.getSelection();
1659 var oldDelta = this.editor.delta;
1660 var change = modifier();
1661 if (range != null) {
1662 if (index === true) index = range.index;
1663 if (shift == null) {
1664 range = shiftRange(range, change, source);
1665 } else if (shift !== 0) {
1666 range = shiftRange(range, index, shift, source);
1667 }
1668 this.setSelection(range, _emitter4.default.sources.SILENT);
1669 }
1670 if (change.length() > 0) {
1671 var _emitter;
1672
1673 var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
1674 (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
1675 if (source !== _emitter4.default.sources.SILENT) {
1676 var _emitter2;
1677
1678 (_emitter2 = this.emitter).emit.apply(_emitter2, args);
1679 }
1680 }
1681 return change;
1682}
1683
1684function overload(index, length, name, value, source) {
1685 var formats = {};
1686 if (typeof index.index === 'number' && typeof index.length === 'number') {
1687 // Allow for throwaway end (used by insertText/insertEmbed)
1688 if (typeof length !== 'number') {
1689 source = value, value = name, name = length, length = index.length, index = index.index;
1690 } else {
1691 length = index.length, index = index.index;
1692 }
1693 } else if (typeof length !== 'number') {
1694 source = value, value = name, name = length, length = 0;
1695 }
1696 // Handle format being object, two format name/value strings or excluded
1697 if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
1698 formats = name;
1699 source = value;
1700 } else if (typeof name === 'string') {
1701 if (value != null) {
1702 formats[name] = value;
1703 } else {
1704 source = name;
1705 }
1706 }
1707 // Handle optional source
1708 source = source || _emitter4.default.sources.API;
1709 return [index, length, formats, source];
1710}
1711
1712function shiftRange(range, index, length, source) {
1713 if (range == null) return null;
1714 var start = void 0,
1715 end = void 0;
1716 if (index instanceof _quillDelta2.default) {
1717 var _map = [range.index, range.index + range.length].map(function (pos) {
1718 return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
1719 });
1720
1721 var _map2 = _slicedToArray(_map, 2);
1722
1723 start = _map2[0];
1724 end = _map2[1];
1725 } else {
1726 var _map3 = [range.index, range.index + range.length].map(function (pos) {
1727 if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
1728 if (length >= 0) {
1729 return pos + length;
1730 } else {
1731 return Math.max(index, pos + length);
1732 }
1733 });
1734
1735 var _map4 = _slicedToArray(_map3, 2);
1736
1737 start = _map4[0];
1738 end = _map4[1];
1739 }
1740 return new _selection.Range(start, end - start);
1741}
1742
1743exports.expandConfig = expandConfig;
1744exports.overload = overload;
1745exports.default = Quill;
1746
1747/***/ }),
1748/* 6 */
1749/***/ (function(module, exports, __webpack_require__) {
1750
1751"use strict";
1752
1753
1754Object.defineProperty(exports, "__esModule", {
1755 value: true
1756});
1757
1758var _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; }; }();
1759
1760var _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); } };
1761
1762var _text = __webpack_require__(7);
1763
1764var _text2 = _interopRequireDefault(_text);
1765
1766var _parchment = __webpack_require__(0);
1767
1768var _parchment2 = _interopRequireDefault(_parchment);
1769
1770function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1771
1772function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1773
1774function _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
1776function _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; }
1777
1778var Inline = function (_Parchment$Inline) {
1779 _inherits(Inline, _Parchment$Inline);
1780
1781 function Inline() {
1782 _classCallCheck(this, Inline);
1783
1784 return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
1785 }
1786
1787 _createClass(Inline, [{
1788 key: 'formatAt',
1789 value: function formatAt(index, length, name, value) {
1790 if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
1791 var blot = this.isolate(index, length);
1792 if (value) {
1793 blot.wrap(name, value);
1794 }
1795 } else {
1796 _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
1797 }
1798 }
1799 }, {
1800 key: 'optimize',
1801 value: function optimize(context) {
1802 _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);
1803 if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
1804 var parent = this.parent.isolate(this.offset(), this.length());
1805 this.moveChildren(parent);
1806 parent.wrap(this);
1807 }
1808 }
1809 }], [{
1810 key: 'compare',
1811 value: function compare(self, other) {
1812 var selfIndex = Inline.order.indexOf(self);
1813 var otherIndex = Inline.order.indexOf(other);
1814 if (selfIndex >= 0 || otherIndex >= 0) {
1815 return selfIndex - otherIndex;
1816 } else if (self === other) {
1817 return 0;
1818 } else if (self < other) {
1819 return -1;
1820 } else {
1821 return 1;
1822 }
1823 }
1824 }]);
1825
1826 return Inline;
1827}(_parchment2.default.Inline);
1828
1829Inline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];
1830// Lower index means deeper in the DOM tree, since not found (-1) is for embeds
1831Inline.order = ['cursor', 'inline', // Must be lower
1832'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher
1833];
1834
1835exports.default = Inline;
1836
1837/***/ }),
1838/* 7 */
1839/***/ (function(module, exports, __webpack_require__) {
1840
1841"use strict";
1842
1843
1844Object.defineProperty(exports, "__esModule", {
1845 value: true
1846});
1847
1848var _parchment = __webpack_require__(0);
1849
1850var _parchment2 = _interopRequireDefault(_parchment);
1851
1852function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1853
1854function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1855
1856function _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; }
1857
1858function _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; }
1859
1860var TextBlot = function (_Parchment$Text) {
1861 _inherits(TextBlot, _Parchment$Text);
1862
1863 function TextBlot() {
1864 _classCallCheck(this, TextBlot);
1865
1866 return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
1867 }
1868
1869 return TextBlot;
1870}(_parchment2.default.Text);
1871
1872exports.default = TextBlot;
1873
1874/***/ }),
1875/* 8 */
1876/***/ (function(module, exports, __webpack_require__) {
1877
1878"use strict";
1879
1880
1881Object.defineProperty(exports, "__esModule", {
1882 value: true
1883});
1884
1885var _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; }; }();
1886
1887var _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); } };
1888
1889var _eventemitter = __webpack_require__(54);
1890
1891var _eventemitter2 = _interopRequireDefault(_eventemitter);
1892
1893var _logger = __webpack_require__(10);
1894
1895var _logger2 = _interopRequireDefault(_logger);
1896
1897function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1898
1899function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1900
1901function _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; }
1902
1903function _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; }
1904
1905var debug = (0, _logger2.default)('quill:events');
1906
1907var EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];
1908
1909EVENTS.forEach(function (eventName) {
1910 document.addEventListener(eventName, function () {
1911 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1912 args[_key] = arguments[_key];
1913 }
1914
1915 [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {
1916 // TODO use WeakMap
1917 if (node.__quill && node.__quill.emitter) {
1918 var _node$__quill$emitter;
1919
1920 (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);
1921 }
1922 });
1923 });
1924});
1925
1926var Emitter = function (_EventEmitter) {
1927 _inherits(Emitter, _EventEmitter);
1928
1929 function Emitter() {
1930 _classCallCheck(this, Emitter);
1931
1932 var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
1933
1934 _this.listeners = {};
1935 _this.on('error', debug.error);
1936 return _this;
1937 }
1938
1939 _createClass(Emitter, [{
1940 key: 'emit',
1941 value: function emit() {
1942 debug.log.apply(debug, arguments);
1943 _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
1944 }
1945 }, {
1946 key: 'handleDOM',
1947 value: function handleDOM(event) {
1948 for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1949 args[_key2 - 1] = arguments[_key2];
1950 }
1951
1952 (this.listeners[event.type] || []).forEach(function (_ref) {
1953 var node = _ref.node,
1954 handler = _ref.handler;
1955
1956 if (event.target === node || node.contains(event.target)) {
1957 handler.apply(undefined, [event].concat(args));
1958 }
1959 });
1960 }
1961 }, {
1962 key: 'listenDOM',
1963 value: function listenDOM(eventName, node, handler) {
1964 if (!this.listeners[eventName]) {
1965 this.listeners[eventName] = [];
1966 }
1967 this.listeners[eventName].push({ node: node, handler: handler });
1968 }
1969 }]);
1970
1971 return Emitter;
1972}(_eventemitter2.default);
1973
1974Emitter.events = {
1975 EDITOR_CHANGE: 'editor-change',
1976 SCROLL_BEFORE_UPDATE: 'scroll-before-update',
1977 SCROLL_OPTIMIZE: 'scroll-optimize',
1978 SCROLL_UPDATE: 'scroll-update',
1979 SELECTION_CHANGE: 'selection-change',
1980 TEXT_CHANGE: 'text-change'
1981};
1982Emitter.sources = {
1983 API: 'api',
1984 SILENT: 'silent',
1985 USER: 'user'
1986};
1987
1988exports.default = Emitter;
1989
1990/***/ }),
1991/* 9 */
1992/***/ (function(module, exports, __webpack_require__) {
1993
1994"use strict";
1995
1996
1997Object.defineProperty(exports, "__esModule", {
1998 value: true
1999});
2000
2001function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2002
2003var Module = function Module(quill) {
2004 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2005
2006 _classCallCheck(this, Module);
2007
2008 this.quill = quill;
2009 this.options = options;
2010};
2011
2012Module.DEFAULTS = {};
2013
2014exports.default = Module;
2015
2016/***/ }),
2017/* 10 */
2018/***/ (function(module, exports, __webpack_require__) {
2019
2020"use strict";
2021
2022
2023Object.defineProperty(exports, "__esModule", {
2024 value: true
2025});
2026var levels = ['error', 'warn', 'log', 'info'];
2027var level = 'warn';
2028
2029function debug(method) {
2030 if (levels.indexOf(method) <= levels.indexOf(level)) {
2031 var _console;
2032
2033 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2034 args[_key - 1] = arguments[_key];
2035 }
2036
2037 (_console = console)[method].apply(_console, args); // eslint-disable-line no-console
2038 }
2039}
2040
2041function namespace(ns) {
2042 return levels.reduce(function (logger, method) {
2043 logger[method] = debug.bind(console, method, ns);
2044 return logger;
2045 }, {});
2046}
2047
2048debug.level = namespace.level = function (newLevel) {
2049 level = newLevel;
2050};
2051
2052exports.default = namespace;
2053
2054/***/ }),
2055/* 11 */
2056/***/ (function(module, exports, __webpack_require__) {
2057
2058var pSlice = Array.prototype.slice;
2059var objectKeys = __webpack_require__(52);
2060var isArguments = __webpack_require__(53);
2061
2062var deepEqual = module.exports = function (actual, expected, opts) {
2063 if (!opts) opts = {};
2064 // 7.1. All identical values are equivalent, as determined by ===.
2065 if (actual === expected) {
2066 return true;
2067
2068 } else if (actual instanceof Date && expected instanceof Date) {
2069 return actual.getTime() === expected.getTime();
2070
2071 // 7.3. Other pairs that do not both pass typeof value == 'object',
2072 // equivalence is determined by ==.
2073 } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
2074 return opts.strict ? actual === expected : actual == expected;
2075
2076 // 7.4. For all other Object pairs, including Array objects, equivalence is
2077 // determined by having the same number of owned properties (as verified
2078 // with Object.prototype.hasOwnProperty.call), the same set of keys
2079 // (although not necessarily the same order), equivalent values for every
2080 // corresponding key, and an identical 'prototype' property. Note: this
2081 // accounts for both named and indexed properties on Arrays.
2082 } else {
2083 return objEquiv(actual, expected, opts);
2084 }
2085}
2086
2087function isUndefinedOrNull(value) {
2088 return value === null || value === undefined;
2089}
2090
2091function isBuffer (x) {
2092 if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
2093 if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
2094 return false;
2095 }
2096 if (x.length > 0 && typeof x[0] !== 'number') return false;
2097 return true;
2098}
2099
2100function objEquiv(a, b, opts) {
2101 var i, key;
2102 if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
2103 return false;
2104 // an identical 'prototype' property.
2105 if (a.prototype !== b.prototype) return false;
2106 //~~~I've managed to break Object.keys through screwy arguments passing.
2107 // Converting to array solves the problem.
2108 if (isArguments(a)) {
2109 if (!isArguments(b)) {
2110 return false;
2111 }
2112 a = pSlice.call(a);
2113 b = pSlice.call(b);
2114 return deepEqual(a, b, opts);
2115 }
2116 if (isBuffer(a)) {
2117 if (!isBuffer(b)) {
2118 return false;
2119 }
2120 if (a.length !== b.length) return false;
2121 for (i = 0; i < a.length; i++) {
2122 if (a[i] !== b[i]) return false;
2123 }
2124 return true;
2125 }
2126 try {
2127 var ka = objectKeys(a),
2128 kb = objectKeys(b);
2129 } catch (e) {//happens when one is a string literal and the other isn't
2130 return false;
2131 }
2132 // having the same number of owned properties (keys incorporates
2133 // hasOwnProperty)
2134 if (ka.length != kb.length)
2135 return false;
2136 //the same set of keys (although not necessarily the same order),
2137 ka.sort();
2138 kb.sort();
2139 //~~~cheap key test
2140 for (i = ka.length - 1; i >= 0; i--) {
2141 if (ka[i] != kb[i])
2142 return false;
2143 }
2144 //equivalent values for every corresponding key, and
2145 //~~~possibly expensive deep test
2146 for (i = ka.length - 1; i >= 0; i--) {
2147 key = ka[i];
2148 if (!deepEqual(a[key], b[key], opts)) return false;
2149 }
2150 return typeof a === typeof b;
2151}
2152
2153
2154/***/ }),
2155/* 12 */
2156/***/ (function(module, exports, __webpack_require__) {
2157
2158"use strict";
2159
2160Object.defineProperty(exports, "__esModule", { value: true });
2161var Registry = __webpack_require__(1);
2162var Attributor = /** @class */ (function () {
2163 function Attributor(attrName, keyName, options) {
2164 if (options === void 0) { options = {}; }
2165 this.attrName = attrName;
2166 this.keyName = keyName;
2167 var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
2168 if (options.scope != null) {
2169 // Ignore type bits, force attribute bit
2170 this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
2171 }
2172 else {
2173 this.scope = Registry.Scope.ATTRIBUTE;
2174 }
2175 if (options.whitelist != null)
2176 this.whitelist = options.whitelist;
2177 }
2178 Attributor.keys = function (node) {
2179 return [].map.call(node.attributes, function (item) {
2180 return item.name;
2181 });
2182 };
2183 Attributor.prototype.add = function (node, value) {
2184 if (!this.canAdd(node, value))
2185 return false;
2186 node.setAttribute(this.keyName, value);
2187 return true;
2188 };
2189 Attributor.prototype.canAdd = function (node, value) {
2190 var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
2191 if (match == null)
2192 return false;
2193 if (this.whitelist == null)
2194 return true;
2195 if (typeof value === 'string') {
2196 return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1;
2197 }
2198 else {
2199 return this.whitelist.indexOf(value) > -1;
2200 }
2201 };
2202 Attributor.prototype.remove = function (node) {
2203 node.removeAttribute(this.keyName);
2204 };
2205 Attributor.prototype.value = function (node) {
2206 var value = node.getAttribute(this.keyName);
2207 if (this.canAdd(node, value) && value) {
2208 return value;
2209 }
2210 return '';
2211 };
2212 return Attributor;
2213}());
2214exports.default = Attributor;
2215
2216
2217/***/ }),
2218/* 13 */
2219/***/ (function(module, exports, __webpack_require__) {
2220
2221"use strict";
2222
2223
2224Object.defineProperty(exports, "__esModule", {
2225 value: true
2226});
2227exports.default = exports.Code = undefined;
2228
2229var _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"); } }; }();
2230
2231var _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; }; }();
2232
2233var _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); } };
2234
2235var _quillDelta = __webpack_require__(2);
2236
2237var _quillDelta2 = _interopRequireDefault(_quillDelta);
2238
2239var _parchment = __webpack_require__(0);
2240
2241var _parchment2 = _interopRequireDefault(_parchment);
2242
2243var _block = __webpack_require__(4);
2244
2245var _block2 = _interopRequireDefault(_block);
2246
2247var _inline = __webpack_require__(6);
2248
2249var _inline2 = _interopRequireDefault(_inline);
2250
2251var _text = __webpack_require__(7);
2252
2253var _text2 = _interopRequireDefault(_text);
2254
2255function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2256
2257function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2258
2259function _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; }
2260
2261function _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; }
2262
2263var Code = function (_Inline) {
2264 _inherits(Code, _Inline);
2265
2266 function Code() {
2267 _classCallCheck(this, Code);
2268
2269 return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
2270 }
2271
2272 return Code;
2273}(_inline2.default);
2274
2275Code.blotName = 'code';
2276Code.tagName = 'CODE';
2277
2278var CodeBlock = function (_Block) {
2279 _inherits(CodeBlock, _Block);
2280
2281 function CodeBlock() {
2282 _classCallCheck(this, CodeBlock);
2283
2284 return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
2285 }
2286
2287 _createClass(CodeBlock, [{
2288 key: 'delta',
2289 value: function delta() {
2290 var _this3 = this;
2291
2292 var text = this.domNode.textContent;
2293 if (text.endsWith('\n')) {
2294 // Should always be true
2295 text = text.slice(0, -1);
2296 }
2297 return text.split('\n').reduce(function (delta, frag) {
2298 return delta.insert(frag).insert('\n', _this3.formats());
2299 }, new _quillDelta2.default());
2300 }
2301 }, {
2302 key: 'format',
2303 value: function format(name, value) {
2304 if (name === this.statics.blotName && value) return;
2305
2306 var _descendant = this.descendant(_text2.default, this.length() - 1),
2307 _descendant2 = _slicedToArray(_descendant, 1),
2308 text = _descendant2[0];
2309
2310 if (text != null) {
2311 text.deleteAt(text.length() - 1, 1);
2312 }
2313 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
2314 }
2315 }, {
2316 key: 'formatAt',
2317 value: function formatAt(index, length, name, value) {
2318 if (length === 0) return;
2319 if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
2320 return;
2321 }
2322 var nextNewline = this.newlineIndex(index);
2323 if (nextNewline < 0 || nextNewline >= index + length) return;
2324 var prevNewline = this.newlineIndex(index, true) + 1;
2325 var isolateLength = nextNewline - prevNewline + 1;
2326 var blot = this.isolate(prevNewline, isolateLength);
2327 var next = blot.next;
2328 blot.format(name, value);
2329 if (next instanceof CodeBlock) {
2330 next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
2331 }
2332 }
2333 }, {
2334 key: 'insertAt',
2335 value: function insertAt(index, value, def) {
2336 if (def != null) return;
2337
2338 var _descendant3 = this.descendant(_text2.default, index),
2339 _descendant4 = _slicedToArray(_descendant3, 2),
2340 text = _descendant4[0],
2341 offset = _descendant4[1];
2342
2343 text.insertAt(offset, value);
2344 }
2345 }, {
2346 key: 'length',
2347 value: function length() {
2348 var length = this.domNode.textContent.length;
2349 if (!this.domNode.textContent.endsWith('\n')) {
2350 return length + 1;
2351 }
2352 return length;
2353 }
2354 }, {
2355 key: 'newlineIndex',
2356 value: function newlineIndex(searchIndex) {
2357 var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2358
2359 if (!reverse) {
2360 var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
2361 return offset > -1 ? searchIndex + offset : -1;
2362 } else {
2363 return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
2364 }
2365 }
2366 }, {
2367 key: 'optimize',
2368 value: function optimize(context) {
2369 if (!this.domNode.textContent.endsWith('\n')) {
2370 this.appendChild(_parchment2.default.create('text', '\n'));
2371 }
2372 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);
2373 var next = this.next;
2374 if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
2375 next.optimize(context);
2376 next.moveChildren(this);
2377 next.remove();
2378 }
2379 }
2380 }, {
2381 key: 'replace',
2382 value: function replace(target) {
2383 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
2384 [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
2385 var blot = _parchment2.default.find(node);
2386 if (blot == null) {
2387 node.parentNode.removeChild(node);
2388 } else if (blot instanceof _parchment2.default.Embed) {
2389 blot.remove();
2390 } else {
2391 blot.unwrap();
2392 }
2393 });
2394 }
2395 }], [{
2396 key: 'create',
2397 value: function create(value) {
2398 var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
2399 domNode.setAttribute('spellcheck', false);
2400 return domNode;
2401 }
2402 }, {
2403 key: 'formats',
2404 value: function formats() {
2405 return true;
2406 }
2407 }]);
2408
2409 return CodeBlock;
2410}(_block2.default);
2411
2412CodeBlock.blotName = 'code-block';
2413CodeBlock.tagName = 'PRE';
2414CodeBlock.TAB = ' ';
2415
2416exports.Code = Code;
2417exports.default = CodeBlock;
2418
2419/***/ }),
2420/* 14 */
2421/***/ (function(module, exports, __webpack_require__) {
2422
2423"use strict";
2424
2425
2426Object.defineProperty(exports, "__esModule", {
2427 value: true
2428});
2429
2430var _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; };
2431
2432var _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"); } }; }();
2433
2434var _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; }; }();
2435
2436var _quillDelta = __webpack_require__(2);
2437
2438var _quillDelta2 = _interopRequireDefault(_quillDelta);
2439
2440var _op = __webpack_require__(20);
2441
2442var _op2 = _interopRequireDefault(_op);
2443
2444var _parchment = __webpack_require__(0);
2445
2446var _parchment2 = _interopRequireDefault(_parchment);
2447
2448var _code = __webpack_require__(13);
2449
2450var _code2 = _interopRequireDefault(_code);
2451
2452var _cursor = __webpack_require__(24);
2453
2454var _cursor2 = _interopRequireDefault(_cursor);
2455
2456var _block = __webpack_require__(4);
2457
2458var _block2 = _interopRequireDefault(_block);
2459
2460var _break = __webpack_require__(16);
2461
2462var _break2 = _interopRequireDefault(_break);
2463
2464var _clone = __webpack_require__(21);
2465
2466var _clone2 = _interopRequireDefault(_clone);
2467
2468var _deepEqual = __webpack_require__(11);
2469
2470var _deepEqual2 = _interopRequireDefault(_deepEqual);
2471
2472var _extend = __webpack_require__(3);
2473
2474var _extend2 = _interopRequireDefault(_extend);
2475
2476function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2477
2478function _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; }
2479
2480function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2481
2482var ASCII = /^[ -~]*$/;
2483
2484var Editor = function () {
2485 function Editor(scroll) {
2486 _classCallCheck(this, Editor);
2487
2488 this.scroll = scroll;
2489 this.delta = this.getDelta();
2490 }
2491
2492 _createClass(Editor, [{
2493 key: 'applyDelta',
2494 value: function applyDelta(delta) {
2495 var _this = this;
2496
2497 var consumeNextNewline = false;
2498 this.scroll.update();
2499 var scrollLength = this.scroll.length();
2500 this.scroll.batchStart();
2501 delta = normalizeDelta(delta);
2502 delta.reduce(function (index, op) {
2503 var length = op.retain || op.delete || op.insert.length || 1;
2504 var attributes = op.attributes || {};
2505 if (op.insert != null) {
2506 if (typeof op.insert === 'string') {
2507 var text = op.insert;
2508 if (text.endsWith('\n') && consumeNextNewline) {
2509 consumeNextNewline = false;
2510 text = text.slice(0, -1);
2511 }
2512 if (index >= scrollLength && !text.endsWith('\n')) {
2513 consumeNextNewline = true;
2514 }
2515 _this.scroll.insertAt(index, text);
2516
2517 var _scroll$line = _this.scroll.line(index),
2518 _scroll$line2 = _slicedToArray(_scroll$line, 2),
2519 line = _scroll$line2[0],
2520 offset = _scroll$line2[1];
2521
2522 var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
2523 if (line instanceof _block2.default) {
2524 var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
2525 _line$descendant2 = _slicedToArray(_line$descendant, 1),
2526 leaf = _line$descendant2[0];
2527
2528 formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
2529 }
2530 attributes = _op2.default.attributes.diff(formats, attributes) || {};
2531 } else if (_typeof(op.insert) === 'object') {
2532 var key = Object.keys(op.insert)[0]; // There should only be one key
2533 if (key == null) return index;
2534 _this.scroll.insertAt(index, key, op.insert[key]);
2535 }
2536 scrollLength += length;
2537 }
2538 Object.keys(attributes).forEach(function (name) {
2539 _this.scroll.formatAt(index, length, name, attributes[name]);
2540 });
2541 return index + length;
2542 }, 0);
2543 delta.reduce(function (index, op) {
2544 if (typeof op.delete === 'number') {
2545 _this.scroll.deleteAt(index, op.delete);
2546 return index;
2547 }
2548 return index + (op.retain || op.insert.length || 1);
2549 }, 0);
2550 this.scroll.batchEnd();
2551 return this.update(delta);
2552 }
2553 }, {
2554 key: 'deleteText',
2555 value: function deleteText(index, length) {
2556 this.scroll.deleteAt(index, length);
2557 return this.update(new _quillDelta2.default().retain(index).delete(length));
2558 }
2559 }, {
2560 key: 'formatLine',
2561 value: function formatLine(index, length) {
2562 var _this2 = this;
2563
2564 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2565
2566 this.scroll.update();
2567 Object.keys(formats).forEach(function (format) {
2568 if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
2569 var lines = _this2.scroll.lines(index, Math.max(length, 1));
2570 var lengthRemaining = length;
2571 lines.forEach(function (line) {
2572 var lineLength = line.length();
2573 if (!(line instanceof _code2.default)) {
2574 line.format(format, formats[format]);
2575 } else {
2576 var codeIndex = index - line.offset(_this2.scroll);
2577 var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
2578 line.formatAt(codeIndex, codeLength, format, formats[format]);
2579 }
2580 lengthRemaining -= lineLength;
2581 });
2582 });
2583 this.scroll.optimize();
2584 return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
2585 }
2586 }, {
2587 key: 'formatText',
2588 value: function formatText(index, length) {
2589 var _this3 = this;
2590
2591 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2592
2593 Object.keys(formats).forEach(function (format) {
2594 _this3.scroll.formatAt(index, length, format, formats[format]);
2595 });
2596 return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
2597 }
2598 }, {
2599 key: 'getContents',
2600 value: function getContents(index, length) {
2601 return this.delta.slice(index, index + length);
2602 }
2603 }, {
2604 key: 'getDelta',
2605 value: function getDelta() {
2606 return this.scroll.lines().reduce(function (delta, line) {
2607 return delta.concat(line.delta());
2608 }, new _quillDelta2.default());
2609 }
2610 }, {
2611 key: 'getFormat',
2612 value: function getFormat(index) {
2613 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2614
2615 var lines = [],
2616 leaves = [];
2617 if (length === 0) {
2618 this.scroll.path(index).forEach(function (path) {
2619 var _path = _slicedToArray(path, 1),
2620 blot = _path[0];
2621
2622 if (blot instanceof _block2.default) {
2623 lines.push(blot);
2624 } else if (blot instanceof _parchment2.default.Leaf) {
2625 leaves.push(blot);
2626 }
2627 });
2628 } else {
2629 lines = this.scroll.lines(index, length);
2630 leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
2631 }
2632 var formatsArr = [lines, leaves].map(function (blots) {
2633 if (blots.length === 0) return {};
2634 var formats = (0, _block.bubbleFormats)(blots.shift());
2635 while (Object.keys(formats).length > 0) {
2636 var blot = blots.shift();
2637 if (blot == null) return formats;
2638 formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
2639 }
2640 return formats;
2641 });
2642 return _extend2.default.apply(_extend2.default, formatsArr);
2643 }
2644 }, {
2645 key: 'getText',
2646 value: function getText(index, length) {
2647 return this.getContents(index, length).filter(function (op) {
2648 return typeof op.insert === 'string';
2649 }).map(function (op) {
2650 return op.insert;
2651 }).join('');
2652 }
2653 }, {
2654 key: 'insertEmbed',
2655 value: function insertEmbed(index, embed, value) {
2656 this.scroll.insertAt(index, embed, value);
2657 return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
2658 }
2659 }, {
2660 key: 'insertText',
2661 value: function insertText(index, text) {
2662 var _this4 = this;
2663
2664 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2665
2666 text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2667 this.scroll.insertAt(index, text);
2668 Object.keys(formats).forEach(function (format) {
2669 _this4.scroll.formatAt(index, text.length, format, formats[format]);
2670 });
2671 return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
2672 }
2673 }, {
2674 key: 'isBlank',
2675 value: function isBlank() {
2676 if (this.scroll.children.length == 0) return true;
2677 if (this.scroll.children.length > 1) return false;
2678 var block = this.scroll.children.head;
2679 if (block.statics.blotName !== _block2.default.blotName) return false;
2680 if (block.children.length > 1) return false;
2681 return block.children.head instanceof _break2.default;
2682 }
2683 }, {
2684 key: 'removeFormat',
2685 value: function removeFormat(index, length) {
2686 var text = this.getText(index, length);
2687
2688 var _scroll$line3 = this.scroll.line(index + length),
2689 _scroll$line4 = _slicedToArray(_scroll$line3, 2),
2690 line = _scroll$line4[0],
2691 offset = _scroll$line4[1];
2692
2693 var suffixLength = 0,
2694 suffix = new _quillDelta2.default();
2695 if (line != null) {
2696 if (!(line instanceof _code2.default)) {
2697 suffixLength = line.length() - offset;
2698 } else {
2699 suffixLength = line.newlineIndex(offset) - offset + 1;
2700 }
2701 suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
2702 }
2703 var contents = this.getContents(index, length + suffixLength);
2704 var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
2705 var delta = new _quillDelta2.default().retain(index).concat(diff);
2706 return this.applyDelta(delta);
2707 }
2708 }, {
2709 key: 'update',
2710 value: function update(change) {
2711 var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
2712 var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
2713
2714 var oldDelta = this.delta;
2715 if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
2716 // Optimization for character changes
2717 var textBlot = _parchment2.default.find(mutations[0].target);
2718 var formats = (0, _block.bubbleFormats)(textBlot);
2719 var index = textBlot.offset(this.scroll);
2720 var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
2721 var oldText = new _quillDelta2.default().insert(oldValue);
2722 var newText = new _quillDelta2.default().insert(textBlot.value());
2723 var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
2724 change = diffDelta.reduce(function (delta, op) {
2725 if (op.insert) {
2726 return delta.insert(op.insert, formats);
2727 } else {
2728 return delta.push(op);
2729 }
2730 }, new _quillDelta2.default());
2731 this.delta = oldDelta.compose(change);
2732 } else {
2733 this.delta = this.getDelta();
2734 if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
2735 change = oldDelta.diff(this.delta, cursorIndex);
2736 }
2737 }
2738 return change;
2739 }
2740 }]);
2741
2742 return Editor;
2743}();
2744
2745function combineFormats(formats, combined) {
2746 return Object.keys(combined).reduce(function (merged, name) {
2747 if (formats[name] == null) return merged;
2748 if (combined[name] === formats[name]) {
2749 merged[name] = combined[name];
2750 } else if (Array.isArray(combined[name])) {
2751 if (combined[name].indexOf(formats[name]) < 0) {
2752 merged[name] = combined[name].concat([formats[name]]);
2753 }
2754 } else {
2755 merged[name] = [combined[name], formats[name]];
2756 }
2757 return merged;
2758 }, {});
2759}
2760
2761function normalizeDelta(delta) {
2762 return delta.reduce(function (delta, op) {
2763 if (op.insert === 1) {
2764 var attributes = (0, _clone2.default)(op.attributes);
2765 delete attributes['image'];
2766 return delta.insert({ image: op.attributes.image }, attributes);
2767 }
2768 if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
2769 op = (0, _clone2.default)(op);
2770 if (op.attributes.list) {
2771 op.attributes.list = 'ordered';
2772 } else {
2773 op.attributes.list = 'bullet';
2774 delete op.attributes.bullet;
2775 }
2776 }
2777 if (typeof op.insert === 'string') {
2778 var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2779 return delta.insert(text, op.attributes);
2780 }
2781 return delta.push(op);
2782 }, new _quillDelta2.default());
2783}
2784
2785exports.default = Editor;
2786
2787/***/ }),
2788/* 15 */
2789/***/ (function(module, exports, __webpack_require__) {
2790
2791"use strict";
2792
2793
2794Object.defineProperty(exports, "__esModule", {
2795 value: true
2796});
2797exports.default = exports.Range = undefined;
2798
2799var _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"); } }; }();
2800
2801var _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; }; }();
2802
2803var _parchment = __webpack_require__(0);
2804
2805var _parchment2 = _interopRequireDefault(_parchment);
2806
2807var _clone = __webpack_require__(21);
2808
2809var _clone2 = _interopRequireDefault(_clone);
2810
2811var _deepEqual = __webpack_require__(11);
2812
2813var _deepEqual2 = _interopRequireDefault(_deepEqual);
2814
2815var _emitter3 = __webpack_require__(8);
2816
2817var _emitter4 = _interopRequireDefault(_emitter3);
2818
2819var _logger = __webpack_require__(10);
2820
2821var _logger2 = _interopRequireDefault(_logger);
2822
2823function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2824
2825function _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); } }
2826
2827function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2828
2829var debug = (0, _logger2.default)('quill:selection');
2830
2831var Range = function Range(index) {
2832 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2833
2834 _classCallCheck(this, Range);
2835
2836 this.index = index;
2837 this.length = length;
2838};
2839
2840var Selection = function () {
2841 function Selection(scroll, emitter) {
2842 var _this = this;
2843
2844 _classCallCheck(this, Selection);
2845
2846 this.emitter = emitter;
2847 this.scroll = scroll;
2848 this.composing = false;
2849 this.mouseDown = false;
2850 this.root = this.scroll.domNode;
2851 this.cursor = _parchment2.default.create('cursor', this);
2852 // savedRange is last non-null range
2853 this.lastRange = this.savedRange = new Range(0, 0);
2854 this.handleComposition();
2855 this.handleDragging();
2856 this.emitter.listenDOM('selectionchange', document, function () {
2857 if (!_this.mouseDown) {
2858 setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
2859 }
2860 });
2861 this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
2862 if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
2863 _this.update(_emitter4.default.sources.SILENT);
2864 }
2865 });
2866 this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
2867 if (!_this.hasFocus()) return;
2868 var native = _this.getNativeRange();
2869 if (native == null) return;
2870 if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
2871 // TODO unclear if this has negative side effects
2872 _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
2873 try {
2874 _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
2875 } catch (ignored) {}
2876 });
2877 });
2878 this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {
2879 if (context.range) {
2880 var _context$range = context.range,
2881 startNode = _context$range.startNode,
2882 startOffset = _context$range.startOffset,
2883 endNode = _context$range.endNode,
2884 endOffset = _context$range.endOffset;
2885
2886 _this.setNativeRange(startNode, startOffset, endNode, endOffset);
2887 }
2888 });
2889 this.update(_emitter4.default.sources.SILENT);
2890 }
2891
2892 _createClass(Selection, [{
2893 key: 'handleComposition',
2894 value: function handleComposition() {
2895 var _this2 = this;
2896
2897 this.root.addEventListener('compositionstart', function () {
2898 _this2.composing = true;
2899 });
2900 this.root.addEventListener('compositionend', function () {
2901 _this2.composing = false;
2902 if (_this2.cursor.parent) {
2903 var range = _this2.cursor.restore();
2904 if (!range) return;
2905 setTimeout(function () {
2906 _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);
2907 }, 1);
2908 }
2909 });
2910 }
2911 }, {
2912 key: 'handleDragging',
2913 value: function handleDragging() {
2914 var _this3 = this;
2915
2916 this.emitter.listenDOM('mousedown', document.body, function () {
2917 _this3.mouseDown = true;
2918 });
2919 this.emitter.listenDOM('mouseup', document.body, function () {
2920 _this3.mouseDown = false;
2921 _this3.update(_emitter4.default.sources.USER);
2922 });
2923 }
2924 }, {
2925 key: 'focus',
2926 value: function focus() {
2927 if (this.hasFocus()) return;
2928 this.root.focus();
2929 this.setRange(this.savedRange);
2930 }
2931 }, {
2932 key: 'format',
2933 value: function format(_format, value) {
2934 if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
2935 this.scroll.update();
2936 var nativeRange = this.getNativeRange();
2937 if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
2938 if (nativeRange.start.node !== this.cursor.textNode) {
2939 var blot = _parchment2.default.find(nativeRange.start.node, false);
2940 if (blot == null) return;
2941 // TODO Give blot ability to not split
2942 if (blot instanceof _parchment2.default.Leaf) {
2943 var after = blot.split(nativeRange.start.offset);
2944 blot.parent.insertBefore(this.cursor, after);
2945 } else {
2946 blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
2947 }
2948 this.cursor.attach();
2949 }
2950 this.cursor.format(_format, value);
2951 this.scroll.optimize();
2952 this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
2953 this.update();
2954 }
2955 }, {
2956 key: 'getBounds',
2957 value: function getBounds(index) {
2958 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2959
2960 var scrollLength = this.scroll.length();
2961 index = Math.min(index, scrollLength - 1);
2962 length = Math.min(index + length, scrollLength - 1) - index;
2963 var node = void 0,
2964 _scroll$leaf = this.scroll.leaf(index),
2965 _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
2966 leaf = _scroll$leaf2[0],
2967 offset = _scroll$leaf2[1];
2968 if (leaf == null) return null;
2969
2970 var _leaf$position = leaf.position(offset, true);
2971
2972 var _leaf$position2 = _slicedToArray(_leaf$position, 2);
2973
2974 node = _leaf$position2[0];
2975 offset = _leaf$position2[1];
2976
2977 var range = document.createRange();
2978 if (length > 0) {
2979 range.setStart(node, offset);
2980
2981 var _scroll$leaf3 = this.scroll.leaf(index + length);
2982
2983 var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
2984
2985 leaf = _scroll$leaf4[0];
2986 offset = _scroll$leaf4[1];
2987
2988 if (leaf == null) return null;
2989
2990 var _leaf$position3 = leaf.position(offset, true);
2991
2992 var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
2993
2994 node = _leaf$position4[0];
2995 offset = _leaf$position4[1];
2996
2997 range.setEnd(node, offset);
2998 return range.getBoundingClientRect();
2999 } else {
3000 var side = 'left';
3001 var rect = void 0;
3002 if (node instanceof Text) {
3003 if (offset < node.data.length) {
3004 range.setStart(node, offset);
3005 range.setEnd(node, offset + 1);
3006 } else {
3007 range.setStart(node, offset - 1);
3008 range.setEnd(node, offset);
3009 side = 'right';
3010 }
3011 rect = range.getBoundingClientRect();
3012 } else {
3013 rect = leaf.domNode.getBoundingClientRect();
3014 if (offset > 0) side = 'right';
3015 }
3016 return {
3017 bottom: rect.top + rect.height,
3018 height: rect.height,
3019 left: rect[side],
3020 right: rect[side],
3021 top: rect.top,
3022 width: 0
3023 };
3024 }
3025 }
3026 }, {
3027 key: 'getNativeRange',
3028 value: function getNativeRange() {
3029 var selection = document.getSelection();
3030 if (selection == null || selection.rangeCount <= 0) return null;
3031 var nativeRange = selection.getRangeAt(0);
3032 if (nativeRange == null) return null;
3033 var range = this.normalizeNative(nativeRange);
3034 debug.info('getNativeRange', range);
3035 return range;
3036 }
3037 }, {
3038 key: 'getRange',
3039 value: function getRange() {
3040 var normalized = this.getNativeRange();
3041 if (normalized == null) return [null, null];
3042 var range = this.normalizedToRange(normalized);
3043 return [range, normalized];
3044 }
3045 }, {
3046 key: 'hasFocus',
3047 value: function hasFocus() {
3048 return document.activeElement === this.root;
3049 }
3050 }, {
3051 key: 'normalizedToRange',
3052 value: function normalizedToRange(range) {
3053 var _this4 = this;
3054
3055 var positions = [[range.start.node, range.start.offset]];
3056 if (!range.native.collapsed) {
3057 positions.push([range.end.node, range.end.offset]);
3058 }
3059 var indexes = positions.map(function (position) {
3060 var _position = _slicedToArray(position, 2),
3061 node = _position[0],
3062 offset = _position[1];
3063
3064 var blot = _parchment2.default.find(node, true);
3065 var index = blot.offset(_this4.scroll);
3066 if (offset === 0) {
3067 return index;
3068 } else if (blot instanceof _parchment2.default.Container) {
3069 return index + blot.length();
3070 } else {
3071 return index + blot.index(node, offset);
3072 }
3073 });
3074 var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
3075 var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
3076 return new Range(start, end - start);
3077 }
3078 }, {
3079 key: 'normalizeNative',
3080 value: function normalizeNative(nativeRange) {
3081 if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
3082 return null;
3083 }
3084 var range = {
3085 start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
3086 end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
3087 native: nativeRange
3088 };
3089 [range.start, range.end].forEach(function (position) {
3090 var node = position.node,
3091 offset = position.offset;
3092 while (!(node instanceof Text) && node.childNodes.length > 0) {
3093 if (node.childNodes.length > offset) {
3094 node = node.childNodes[offset];
3095 offset = 0;
3096 } else if (node.childNodes.length === offset) {
3097 node = node.lastChild;
3098 offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
3099 } else {
3100 break;
3101 }
3102 }
3103 position.node = node, position.offset = offset;
3104 });
3105 return range;
3106 }
3107 }, {
3108 key: 'rangeToNative',
3109 value: function rangeToNative(range) {
3110 var _this5 = this;
3111
3112 var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
3113 var args = [];
3114 var scrollLength = this.scroll.length();
3115 indexes.forEach(function (index, i) {
3116 index = Math.min(scrollLength - 1, index);
3117 var node = void 0,
3118 _scroll$leaf5 = _this5.scroll.leaf(index),
3119 _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
3120 leaf = _scroll$leaf6[0],
3121 offset = _scroll$leaf6[1];
3122 var _leaf$position5 = leaf.position(offset, i !== 0);
3123
3124 var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
3125
3126 node = _leaf$position6[0];
3127 offset = _leaf$position6[1];
3128
3129 args.push(node, offset);
3130 });
3131 if (args.length < 2) {
3132 args = args.concat(args);
3133 }
3134 return args;
3135 }
3136 }, {
3137 key: 'scrollIntoView',
3138 value: function scrollIntoView(scrollingContainer) {
3139 var range = this.lastRange;
3140 if (range == null) return;
3141 var bounds = this.getBounds(range.index, range.length);
3142 if (bounds == null) return;
3143 var limit = this.scroll.length() - 1;
3144
3145 var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
3146 _scroll$line2 = _slicedToArray(_scroll$line, 1),
3147 first = _scroll$line2[0];
3148
3149 var last = first;
3150 if (range.length > 0) {
3151 var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
3152
3153 var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
3154
3155 last = _scroll$line4[0];
3156 }
3157 if (first == null || last == null) return;
3158 var scrollBounds = scrollingContainer.getBoundingClientRect();
3159 if (bounds.top < scrollBounds.top) {
3160 scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;
3161 } else if (bounds.bottom > scrollBounds.bottom) {
3162 scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;
3163 }
3164 }
3165 }, {
3166 key: 'setNativeRange',
3167 value: function setNativeRange(startNode, startOffset) {
3168 var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
3169 var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
3170 var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
3171
3172 debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
3173 if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
3174 return;
3175 }
3176 var selection = document.getSelection();
3177 if (selection == null) return;
3178 if (startNode != null) {
3179 if (!this.hasFocus()) this.root.focus();
3180 var native = (this.getNativeRange() || {}).native;
3181 if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
3182
3183 if (startNode.tagName == "BR") {
3184 startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
3185 startNode = startNode.parentNode;
3186 }
3187 if (endNode.tagName == "BR") {
3188 endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
3189 endNode = endNode.parentNode;
3190 }
3191 var range = document.createRange();
3192 range.setStart(startNode, startOffset);
3193 range.setEnd(endNode, endOffset);
3194 selection.removeAllRanges();
3195 selection.addRange(range);
3196 }
3197 } else {
3198 selection.removeAllRanges();
3199 this.root.blur();
3200 document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
3201 }
3202 }
3203 }, {
3204 key: 'setRange',
3205 value: function setRange(range) {
3206 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3207 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
3208
3209 if (typeof force === 'string') {
3210 source = force;
3211 force = false;
3212 }
3213 debug.info('setRange', range);
3214 if (range != null) {
3215 var args = this.rangeToNative(range);
3216 this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
3217 } else {
3218 this.setNativeRange(null);
3219 }
3220 this.update(source);
3221 }
3222 }, {
3223 key: 'update',
3224 value: function update() {
3225 var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
3226
3227 var oldRange = this.lastRange;
3228
3229 var _getRange = this.getRange(),
3230 _getRange2 = _slicedToArray(_getRange, 2),
3231 lastRange = _getRange2[0],
3232 nativeRange = _getRange2[1];
3233
3234 this.lastRange = lastRange;
3235 if (this.lastRange != null) {
3236 this.savedRange = this.lastRange;
3237 }
3238 if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
3239 var _emitter;
3240
3241 if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
3242 this.cursor.restore();
3243 }
3244 var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
3245 (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
3246 if (source !== _emitter4.default.sources.SILENT) {
3247 var _emitter2;
3248
3249 (_emitter2 = this.emitter).emit.apply(_emitter2, args);
3250 }
3251 }
3252 }
3253 }]);
3254
3255 return Selection;
3256}();
3257
3258function contains(parent, descendant) {
3259 try {
3260 // Firefox inserts inaccessible nodes around video elements
3261 descendant.parentNode;
3262 } catch (e) {
3263 return false;
3264 }
3265 // IE11 has bug with Text nodes
3266 // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
3267 if (descendant instanceof Text) {
3268 descendant = descendant.parentNode;
3269 }
3270 return parent.contains(descendant);
3271}
3272
3273exports.Range = Range;
3274exports.default = Selection;
3275
3276/***/ }),
3277/* 16 */
3278/***/ (function(module, exports, __webpack_require__) {
3279
3280"use strict";
3281
3282
3283Object.defineProperty(exports, "__esModule", {
3284 value: true
3285});
3286
3287var _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; }; }();
3288
3289var _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); } };
3290
3291var _parchment = __webpack_require__(0);
3292
3293var _parchment2 = _interopRequireDefault(_parchment);
3294
3295function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3296
3297function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3298
3299function _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; }
3300
3301function _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; }
3302
3303var Break = function (_Parchment$Embed) {
3304 _inherits(Break, _Parchment$Embed);
3305
3306 function Break() {
3307 _classCallCheck(this, Break);
3308
3309 return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
3310 }
3311
3312 _createClass(Break, [{
3313 key: 'insertInto',
3314 value: function insertInto(parent, ref) {
3315 if (parent.children.length === 0) {
3316 _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
3317 } else {
3318 this.remove();
3319 }
3320 }
3321 }, {
3322 key: 'length',
3323 value: function length() {
3324 return 0;
3325 }
3326 }, {
3327 key: 'value',
3328 value: function value() {
3329 return '';
3330 }
3331 }], [{
3332 key: 'value',
3333 value: function value() {
3334 return undefined;
3335 }
3336 }]);
3337
3338 return Break;
3339}(_parchment2.default.Embed);
3340
3341Break.blotName = 'break';
3342Break.tagName = 'BR';
3343
3344exports.default = Break;
3345
3346/***/ }),
3347/* 17 */
3348/***/ (function(module, exports, __webpack_require__) {
3349
3350"use strict";
3351
3352var __extends = (this && this.__extends) || (function () {
3353 var extendStatics = Object.setPrototypeOf ||
3354 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3355 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3356 return function (d, b) {
3357 extendStatics(d, b);
3358 function __() { this.constructor = d; }
3359 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3360 };
3361})();
3362Object.defineProperty(exports, "__esModule", { value: true });
3363var linked_list_1 = __webpack_require__(44);
3364var shadow_1 = __webpack_require__(30);
3365var Registry = __webpack_require__(1);
3366var ContainerBlot = /** @class */ (function (_super) {
3367 __extends(ContainerBlot, _super);
3368 function ContainerBlot(domNode) {
3369 var _this = _super.call(this, domNode) || this;
3370 _this.build();
3371 return _this;
3372 }
3373 ContainerBlot.prototype.appendChild = function (other) {
3374 this.insertBefore(other);
3375 };
3376 ContainerBlot.prototype.attach = function () {
3377 _super.prototype.attach.call(this);
3378 this.children.forEach(function (child) {
3379 child.attach();
3380 });
3381 };
3382 ContainerBlot.prototype.build = function () {
3383 var _this = this;
3384 this.children = new linked_list_1.default();
3385 // Need to be reversed for if DOM nodes already in order
3386 [].slice
3387 .call(this.domNode.childNodes)
3388 .reverse()
3389 .forEach(function (node) {
3390 try {
3391 var child = makeBlot(node);
3392 _this.insertBefore(child, _this.children.head || undefined);
3393 }
3394 catch (err) {
3395 if (err instanceof Registry.ParchmentError)
3396 return;
3397 else
3398 throw err;
3399 }
3400 });
3401 };
3402 ContainerBlot.prototype.deleteAt = function (index, length) {
3403 if (index === 0 && length === this.length()) {
3404 return this.remove();
3405 }
3406 this.children.forEachAt(index, length, function (child, offset, length) {
3407 child.deleteAt(offset, length);
3408 });
3409 };
3410 ContainerBlot.prototype.descendant = function (criteria, index) {
3411 var _a = this.children.find(index), child = _a[0], offset = _a[1];
3412 if ((criteria.blotName == null && criteria(child)) ||
3413 (criteria.blotName != null && child instanceof criteria)) {
3414 return [child, offset];
3415 }
3416 else if (child instanceof ContainerBlot) {
3417 return child.descendant(criteria, offset);
3418 }
3419 else {
3420 return [null, -1];
3421 }
3422 };
3423 ContainerBlot.prototype.descendants = function (criteria, index, length) {
3424 if (index === void 0) { index = 0; }
3425 if (length === void 0) { length = Number.MAX_VALUE; }
3426 var descendants = [];
3427 var lengthLeft = length;
3428 this.children.forEachAt(index, length, function (child, index, length) {
3429 if ((criteria.blotName == null && criteria(child)) ||
3430 (criteria.blotName != null && child instanceof criteria)) {
3431 descendants.push(child);
3432 }
3433 if (child instanceof ContainerBlot) {
3434 descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
3435 }
3436 lengthLeft -= length;
3437 });
3438 return descendants;
3439 };
3440 ContainerBlot.prototype.detach = function () {
3441 this.children.forEach(function (child) {
3442 child.detach();
3443 });
3444 _super.prototype.detach.call(this);
3445 };
3446 ContainerBlot.prototype.formatAt = function (index, length, name, value) {
3447 this.children.forEachAt(index, length, function (child, offset, length) {
3448 child.formatAt(offset, length, name, value);
3449 });
3450 };
3451 ContainerBlot.prototype.insertAt = function (index, value, def) {
3452 var _a = this.children.find(index), child = _a[0], offset = _a[1];
3453 if (child) {
3454 child.insertAt(offset, value, def);
3455 }
3456 else {
3457 var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
3458 this.appendChild(blot);
3459 }
3460 };
3461 ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
3462 if (this.statics.allowedChildren != null &&
3463 !this.statics.allowedChildren.some(function (child) {
3464 return childBlot instanceof child;
3465 })) {
3466 throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
3467 }
3468 childBlot.insertInto(this, refBlot);
3469 };
3470 ContainerBlot.prototype.length = function () {
3471 return this.children.reduce(function (memo, child) {
3472 return memo + child.length();
3473 }, 0);
3474 };
3475 ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
3476 this.children.forEach(function (child) {
3477 targetParent.insertBefore(child, refNode);
3478 });
3479 };
3480 ContainerBlot.prototype.optimize = function (context) {
3481 _super.prototype.optimize.call(this, context);
3482 if (this.children.length === 0) {
3483 if (this.statics.defaultChild != null) {
3484 var child = Registry.create(this.statics.defaultChild);
3485 this.appendChild(child);
3486 child.optimize(context);
3487 }
3488 else {
3489 this.remove();
3490 }
3491 }
3492 };
3493 ContainerBlot.prototype.path = function (index, inclusive) {
3494 if (inclusive === void 0) { inclusive = false; }
3495 var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
3496 var position = [[this, index]];
3497 if (child instanceof ContainerBlot) {
3498 return position.concat(child.path(offset, inclusive));
3499 }
3500 else if (child != null) {
3501 position.push([child, offset]);
3502 }
3503 return position;
3504 };
3505 ContainerBlot.prototype.removeChild = function (child) {
3506 this.children.remove(child);
3507 };
3508 ContainerBlot.prototype.replace = function (target) {
3509 if (target instanceof ContainerBlot) {
3510 target.moveChildren(this);
3511 }
3512 _super.prototype.replace.call(this, target);
3513 };
3514 ContainerBlot.prototype.split = function (index, force) {
3515 if (force === void 0) { force = false; }
3516 if (!force) {
3517 if (index === 0)
3518 return this;
3519 if (index === this.length())
3520 return this.next;
3521 }
3522 var after = this.clone();
3523 this.parent.insertBefore(after, this.next);
3524 this.children.forEachAt(index, this.length(), function (child, offset, length) {
3525 child = child.split(offset, force);
3526 after.appendChild(child);
3527 });
3528 return after;
3529 };
3530 ContainerBlot.prototype.unwrap = function () {
3531 this.moveChildren(this.parent, this.next);
3532 this.remove();
3533 };
3534 ContainerBlot.prototype.update = function (mutations, context) {
3535 var _this = this;
3536 var addedNodes = [];
3537 var removedNodes = [];
3538 mutations.forEach(function (mutation) {
3539 if (mutation.target === _this.domNode && mutation.type === 'childList') {
3540 addedNodes.push.apply(addedNodes, mutation.addedNodes);
3541 removedNodes.push.apply(removedNodes, mutation.removedNodes);
3542 }
3543 });
3544 removedNodes.forEach(function (node) {
3545 // Check node has actually been removed
3546 // One exception is Chrome does not immediately remove IFRAMEs
3547 // from DOM but MutationRecord is correct in its reported removal
3548 if (node.parentNode != null &&
3549 // @ts-ignore
3550 node.tagName !== 'IFRAME' &&
3551 document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
3552 return;
3553 }
3554 var blot = Registry.find(node);
3555 if (blot == null)
3556 return;
3557 if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
3558 blot.detach();
3559 }
3560 });
3561 addedNodes
3562 .filter(function (node) {
3563 return node.parentNode == _this.domNode;
3564 })
3565 .sort(function (a, b) {
3566 if (a === b)
3567 return 0;
3568 if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
3569 return 1;
3570 }
3571 return -1;
3572 })
3573 .forEach(function (node) {
3574 var refBlot = null;
3575 if (node.nextSibling != null) {
3576 refBlot = Registry.find(node.nextSibling);
3577 }
3578 var blot = makeBlot(node);
3579 if (blot.next != refBlot || blot.next == null) {
3580 if (blot.parent != null) {
3581 blot.parent.removeChild(_this);
3582 }
3583 _this.insertBefore(blot, refBlot || undefined);
3584 }
3585 });
3586 };
3587 return ContainerBlot;
3588}(shadow_1.default));
3589function makeBlot(node) {
3590 var blot = Registry.find(node);
3591 if (blot == null) {
3592 try {
3593 blot = Registry.create(node);
3594 }
3595 catch (e) {
3596 blot = Registry.create(Registry.Scope.INLINE);
3597 [].slice.call(node.childNodes).forEach(function (child) {
3598 // @ts-ignore
3599 blot.domNode.appendChild(child);
3600 });
3601 if (node.parentNode) {
3602 node.parentNode.replaceChild(blot.domNode, node);
3603 }
3604 blot.attach();
3605 }
3606 }
3607 return blot;
3608}
3609exports.default = ContainerBlot;
3610
3611
3612/***/ }),
3613/* 18 */
3614/***/ (function(module, exports, __webpack_require__) {
3615
3616"use strict";
3617
3618var __extends = (this && this.__extends) || (function () {
3619 var extendStatics = Object.setPrototypeOf ||
3620 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3621 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3622 return function (d, b) {
3623 extendStatics(d, b);
3624 function __() { this.constructor = d; }
3625 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3626 };
3627})();
3628Object.defineProperty(exports, "__esModule", { value: true });
3629var attributor_1 = __webpack_require__(12);
3630var store_1 = __webpack_require__(31);
3631var container_1 = __webpack_require__(17);
3632var Registry = __webpack_require__(1);
3633var FormatBlot = /** @class */ (function (_super) {
3634 __extends(FormatBlot, _super);
3635 function FormatBlot(domNode) {
3636 var _this = _super.call(this, domNode) || this;
3637 _this.attributes = new store_1.default(_this.domNode);
3638 return _this;
3639 }
3640 FormatBlot.formats = function (domNode) {
3641 if (typeof this.tagName === 'string') {
3642 return true;
3643 }
3644 else if (Array.isArray(this.tagName)) {
3645 return domNode.tagName.toLowerCase();
3646 }
3647 return undefined;
3648 };
3649 FormatBlot.prototype.format = function (name, value) {
3650 var format = Registry.query(name);
3651 if (format instanceof attributor_1.default) {
3652 this.attributes.attribute(format, value);
3653 }
3654 else if (value) {
3655 if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
3656 this.replaceWith(name, value);
3657 }
3658 }
3659 };
3660 FormatBlot.prototype.formats = function () {
3661 var formats = this.attributes.values();
3662 var format = this.statics.formats(this.domNode);
3663 if (format != null) {
3664 formats[this.statics.blotName] = format;
3665 }
3666 return formats;
3667 };
3668 FormatBlot.prototype.replaceWith = function (name, value) {
3669 var replacement = _super.prototype.replaceWith.call(this, name, value);
3670 this.attributes.copy(replacement);
3671 return replacement;
3672 };
3673 FormatBlot.prototype.update = function (mutations, context) {
3674 var _this = this;
3675 _super.prototype.update.call(this, mutations, context);
3676 if (mutations.some(function (mutation) {
3677 return mutation.target === _this.domNode && mutation.type === 'attributes';
3678 })) {
3679 this.attributes.build();
3680 }
3681 };
3682 FormatBlot.prototype.wrap = function (name, value) {
3683 var wrapper = _super.prototype.wrap.call(this, name, value);
3684 if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
3685 this.attributes.move(wrapper);
3686 }
3687 return wrapper;
3688 };
3689 return FormatBlot;
3690}(container_1.default));
3691exports.default = FormatBlot;
3692
3693
3694/***/ }),
3695/* 19 */
3696/***/ (function(module, exports, __webpack_require__) {
3697
3698"use strict";
3699
3700var __extends = (this && this.__extends) || (function () {
3701 var extendStatics = Object.setPrototypeOf ||
3702 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3703 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3704 return function (d, b) {
3705 extendStatics(d, b);
3706 function __() { this.constructor = d; }
3707 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3708 };
3709})();
3710Object.defineProperty(exports, "__esModule", { value: true });
3711var shadow_1 = __webpack_require__(30);
3712var Registry = __webpack_require__(1);
3713var LeafBlot = /** @class */ (function (_super) {
3714 __extends(LeafBlot, _super);
3715 function LeafBlot() {
3716 return _super !== null && _super.apply(this, arguments) || this;
3717 }
3718 LeafBlot.value = function (domNode) {
3719 return true;
3720 };
3721 LeafBlot.prototype.index = function (node, offset) {
3722 if (this.domNode === node ||
3723 this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
3724 return Math.min(offset, 1);
3725 }
3726 return -1;
3727 };
3728 LeafBlot.prototype.position = function (index, inclusive) {
3729 var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
3730 if (index > 0)
3731 offset += 1;
3732 return [this.parent.domNode, offset];
3733 };
3734 LeafBlot.prototype.value = function () {
3735 var _a;
3736 return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
3737 };
3738 LeafBlot.scope = Registry.Scope.INLINE_BLOT;
3739 return LeafBlot;
3740}(shadow_1.default));
3741exports.default = LeafBlot;
3742
3743
3744/***/ }),
3745/* 20 */
3746/***/ (function(module, exports, __webpack_require__) {
3747
3748var equal = __webpack_require__(11);
3749var extend = __webpack_require__(3);
3750
3751
3752var lib = {
3753 attributes: {
3754 compose: function (a, b, keepNull) {
3755 if (typeof a !== 'object') a = {};
3756 if (typeof b !== 'object') b = {};
3757 var attributes = extend(true, {}, b);
3758 if (!keepNull) {
3759 attributes = Object.keys(attributes).reduce(function (copy, key) {
3760 if (attributes[key] != null) {
3761 copy[key] = attributes[key];
3762 }
3763 return copy;
3764 }, {});
3765 }
3766 for (var key in a) {
3767 if (a[key] !== undefined && b[key] === undefined) {
3768 attributes[key] = a[key];
3769 }
3770 }
3771 return Object.keys(attributes).length > 0 ? attributes : undefined;
3772 },
3773
3774 diff: function(a, b) {
3775 if (typeof a !== 'object') a = {};
3776 if (typeof b !== 'object') b = {};
3777 var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
3778 if (!equal(a[key], b[key])) {
3779 attributes[key] = b[key] === undefined ? null : b[key];
3780 }
3781 return attributes;
3782 }, {});
3783 return Object.keys(attributes).length > 0 ? attributes : undefined;
3784 },
3785
3786 transform: function (a, b, priority) {
3787 if (typeof a !== 'object') return b;
3788 if (typeof b !== 'object') return undefined;
3789 if (!priority) return b; // b simply overwrites us without priority
3790 var attributes = Object.keys(b).reduce(function (attributes, key) {
3791 if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
3792 return attributes;
3793 }, {});
3794 return Object.keys(attributes).length > 0 ? attributes : undefined;
3795 }
3796 },
3797
3798 iterator: function (ops) {
3799 return new Iterator(ops);
3800 },
3801
3802 length: function (op) {
3803 if (typeof op['delete'] === 'number') {
3804 return op['delete'];
3805 } else if (typeof op.retain === 'number') {
3806 return op.retain;
3807 } else {
3808 return typeof op.insert === 'string' ? op.insert.length : 1;
3809 }
3810 }
3811};
3812
3813
3814function Iterator(ops) {
3815 this.ops = ops;
3816 this.index = 0;
3817 this.offset = 0;
3818};
3819
3820Iterator.prototype.hasNext = function () {
3821 return this.peekLength() < Infinity;
3822};
3823
3824Iterator.prototype.next = function (length) {
3825 if (!length) length = Infinity;
3826 var nextOp = this.ops[this.index];
3827 if (nextOp) {
3828 var offset = this.offset;
3829 var opLength = lib.length(nextOp)
3830 if (length >= opLength - offset) {
3831 length = opLength - offset;
3832 this.index += 1;
3833 this.offset = 0;
3834 } else {
3835 this.offset += length;
3836 }
3837 if (typeof nextOp['delete'] === 'number') {
3838 return { 'delete': length };
3839 } else {
3840 var retOp = {};
3841 if (nextOp.attributes) {
3842 retOp.attributes = nextOp.attributes;
3843 }
3844 if (typeof nextOp.retain === 'number') {
3845 retOp.retain = length;
3846 } else if (typeof nextOp.insert === 'string') {
3847 retOp.insert = nextOp.insert.substr(offset, length);
3848 } else {
3849 // offset should === 0, length should === 1
3850 retOp.insert = nextOp.insert;
3851 }
3852 return retOp;
3853 }
3854 } else {
3855 return { retain: Infinity };
3856 }
3857};
3858
3859Iterator.prototype.peek = function () {
3860 return this.ops[this.index];
3861};
3862
3863Iterator.prototype.peekLength = function () {
3864 if (this.ops[this.index]) {
3865 // Should never return 0 if our index is being managed correctly
3866 return lib.length(this.ops[this.index]) - this.offset;
3867 } else {
3868 return Infinity;
3869 }
3870};
3871
3872Iterator.prototype.peekType = function () {
3873 if (this.ops[this.index]) {
3874 if (typeof this.ops[this.index]['delete'] === 'number') {
3875 return 'delete';
3876 } else if (typeof this.ops[this.index].retain === 'number') {
3877 return 'retain';
3878 } else {
3879 return 'insert';
3880 }
3881 }
3882 return 'retain';
3883};
3884
3885Iterator.prototype.rest = function () {
3886 if (!this.hasNext()) {
3887 return [];
3888 } else if (this.offset === 0) {
3889 return this.ops.slice(this.index);
3890 } else {
3891 var offset = this.offset;
3892 var index = this.index;
3893 var next = this.next();
3894 var rest = this.ops.slice(this.index);
3895 this.offset = offset;
3896 this.index = index;
3897 return [next].concat(rest);
3898 }
3899};
3900
3901
3902module.exports = lib;
3903
3904
3905/***/ }),
3906/* 21 */
3907/***/ (function(module, exports) {
3908
3909var clone = (function() {
3910'use strict';
3911
3912function _instanceof(obj, type) {
3913 return type != null && obj instanceof type;
3914}
3915
3916var nativeMap;
3917try {
3918 nativeMap = Map;
3919} catch(_) {
3920 // maybe a reference error because no `Map`. Give it a dummy value that no
3921 // value will ever be an instanceof.
3922 nativeMap = function() {};
3923}
3924
3925var nativeSet;
3926try {
3927 nativeSet = Set;
3928} catch(_) {
3929 nativeSet = function() {};
3930}
3931
3932var nativePromise;
3933try {
3934 nativePromise = Promise;
3935} catch(_) {
3936 nativePromise = function() {};
3937}
3938
3939/**
3940 * Clones (copies) an Object using deep copying.
3941 *
3942 * This function supports circular references by default, but if you are certain
3943 * there are no circular references in your object, you can save some CPU time
3944 * by calling clone(obj, false).
3945 *
3946 * Caution: if `circular` is false and `parent` contains circular references,
3947 * your program may enter an infinite loop and crash.
3948 *
3949 * @param `parent` - the object to be cloned
3950 * @param `circular` - set to true if the object to be cloned may contain
3951 * circular references. (optional - true by default)
3952 * @param `depth` - set to a number if the object is only to be cloned to
3953 * a particular depth. (optional - defaults to Infinity)
3954 * @param `prototype` - sets the prototype to be used when cloning an object.
3955 * (optional - defaults to parent prototype).
3956 * @param `includeNonEnumerable` - set to true if the non-enumerable properties
3957 * should be cloned as well. Non-enumerable properties on the prototype
3958 * chain will be ignored. (optional - false by default)
3959*/
3960function clone(parent, circular, depth, prototype, includeNonEnumerable) {
3961 if (typeof circular === 'object') {
3962 depth = circular.depth;
3963 prototype = circular.prototype;
3964 includeNonEnumerable = circular.includeNonEnumerable;
3965 circular = circular.circular;
3966 }
3967 // maintain two arrays for circular references, where corresponding parents
3968 // and children have the same index
3969 var allParents = [];
3970 var allChildren = [];
3971
3972 var useBuffer = typeof Buffer != 'undefined';
3973
3974 if (typeof circular == 'undefined')
3975 circular = true;
3976
3977 if (typeof depth == 'undefined')
3978 depth = Infinity;
3979
3980 // recurse this function so we don't reset allParents and allChildren
3981 function _clone(parent, depth) {
3982 // cloning null always returns null
3983 if (parent === null)
3984 return null;
3985
3986 if (depth === 0)
3987 return parent;
3988
3989 var child;
3990 var proto;
3991 if (typeof parent != 'object') {
3992 return parent;
3993 }
3994
3995 if (_instanceof(parent, nativeMap)) {
3996 child = new nativeMap();
3997 } else if (_instanceof(parent, nativeSet)) {
3998 child = new nativeSet();
3999 } else if (_instanceof(parent, nativePromise)) {
4000 child = new nativePromise(function (resolve, reject) {
4001 parent.then(function(value) {
4002 resolve(_clone(value, depth - 1));
4003 }, function(err) {
4004 reject(_clone(err, depth - 1));
4005 });
4006 });
4007 } else if (clone.__isArray(parent)) {
4008 child = [];
4009 } else if (clone.__isRegExp(parent)) {
4010 child = new RegExp(parent.source, __getRegExpFlags(parent));
4011 if (parent.lastIndex) child.lastIndex = parent.lastIndex;
4012 } else if (clone.__isDate(parent)) {
4013 child = new Date(parent.getTime());
4014 } else if (useBuffer && Buffer.isBuffer(parent)) {
4015 if (Buffer.allocUnsafe) {
4016 // Node.js >= 4.5.0
4017 child = Buffer.allocUnsafe(parent.length);
4018 } else {
4019 // Older Node.js versions
4020 child = new Buffer(parent.length);
4021 }
4022 parent.copy(child);
4023 return child;
4024 } else if (_instanceof(parent, Error)) {
4025 child = Object.create(parent);
4026 } else {
4027 if (typeof prototype == 'undefined') {
4028 proto = Object.getPrototypeOf(parent);
4029 child = Object.create(proto);
4030 }
4031 else {
4032 child = Object.create(prototype);
4033 proto = prototype;
4034 }
4035 }
4036
4037 if (circular) {
4038 var index = allParents.indexOf(parent);
4039
4040 if (index != -1) {
4041 return allChildren[index];
4042 }
4043 allParents.push(parent);
4044 allChildren.push(child);
4045 }
4046
4047 if (_instanceof(parent, nativeMap)) {
4048 parent.forEach(function(value, key) {
4049 var keyChild = _clone(key, depth - 1);
4050 var valueChild = _clone(value, depth - 1);
4051 child.set(keyChild, valueChild);
4052 });
4053 }
4054 if (_instanceof(parent, nativeSet)) {
4055 parent.forEach(function(value) {
4056 var entryChild = _clone(value, depth - 1);
4057 child.add(entryChild);
4058 });
4059 }
4060
4061 for (var i in parent) {
4062 var attrs;
4063 if (proto) {
4064 attrs = Object.getOwnPropertyDescriptor(proto, i);
4065 }
4066
4067 if (attrs && attrs.set == null) {
4068 continue;
4069 }
4070 child[i] = _clone(parent[i], depth - 1);
4071 }
4072
4073 if (Object.getOwnPropertySymbols) {
4074 var symbols = Object.getOwnPropertySymbols(parent);
4075 for (var i = 0; i < symbols.length; i++) {
4076 // Don't need to worry about cloning a symbol because it is a primitive,
4077 // like a number or string.
4078 var symbol = symbols[i];
4079 var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
4080 if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
4081 continue;
4082 }
4083 child[symbol] = _clone(parent[symbol], depth - 1);
4084 if (!descriptor.enumerable) {
4085 Object.defineProperty(child, symbol, {
4086 enumerable: false
4087 });
4088 }
4089 }
4090 }
4091
4092 if (includeNonEnumerable) {
4093 var allPropertyNames = Object.getOwnPropertyNames(parent);
4094 for (var i = 0; i < allPropertyNames.length; i++) {
4095 var propertyName = allPropertyNames[i];
4096 var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
4097 if (descriptor && descriptor.enumerable) {
4098 continue;
4099 }
4100 child[propertyName] = _clone(parent[propertyName], depth - 1);
4101 Object.defineProperty(child, propertyName, {
4102 enumerable: false
4103 });
4104 }
4105 }
4106
4107 return child;
4108 }
4109
4110 return _clone(parent, depth);
4111}
4112
4113/**
4114 * Simple flat clone using prototype, accepts only objects, usefull for property
4115 * override on FLAT configuration object (no nested props).
4116 *
4117 * USE WITH CAUTION! This may not behave as you wish if you do not know how this
4118 * works.
4119 */
4120clone.clonePrototype = function clonePrototype(parent) {
4121 if (parent === null)
4122 return null;
4123
4124 var c = function () {};
4125 c.prototype = parent;
4126 return new c();
4127};
4128
4129// private utility functions
4130
4131function __objToStr(o) {
4132 return Object.prototype.toString.call(o);
4133}
4134clone.__objToStr = __objToStr;
4135
4136function __isDate(o) {
4137 return typeof o === 'object' && __objToStr(o) === '[object Date]';
4138}
4139clone.__isDate = __isDate;
4140
4141function __isArray(o) {
4142 return typeof o === 'object' && __objToStr(o) === '[object Array]';
4143}
4144clone.__isArray = __isArray;
4145
4146function __isRegExp(o) {
4147 return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
4148}
4149clone.__isRegExp = __isRegExp;
4150
4151function __getRegExpFlags(re) {
4152 var flags = '';
4153 if (re.global) flags += 'g';
4154 if (re.ignoreCase) flags += 'i';
4155 if (re.multiline) flags += 'm';
4156 return flags;
4157}
4158clone.__getRegExpFlags = __getRegExpFlags;
4159
4160return clone;
4161})();
4162
4163if (typeof module === 'object' && module.exports) {
4164 module.exports = clone;
4165}
4166
4167
4168/***/ }),
4169/* 22 */
4170/***/ (function(module, exports, __webpack_require__) {
4171
4172"use strict";
4173
4174
4175Object.defineProperty(exports, "__esModule", {
4176 value: true
4177});
4178
4179var _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"); } }; }();
4180
4181var _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; }; }();
4182
4183var _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); } };
4184
4185var _parchment = __webpack_require__(0);
4186
4187var _parchment2 = _interopRequireDefault(_parchment);
4188
4189var _emitter = __webpack_require__(8);
4190
4191var _emitter2 = _interopRequireDefault(_emitter);
4192
4193var _block = __webpack_require__(4);
4194
4195var _block2 = _interopRequireDefault(_block);
4196
4197var _break = __webpack_require__(16);
4198
4199var _break2 = _interopRequireDefault(_break);
4200
4201var _code = __webpack_require__(13);
4202
4203var _code2 = _interopRequireDefault(_code);
4204
4205var _container = __webpack_require__(25);
4206
4207var _container2 = _interopRequireDefault(_container);
4208
4209function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4210
4211function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4212
4213function _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; }
4214
4215function _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; }
4216
4217function isLine(blot) {
4218 return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
4219}
4220
4221var Scroll = function (_Parchment$Scroll) {
4222 _inherits(Scroll, _Parchment$Scroll);
4223
4224 function Scroll(domNode, config) {
4225 _classCallCheck(this, Scroll);
4226
4227 var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
4228
4229 _this.emitter = config.emitter;
4230 if (Array.isArray(config.whitelist)) {
4231 _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
4232 whitelist[format] = true;
4233 return whitelist;
4234 }, {});
4235 }
4236 // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
4237 _this.domNode.addEventListener('DOMNodeInserted', function () {});
4238 _this.optimize();
4239 _this.enable();
4240 return _this;
4241 }
4242
4243 _createClass(Scroll, [{
4244 key: 'batchStart',
4245 value: function batchStart() {
4246 this.batch = true;
4247 }
4248 }, {
4249 key: 'batchEnd',
4250 value: function batchEnd() {
4251 this.batch = false;
4252 this.optimize();
4253 }
4254 }, {
4255 key: 'deleteAt',
4256 value: function deleteAt(index, length) {
4257 var _line = this.line(index),
4258 _line2 = _slicedToArray(_line, 2),
4259 first = _line2[0],
4260 offset = _line2[1];
4261
4262 var _line3 = this.line(index + length),
4263 _line4 = _slicedToArray(_line3, 1),
4264 last = _line4[0];
4265
4266 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
4267 if (last != null && first !== last && offset > 0) {
4268 if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {
4269 this.optimize();
4270 return;
4271 }
4272 if (first instanceof _code2.default) {
4273 var newlineIndex = first.newlineIndex(first.length(), true);
4274 if (newlineIndex > -1) {
4275 first = first.split(newlineIndex + 1);
4276 if (first === last) {
4277 this.optimize();
4278 return;
4279 }
4280 }
4281 } else if (last instanceof _code2.default) {
4282 var _newlineIndex = last.newlineIndex(0);
4283 if (_newlineIndex > -1) {
4284 last.split(_newlineIndex + 1);
4285 }
4286 }
4287 var ref = last.children.head instanceof _break2.default ? null : last.children.head;
4288 first.moveChildren(last, ref);
4289 first.remove();
4290 }
4291 this.optimize();
4292 }
4293 }, {
4294 key: 'enable',
4295 value: function enable() {
4296 var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4297
4298 this.domNode.setAttribute('contenteditable', enabled);
4299 }
4300 }, {
4301 key: 'formatAt',
4302 value: function formatAt(index, length, format, value) {
4303 if (this.whitelist != null && !this.whitelist[format]) return;
4304 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
4305 this.optimize();
4306 }
4307 }, {
4308 key: 'insertAt',
4309 value: function insertAt(index, value, def) {
4310 if (def != null && this.whitelist != null && !this.whitelist[value]) return;
4311 if (index >= this.length()) {
4312 if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
4313 var blot = _parchment2.default.create(this.statics.defaultChild);
4314 this.appendChild(blot);
4315 if (def == null && value.endsWith('\n')) {
4316 value = value.slice(0, -1);
4317 }
4318 blot.insertAt(0, value, def);
4319 } else {
4320 var embed = _parchment2.default.create(value, def);
4321 this.appendChild(embed);
4322 }
4323 } else {
4324 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
4325 }
4326 this.optimize();
4327 }
4328 }, {
4329 key: 'insertBefore',
4330 value: function insertBefore(blot, ref) {
4331 if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
4332 var wrapper = _parchment2.default.create(this.statics.defaultChild);
4333 wrapper.appendChild(blot);
4334 blot = wrapper;
4335 }
4336 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
4337 }
4338 }, {
4339 key: 'leaf',
4340 value: function leaf(index) {
4341 return this.path(index).pop() || [null, -1];
4342 }
4343 }, {
4344 key: 'line',
4345 value: function line(index) {
4346 if (index === this.length()) {
4347 return this.line(index - 1);
4348 }
4349 return this.descendant(isLine, index);
4350 }
4351 }, {
4352 key: 'lines',
4353 value: function lines() {
4354 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
4355 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
4356
4357 var getLines = function getLines(blot, index, length) {
4358 var lines = [],
4359 lengthLeft = length;
4360 blot.children.forEachAt(index, length, function (child, index, length) {
4361 if (isLine(child)) {
4362 lines.push(child);
4363 } else if (child instanceof _parchment2.default.Container) {
4364 lines = lines.concat(getLines(child, index, lengthLeft));
4365 }
4366 lengthLeft -= length;
4367 });
4368 return lines;
4369 };
4370 return getLines(this, index, length);
4371 }
4372 }, {
4373 key: 'optimize',
4374 value: function optimize() {
4375 var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4376 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4377
4378 if (this.batch === true) return;
4379 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);
4380 if (mutations.length > 0) {
4381 this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);
4382 }
4383 }
4384 }, {
4385 key: 'path',
4386 value: function path(index) {
4387 return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
4388 }
4389 }, {
4390 key: 'update',
4391 value: function update(mutations) {
4392 if (this.batch === true) return;
4393 var source = _emitter2.default.sources.USER;
4394 if (typeof mutations === 'string') {
4395 source = mutations;
4396 }
4397 if (!Array.isArray(mutations)) {
4398 mutations = this.observer.takeRecords();
4399 }
4400 if (mutations.length > 0) {
4401 this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
4402 }
4403 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
4404 if (mutations.length > 0) {
4405 this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
4406 }
4407 }
4408 }]);
4409
4410 return Scroll;
4411}(_parchment2.default.Scroll);
4412
4413Scroll.blotName = 'scroll';
4414Scroll.className = 'ql-editor';
4415Scroll.tagName = 'DIV';
4416Scroll.defaultChild = 'block';
4417Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
4418
4419exports.default = Scroll;
4420
4421/***/ }),
4422/* 23 */
4423/***/ (function(module, exports, __webpack_require__) {
4424
4425"use strict";
4426
4427
4428Object.defineProperty(exports, "__esModule", {
4429 value: true
4430});
4431exports.SHORTKEY = exports.default = undefined;
4432
4433var _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; };
4434
4435var _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"); } }; }();
4436
4437var _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; }; }();
4438
4439var _clone = __webpack_require__(21);
4440
4441var _clone2 = _interopRequireDefault(_clone);
4442
4443var _deepEqual = __webpack_require__(11);
4444
4445var _deepEqual2 = _interopRequireDefault(_deepEqual);
4446
4447var _extend = __webpack_require__(3);
4448
4449var _extend2 = _interopRequireDefault(_extend);
4450
4451var _quillDelta = __webpack_require__(2);
4452
4453var _quillDelta2 = _interopRequireDefault(_quillDelta);
4454
4455var _op = __webpack_require__(20);
4456
4457var _op2 = _interopRequireDefault(_op);
4458
4459var _parchment = __webpack_require__(0);
4460
4461var _parchment2 = _interopRequireDefault(_parchment);
4462
4463var _quill = __webpack_require__(5);
4464
4465var _quill2 = _interopRequireDefault(_quill);
4466
4467var _logger = __webpack_require__(10);
4468
4469var _logger2 = _interopRequireDefault(_logger);
4470
4471var _module = __webpack_require__(9);
4472
4473var _module2 = _interopRequireDefault(_module);
4474
4475function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4476
4477function _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; }
4478
4479function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4480
4481function _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; }
4482
4483function _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; }
4484
4485var debug = (0, _logger2.default)('quill:keyboard');
4486
4487var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
4488
4489var Keyboard = function (_Module) {
4490 _inherits(Keyboard, _Module);
4491
4492 _createClass(Keyboard, null, [{
4493 key: 'match',
4494 value: function match(evt, binding) {
4495 binding = normalize(binding);
4496 if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
4497 return !!binding[key] !== evt[key] && binding[key] !== null;
4498 })) {
4499 return false;
4500 }
4501 return binding.key === (evt.which || evt.keyCode);
4502 }
4503 }]);
4504
4505 function Keyboard(quill, options) {
4506 _classCallCheck(this, Keyboard);
4507
4508 var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
4509
4510 _this.bindings = {};
4511 Object.keys(_this.options.bindings).forEach(function (name) {
4512 if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {
4513 return;
4514 }
4515 if (_this.options.bindings[name]) {
4516 _this.addBinding(_this.options.bindings[name]);
4517 }
4518 });
4519 _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
4520 _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
4521 if (/Firefox/i.test(navigator.userAgent)) {
4522 // Need to handle delete and backspace for Firefox in the general case #1171
4523 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
4524 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
4525 } else {
4526 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
4527 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
4528 }
4529 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
4530 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
4531 _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
4532 _this.listen();
4533 return _this;
4534 }
4535
4536 _createClass(Keyboard, [{
4537 key: 'addBinding',
4538 value: function addBinding(key) {
4539 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4540 var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4541
4542 var binding = normalize(key);
4543 if (binding == null || binding.key == null) {
4544 return debug.warn('Attempted to add invalid keyboard binding', binding);
4545 }
4546 if (typeof context === 'function') {
4547 context = { handler: context };
4548 }
4549 if (typeof handler === 'function') {
4550 handler = { handler: handler };
4551 }
4552 binding = (0, _extend2.default)(binding, context, handler);
4553 this.bindings[binding.key] = this.bindings[binding.key] || [];
4554 this.bindings[binding.key].push(binding);
4555 }
4556 }, {
4557 key: 'listen',
4558 value: function listen() {
4559 var _this2 = this;
4560
4561 this.quill.root.addEventListener('keydown', function (evt) {
4562 if (evt.defaultPrevented) return;
4563 var which = evt.which || evt.keyCode;
4564 var bindings = (_this2.bindings[which] || []).filter(function (binding) {
4565 return Keyboard.match(evt, binding);
4566 });
4567 if (bindings.length === 0) return;
4568 var range = _this2.quill.getSelection();
4569 if (range == null || !_this2.quill.hasFocus()) return;
4570
4571 var _quill$getLine = _this2.quill.getLine(range.index),
4572 _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
4573 line = _quill$getLine2[0],
4574 offset = _quill$getLine2[1];
4575
4576 var _quill$getLeaf = _this2.quill.getLeaf(range.index),
4577 _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
4578 leafStart = _quill$getLeaf2[0],
4579 offsetStart = _quill$getLeaf2[1];
4580
4581 var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
4582 _ref2 = _slicedToArray(_ref, 2),
4583 leafEnd = _ref2[0],
4584 offsetEnd = _ref2[1];
4585
4586 var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
4587 var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
4588 var curContext = {
4589 collapsed: range.length === 0,
4590 empty: range.length === 0 && line.length() <= 1,
4591 format: _this2.quill.getFormat(range),
4592 offset: offset,
4593 prefix: prefixText,
4594 suffix: suffixText
4595 };
4596 var prevented = bindings.some(function (binding) {
4597 if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
4598 if (binding.empty != null && binding.empty !== curContext.empty) return false;
4599 if (binding.offset != null && binding.offset !== curContext.offset) return false;
4600 if (Array.isArray(binding.format)) {
4601 // any format is present
4602 if (binding.format.every(function (name) {
4603 return curContext.format[name] == null;
4604 })) {
4605 return false;
4606 }
4607 } else if (_typeof(binding.format) === 'object') {
4608 // all formats must match
4609 if (!Object.keys(binding.format).every(function (name) {
4610 if (binding.format[name] === true) return curContext.format[name] != null;
4611 if (binding.format[name] === false) return curContext.format[name] == null;
4612 return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
4613 })) {
4614 return false;
4615 }
4616 }
4617 if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
4618 if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
4619 return binding.handler.call(_this2, range, curContext) !== true;
4620 });
4621 if (prevented) {
4622 evt.preventDefault();
4623 }
4624 });
4625 }
4626 }]);
4627
4628 return Keyboard;
4629}(_module2.default);
4630
4631Keyboard.keys = {
4632 BACKSPACE: 8,
4633 TAB: 9,
4634 ENTER: 13,
4635 ESCAPE: 27,
4636 LEFT: 37,
4637 UP: 38,
4638 RIGHT: 39,
4639 DOWN: 40,
4640 DELETE: 46
4641};
4642
4643Keyboard.DEFAULTS = {
4644 bindings: {
4645 'bold': makeFormatHandler('bold'),
4646 'italic': makeFormatHandler('italic'),
4647 'underline': makeFormatHandler('underline'),
4648 'indent': {
4649 // highlight tab or tab at beginning of list, indent or blockquote
4650 key: Keyboard.keys.TAB,
4651 format: ['blockquote', 'indent', 'list'],
4652 handler: function handler(range, context) {
4653 if (context.collapsed && context.offset !== 0) return true;
4654 this.quill.format('indent', '+1', _quill2.default.sources.USER);
4655 }
4656 },
4657 'outdent': {
4658 key: Keyboard.keys.TAB,
4659 shiftKey: true,
4660 format: ['blockquote', 'indent', 'list'],
4661 // highlight tab or tab at beginning of list, indent or blockquote
4662 handler: function handler(range, context) {
4663 if (context.collapsed && context.offset !== 0) return true;
4664 this.quill.format('indent', '-1', _quill2.default.sources.USER);
4665 }
4666 },
4667 'outdent backspace': {
4668 key: Keyboard.keys.BACKSPACE,
4669 collapsed: true,
4670 shiftKey: null,
4671 metaKey: null,
4672 ctrlKey: null,
4673 altKey: null,
4674 format: ['indent', 'list'],
4675 offset: 0,
4676 handler: function handler(range, context) {
4677 if (context.format.indent != null) {
4678 this.quill.format('indent', '-1', _quill2.default.sources.USER);
4679 } else if (context.format.list != null) {
4680 this.quill.format('list', false, _quill2.default.sources.USER);
4681 }
4682 }
4683 },
4684 'indent code-block': makeCodeBlockHandler(true),
4685 'outdent code-block': makeCodeBlockHandler(false),
4686 'remove tab': {
4687 key: Keyboard.keys.TAB,
4688 shiftKey: true,
4689 collapsed: true,
4690 prefix: /\t$/,
4691 handler: function handler(range) {
4692 this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
4693 }
4694 },
4695 'tab': {
4696 key: Keyboard.keys.TAB,
4697 handler: function handler(range) {
4698 this.quill.history.cutoff();
4699 var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\t');
4700 this.quill.updateContents(delta, _quill2.default.sources.USER);
4701 this.quill.history.cutoff();
4702 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4703 }
4704 },
4705 'list empty enter': {
4706 key: Keyboard.keys.ENTER,
4707 collapsed: true,
4708 format: ['list'],
4709 empty: true,
4710 handler: function handler(range, context) {
4711 this.quill.format('list', false, _quill2.default.sources.USER);
4712 if (context.format.indent) {
4713 this.quill.format('indent', false, _quill2.default.sources.USER);
4714 }
4715 }
4716 },
4717 'checklist enter': {
4718 key: Keyboard.keys.ENTER,
4719 collapsed: true,
4720 format: { list: 'checked' },
4721 handler: function handler(range) {
4722 var _quill$getLine3 = this.quill.getLine(range.index),
4723 _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),
4724 line = _quill$getLine4[0],
4725 offset = _quill$getLine4[1];
4726
4727 var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });
4728 var delta = new _quillDelta2.default().retain(range.index).insert('\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });
4729 this.quill.updateContents(delta, _quill2.default.sources.USER);
4730 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4731 this.quill.scrollIntoView();
4732 }
4733 },
4734 'header enter': {
4735 key: Keyboard.keys.ENTER,
4736 collapsed: true,
4737 format: ['header'],
4738 suffix: /^$/,
4739 handler: function handler(range, context) {
4740 var _quill$getLine5 = this.quill.getLine(range.index),
4741 _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),
4742 line = _quill$getLine6[0],
4743 offset = _quill$getLine6[1];
4744
4745 var delta = new _quillDelta2.default().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });
4746 this.quill.updateContents(delta, _quill2.default.sources.USER);
4747 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4748 this.quill.scrollIntoView();
4749 }
4750 },
4751 'list autofill': {
4752 key: ' ',
4753 collapsed: true,
4754 format: { list: false },
4755 prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
4756 handler: function handler(range, context) {
4757 var length = context.prefix.length;
4758
4759 var _quill$getLine7 = this.quill.getLine(range.index),
4760 _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),
4761 line = _quill$getLine8[0],
4762 offset = _quill$getLine8[1];
4763
4764 if (offset > length) return true;
4765 var value = void 0;
4766 switch (context.prefix.trim()) {
4767 case '[]':case '[ ]':
4768 value = 'unchecked';
4769 break;
4770 case '[x]':
4771 value = 'checked';
4772 break;
4773 case '-':case '*':
4774 value = 'bullet';
4775 break;
4776 default:
4777 value = 'ordered';
4778 }
4779 this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);
4780 this.quill.history.cutoff();
4781 var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });
4782 this.quill.updateContents(delta, _quill2.default.sources.USER);
4783 this.quill.history.cutoff();
4784 this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
4785 }
4786 },
4787 'code exit': {
4788 key: Keyboard.keys.ENTER,
4789 collapsed: true,
4790 format: ['code-block'],
4791 prefix: /\n\n$/,
4792 suffix: /^\s+$/,
4793 handler: function handler(range) {
4794 var _quill$getLine9 = this.quill.getLine(range.index),
4795 _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),
4796 line = _quill$getLine10[0],
4797 offset = _quill$getLine10[1];
4798
4799 var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);
4800 this.quill.updateContents(delta, _quill2.default.sources.USER);
4801 }
4802 },
4803 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),
4804 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),
4805 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),
4806 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)
4807 }
4808};
4809
4810function makeEmbedArrowHandler(key, shiftKey) {
4811 var _ref3;
4812
4813 var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';
4814 return _ref3 = {
4815 key: key,
4816 shiftKey: shiftKey,
4817 altKey: null
4818 }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {
4819 var index = range.index;
4820 if (key === Keyboard.keys.RIGHT) {
4821 index += range.length + 1;
4822 }
4823
4824 var _quill$getLeaf3 = this.quill.getLeaf(index),
4825 _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),
4826 leaf = _quill$getLeaf4[0];
4827
4828 if (!(leaf instanceof _parchment2.default.Embed)) return true;
4829 if (key === Keyboard.keys.LEFT) {
4830 if (shiftKey) {
4831 this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);
4832 } else {
4833 this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);
4834 }
4835 } else {
4836 if (shiftKey) {
4837 this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);
4838 } else {
4839 this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);
4840 }
4841 }
4842 return false;
4843 }), _ref3;
4844}
4845
4846function handleBackspace(range, context) {
4847 if (range.index === 0 || this.quill.getLength() <= 1) return;
4848
4849 var _quill$getLine11 = this.quill.getLine(range.index),
4850 _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
4851 line = _quill$getLine12[0];
4852
4853 var formats = {};
4854 if (context.offset === 0) {
4855 var _quill$getLine13 = this.quill.getLine(range.index - 1),
4856 _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),
4857 prev = _quill$getLine14[0];
4858
4859 if (prev != null && prev.length() > 1) {
4860 var curFormats = line.formats();
4861 var prevFormats = this.quill.getFormat(range.index - 1, 1);
4862 formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
4863 }
4864 }
4865 // Check for astral symbols
4866 var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
4867 this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
4868 if (Object.keys(formats).length > 0) {
4869 this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
4870 }
4871 this.quill.focus();
4872}
4873
4874function handleDelete(range, context) {
4875 // Check for astral symbols
4876 var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
4877 if (range.index >= this.quill.getLength() - length) return;
4878 var formats = {},
4879 nextLength = 0;
4880
4881 var _quill$getLine15 = this.quill.getLine(range.index),
4882 _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),
4883 line = _quill$getLine16[0];
4884
4885 if (context.offset >= line.length() - 1) {
4886 var _quill$getLine17 = this.quill.getLine(range.index + 1),
4887 _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),
4888 next = _quill$getLine18[0];
4889
4890 if (next) {
4891 var curFormats = line.formats();
4892 var nextFormats = this.quill.getFormat(range.index, 1);
4893 formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
4894 nextLength = next.length();
4895 }
4896 }
4897 this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
4898 if (Object.keys(formats).length > 0) {
4899 this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
4900 }
4901}
4902
4903function handleDeleteRange(range) {
4904 var lines = this.quill.getLines(range);
4905 var formats = {};
4906 if (lines.length > 1) {
4907 var firstFormats = lines[0].formats();
4908 var lastFormats = lines[lines.length - 1].formats();
4909 formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};
4910 }
4911 this.quill.deleteText(range, _quill2.default.sources.USER);
4912 if (Object.keys(formats).length > 0) {
4913 this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);
4914 }
4915 this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
4916 this.quill.focus();
4917}
4918
4919function handleEnter(range, context) {
4920 var _this3 = this;
4921
4922 if (range.length > 0) {
4923 this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
4924 }
4925 var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
4926 if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
4927 lineFormats[format] = context.format[format];
4928 }
4929 return lineFormats;
4930 }, {});
4931 this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
4932 // Earlier scroll.deleteAt might have messed up our selection,
4933 // so insertText's built in selection preservation is not reliable
4934 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4935 this.quill.focus();
4936 Object.keys(context.format).forEach(function (name) {
4937 if (lineFormats[name] != null) return;
4938 if (Array.isArray(context.format[name])) return;
4939 if (name === 'link') return;
4940 _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
4941 });
4942}
4943
4944function makeCodeBlockHandler(indent) {
4945 return {
4946 key: Keyboard.keys.TAB,
4947 shiftKey: !indent,
4948 format: { 'code-block': true },
4949 handler: function handler(range) {
4950 var CodeBlock = _parchment2.default.query('code-block');
4951 var index = range.index,
4952 length = range.length;
4953
4954 var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
4955 _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
4956 block = _quill$scroll$descend2[0],
4957 offset = _quill$scroll$descend2[1];
4958
4959 if (block == null) return;
4960 var scrollIndex = this.quill.getIndex(block);
4961 var start = block.newlineIndex(offset, true) + 1;
4962 var end = block.newlineIndex(scrollIndex + offset + length);
4963 var lines = block.domNode.textContent.slice(start, end).split('\n');
4964 offset = 0;
4965 lines.forEach(function (line, i) {
4966 if (indent) {
4967 block.insertAt(start + offset, CodeBlock.TAB);
4968 offset += CodeBlock.TAB.length;
4969 if (i === 0) {
4970 index += CodeBlock.TAB.length;
4971 } else {
4972 length += CodeBlock.TAB.length;
4973 }
4974 } else if (line.startsWith(CodeBlock.TAB)) {
4975 block.deleteAt(start + offset, CodeBlock.TAB.length);
4976 offset -= CodeBlock.TAB.length;
4977 if (i === 0) {
4978 index -= CodeBlock.TAB.length;
4979 } else {
4980 length -= CodeBlock.TAB.length;
4981 }
4982 }
4983 offset += line.length + 1;
4984 });
4985 this.quill.update(_quill2.default.sources.USER);
4986 this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
4987 }
4988 };
4989}
4990
4991function makeFormatHandler(format) {
4992 return {
4993 key: format[0].toUpperCase(),
4994 shortKey: true,
4995 handler: function handler(range, context) {
4996 this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
4997 }
4998 };
4999}
5000
5001function normalize(binding) {
5002 if (typeof binding === 'string' || typeof binding === 'number') {
5003 return normalize({ key: binding });
5004 }
5005 if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
5006 binding = (0, _clone2.default)(binding, false);
5007 }
5008 if (typeof binding.key === 'string') {
5009 if (Keyboard.keys[binding.key.toUpperCase()] != null) {
5010 binding.key = Keyboard.keys[binding.key.toUpperCase()];
5011 } else if (binding.key.length === 1) {
5012 binding.key = binding.key.toUpperCase().charCodeAt(0);
5013 } else {
5014 return null;
5015 }
5016 }
5017 if (binding.shortKey) {
5018 binding[SHORTKEY] = binding.shortKey;
5019 delete binding.shortKey;
5020 }
5021 return binding;
5022}
5023
5024exports.default = Keyboard;
5025exports.SHORTKEY = SHORTKEY;
5026
5027/***/ }),
5028/* 24 */
5029/***/ (function(module, exports, __webpack_require__) {
5030
5031"use strict";
5032
5033
5034Object.defineProperty(exports, "__esModule", {
5035 value: true
5036});
5037
5038var _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"); } }; }();
5039
5040var _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); } };
5041
5042var _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; }; }();
5043
5044var _parchment = __webpack_require__(0);
5045
5046var _parchment2 = _interopRequireDefault(_parchment);
5047
5048var _text = __webpack_require__(7);
5049
5050var _text2 = _interopRequireDefault(_text);
5051
5052function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5053
5054function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5055
5056function _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; }
5057
5058function _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; }
5059
5060var Cursor = function (_Parchment$Embed) {
5061 _inherits(Cursor, _Parchment$Embed);
5062
5063 _createClass(Cursor, null, [{
5064 key: 'value',
5065 value: function value() {
5066 return undefined;
5067 }
5068 }]);
5069
5070 function Cursor(domNode, selection) {
5071 _classCallCheck(this, Cursor);
5072
5073 var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
5074
5075 _this.selection = selection;
5076 _this.textNode = document.createTextNode(Cursor.CONTENTS);
5077 _this.domNode.appendChild(_this.textNode);
5078 _this._length = 0;
5079 return _this;
5080 }
5081
5082 _createClass(Cursor, [{
5083 key: 'detach',
5084 value: function detach() {
5085 // super.detach() will also clear domNode.__blot
5086 if (this.parent != null) this.parent.removeChild(this);
5087 }
5088 }, {
5089 key: 'format',
5090 value: function format(name, value) {
5091 if (this._length !== 0) {
5092 return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
5093 }
5094 var target = this,
5095 index = 0;
5096 while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
5097 index += target.offset(target.parent);
5098 target = target.parent;
5099 }
5100 if (target != null) {
5101 this._length = Cursor.CONTENTS.length;
5102 target.optimize();
5103 target.formatAt(index, Cursor.CONTENTS.length, name, value);
5104 this._length = 0;
5105 }
5106 }
5107 }, {
5108 key: 'index',
5109 value: function index(node, offset) {
5110 if (node === this.textNode) return 0;
5111 return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
5112 }
5113 }, {
5114 key: 'length',
5115 value: function length() {
5116 return this._length;
5117 }
5118 }, {
5119 key: 'position',
5120 value: function position() {
5121 return [this.textNode, this.textNode.data.length];
5122 }
5123 }, {
5124 key: 'remove',
5125 value: function remove() {
5126 _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
5127 this.parent = null;
5128 }
5129 }, {
5130 key: 'restore',
5131 value: function restore() {
5132 if (this.selection.composing || this.parent == null) return;
5133 var textNode = this.textNode;
5134 var range = this.selection.getNativeRange();
5135 var restoreText = void 0,
5136 start = void 0,
5137 end = void 0;
5138 if (range != null && range.start.node === textNode && range.end.node === textNode) {
5139 var _ref = [textNode, range.start.offset, range.end.offset];
5140 restoreText = _ref[0];
5141 start = _ref[1];
5142 end = _ref[2];
5143 }
5144 // Link format will insert text outside of anchor tag
5145 while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
5146 this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
5147 }
5148 if (this.textNode.data !== Cursor.CONTENTS) {
5149 var text = this.textNode.data.split(Cursor.CONTENTS).join('');
5150 if (this.next instanceof _text2.default) {
5151 restoreText = this.next.domNode;
5152 this.next.insertAt(0, text);
5153 this.textNode.data = Cursor.CONTENTS;
5154 } else {
5155 this.textNode.data = text;
5156 this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
5157 this.textNode = document.createTextNode(Cursor.CONTENTS);
5158 this.domNode.appendChild(this.textNode);
5159 }
5160 }
5161 this.remove();
5162 if (start != null) {
5163 var _map = [start, end].map(function (offset) {
5164 return Math.max(0, Math.min(restoreText.data.length, offset - 1));
5165 });
5166
5167 var _map2 = _slicedToArray(_map, 2);
5168
5169 start = _map2[0];
5170 end = _map2[1];
5171
5172 return {
5173 startNode: restoreText,
5174 startOffset: start,
5175 endNode: restoreText,
5176 endOffset: end
5177 };
5178 }
5179 }
5180 }, {
5181 key: 'update',
5182 value: function update(mutations, context) {
5183 var _this2 = this;
5184
5185 if (mutations.some(function (mutation) {
5186 return mutation.type === 'characterData' && mutation.target === _this2.textNode;
5187 })) {
5188 var range = this.restore();
5189 if (range) context.range = range;
5190 }
5191 }
5192 }, {
5193 key: 'value',
5194 value: function value() {
5195 return '';
5196 }
5197 }]);
5198
5199 return Cursor;
5200}(_parchment2.default.Embed);
5201
5202Cursor.blotName = 'cursor';
5203Cursor.className = 'ql-cursor';
5204Cursor.tagName = 'span';
5205Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
5206
5207
5208exports.default = Cursor;
5209
5210/***/ }),
5211/* 25 */
5212/***/ (function(module, exports, __webpack_require__) {
5213
5214"use strict";
5215
5216
5217Object.defineProperty(exports, "__esModule", {
5218 value: true
5219});
5220
5221var _parchment = __webpack_require__(0);
5222
5223var _parchment2 = _interopRequireDefault(_parchment);
5224
5225var _block = __webpack_require__(4);
5226
5227var _block2 = _interopRequireDefault(_block);
5228
5229function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5230
5231function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5232
5233function _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; }
5234
5235function _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; }
5236
5237var Container = function (_Parchment$Container) {
5238 _inherits(Container, _Parchment$Container);
5239
5240 function Container() {
5241 _classCallCheck(this, Container);
5242
5243 return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
5244 }
5245
5246 return Container;
5247}(_parchment2.default.Container);
5248
5249Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
5250
5251exports.default = Container;
5252
5253/***/ }),
5254/* 26 */
5255/***/ (function(module, exports, __webpack_require__) {
5256
5257"use strict";
5258
5259
5260Object.defineProperty(exports, "__esModule", {
5261 value: true
5262});
5263exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
5264
5265var _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; }; }();
5266
5267var _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); } };
5268
5269var _parchment = __webpack_require__(0);
5270
5271var _parchment2 = _interopRequireDefault(_parchment);
5272
5273function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5274
5275function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5276
5277function _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; }
5278
5279function _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; }
5280
5281var ColorAttributor = function (_Parchment$Attributor) {
5282 _inherits(ColorAttributor, _Parchment$Attributor);
5283
5284 function ColorAttributor() {
5285 _classCallCheck(this, ColorAttributor);
5286
5287 return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
5288 }
5289
5290 _createClass(ColorAttributor, [{
5291 key: 'value',
5292 value: function value(domNode) {
5293 var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
5294 if (!value.startsWith('rgb(')) return value;
5295 value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
5296 return '#' + value.split(',').map(function (component) {
5297 return ('00' + parseInt(component).toString(16)).slice(-2);
5298 }).join('');
5299 }
5300 }]);
5301
5302 return ColorAttributor;
5303}(_parchment2.default.Attributor.Style);
5304
5305var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
5306 scope: _parchment2.default.Scope.INLINE
5307});
5308var ColorStyle = new ColorAttributor('color', 'color', {
5309 scope: _parchment2.default.Scope.INLINE
5310});
5311
5312exports.ColorAttributor = ColorAttributor;
5313exports.ColorClass = ColorClass;
5314exports.ColorStyle = ColorStyle;
5315
5316/***/ }),
5317/* 27 */
5318/***/ (function(module, exports, __webpack_require__) {
5319
5320"use strict";
5321
5322
5323Object.defineProperty(exports, "__esModule", {
5324 value: true
5325});
5326exports.sanitize = exports.default = undefined;
5327
5328var _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; }; }();
5329
5330var _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); } };
5331
5332var _inline = __webpack_require__(6);
5333
5334var _inline2 = _interopRequireDefault(_inline);
5335
5336function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5337
5338function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5339
5340function _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; }
5341
5342function _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; }
5343
5344var Link = function (_Inline) {
5345 _inherits(Link, _Inline);
5346
5347 function Link() {
5348 _classCallCheck(this, Link);
5349
5350 return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
5351 }
5352
5353 _createClass(Link, [{
5354 key: 'format',
5355 value: function format(name, value) {
5356 if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
5357 value = this.constructor.sanitize(value);
5358 this.domNode.setAttribute('href', value);
5359 }
5360 }], [{
5361 key: 'create',
5362 value: function create(value) {
5363 var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
5364 value = this.sanitize(value);
5365 node.setAttribute('href', value);
5366 node.setAttribute('rel', 'noopener noreferrer');
5367 node.setAttribute('target', '_blank');
5368 return node;
5369 }
5370 }, {
5371 key: 'formats',
5372 value: function formats(domNode) {
5373 return domNode.getAttribute('href');
5374 }
5375 }, {
5376 key: 'sanitize',
5377 value: function sanitize(url) {
5378 return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
5379 }
5380 }]);
5381
5382 return Link;
5383}(_inline2.default);
5384
5385Link.blotName = 'link';
5386Link.tagName = 'A';
5387Link.SANITIZED_URL = 'about:blank';
5388Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];
5389
5390function _sanitize(url, protocols) {
5391 var anchor = document.createElement('a');
5392 anchor.href = url;
5393 var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
5394 return protocols.indexOf(protocol) > -1;
5395}
5396
5397exports.default = Link;
5398exports.sanitize = _sanitize;
5399
5400/***/ }),
5401/* 28 */
5402/***/ (function(module, exports, __webpack_require__) {
5403
5404"use strict";
5405
5406
5407Object.defineProperty(exports, "__esModule", {
5408 value: true
5409});
5410
5411var _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; };
5412
5413var _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; }; }();
5414
5415var _keyboard = __webpack_require__(23);
5416
5417var _keyboard2 = _interopRequireDefault(_keyboard);
5418
5419var _dropdown = __webpack_require__(107);
5420
5421var _dropdown2 = _interopRequireDefault(_dropdown);
5422
5423function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5424
5425function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5426
5427var optionsCounter = 0;
5428
5429function toggleAriaAttribute(element, attribute) {
5430 element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));
5431}
5432
5433var Picker = function () {
5434 function Picker(select) {
5435 var _this = this;
5436
5437 _classCallCheck(this, Picker);
5438
5439 this.select = select;
5440 this.container = document.createElement('span');
5441 this.buildPicker();
5442 this.select.style.display = 'none';
5443 this.select.parentNode.insertBefore(this.container, this.select);
5444
5445 this.label.addEventListener('mousedown', function () {
5446 _this.togglePicker();
5447 });
5448 this.label.addEventListener('keydown', function (event) {
5449 switch (event.keyCode) {
5450 // Allows the "Enter" key to open the picker
5451 case _keyboard2.default.keys.ENTER:
5452 _this.togglePicker();
5453 break;
5454
5455 // Allows the "Escape" key to close the picker
5456 case _keyboard2.default.keys.ESCAPE:
5457 _this.escape();
5458 event.preventDefault();
5459 break;
5460 default:
5461 }
5462 });
5463 this.select.addEventListener('change', this.update.bind(this));
5464 }
5465
5466 _createClass(Picker, [{
5467 key: 'togglePicker',
5468 value: function togglePicker() {
5469 this.container.classList.toggle('ql-expanded');
5470 // Toggle aria-expanded and aria-hidden to make the picker accessible
5471 toggleAriaAttribute(this.label, 'aria-expanded');
5472 toggleAriaAttribute(this.options, 'aria-hidden');
5473 }
5474 }, {
5475 key: 'buildItem',
5476 value: function buildItem(option) {
5477 var _this2 = this;
5478
5479 var item = document.createElement('span');
5480 item.tabIndex = '0';
5481 item.setAttribute('role', 'button');
5482
5483 item.classList.add('ql-picker-item');
5484 if (option.hasAttribute('value')) {
5485 item.setAttribute('data-value', option.getAttribute('value'));
5486 }
5487 if (option.textContent) {
5488 item.setAttribute('data-label', option.textContent);
5489 }
5490 item.addEventListener('click', function () {
5491 _this2.selectItem(item, true);
5492 });
5493 item.addEventListener('keydown', function (event) {
5494 switch (event.keyCode) {
5495 // Allows the "Enter" key to select an item
5496 case _keyboard2.default.keys.ENTER:
5497 _this2.selectItem(item, true);
5498 event.preventDefault();
5499 break;
5500
5501 // Allows the "Escape" key to close the picker
5502 case _keyboard2.default.keys.ESCAPE:
5503 _this2.escape();
5504 event.preventDefault();
5505 break;
5506 default:
5507 }
5508 });
5509
5510 return item;
5511 }
5512 }, {
5513 key: 'buildLabel',
5514 value: function buildLabel() {
5515 var label = document.createElement('span');
5516 label.classList.add('ql-picker-label');
5517 label.innerHTML = _dropdown2.default;
5518 label.tabIndex = '0';
5519 label.setAttribute('role', 'button');
5520 label.setAttribute('aria-expanded', 'false');
5521 this.container.appendChild(label);
5522 return label;
5523 }
5524 }, {
5525 key: 'buildOptions',
5526 value: function buildOptions() {
5527 var _this3 = this;
5528
5529 var options = document.createElement('span');
5530 options.classList.add('ql-picker-options');
5531
5532 // Don't want screen readers to read this until options are visible
5533 options.setAttribute('aria-hidden', 'true');
5534 options.tabIndex = '-1';
5535
5536 // Need a unique id for aria-controls
5537 options.id = 'ql-picker-options-' + optionsCounter;
5538 optionsCounter += 1;
5539 this.label.setAttribute('aria-controls', options.id);
5540
5541 this.options = options;
5542
5543 [].slice.call(this.select.options).forEach(function (option) {
5544 var item = _this3.buildItem(option);
5545 options.appendChild(item);
5546 if (option.selected === true) {
5547 _this3.selectItem(item);
5548 }
5549 });
5550 this.container.appendChild(options);
5551 }
5552 }, {
5553 key: 'buildPicker',
5554 value: function buildPicker() {
5555 var _this4 = this;
5556
5557 [].slice.call(this.select.attributes).forEach(function (item) {
5558 _this4.container.setAttribute(item.name, item.value);
5559 });
5560 this.container.classList.add('ql-picker');
5561 this.label = this.buildLabel();
5562 this.buildOptions();
5563 }
5564 }, {
5565 key: 'escape',
5566 value: function escape() {
5567 var _this5 = this;
5568
5569 // Close menu and return focus to trigger label
5570 this.close();
5571 // Need setTimeout for accessibility to ensure that the browser executes
5572 // focus on the next process thread and after any DOM content changes
5573 setTimeout(function () {
5574 return _this5.label.focus();
5575 }, 1);
5576 }
5577 }, {
5578 key: 'close',
5579 value: function close() {
5580 this.container.classList.remove('ql-expanded');
5581 this.label.setAttribute('aria-expanded', 'false');
5582 this.options.setAttribute('aria-hidden', 'true');
5583 }
5584 }, {
5585 key: 'selectItem',
5586 value: function selectItem(item) {
5587 var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5588
5589 var selected = this.container.querySelector('.ql-selected');
5590 if (item === selected) return;
5591 if (selected != null) {
5592 selected.classList.remove('ql-selected');
5593 }
5594 if (item == null) return;
5595 item.classList.add('ql-selected');
5596 this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
5597 if (item.hasAttribute('data-value')) {
5598 this.label.setAttribute('data-value', item.getAttribute('data-value'));
5599 } else {
5600 this.label.removeAttribute('data-value');
5601 }
5602 if (item.hasAttribute('data-label')) {
5603 this.label.setAttribute('data-label', item.getAttribute('data-label'));
5604 } else {
5605 this.label.removeAttribute('data-label');
5606 }
5607 if (trigger) {
5608 if (typeof Event === 'function') {
5609 this.select.dispatchEvent(new Event('change'));
5610 } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
5611 // IE11
5612 var event = document.createEvent('Event');
5613 event.initEvent('change', true, true);
5614 this.select.dispatchEvent(event);
5615 }
5616 this.close();
5617 }
5618 }
5619 }, {
5620 key: 'update',
5621 value: function update() {
5622 var option = void 0;
5623 if (this.select.selectedIndex > -1) {
5624 var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
5625 option = this.select.options[this.select.selectedIndex];
5626 this.selectItem(item);
5627 } else {
5628 this.selectItem(null);
5629 }
5630 var isActive = option != null && option !== this.select.querySelector('option[selected]');
5631 this.label.classList.toggle('ql-active', isActive);
5632 }
5633 }]);
5634
5635 return Picker;
5636}();
5637
5638exports.default = Picker;
5639
5640/***/ }),
5641/* 29 */
5642/***/ (function(module, exports, __webpack_require__) {
5643
5644"use strict";
5645
5646
5647Object.defineProperty(exports, "__esModule", {
5648 value: true
5649});
5650
5651var _parchment = __webpack_require__(0);
5652
5653var _parchment2 = _interopRequireDefault(_parchment);
5654
5655var _quill = __webpack_require__(5);
5656
5657var _quill2 = _interopRequireDefault(_quill);
5658
5659var _block = __webpack_require__(4);
5660
5661var _block2 = _interopRequireDefault(_block);
5662
5663var _break = __webpack_require__(16);
5664
5665var _break2 = _interopRequireDefault(_break);
5666
5667var _container = __webpack_require__(25);
5668
5669var _container2 = _interopRequireDefault(_container);
5670
5671var _cursor = __webpack_require__(24);
5672
5673var _cursor2 = _interopRequireDefault(_cursor);
5674
5675var _embed = __webpack_require__(35);
5676
5677var _embed2 = _interopRequireDefault(_embed);
5678
5679var _inline = __webpack_require__(6);
5680
5681var _inline2 = _interopRequireDefault(_inline);
5682
5683var _scroll = __webpack_require__(22);
5684
5685var _scroll2 = _interopRequireDefault(_scroll);
5686
5687var _text = __webpack_require__(7);
5688
5689var _text2 = _interopRequireDefault(_text);
5690
5691var _clipboard = __webpack_require__(55);
5692
5693var _clipboard2 = _interopRequireDefault(_clipboard);
5694
5695var _history = __webpack_require__(42);
5696
5697var _history2 = _interopRequireDefault(_history);
5698
5699var _keyboard = __webpack_require__(23);
5700
5701var _keyboard2 = _interopRequireDefault(_keyboard);
5702
5703function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5704
5705_quill2.default.register({
5706 'blots/block': _block2.default,
5707 'blots/block/embed': _block.BlockEmbed,
5708 'blots/break': _break2.default,
5709 'blots/container': _container2.default,
5710 'blots/cursor': _cursor2.default,
5711 'blots/embed': _embed2.default,
5712 'blots/inline': _inline2.default,
5713 'blots/scroll': _scroll2.default,
5714 'blots/text': _text2.default,
5715
5716 'modules/clipboard': _clipboard2.default,
5717 'modules/history': _history2.default,
5718 'modules/keyboard': _keyboard2.default
5719});
5720
5721_parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
5722
5723exports.default = _quill2.default;
5724
5725/***/ }),
5726/* 30 */
5727/***/ (function(module, exports, __webpack_require__) {
5728
5729"use strict";
5730
5731Object.defineProperty(exports, "__esModule", { value: true });
5732var Registry = __webpack_require__(1);
5733var ShadowBlot = /** @class */ (function () {
5734 function ShadowBlot(domNode) {
5735 this.domNode = domNode;
5736 // @ts-ignore
5737 this.domNode[Registry.DATA_KEY] = { blot: this };
5738 }
5739 Object.defineProperty(ShadowBlot.prototype, "statics", {
5740 // Hack for accessing inherited static methods
5741 get: function () {
5742 return this.constructor;
5743 },
5744 enumerable: true,
5745 configurable: true
5746 });
5747 ShadowBlot.create = function (value) {
5748 if (this.tagName == null) {
5749 throw new Registry.ParchmentError('Blot definition missing tagName');
5750 }
5751 var node;
5752 if (Array.isArray(this.tagName)) {
5753 if (typeof value === 'string') {
5754 value = value.toUpperCase();
5755 if (parseInt(value).toString() === value) {
5756 value = parseInt(value);
5757 }
5758 }
5759 if (typeof value === 'number') {
5760 node = document.createElement(this.tagName[value - 1]);
5761 }
5762 else if (this.tagName.indexOf(value) > -1) {
5763 node = document.createElement(value);
5764 }
5765 else {
5766 node = document.createElement(this.tagName[0]);
5767 }
5768 }
5769 else {
5770 node = document.createElement(this.tagName);
5771 }
5772 if (this.className) {
5773 node.classList.add(this.className);
5774 }
5775 return node;
5776 };
5777 ShadowBlot.prototype.attach = function () {
5778 if (this.parent != null) {
5779 this.scroll = this.parent.scroll;
5780 }
5781 };
5782 ShadowBlot.prototype.clone = function () {
5783 var domNode = this.domNode.cloneNode(false);
5784 return Registry.create(domNode);
5785 };
5786 ShadowBlot.prototype.detach = function () {
5787 if (this.parent != null)
5788 this.parent.removeChild(this);
5789 // @ts-ignore
5790 delete this.domNode[Registry.DATA_KEY];
5791 };
5792 ShadowBlot.prototype.deleteAt = function (index, length) {
5793 var blot = this.isolate(index, length);
5794 blot.remove();
5795 };
5796 ShadowBlot.prototype.formatAt = function (index, length, name, value) {
5797 var blot = this.isolate(index, length);
5798 if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
5799 blot.wrap(name, value);
5800 }
5801 else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
5802 var parent = Registry.create(this.statics.scope);
5803 blot.wrap(parent);
5804 parent.format(name, value);
5805 }
5806 };
5807 ShadowBlot.prototype.insertAt = function (index, value, def) {
5808 var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
5809 var ref = this.split(index);
5810 this.parent.insertBefore(blot, ref);
5811 };
5812 ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
5813 if (refBlot === void 0) { refBlot = null; }
5814 if (this.parent != null) {
5815 this.parent.children.remove(this);
5816 }
5817 var refDomNode = null;
5818 parentBlot.children.insertBefore(this, refBlot);
5819 if (refBlot != null) {
5820 refDomNode = refBlot.domNode;
5821 }
5822 if (this.domNode.parentNode != parentBlot.domNode ||
5823 this.domNode.nextSibling != refDomNode) {
5824 parentBlot.domNode.insertBefore(this.domNode, refDomNode);
5825 }
5826 this.parent = parentBlot;
5827 this.attach();
5828 };
5829 ShadowBlot.prototype.isolate = function (index, length) {
5830 var target = this.split(index);
5831 target.split(length);
5832 return target;
5833 };
5834 ShadowBlot.prototype.length = function () {
5835 return 1;
5836 };
5837 ShadowBlot.prototype.offset = function (root) {
5838 if (root === void 0) { root = this.parent; }
5839 if (this.parent == null || this == root)
5840 return 0;
5841 return this.parent.children.offset(this) + this.parent.offset(root);
5842 };
5843 ShadowBlot.prototype.optimize = function (context) {
5844 // TODO clean up once we use WeakMap
5845 // @ts-ignore
5846 if (this.domNode[Registry.DATA_KEY] != null) {
5847 // @ts-ignore
5848 delete this.domNode[Registry.DATA_KEY].mutations;
5849 }
5850 };
5851 ShadowBlot.prototype.remove = function () {
5852 if (this.domNode.parentNode != null) {
5853 this.domNode.parentNode.removeChild(this.domNode);
5854 }
5855 this.detach();
5856 };
5857 ShadowBlot.prototype.replace = function (target) {
5858 if (target.parent == null)
5859 return;
5860 target.parent.insertBefore(this, target.next);
5861 target.remove();
5862 };
5863 ShadowBlot.prototype.replaceWith = function (name, value) {
5864 var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
5865 replacement.replace(this);
5866 return replacement;
5867 };
5868 ShadowBlot.prototype.split = function (index, force) {
5869 return index === 0 ? this : this.next;
5870 };
5871 ShadowBlot.prototype.update = function (mutations, context) {
5872 // Nothing to do by default
5873 };
5874 ShadowBlot.prototype.wrap = function (name, value) {
5875 var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
5876 if (this.parent != null) {
5877 this.parent.insertBefore(wrapper, this.next);
5878 }
5879 wrapper.appendChild(this);
5880 return wrapper;
5881 };
5882 ShadowBlot.blotName = 'abstract';
5883 return ShadowBlot;
5884}());
5885exports.default = ShadowBlot;
5886
5887
5888/***/ }),
5889/* 31 */
5890/***/ (function(module, exports, __webpack_require__) {
5891
5892"use strict";
5893
5894Object.defineProperty(exports, "__esModule", { value: true });
5895var attributor_1 = __webpack_require__(12);
5896var class_1 = __webpack_require__(32);
5897var style_1 = __webpack_require__(33);
5898var Registry = __webpack_require__(1);
5899var AttributorStore = /** @class */ (function () {
5900 function AttributorStore(domNode) {
5901 this.attributes = {};
5902 this.domNode = domNode;
5903 this.build();
5904 }
5905 AttributorStore.prototype.attribute = function (attribute, value) {
5906 // verb
5907 if (value) {
5908 if (attribute.add(this.domNode, value)) {
5909 if (attribute.value(this.domNode) != null) {
5910 this.attributes[attribute.attrName] = attribute;
5911 }
5912 else {
5913 delete this.attributes[attribute.attrName];
5914 }
5915 }
5916 }
5917 else {
5918 attribute.remove(this.domNode);
5919 delete this.attributes[attribute.attrName];
5920 }
5921 };
5922 AttributorStore.prototype.build = function () {
5923 var _this = this;
5924 this.attributes = {};
5925 var attributes = attributor_1.default.keys(this.domNode);
5926 var classes = class_1.default.keys(this.domNode);
5927 var styles = style_1.default.keys(this.domNode);
5928 attributes
5929 .concat(classes)
5930 .concat(styles)
5931 .forEach(function (name) {
5932 var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
5933 if (attr instanceof attributor_1.default) {
5934 _this.attributes[attr.attrName] = attr;
5935 }
5936 });
5937 };
5938 AttributorStore.prototype.copy = function (target) {
5939 var _this = this;
5940 Object.keys(this.attributes).forEach(function (key) {
5941 var value = _this.attributes[key].value(_this.domNode);
5942 target.format(key, value);
5943 });
5944 };
5945 AttributorStore.prototype.move = function (target) {
5946 var _this = this;
5947 this.copy(target);
5948 Object.keys(this.attributes).forEach(function (key) {
5949 _this.attributes[key].remove(_this.domNode);
5950 });
5951 this.attributes = {};
5952 };
5953 AttributorStore.prototype.values = function () {
5954 var _this = this;
5955 return Object.keys(this.attributes).reduce(function (attributes, name) {
5956 attributes[name] = _this.attributes[name].value(_this.domNode);
5957 return attributes;
5958 }, {});
5959 };
5960 return AttributorStore;
5961}());
5962exports.default = AttributorStore;
5963
5964
5965/***/ }),
5966/* 32 */
5967/***/ (function(module, exports, __webpack_require__) {
5968
5969"use strict";
5970
5971var __extends = (this && this.__extends) || (function () {
5972 var extendStatics = Object.setPrototypeOf ||
5973 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5974 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5975 return function (d, b) {
5976 extendStatics(d, b);
5977 function __() { this.constructor = d; }
5978 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5979 };
5980})();
5981Object.defineProperty(exports, "__esModule", { value: true });
5982var attributor_1 = __webpack_require__(12);
5983function match(node, prefix) {
5984 var className = node.getAttribute('class') || '';
5985 return className.split(/\s+/).filter(function (name) {
5986 return name.indexOf(prefix + "-") === 0;
5987 });
5988}
5989var ClassAttributor = /** @class */ (function (_super) {
5990 __extends(ClassAttributor, _super);
5991 function ClassAttributor() {
5992 return _super !== null && _super.apply(this, arguments) || this;
5993 }
5994 ClassAttributor.keys = function (node) {
5995 return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
5996 return name
5997 .split('-')
5998 .slice(0, -1)
5999 .join('-');
6000 });
6001 };
6002 ClassAttributor.prototype.add = function (node, value) {
6003 if (!this.canAdd(node, value))
6004 return false;
6005 this.remove(node);
6006 node.classList.add(this.keyName + "-" + value);
6007 return true;
6008 };
6009 ClassAttributor.prototype.remove = function (node) {
6010 var matches = match(node, this.keyName);
6011 matches.forEach(function (name) {
6012 node.classList.remove(name);
6013 });
6014 if (node.classList.length === 0) {
6015 node.removeAttribute('class');
6016 }
6017 };
6018 ClassAttributor.prototype.value = function (node) {
6019 var result = match(node, this.keyName)[0] || '';
6020 var value = result.slice(this.keyName.length + 1); // +1 for hyphen
6021 return this.canAdd(node, value) ? value : '';
6022 };
6023 return ClassAttributor;
6024}(attributor_1.default));
6025exports.default = ClassAttributor;
6026
6027
6028/***/ }),
6029/* 33 */
6030/***/ (function(module, exports, __webpack_require__) {
6031
6032"use strict";
6033
6034var __extends = (this && this.__extends) || (function () {
6035 var extendStatics = Object.setPrototypeOf ||
6036 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6037 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6038 return function (d, b) {
6039 extendStatics(d, b);
6040 function __() { this.constructor = d; }
6041 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6042 };
6043})();
6044Object.defineProperty(exports, "__esModule", { value: true });
6045var attributor_1 = __webpack_require__(12);
6046function camelize(name) {
6047 var parts = name.split('-');
6048 var rest = parts
6049 .slice(1)
6050 .map(function (part) {
6051 return part[0].toUpperCase() + part.slice(1);
6052 })
6053 .join('');
6054 return parts[0] + rest;
6055}
6056var StyleAttributor = /** @class */ (function (_super) {
6057 __extends(StyleAttributor, _super);
6058 function StyleAttributor() {
6059 return _super !== null && _super.apply(this, arguments) || this;
6060 }
6061 StyleAttributor.keys = function (node) {
6062 return (node.getAttribute('style') || '').split(';').map(function (value) {
6063 var arr = value.split(':');
6064 return arr[0].trim();
6065 });
6066 };
6067 StyleAttributor.prototype.add = function (node, value) {
6068 if (!this.canAdd(node, value))
6069 return false;
6070 // @ts-ignore
6071 node.style[camelize(this.keyName)] = value;
6072 return true;
6073 };
6074 StyleAttributor.prototype.remove = function (node) {
6075 // @ts-ignore
6076 node.style[camelize(this.keyName)] = '';
6077 if (!node.getAttribute('style')) {
6078 node.removeAttribute('style');
6079 }
6080 };
6081 StyleAttributor.prototype.value = function (node) {
6082 // @ts-ignore
6083 var value = node.style[camelize(this.keyName)];
6084 return this.canAdd(node, value) ? value : '';
6085 };
6086 return StyleAttributor;
6087}(attributor_1.default));
6088exports.default = StyleAttributor;
6089
6090
6091/***/ }),
6092/* 34 */
6093/***/ (function(module, exports, __webpack_require__) {
6094
6095"use strict";
6096
6097
6098Object.defineProperty(exports, "__esModule", {
6099 value: true
6100});
6101
6102var _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; }; }();
6103
6104function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6105
6106var Theme = function () {
6107 function Theme(quill, options) {
6108 _classCallCheck(this, Theme);
6109
6110 this.quill = quill;
6111 this.options = options;
6112 this.modules = {};
6113 }
6114
6115 _createClass(Theme, [{
6116 key: 'init',
6117 value: function init() {
6118 var _this = this;
6119
6120 Object.keys(this.options.modules).forEach(function (name) {
6121 if (_this.modules[name] == null) {
6122 _this.addModule(name);
6123 }
6124 });
6125 }
6126 }, {
6127 key: 'addModule',
6128 value: function addModule(name) {
6129 var moduleClass = this.quill.constructor.import('modules/' + name);
6130 this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
6131 return this.modules[name];
6132 }
6133 }]);
6134
6135 return Theme;
6136}();
6137
6138Theme.DEFAULTS = {
6139 modules: {}
6140};
6141Theme.themes = {
6142 'default': Theme
6143};
6144
6145exports.default = Theme;
6146
6147/***/ }),
6148/* 35 */
6149/***/ (function(module, exports, __webpack_require__) {
6150
6151"use strict";
6152
6153
6154Object.defineProperty(exports, "__esModule", {
6155 value: true
6156});
6157
6158var _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; }; }();
6159
6160var _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); } };
6161
6162var _parchment = __webpack_require__(0);
6163
6164var _parchment2 = _interopRequireDefault(_parchment);
6165
6166var _text = __webpack_require__(7);
6167
6168var _text2 = _interopRequireDefault(_text);
6169
6170function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6171
6172function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6173
6174function _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; }
6175
6176function _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; }
6177
6178var GUARD_TEXT = '\uFEFF';
6179
6180var Embed = function (_Parchment$Embed) {
6181 _inherits(Embed, _Parchment$Embed);
6182
6183 function Embed(node) {
6184 _classCallCheck(this, Embed);
6185
6186 var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));
6187
6188 _this.contentNode = document.createElement('span');
6189 _this.contentNode.setAttribute('contenteditable', false);
6190 [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {
6191 _this.contentNode.appendChild(childNode);
6192 });
6193 _this.leftGuard = document.createTextNode(GUARD_TEXT);
6194 _this.rightGuard = document.createTextNode(GUARD_TEXT);
6195 _this.domNode.appendChild(_this.leftGuard);
6196 _this.domNode.appendChild(_this.contentNode);
6197 _this.domNode.appendChild(_this.rightGuard);
6198 return _this;
6199 }
6200
6201 _createClass(Embed, [{
6202 key: 'index',
6203 value: function index(node, offset) {
6204 if (node === this.leftGuard) return 0;
6205 if (node === this.rightGuard) return 1;
6206 return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);
6207 }
6208 }, {
6209 key: 'restore',
6210 value: function restore(node) {
6211 var range = void 0,
6212 textNode = void 0;
6213 var text = node.data.split(GUARD_TEXT).join('');
6214 if (node === this.leftGuard) {
6215 if (this.prev instanceof _text2.default) {
6216 var prevLength = this.prev.length();
6217 this.prev.insertAt(prevLength, text);
6218 range = {
6219 startNode: this.prev.domNode,
6220 startOffset: prevLength + text.length
6221 };
6222 } else {
6223 textNode = document.createTextNode(text);
6224 this.parent.insertBefore(_parchment2.default.create(textNode), this);
6225 range = {
6226 startNode: textNode,
6227 startOffset: text.length
6228 };
6229 }
6230 } else if (node === this.rightGuard) {
6231 if (this.next instanceof _text2.default) {
6232 this.next.insertAt(0, text);
6233 range = {
6234 startNode: this.next.domNode,
6235 startOffset: text.length
6236 };
6237 } else {
6238 textNode = document.createTextNode(text);
6239 this.parent.insertBefore(_parchment2.default.create(textNode), this.next);
6240 range = {
6241 startNode: textNode,
6242 startOffset: text.length
6243 };
6244 }
6245 }
6246 node.data = GUARD_TEXT;
6247 return range;
6248 }
6249 }, {
6250 key: 'update',
6251 value: function update(mutations, context) {
6252 var _this2 = this;
6253
6254 mutations.forEach(function (mutation) {
6255 if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {
6256 var range = _this2.restore(mutation.target);
6257 if (range) context.range = range;
6258 }
6259 });
6260 }
6261 }]);
6262
6263 return Embed;
6264}(_parchment2.default.Embed);
6265
6266exports.default = Embed;
6267
6268/***/ }),
6269/* 36 */
6270/***/ (function(module, exports, __webpack_require__) {
6271
6272"use strict";
6273
6274
6275Object.defineProperty(exports, "__esModule", {
6276 value: true
6277});
6278exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
6279
6280var _parchment = __webpack_require__(0);
6281
6282var _parchment2 = _interopRequireDefault(_parchment);
6283
6284function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6285
6286var config = {
6287 scope: _parchment2.default.Scope.BLOCK,
6288 whitelist: ['right', 'center', 'justify']
6289};
6290
6291var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
6292var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
6293var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
6294
6295exports.AlignAttribute = AlignAttribute;
6296exports.AlignClass = AlignClass;
6297exports.AlignStyle = AlignStyle;
6298
6299/***/ }),
6300/* 37 */
6301/***/ (function(module, exports, __webpack_require__) {
6302
6303"use strict";
6304
6305
6306Object.defineProperty(exports, "__esModule", {
6307 value: true
6308});
6309exports.BackgroundStyle = exports.BackgroundClass = undefined;
6310
6311var _parchment = __webpack_require__(0);
6312
6313var _parchment2 = _interopRequireDefault(_parchment);
6314
6315var _color = __webpack_require__(26);
6316
6317function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6318
6319var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
6320 scope: _parchment2.default.Scope.INLINE
6321});
6322var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
6323 scope: _parchment2.default.Scope.INLINE
6324});
6325
6326exports.BackgroundClass = BackgroundClass;
6327exports.BackgroundStyle = BackgroundStyle;
6328
6329/***/ }),
6330/* 38 */
6331/***/ (function(module, exports, __webpack_require__) {
6332
6333"use strict";
6334
6335
6336Object.defineProperty(exports, "__esModule", {
6337 value: true
6338});
6339exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
6340
6341var _parchment = __webpack_require__(0);
6342
6343var _parchment2 = _interopRequireDefault(_parchment);
6344
6345function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6346
6347var config = {
6348 scope: _parchment2.default.Scope.BLOCK,
6349 whitelist: ['rtl']
6350};
6351
6352var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
6353var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
6354var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
6355
6356exports.DirectionAttribute = DirectionAttribute;
6357exports.DirectionClass = DirectionClass;
6358exports.DirectionStyle = DirectionStyle;
6359
6360/***/ }),
6361/* 39 */
6362/***/ (function(module, exports, __webpack_require__) {
6363
6364"use strict";
6365
6366
6367Object.defineProperty(exports, "__esModule", {
6368 value: true
6369});
6370exports.FontClass = exports.FontStyle = undefined;
6371
6372var _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; }; }();
6373
6374var _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); } };
6375
6376var _parchment = __webpack_require__(0);
6377
6378var _parchment2 = _interopRequireDefault(_parchment);
6379
6380function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6381
6382function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6383
6384function _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; }
6385
6386function _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; }
6387
6388var config = {
6389 scope: _parchment2.default.Scope.INLINE,
6390 whitelist: ['serif', 'monospace']
6391};
6392
6393var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
6394
6395var FontStyleAttributor = function (_Parchment$Attributor) {
6396 _inherits(FontStyleAttributor, _Parchment$Attributor);
6397
6398 function FontStyleAttributor() {
6399 _classCallCheck(this, FontStyleAttributor);
6400
6401 return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
6402 }
6403
6404 _createClass(FontStyleAttributor, [{
6405 key: 'value',
6406 value: function value(node) {
6407 return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
6408 }
6409 }]);
6410
6411 return FontStyleAttributor;
6412}(_parchment2.default.Attributor.Style);
6413
6414var FontStyle = new FontStyleAttributor('font', 'font-family', config);
6415
6416exports.FontStyle = FontStyle;
6417exports.FontClass = FontClass;
6418
6419/***/ }),
6420/* 40 */
6421/***/ (function(module, exports, __webpack_require__) {
6422
6423"use strict";
6424
6425
6426Object.defineProperty(exports, "__esModule", {
6427 value: true
6428});
6429exports.SizeStyle = exports.SizeClass = undefined;
6430
6431var _parchment = __webpack_require__(0);
6432
6433var _parchment2 = _interopRequireDefault(_parchment);
6434
6435function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6436
6437var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
6438 scope: _parchment2.default.Scope.INLINE,
6439 whitelist: ['small', 'large', 'huge']
6440});
6441var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
6442 scope: _parchment2.default.Scope.INLINE,
6443 whitelist: ['10px', '18px', '32px']
6444});
6445
6446exports.SizeClass = SizeClass;
6447exports.SizeStyle = SizeStyle;
6448
6449/***/ }),
6450/* 41 */
6451/***/ (function(module, exports, __webpack_require__) {
6452
6453"use strict";
6454
6455
6456module.exports = {
6457 'align': {
6458 '': __webpack_require__(76),
6459 'center': __webpack_require__(77),
6460 'right': __webpack_require__(78),
6461 'justify': __webpack_require__(79)
6462 },
6463 'background': __webpack_require__(80),
6464 'blockquote': __webpack_require__(81),
6465 'bold': __webpack_require__(82),
6466 'clean': __webpack_require__(83),
6467 'code': __webpack_require__(58),
6468 'code-block': __webpack_require__(58),
6469 'color': __webpack_require__(84),
6470 'direction': {
6471 '': __webpack_require__(85),
6472 'rtl': __webpack_require__(86)
6473 },
6474 'float': {
6475 'center': __webpack_require__(87),
6476 'full': __webpack_require__(88),
6477 'left': __webpack_require__(89),
6478 'right': __webpack_require__(90)
6479 },
6480 'formula': __webpack_require__(91),
6481 'header': {
6482 '1': __webpack_require__(92),
6483 '2': __webpack_require__(93)
6484 },
6485 'italic': __webpack_require__(94),
6486 'image': __webpack_require__(95),
6487 'indent': {
6488 '+1': __webpack_require__(96),
6489 '-1': __webpack_require__(97)
6490 },
6491 'link': __webpack_require__(98),
6492 'list': {
6493 'ordered': __webpack_require__(99),
6494 'bullet': __webpack_require__(100),
6495 'check': __webpack_require__(101)
6496 },
6497 'script': {
6498 'sub': __webpack_require__(102),
6499 'super': __webpack_require__(103)
6500 },
6501 'strike': __webpack_require__(104),
6502 'underline': __webpack_require__(105),
6503 'video': __webpack_require__(106)
6504};
6505
6506/***/ }),
6507/* 42 */
6508/***/ (function(module, exports, __webpack_require__) {
6509
6510"use strict";
6511
6512
6513Object.defineProperty(exports, "__esModule", {
6514 value: true
6515});
6516exports.getLastChangeIndex = exports.default = undefined;
6517
6518var _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; }; }();
6519
6520var _parchment = __webpack_require__(0);
6521
6522var _parchment2 = _interopRequireDefault(_parchment);
6523
6524var _quill = __webpack_require__(5);
6525
6526var _quill2 = _interopRequireDefault(_quill);
6527
6528var _module = __webpack_require__(9);
6529
6530var _module2 = _interopRequireDefault(_module);
6531
6532function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6533
6534function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6535
6536function _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; }
6537
6538function _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; }
6539
6540var History = function (_Module) {
6541 _inherits(History, _Module);
6542
6543 function History(quill, options) {
6544 _classCallCheck(this, History);
6545
6546 var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
6547
6548 _this.lastRecorded = 0;
6549 _this.ignoreChange = false;
6550 _this.clear();
6551 _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
6552 if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
6553 if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
6554 _this.record(delta, oldDelta);
6555 } else {
6556 _this.transform(delta);
6557 }
6558 });
6559 _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
6560 _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
6561 if (/Win/i.test(navigator.platform)) {
6562 _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
6563 }
6564 return _this;
6565 }
6566
6567 _createClass(History, [{
6568 key: 'change',
6569 value: function change(source, dest) {
6570 if (this.stack[source].length === 0) return;
6571 var delta = this.stack[source].pop();
6572 this.stack[dest].push(delta);
6573 this.lastRecorded = 0;
6574 this.ignoreChange = true;
6575 this.quill.updateContents(delta[source], _quill2.default.sources.USER);
6576 this.ignoreChange = false;
6577 var index = getLastChangeIndex(delta[source]);
6578 this.quill.setSelection(index);
6579 }
6580 }, {
6581 key: 'clear',
6582 value: function clear() {
6583 this.stack = { undo: [], redo: [] };
6584 }
6585 }, {
6586 key: 'cutoff',
6587 value: function cutoff() {
6588 this.lastRecorded = 0;
6589 }
6590 }, {
6591 key: 'record',
6592 value: function record(changeDelta, oldDelta) {
6593 if (changeDelta.ops.length === 0) return;
6594 this.stack.redo = [];
6595 var undoDelta = this.quill.getContents().diff(oldDelta);
6596 var timestamp = Date.now();
6597 if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
6598 var delta = this.stack.undo.pop();
6599 undoDelta = undoDelta.compose(delta.undo);
6600 changeDelta = delta.redo.compose(changeDelta);
6601 } else {
6602 this.lastRecorded = timestamp;
6603 }
6604 this.stack.undo.push({
6605 redo: changeDelta,
6606 undo: undoDelta
6607 });
6608 if (this.stack.undo.length > this.options.maxStack) {
6609 this.stack.undo.shift();
6610 }
6611 }
6612 }, {
6613 key: 'redo',
6614 value: function redo() {
6615 this.change('redo', 'undo');
6616 }
6617 }, {
6618 key: 'transform',
6619 value: function transform(delta) {
6620 this.stack.undo.forEach(function (change) {
6621 change.undo = delta.transform(change.undo, true);
6622 change.redo = delta.transform(change.redo, true);
6623 });
6624 this.stack.redo.forEach(function (change) {
6625 change.undo = delta.transform(change.undo, true);
6626 change.redo = delta.transform(change.redo, true);
6627 });
6628 }
6629 }, {
6630 key: 'undo',
6631 value: function undo() {
6632 this.change('undo', 'redo');
6633 }
6634 }]);
6635
6636 return History;
6637}(_module2.default);
6638
6639History.DEFAULTS = {
6640 delay: 1000,
6641 maxStack: 100,
6642 userOnly: false
6643};
6644
6645function endsWithNewlineChange(delta) {
6646 var lastOp = delta.ops[delta.ops.length - 1];
6647 if (lastOp == null) return false;
6648 if (lastOp.insert != null) {
6649 return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
6650 }
6651 if (lastOp.attributes != null) {
6652 return Object.keys(lastOp.attributes).some(function (attr) {
6653 return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
6654 });
6655 }
6656 return false;
6657}
6658
6659function getLastChangeIndex(delta) {
6660 var deleteLength = delta.reduce(function (length, op) {
6661 length += op.delete || 0;
6662 return length;
6663 }, 0);
6664 var changeIndex = delta.length() - deleteLength;
6665 if (endsWithNewlineChange(delta)) {
6666 changeIndex -= 1;
6667 }
6668 return changeIndex;
6669}
6670
6671exports.default = History;
6672exports.getLastChangeIndex = getLastChangeIndex;
6673
6674/***/ }),
6675/* 43 */
6676/***/ (function(module, exports, __webpack_require__) {
6677
6678"use strict";
6679
6680
6681Object.defineProperty(exports, "__esModule", {
6682 value: true
6683});
6684exports.default = exports.BaseTooltip = undefined;
6685
6686var _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; }; }();
6687
6688var _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); } };
6689
6690var _extend = __webpack_require__(3);
6691
6692var _extend2 = _interopRequireDefault(_extend);
6693
6694var _quillDelta = __webpack_require__(2);
6695
6696var _quillDelta2 = _interopRequireDefault(_quillDelta);
6697
6698var _emitter = __webpack_require__(8);
6699
6700var _emitter2 = _interopRequireDefault(_emitter);
6701
6702var _keyboard = __webpack_require__(23);
6703
6704var _keyboard2 = _interopRequireDefault(_keyboard);
6705
6706var _theme = __webpack_require__(34);
6707
6708var _theme2 = _interopRequireDefault(_theme);
6709
6710var _colorPicker = __webpack_require__(59);
6711
6712var _colorPicker2 = _interopRequireDefault(_colorPicker);
6713
6714var _iconPicker = __webpack_require__(60);
6715
6716var _iconPicker2 = _interopRequireDefault(_iconPicker);
6717
6718var _picker = __webpack_require__(28);
6719
6720var _picker2 = _interopRequireDefault(_picker);
6721
6722var _tooltip = __webpack_require__(61);
6723
6724var _tooltip2 = _interopRequireDefault(_tooltip);
6725
6726function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6727
6728function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6729
6730function _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; }
6731
6732function _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; }
6733
6734var ALIGNS = [false, 'center', 'right', 'justify'];
6735
6736var 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"];
6737
6738var FONTS = [false, 'serif', 'monospace'];
6739
6740var HEADERS = ['1', '2', '3', false];
6741
6742var SIZES = ['small', false, 'large', 'huge'];
6743
6744var BaseTheme = function (_Theme) {
6745 _inherits(BaseTheme, _Theme);
6746
6747 function BaseTheme(quill, options) {
6748 _classCallCheck(this, BaseTheme);
6749
6750 var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
6751
6752 var listener = function listener(e) {
6753 if (!document.body.contains(quill.root)) {
6754 return document.body.removeEventListener('click', listener);
6755 }
6756 if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
6757 _this.tooltip.hide();
6758 }
6759 if (_this.pickers != null) {
6760 _this.pickers.forEach(function (picker) {
6761 if (!picker.container.contains(e.target)) {
6762 picker.close();
6763 }
6764 });
6765 }
6766 };
6767 quill.emitter.listenDOM('click', document.body, listener);
6768 return _this;
6769 }
6770
6771 _createClass(BaseTheme, [{
6772 key: 'addModule',
6773 value: function addModule(name) {
6774 var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
6775 if (name === 'toolbar') {
6776 this.extendToolbar(module);
6777 }
6778 return module;
6779 }
6780 }, {
6781 key: 'buildButtons',
6782 value: function buildButtons(buttons, icons) {
6783 buttons.forEach(function (button) {
6784 var className = button.getAttribute('class') || '';
6785 className.split(/\s+/).forEach(function (name) {
6786 if (!name.startsWith('ql-')) return;
6787 name = name.slice('ql-'.length);
6788 if (icons[name] == null) return;
6789 if (name === 'direction') {
6790 button.innerHTML = icons[name][''] + icons[name]['rtl'];
6791 } else if (typeof icons[name] === 'string') {
6792 button.innerHTML = icons[name];
6793 } else {
6794 var value = button.value || '';
6795 if (value != null && icons[name][value]) {
6796 button.innerHTML = icons[name][value];
6797 }
6798 }
6799 });
6800 });
6801 }
6802 }, {
6803 key: 'buildPickers',
6804 value: function buildPickers(selects, icons) {
6805 var _this2 = this;
6806
6807 this.pickers = selects.map(function (select) {
6808 if (select.classList.contains('ql-align')) {
6809 if (select.querySelector('option') == null) {
6810 fillSelect(select, ALIGNS);
6811 }
6812 return new _iconPicker2.default(select, icons.align);
6813 } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
6814 var format = select.classList.contains('ql-background') ? 'background' : 'color';
6815 if (select.querySelector('option') == null) {
6816 fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
6817 }
6818 return new _colorPicker2.default(select, icons[format]);
6819 } else {
6820 if (select.querySelector('option') == null) {
6821 if (select.classList.contains('ql-font')) {
6822 fillSelect(select, FONTS);
6823 } else if (select.classList.contains('ql-header')) {
6824 fillSelect(select, HEADERS);
6825 } else if (select.classList.contains('ql-size')) {
6826 fillSelect(select, SIZES);
6827 }
6828 }
6829 return new _picker2.default(select);
6830 }
6831 });
6832 var update = function update() {
6833 _this2.pickers.forEach(function (picker) {
6834 picker.update();
6835 });
6836 };
6837 this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
6838 }
6839 }]);
6840
6841 return BaseTheme;
6842}(_theme2.default);
6843
6844BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
6845 modules: {
6846 toolbar: {
6847 handlers: {
6848 formula: function formula() {
6849 this.quill.theme.tooltip.edit('formula');
6850 },
6851 image: function image() {
6852 var _this3 = this;
6853
6854 var fileInput = this.container.querySelector('input.ql-image[type=file]');
6855 if (fileInput == null) {
6856 fileInput = document.createElement('input');
6857 fileInput.setAttribute('type', 'file');
6858 fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
6859 fileInput.classList.add('ql-image');
6860 fileInput.addEventListener('change', function () {
6861 if (fileInput.files != null && fileInput.files[0] != null) {
6862 var reader = new FileReader();
6863 reader.onload = function (e) {
6864 var range = _this3.quill.getSelection(true);
6865 _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
6866 _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);
6867 fileInput.value = "";
6868 };
6869 reader.readAsDataURL(fileInput.files[0]);
6870 }
6871 });
6872 this.container.appendChild(fileInput);
6873 }
6874 fileInput.click();
6875 },
6876 video: function video() {
6877 this.quill.theme.tooltip.edit('video');
6878 }
6879 }
6880 }
6881 }
6882});
6883
6884var BaseTooltip = function (_Tooltip) {
6885 _inherits(BaseTooltip, _Tooltip);
6886
6887 function BaseTooltip(quill, boundsContainer) {
6888 _classCallCheck(this, BaseTooltip);
6889
6890 var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
6891
6892 _this4.textbox = _this4.root.querySelector('input[type="text"]');
6893 _this4.listen();
6894 return _this4;
6895 }
6896
6897 _createClass(BaseTooltip, [{
6898 key: 'listen',
6899 value: function listen() {
6900 var _this5 = this;
6901
6902 this.textbox.addEventListener('keydown', function (event) {
6903 if (_keyboard2.default.match(event, 'enter')) {
6904 _this5.save();
6905 event.preventDefault();
6906 } else if (_keyboard2.default.match(event, 'escape')) {
6907 _this5.cancel();
6908 event.preventDefault();
6909 }
6910 });
6911 }
6912 }, {
6913 key: 'cancel',
6914 value: function cancel() {
6915 this.hide();
6916 }
6917 }, {
6918 key: 'edit',
6919 value: function edit() {
6920 var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
6921 var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
6922
6923 this.root.classList.remove('ql-hidden');
6924 this.root.classList.add('ql-editing');
6925 if (preview != null) {
6926 this.textbox.value = preview;
6927 } else if (mode !== this.root.getAttribute('data-mode')) {
6928 this.textbox.value = '';
6929 }
6930 this.position(this.quill.getBounds(this.quill.selection.savedRange));
6931 this.textbox.select();
6932 this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
6933 this.root.setAttribute('data-mode', mode);
6934 }
6935 }, {
6936 key: 'restoreFocus',
6937 value: function restoreFocus() {
6938 var scrollTop = this.quill.scrollingContainer.scrollTop;
6939 this.quill.focus();
6940 this.quill.scrollingContainer.scrollTop = scrollTop;
6941 }
6942 }, {
6943 key: 'save',
6944 value: function save() {
6945 var value = this.textbox.value;
6946 switch (this.root.getAttribute('data-mode')) {
6947 case 'link':
6948 {
6949 var scrollTop = this.quill.root.scrollTop;
6950 if (this.linkRange) {
6951 this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
6952 delete this.linkRange;
6953 } else {
6954 this.restoreFocus();
6955 this.quill.format('link', value, _emitter2.default.sources.USER);
6956 }
6957 this.quill.root.scrollTop = scrollTop;
6958 break;
6959 }
6960 case 'video':
6961 {
6962 value = extractVideoUrl(value);
6963 } // eslint-disable-next-line no-fallthrough
6964 case 'formula':
6965 {
6966 if (!value) break;
6967 var range = this.quill.getSelection(true);
6968 if (range != null) {
6969 var index = range.index + range.length;
6970 this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
6971 if (this.root.getAttribute('data-mode') === 'formula') {
6972 this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
6973 }
6974 this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
6975 }
6976 break;
6977 }
6978 default:
6979 }
6980 this.textbox.value = '';
6981 this.hide();
6982 }
6983 }]);
6984
6985 return BaseTooltip;
6986}(_tooltip2.default);
6987
6988function extractVideoUrl(url) {
6989 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_-]+)/);
6990 if (match) {
6991 return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
6992 }
6993 if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
6994 // eslint-disable-line no-cond-assign
6995 return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';
6996 }
6997 return url;
6998}
6999
7000function fillSelect(select, values) {
7001 var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7002
7003 values.forEach(function (value) {
7004 var option = document.createElement('option');
7005 if (value === defaultValue) {
7006 option.setAttribute('selected', 'selected');
7007 } else {
7008 option.setAttribute('value', value);
7009 }
7010 select.appendChild(option);
7011 });
7012}
7013
7014exports.BaseTooltip = BaseTooltip;
7015exports.default = BaseTheme;
7016
7017/***/ }),
7018/* 44 */
7019/***/ (function(module, exports, __webpack_require__) {
7020
7021"use strict";
7022
7023Object.defineProperty(exports, "__esModule", { value: true });
7024var LinkedList = /** @class */ (function () {
7025 function LinkedList() {
7026 this.head = this.tail = null;
7027 this.length = 0;
7028 }
7029 LinkedList.prototype.append = function () {
7030 var nodes = [];
7031 for (var _i = 0; _i < arguments.length; _i++) {
7032 nodes[_i] = arguments[_i];
7033 }
7034 this.insertBefore(nodes[0], null);
7035 if (nodes.length > 1) {
7036 this.append.apply(this, nodes.slice(1));
7037 }
7038 };
7039 LinkedList.prototype.contains = function (node) {
7040 var cur, next = this.iterator();
7041 while ((cur = next())) {
7042 if (cur === node)
7043 return true;
7044 }
7045 return false;
7046 };
7047 LinkedList.prototype.insertBefore = function (node, refNode) {
7048 if (!node)
7049 return;
7050 node.next = refNode;
7051 if (refNode != null) {
7052 node.prev = refNode.prev;
7053 if (refNode.prev != null) {
7054 refNode.prev.next = node;
7055 }
7056 refNode.prev = node;
7057 if (refNode === this.head) {
7058 this.head = node;
7059 }
7060 }
7061 else if (this.tail != null) {
7062 this.tail.next = node;
7063 node.prev = this.tail;
7064 this.tail = node;
7065 }
7066 else {
7067 node.prev = null;
7068 this.head = this.tail = node;
7069 }
7070 this.length += 1;
7071 };
7072 LinkedList.prototype.offset = function (target) {
7073 var index = 0, cur = this.head;
7074 while (cur != null) {
7075 if (cur === target)
7076 return index;
7077 index += cur.length();
7078 cur = cur.next;
7079 }
7080 return -1;
7081 };
7082 LinkedList.prototype.remove = function (node) {
7083 if (!this.contains(node))
7084 return;
7085 if (node.prev != null)
7086 node.prev.next = node.next;
7087 if (node.next != null)
7088 node.next.prev = node.prev;
7089 if (node === this.head)
7090 this.head = node.next;
7091 if (node === this.tail)
7092 this.tail = node.prev;
7093 this.length -= 1;
7094 };
7095 LinkedList.prototype.iterator = function (curNode) {
7096 if (curNode === void 0) { curNode = this.head; }
7097 // TODO use yield when we can
7098 return function () {
7099 var ret = curNode;
7100 if (curNode != null)
7101 curNode = curNode.next;
7102 return ret;
7103 };
7104 };
7105 LinkedList.prototype.find = function (index, inclusive) {
7106 if (inclusive === void 0) { inclusive = false; }
7107 var cur, next = this.iterator();
7108 while ((cur = next())) {
7109 var length = cur.length();
7110 if (index < length ||
7111 (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
7112 return [cur, index];
7113 }
7114 index -= length;
7115 }
7116 return [null, 0];
7117 };
7118 LinkedList.prototype.forEach = function (callback) {
7119 var cur, next = this.iterator();
7120 while ((cur = next())) {
7121 callback(cur);
7122 }
7123 };
7124 LinkedList.prototype.forEachAt = function (index, length, callback) {
7125 if (length <= 0)
7126 return;
7127 var _a = this.find(index), startNode = _a[0], offset = _a[1];
7128 var cur, curIndex = index - offset, next = this.iterator(startNode);
7129 while ((cur = next()) && curIndex < index + length) {
7130 var curLength = cur.length();
7131 if (index > curIndex) {
7132 callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
7133 }
7134 else {
7135 callback(cur, 0, Math.min(curLength, index + length - curIndex));
7136 }
7137 curIndex += curLength;
7138 }
7139 };
7140 LinkedList.prototype.map = function (callback) {
7141 return this.reduce(function (memo, cur) {
7142 memo.push(callback(cur));
7143 return memo;
7144 }, []);
7145 };
7146 LinkedList.prototype.reduce = function (callback, memo) {
7147 var cur, next = this.iterator();
7148 while ((cur = next())) {
7149 memo = callback(memo, cur);
7150 }
7151 return memo;
7152 };
7153 return LinkedList;
7154}());
7155exports.default = LinkedList;
7156
7157
7158/***/ }),
7159/* 45 */
7160/***/ (function(module, exports, __webpack_require__) {
7161
7162"use strict";
7163
7164var __extends = (this && this.__extends) || (function () {
7165 var extendStatics = Object.setPrototypeOf ||
7166 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7167 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7168 return function (d, b) {
7169 extendStatics(d, b);
7170 function __() { this.constructor = d; }
7171 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7172 };
7173})();
7174Object.defineProperty(exports, "__esModule", { value: true });
7175var container_1 = __webpack_require__(17);
7176var Registry = __webpack_require__(1);
7177var OBSERVER_CONFIG = {
7178 attributes: true,
7179 characterData: true,
7180 characterDataOldValue: true,
7181 childList: true,
7182 subtree: true,
7183};
7184var MAX_OPTIMIZE_ITERATIONS = 100;
7185var ScrollBlot = /** @class */ (function (_super) {
7186 __extends(ScrollBlot, _super);
7187 function ScrollBlot(node) {
7188 var _this = _super.call(this, node) || this;
7189 _this.scroll = _this;
7190 _this.observer = new MutationObserver(function (mutations) {
7191 _this.update(mutations);
7192 });
7193 _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
7194 _this.attach();
7195 return _this;
7196 }
7197 ScrollBlot.prototype.detach = function () {
7198 _super.prototype.detach.call(this);
7199 this.observer.disconnect();
7200 };
7201 ScrollBlot.prototype.deleteAt = function (index, length) {
7202 this.update();
7203 if (index === 0 && length === this.length()) {
7204 this.children.forEach(function (child) {
7205 child.remove();
7206 });
7207 }
7208 else {
7209 _super.prototype.deleteAt.call(this, index, length);
7210 }
7211 };
7212 ScrollBlot.prototype.formatAt = function (index, length, name, value) {
7213 this.update();
7214 _super.prototype.formatAt.call(this, index, length, name, value);
7215 };
7216 ScrollBlot.prototype.insertAt = function (index, value, def) {
7217 this.update();
7218 _super.prototype.insertAt.call(this, index, value, def);
7219 };
7220 ScrollBlot.prototype.optimize = function (mutations, context) {
7221 var _this = this;
7222 if (mutations === void 0) { mutations = []; }
7223 if (context === void 0) { context = {}; }
7224 _super.prototype.optimize.call(this, context);
7225 // We must modify mutations directly, cannot make copy and then modify
7226 var records = [].slice.call(this.observer.takeRecords());
7227 // Array.push currently seems to be implemented by a non-tail recursive function
7228 // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
7229 while (records.length > 0)
7230 mutations.push(records.pop());
7231 // TODO use WeakMap
7232 var mark = function (blot, markParent) {
7233 if (markParent === void 0) { markParent = true; }
7234 if (blot == null || blot === _this)
7235 return;
7236 if (blot.domNode.parentNode == null)
7237 return;
7238 // @ts-ignore
7239 if (blot.domNode[Registry.DATA_KEY].mutations == null) {
7240 // @ts-ignore
7241 blot.domNode[Registry.DATA_KEY].mutations = [];
7242 }
7243 if (markParent)
7244 mark(blot.parent);
7245 };
7246 var optimize = function (blot) {
7247 // Post-order traversal
7248 if (
7249 // @ts-ignore
7250 blot.domNode[Registry.DATA_KEY] == null ||
7251 // @ts-ignore
7252 blot.domNode[Registry.DATA_KEY].mutations == null) {
7253 return;
7254 }
7255 if (blot instanceof container_1.default) {
7256 blot.children.forEach(optimize);
7257 }
7258 blot.optimize(context);
7259 };
7260 var remaining = mutations;
7261 for (var i = 0; remaining.length > 0; i += 1) {
7262 if (i >= MAX_OPTIMIZE_ITERATIONS) {
7263 throw new Error('[Parchment] Maximum optimize iterations reached');
7264 }
7265 remaining.forEach(function (mutation) {
7266 var blot = Registry.find(mutation.target, true);
7267 if (blot == null)
7268 return;
7269 if (blot.domNode === mutation.target) {
7270 if (mutation.type === 'childList') {
7271 mark(Registry.find(mutation.previousSibling, false));
7272 [].forEach.call(mutation.addedNodes, function (node) {
7273 var child = Registry.find(node, false);
7274 mark(child, false);
7275 if (child instanceof container_1.default) {
7276 child.children.forEach(function (grandChild) {
7277 mark(grandChild, false);
7278 });
7279 }
7280 });
7281 }
7282 else if (mutation.type === 'attributes') {
7283 mark(blot.prev);
7284 }
7285 }
7286 mark(blot);
7287 });
7288 this.children.forEach(optimize);
7289 remaining = [].slice.call(this.observer.takeRecords());
7290 records = remaining.slice();
7291 while (records.length > 0)
7292 mutations.push(records.pop());
7293 }
7294 };
7295 ScrollBlot.prototype.update = function (mutations, context) {
7296 var _this = this;
7297 if (context === void 0) { context = {}; }
7298 mutations = mutations || this.observer.takeRecords();
7299 // TODO use WeakMap
7300 mutations
7301 .map(function (mutation) {
7302 var blot = Registry.find(mutation.target, true);
7303 if (blot == null)
7304 return null;
7305 // @ts-ignore
7306 if (blot.domNode[Registry.DATA_KEY].mutations == null) {
7307 // @ts-ignore
7308 blot.domNode[Registry.DATA_KEY].mutations = [mutation];
7309 return blot;
7310 }
7311 else {
7312 // @ts-ignore
7313 blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
7314 return null;
7315 }
7316 })
7317 .forEach(function (blot) {
7318 if (blot == null ||
7319 blot === _this ||
7320 //@ts-ignore
7321 blot.domNode[Registry.DATA_KEY] == null)
7322 return;
7323 // @ts-ignore
7324 blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);
7325 });
7326 // @ts-ignore
7327 if (this.domNode[Registry.DATA_KEY].mutations != null) {
7328 // @ts-ignore
7329 _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);
7330 }
7331 this.optimize(mutations, context);
7332 };
7333 ScrollBlot.blotName = 'scroll';
7334 ScrollBlot.defaultChild = 'block';
7335 ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
7336 ScrollBlot.tagName = 'DIV';
7337 return ScrollBlot;
7338}(container_1.default));
7339exports.default = ScrollBlot;
7340
7341
7342/***/ }),
7343/* 46 */
7344/***/ (function(module, exports, __webpack_require__) {
7345
7346"use strict";
7347
7348var __extends = (this && this.__extends) || (function () {
7349 var extendStatics = Object.setPrototypeOf ||
7350 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7351 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7352 return function (d, b) {
7353 extendStatics(d, b);
7354 function __() { this.constructor = d; }
7355 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7356 };
7357})();
7358Object.defineProperty(exports, "__esModule", { value: true });
7359var format_1 = __webpack_require__(18);
7360var Registry = __webpack_require__(1);
7361// Shallow object comparison
7362function isEqual(obj1, obj2) {
7363 if (Object.keys(obj1).length !== Object.keys(obj2).length)
7364 return false;
7365 // @ts-ignore
7366 for (var prop in obj1) {
7367 // @ts-ignore
7368 if (obj1[prop] !== obj2[prop])
7369 return false;
7370 }
7371 return true;
7372}
7373var InlineBlot = /** @class */ (function (_super) {
7374 __extends(InlineBlot, _super);
7375 function InlineBlot() {
7376 return _super !== null && _super.apply(this, arguments) || this;
7377 }
7378 InlineBlot.formats = function (domNode) {
7379 if (domNode.tagName === InlineBlot.tagName)
7380 return undefined;
7381 return _super.formats.call(this, domNode);
7382 };
7383 InlineBlot.prototype.format = function (name, value) {
7384 var _this = this;
7385 if (name === this.statics.blotName && !value) {
7386 this.children.forEach(function (child) {
7387 if (!(child instanceof format_1.default)) {
7388 child = child.wrap(InlineBlot.blotName, true);
7389 }
7390 _this.attributes.copy(child);
7391 });
7392 this.unwrap();
7393 }
7394 else {
7395 _super.prototype.format.call(this, name, value);
7396 }
7397 };
7398 InlineBlot.prototype.formatAt = function (index, length, name, value) {
7399 if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
7400 var blot = this.isolate(index, length);
7401 blot.format(name, value);
7402 }
7403 else {
7404 _super.prototype.formatAt.call(this, index, length, name, value);
7405 }
7406 };
7407 InlineBlot.prototype.optimize = function (context) {
7408 _super.prototype.optimize.call(this, context);
7409 var formats = this.formats();
7410 if (Object.keys(formats).length === 0) {
7411 return this.unwrap(); // unformatted span
7412 }
7413 var next = this.next;
7414 if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
7415 next.moveChildren(this);
7416 next.remove();
7417 }
7418 };
7419 InlineBlot.blotName = 'inline';
7420 InlineBlot.scope = Registry.Scope.INLINE_BLOT;
7421 InlineBlot.tagName = 'SPAN';
7422 return InlineBlot;
7423}(format_1.default));
7424exports.default = InlineBlot;
7425
7426
7427/***/ }),
7428/* 47 */
7429/***/ (function(module, exports, __webpack_require__) {
7430
7431"use strict";
7432
7433var __extends = (this && this.__extends) || (function () {
7434 var extendStatics = Object.setPrototypeOf ||
7435 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7436 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7437 return function (d, b) {
7438 extendStatics(d, b);
7439 function __() { this.constructor = d; }
7440 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7441 };
7442})();
7443Object.defineProperty(exports, "__esModule", { value: true });
7444var format_1 = __webpack_require__(18);
7445var Registry = __webpack_require__(1);
7446var BlockBlot = /** @class */ (function (_super) {
7447 __extends(BlockBlot, _super);
7448 function BlockBlot() {
7449 return _super !== null && _super.apply(this, arguments) || this;
7450 }
7451 BlockBlot.formats = function (domNode) {
7452 var tagName = Registry.query(BlockBlot.blotName).tagName;
7453 if (domNode.tagName === tagName)
7454 return undefined;
7455 return _super.formats.call(this, domNode);
7456 };
7457 BlockBlot.prototype.format = function (name, value) {
7458 if (Registry.query(name, Registry.Scope.BLOCK) == null) {
7459 return;
7460 }
7461 else if (name === this.statics.blotName && !value) {
7462 this.replaceWith(BlockBlot.blotName);
7463 }
7464 else {
7465 _super.prototype.format.call(this, name, value);
7466 }
7467 };
7468 BlockBlot.prototype.formatAt = function (index, length, name, value) {
7469 if (Registry.query(name, Registry.Scope.BLOCK) != null) {
7470 this.format(name, value);
7471 }
7472 else {
7473 _super.prototype.formatAt.call(this, index, length, name, value);
7474 }
7475 };
7476 BlockBlot.prototype.insertAt = function (index, value, def) {
7477 if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
7478 // Insert text or inline
7479 _super.prototype.insertAt.call(this, index, value, def);
7480 }
7481 else {
7482 var after = this.split(index);
7483 var blot = Registry.create(value, def);
7484 after.parent.insertBefore(blot, after);
7485 }
7486 };
7487 BlockBlot.prototype.update = function (mutations, context) {
7488 if (navigator.userAgent.match(/Trident/)) {
7489 this.build();
7490 }
7491 else {
7492 _super.prototype.update.call(this, mutations, context);
7493 }
7494 };
7495 BlockBlot.blotName = 'block';
7496 BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
7497 BlockBlot.tagName = 'P';
7498 return BlockBlot;
7499}(format_1.default));
7500exports.default = BlockBlot;
7501
7502
7503/***/ }),
7504/* 48 */
7505/***/ (function(module, exports, __webpack_require__) {
7506
7507"use strict";
7508
7509var __extends = (this && this.__extends) || (function () {
7510 var extendStatics = Object.setPrototypeOf ||
7511 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7512 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7513 return function (d, b) {
7514 extendStatics(d, b);
7515 function __() { this.constructor = d; }
7516 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7517 };
7518})();
7519Object.defineProperty(exports, "__esModule", { value: true });
7520var leaf_1 = __webpack_require__(19);
7521var EmbedBlot = /** @class */ (function (_super) {
7522 __extends(EmbedBlot, _super);
7523 function EmbedBlot() {
7524 return _super !== null && _super.apply(this, arguments) || this;
7525 }
7526 EmbedBlot.formats = function (domNode) {
7527 return undefined;
7528 };
7529 EmbedBlot.prototype.format = function (name, value) {
7530 // super.formatAt wraps, which is what we want in general,
7531 // but this allows subclasses to overwrite for formats
7532 // that just apply to particular embeds
7533 _super.prototype.formatAt.call(this, 0, this.length(), name, value);
7534 };
7535 EmbedBlot.prototype.formatAt = function (index, length, name, value) {
7536 if (index === 0 && length === this.length()) {
7537 this.format(name, value);
7538 }
7539 else {
7540 _super.prototype.formatAt.call(this, index, length, name, value);
7541 }
7542 };
7543 EmbedBlot.prototype.formats = function () {
7544 return this.statics.formats(this.domNode);
7545 };
7546 return EmbedBlot;
7547}(leaf_1.default));
7548exports.default = EmbedBlot;
7549
7550
7551/***/ }),
7552/* 49 */
7553/***/ (function(module, exports, __webpack_require__) {
7554
7555"use strict";
7556
7557var __extends = (this && this.__extends) || (function () {
7558 var extendStatics = Object.setPrototypeOf ||
7559 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7560 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7561 return function (d, b) {
7562 extendStatics(d, b);
7563 function __() { this.constructor = d; }
7564 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7565 };
7566})();
7567Object.defineProperty(exports, "__esModule", { value: true });
7568var leaf_1 = __webpack_require__(19);
7569var Registry = __webpack_require__(1);
7570var TextBlot = /** @class */ (function (_super) {
7571 __extends(TextBlot, _super);
7572 function TextBlot(node) {
7573 var _this = _super.call(this, node) || this;
7574 _this.text = _this.statics.value(_this.domNode);
7575 return _this;
7576 }
7577 TextBlot.create = function (value) {
7578 return document.createTextNode(value);
7579 };
7580 TextBlot.value = function (domNode) {
7581 var text = domNode.data;
7582 // @ts-ignore
7583 if (text['normalize'])
7584 text = text['normalize']();
7585 return text;
7586 };
7587 TextBlot.prototype.deleteAt = function (index, length) {
7588 this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
7589 };
7590 TextBlot.prototype.index = function (node, offset) {
7591 if (this.domNode === node) {
7592 return offset;
7593 }
7594 return -1;
7595 };
7596 TextBlot.prototype.insertAt = function (index, value, def) {
7597 if (def == null) {
7598 this.text = this.text.slice(0, index) + value + this.text.slice(index);
7599 this.domNode.data = this.text;
7600 }
7601 else {
7602 _super.prototype.insertAt.call(this, index, value, def);
7603 }
7604 };
7605 TextBlot.prototype.length = function () {
7606 return this.text.length;
7607 };
7608 TextBlot.prototype.optimize = function (context) {
7609 _super.prototype.optimize.call(this, context);
7610 this.text = this.statics.value(this.domNode);
7611 if (this.text.length === 0) {
7612 this.remove();
7613 }
7614 else if (this.next instanceof TextBlot && this.next.prev === this) {
7615 this.insertAt(this.length(), this.next.value());
7616 this.next.remove();
7617 }
7618 };
7619 TextBlot.prototype.position = function (index, inclusive) {
7620 if (inclusive === void 0) { inclusive = false; }
7621 return [this.domNode, index];
7622 };
7623 TextBlot.prototype.split = function (index, force) {
7624 if (force === void 0) { force = false; }
7625 if (!force) {
7626 if (index === 0)
7627 return this;
7628 if (index === this.length())
7629 return this.next;
7630 }
7631 var after = Registry.create(this.domNode.splitText(index));
7632 this.parent.insertBefore(after, this.next);
7633 this.text = this.statics.value(this.domNode);
7634 return after;
7635 };
7636 TextBlot.prototype.update = function (mutations, context) {
7637 var _this = this;
7638 if (mutations.some(function (mutation) {
7639 return mutation.type === 'characterData' && mutation.target === _this.domNode;
7640 })) {
7641 this.text = this.statics.value(this.domNode);
7642 }
7643 };
7644 TextBlot.prototype.value = function () {
7645 return this.text;
7646 };
7647 TextBlot.blotName = 'text';
7648 TextBlot.scope = Registry.Scope.INLINE_BLOT;
7649 return TextBlot;
7650}(leaf_1.default));
7651exports.default = TextBlot;
7652
7653
7654/***/ }),
7655/* 50 */
7656/***/ (function(module, exports, __webpack_require__) {
7657
7658"use strict";
7659
7660
7661var elem = document.createElement('div');
7662elem.classList.toggle('test-class', false);
7663if (elem.classList.contains('test-class')) {
7664 var _toggle = DOMTokenList.prototype.toggle;
7665 DOMTokenList.prototype.toggle = function (token, force) {
7666 if (arguments.length > 1 && !this.contains(token) === !force) {
7667 return force;
7668 } else {
7669 return _toggle.call(this, token);
7670 }
7671 };
7672}
7673
7674if (!String.prototype.startsWith) {
7675 String.prototype.startsWith = function (searchString, position) {
7676 position = position || 0;
7677 return this.substr(position, searchString.length) === searchString;
7678 };
7679}
7680
7681if (!String.prototype.endsWith) {
7682 String.prototype.endsWith = function (searchString, position) {
7683 var subjectString = this.toString();
7684 if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
7685 position = subjectString.length;
7686 }
7687 position -= searchString.length;
7688 var lastIndex = subjectString.indexOf(searchString, position);
7689 return lastIndex !== -1 && lastIndex === position;
7690 };
7691}
7692
7693if (!Array.prototype.find) {
7694 Object.defineProperty(Array.prototype, "find", {
7695 value: function value(predicate) {
7696 if (this === null) {
7697 throw new TypeError('Array.prototype.find called on null or undefined');
7698 }
7699 if (typeof predicate !== 'function') {
7700 throw new TypeError('predicate must be a function');
7701 }
7702 var list = Object(this);
7703 var length = list.length >>> 0;
7704 var thisArg = arguments[1];
7705 var value;
7706
7707 for (var i = 0; i < length; i++) {
7708 value = list[i];
7709 if (predicate.call(thisArg, value, i, list)) {
7710 return value;
7711 }
7712 }
7713 return undefined;
7714 }
7715 });
7716}
7717
7718document.addEventListener("DOMContentLoaded", function () {
7719 // Disable resizing in Firefox
7720 document.execCommand("enableObjectResizing", false, false);
7721 // Disable automatic linkifying in IE11
7722 document.execCommand("autoUrlDetect", false, false);
7723});
7724
7725/***/ }),
7726/* 51 */
7727/***/ (function(module, exports) {
7728
7729/**
7730 * This library modifies the diff-patch-match library by Neil Fraser
7731 * by removing the patch and match functionality and certain advanced
7732 * options in the diff function. The original license is as follows:
7733 *
7734 * ===
7735 *
7736 * Diff Match and Patch
7737 *
7738 * Copyright 2006 Google Inc.
7739 * http://code.google.com/p/google-diff-match-patch/
7740 *
7741 * Licensed under the Apache License, Version 2.0 (the "License");
7742 * you may not use this file except in compliance with the License.
7743 * You may obtain a copy of the License at
7744 *
7745 * http://www.apache.org/licenses/LICENSE-2.0
7746 *
7747 * Unless required by applicable law or agreed to in writing, software
7748 * distributed under the License is distributed on an "AS IS" BASIS,
7749 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7750 * See the License for the specific language governing permissions and
7751 * limitations under the License.
7752 */
7753
7754
7755/**
7756 * The data structure representing a diff is an array of tuples:
7757 * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
7758 * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
7759 */
7760var DIFF_DELETE = -1;
7761var DIFF_INSERT = 1;
7762var DIFF_EQUAL = 0;
7763
7764
7765/**
7766 * Find the differences between two texts. Simplifies the problem by stripping
7767 * any common prefix or suffix off the texts before diffing.
7768 * @param {string} text1 Old string to be diffed.
7769 * @param {string} text2 New string to be diffed.
7770 * @param {Int} cursor_pos Expected edit position in text1 (optional)
7771 * @return {Array} Array of diff tuples.
7772 */
7773function diff_main(text1, text2, cursor_pos) {
7774 // Check for equality (speedup).
7775 if (text1 == text2) {
7776 if (text1) {
7777 return [[DIFF_EQUAL, text1]];
7778 }
7779 return [];
7780 }
7781
7782 // Check cursor_pos within bounds
7783 if (cursor_pos < 0 || text1.length < cursor_pos) {
7784 cursor_pos = null;
7785 }
7786
7787 // Trim off common prefix (speedup).
7788 var commonlength = diff_commonPrefix(text1, text2);
7789 var commonprefix = text1.substring(0, commonlength);
7790 text1 = text1.substring(commonlength);
7791 text2 = text2.substring(commonlength);
7792
7793 // Trim off common suffix (speedup).
7794 commonlength = diff_commonSuffix(text1, text2);
7795 var commonsuffix = text1.substring(text1.length - commonlength);
7796 text1 = text1.substring(0, text1.length - commonlength);
7797 text2 = text2.substring(0, text2.length - commonlength);
7798
7799 // Compute the diff on the middle block.
7800 var diffs = diff_compute_(text1, text2);
7801
7802 // Restore the prefix and suffix.
7803 if (commonprefix) {
7804 diffs.unshift([DIFF_EQUAL, commonprefix]);
7805 }
7806 if (commonsuffix) {
7807 diffs.push([DIFF_EQUAL, commonsuffix]);
7808 }
7809 diff_cleanupMerge(diffs);
7810 if (cursor_pos != null) {
7811 diffs = fix_cursor(diffs, cursor_pos);
7812 }
7813 diffs = fix_emoji(diffs);
7814 return diffs;
7815};
7816
7817
7818/**
7819 * Find the differences between two texts. Assumes that the texts do not
7820 * have any common prefix or suffix.
7821 * @param {string} text1 Old string to be diffed.
7822 * @param {string} text2 New string to be diffed.
7823 * @return {Array} Array of diff tuples.
7824 */
7825function diff_compute_(text1, text2) {
7826 var diffs;
7827
7828 if (!text1) {
7829 // Just add some text (speedup).
7830 return [[DIFF_INSERT, text2]];
7831 }
7832
7833 if (!text2) {
7834 // Just delete some text (speedup).
7835 return [[DIFF_DELETE, text1]];
7836 }
7837
7838 var longtext = text1.length > text2.length ? text1 : text2;
7839 var shorttext = text1.length > text2.length ? text2 : text1;
7840 var i = longtext.indexOf(shorttext);
7841 if (i != -1) {
7842 // Shorter text is inside the longer text (speedup).
7843 diffs = [[DIFF_INSERT, longtext.substring(0, i)],
7844 [DIFF_EQUAL, shorttext],
7845 [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
7846 // Swap insertions for deletions if diff is reversed.
7847 if (text1.length > text2.length) {
7848 diffs[0][0] = diffs[2][0] = DIFF_DELETE;
7849 }
7850 return diffs;
7851 }
7852
7853 if (shorttext.length == 1) {
7854 // Single character string.
7855 // After the previous speedup, the character can't be an equality.
7856 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
7857 }
7858
7859 // Check to see if the problem can be split in two.
7860 var hm = diff_halfMatch_(text1, text2);
7861 if (hm) {
7862 // A half-match was found, sort out the return data.
7863 var text1_a = hm[0];
7864 var text1_b = hm[1];
7865 var text2_a = hm[2];
7866 var text2_b = hm[3];
7867 var mid_common = hm[4];
7868 // Send both pairs off for separate processing.
7869 var diffs_a = diff_main(text1_a, text2_a);
7870 var diffs_b = diff_main(text1_b, text2_b);
7871 // Merge the results.
7872 return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
7873 }
7874
7875 return diff_bisect_(text1, text2);
7876};
7877
7878
7879/**
7880 * Find the 'middle snake' of a diff, split the problem in two
7881 * and return the recursively constructed diff.
7882 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
7883 * @param {string} text1 Old string to be diffed.
7884 * @param {string} text2 New string to be diffed.
7885 * @return {Array} Array of diff tuples.
7886 * @private
7887 */
7888function diff_bisect_(text1, text2) {
7889 // Cache the text lengths to prevent multiple calls.
7890 var text1_length = text1.length;
7891 var text2_length = text2.length;
7892 var max_d = Math.ceil((text1_length + text2_length) / 2);
7893 var v_offset = max_d;
7894 var v_length = 2 * max_d;
7895 var v1 = new Array(v_length);
7896 var v2 = new Array(v_length);
7897 // Setting all elements to -1 is faster in Chrome & Firefox than mixing
7898 // integers and undefined.
7899 for (var x = 0; x < v_length; x++) {
7900 v1[x] = -1;
7901 v2[x] = -1;
7902 }
7903 v1[v_offset + 1] = 0;
7904 v2[v_offset + 1] = 0;
7905 var delta = text1_length - text2_length;
7906 // If the total number of characters is odd, then the front path will collide
7907 // with the reverse path.
7908 var front = (delta % 2 != 0);
7909 // Offsets for start and end of k loop.
7910 // Prevents mapping of space beyond the grid.
7911 var k1start = 0;
7912 var k1end = 0;
7913 var k2start = 0;
7914 var k2end = 0;
7915 for (var d = 0; d < max_d; d++) {
7916 // Walk the front path one step.
7917 for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
7918 var k1_offset = v_offset + k1;
7919 var x1;
7920 if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
7921 x1 = v1[k1_offset + 1];
7922 } else {
7923 x1 = v1[k1_offset - 1] + 1;
7924 }
7925 var y1 = x1 - k1;
7926 while (x1 < text1_length && y1 < text2_length &&
7927 text1.charAt(x1) == text2.charAt(y1)) {
7928 x1++;
7929 y1++;
7930 }
7931 v1[k1_offset] = x1;
7932 if (x1 > text1_length) {
7933 // Ran off the right of the graph.
7934 k1end += 2;
7935 } else if (y1 > text2_length) {
7936 // Ran off the bottom of the graph.
7937 k1start += 2;
7938 } else if (front) {
7939 var k2_offset = v_offset + delta - k1;
7940 if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
7941 // Mirror x2 onto top-left coordinate system.
7942 var x2 = text1_length - v2[k2_offset];
7943 if (x1 >= x2) {
7944 // Overlap detected.
7945 return diff_bisectSplit_(text1, text2, x1, y1);
7946 }
7947 }
7948 }
7949 }
7950
7951 // Walk the reverse path one step.
7952 for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
7953 var k2_offset = v_offset + k2;
7954 var x2;
7955 if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
7956 x2 = v2[k2_offset + 1];
7957 } else {
7958 x2 = v2[k2_offset - 1] + 1;
7959 }
7960 var y2 = x2 - k2;
7961 while (x2 < text1_length && y2 < text2_length &&
7962 text1.charAt(text1_length - x2 - 1) ==
7963 text2.charAt(text2_length - y2 - 1)) {
7964 x2++;
7965 y2++;
7966 }
7967 v2[k2_offset] = x2;
7968 if (x2 > text1_length) {
7969 // Ran off the left of the graph.
7970 k2end += 2;
7971 } else if (y2 > text2_length) {
7972 // Ran off the top of the graph.
7973 k2start += 2;
7974 } else if (!front) {
7975 var k1_offset = v_offset + delta - k2;
7976 if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
7977 var x1 = v1[k1_offset];
7978 var y1 = v_offset + x1 - k1_offset;
7979 // Mirror x2 onto top-left coordinate system.
7980 x2 = text1_length - x2;
7981 if (x1 >= x2) {
7982 // Overlap detected.
7983 return diff_bisectSplit_(text1, text2, x1, y1);
7984 }
7985 }
7986 }
7987 }
7988 }
7989 // Diff took too long and hit the deadline or
7990 // number of diffs equals number of characters, no commonality at all.
7991 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
7992};
7993
7994
7995/**
7996 * Given the location of the 'middle snake', split the diff in two parts
7997 * and recurse.
7998 * @param {string} text1 Old string to be diffed.
7999 * @param {string} text2 New string to be diffed.
8000 * @param {number} x Index of split point in text1.
8001 * @param {number} y Index of split point in text2.
8002 * @return {Array} Array of diff tuples.
8003 */
8004function diff_bisectSplit_(text1, text2, x, y) {
8005 var text1a = text1.substring(0, x);
8006 var text2a = text2.substring(0, y);
8007 var text1b = text1.substring(x);
8008 var text2b = text2.substring(y);
8009
8010 // Compute both diffs serially.
8011 var diffs = diff_main(text1a, text2a);
8012 var diffsb = diff_main(text1b, text2b);
8013
8014 return diffs.concat(diffsb);
8015};
8016
8017
8018/**
8019 * Determine the common prefix of two strings.
8020 * @param {string} text1 First string.
8021 * @param {string} text2 Second string.
8022 * @return {number} The number of characters common to the start of each
8023 * string.
8024 */
8025function diff_commonPrefix(text1, text2) {
8026 // Quick check for common null cases.
8027 if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
8028 return 0;
8029 }
8030 // Binary search.
8031 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
8032 var pointermin = 0;
8033 var pointermax = Math.min(text1.length, text2.length);
8034 var pointermid = pointermax;
8035 var pointerstart = 0;
8036 while (pointermin < pointermid) {
8037 if (text1.substring(pointerstart, pointermid) ==
8038 text2.substring(pointerstart, pointermid)) {
8039 pointermin = pointermid;
8040 pointerstart = pointermin;
8041 } else {
8042 pointermax = pointermid;
8043 }
8044 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
8045 }
8046 return pointermid;
8047};
8048
8049
8050/**
8051 * Determine the common suffix of two strings.
8052 * @param {string} text1 First string.
8053 * @param {string} text2 Second string.
8054 * @return {number} The number of characters common to the end of each string.
8055 */
8056function diff_commonSuffix(text1, text2) {
8057 // Quick check for common null cases.
8058 if (!text1 || !text2 ||
8059 text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
8060 return 0;
8061 }
8062 // Binary search.
8063 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
8064 var pointermin = 0;
8065 var pointermax = Math.min(text1.length, text2.length);
8066 var pointermid = pointermax;
8067 var pointerend = 0;
8068 while (pointermin < pointermid) {
8069 if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
8070 text2.substring(text2.length - pointermid, text2.length - pointerend)) {
8071 pointermin = pointermid;
8072 pointerend = pointermin;
8073 } else {
8074 pointermax = pointermid;
8075 }
8076 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
8077 }
8078 return pointermid;
8079};
8080
8081
8082/**
8083 * Do the two texts share a substring which is at least half the length of the
8084 * longer text?
8085 * This speedup can produce non-minimal diffs.
8086 * @param {string} text1 First string.
8087 * @param {string} text2 Second string.
8088 * @return {Array.<string>} Five element Array, containing the prefix of
8089 * text1, the suffix of text1, the prefix of text2, the suffix of
8090 * text2 and the common middle. Or null if there was no match.
8091 */
8092function diff_halfMatch_(text1, text2) {
8093 var longtext = text1.length > text2.length ? text1 : text2;
8094 var shorttext = text1.length > text2.length ? text2 : text1;
8095 if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
8096 return null; // Pointless.
8097 }
8098
8099 /**
8100 * Does a substring of shorttext exist within longtext such that the substring
8101 * is at least half the length of longtext?
8102 * Closure, but does not reference any external variables.
8103 * @param {string} longtext Longer string.
8104 * @param {string} shorttext Shorter string.
8105 * @param {number} i Start index of quarter length substring within longtext.
8106 * @return {Array.<string>} Five element Array, containing the prefix of
8107 * longtext, the suffix of longtext, the prefix of shorttext, the suffix
8108 * of shorttext and the common middle. Or null if there was no match.
8109 * @private
8110 */
8111 function diff_halfMatchI_(longtext, shorttext, i) {
8112 // Start with a 1/4 length substring at position i as a seed.
8113 var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
8114 var j = -1;
8115 var best_common = '';
8116 var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
8117 while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
8118 var prefixLength = diff_commonPrefix(longtext.substring(i),
8119 shorttext.substring(j));
8120 var suffixLength = diff_commonSuffix(longtext.substring(0, i),
8121 shorttext.substring(0, j));
8122 if (best_common.length < suffixLength + prefixLength) {
8123 best_common = shorttext.substring(j - suffixLength, j) +
8124 shorttext.substring(j, j + prefixLength);
8125 best_longtext_a = longtext.substring(0, i - suffixLength);
8126 best_longtext_b = longtext.substring(i + prefixLength);
8127 best_shorttext_a = shorttext.substring(0, j - suffixLength);
8128 best_shorttext_b = shorttext.substring(j + prefixLength);
8129 }
8130 }
8131 if (best_common.length * 2 >= longtext.length) {
8132 return [best_longtext_a, best_longtext_b,
8133 best_shorttext_a, best_shorttext_b, best_common];
8134 } else {
8135 return null;
8136 }
8137 }
8138
8139 // First check if the second quarter is the seed for a half-match.
8140 var hm1 = diff_halfMatchI_(longtext, shorttext,
8141 Math.ceil(longtext.length / 4));
8142 // Check again based on the third quarter.
8143 var hm2 = diff_halfMatchI_(longtext, shorttext,
8144 Math.ceil(longtext.length / 2));
8145 var hm;
8146 if (!hm1 && !hm2) {
8147 return null;
8148 } else if (!hm2) {
8149 hm = hm1;
8150 } else if (!hm1) {
8151 hm = hm2;
8152 } else {
8153 // Both matched. Select the longest.
8154 hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
8155 }
8156
8157 // A half-match was found, sort out the return data.
8158 var text1_a, text1_b, text2_a, text2_b;
8159 if (text1.length > text2.length) {
8160 text1_a = hm[0];
8161 text1_b = hm[1];
8162 text2_a = hm[2];
8163 text2_b = hm[3];
8164 } else {
8165 text2_a = hm[0];
8166 text2_b = hm[1];
8167 text1_a = hm[2];
8168 text1_b = hm[3];
8169 }
8170 var mid_common = hm[4];
8171 return [text1_a, text1_b, text2_a, text2_b, mid_common];
8172};
8173
8174
8175/**
8176 * Reorder and merge like edit sections. Merge equalities.
8177 * Any edit section can move as long as it doesn't cross an equality.
8178 * @param {Array} diffs Array of diff tuples.
8179 */
8180function diff_cleanupMerge(diffs) {
8181 diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
8182 var pointer = 0;
8183 var count_delete = 0;
8184 var count_insert = 0;
8185 var text_delete = '';
8186 var text_insert = '';
8187 var commonlength;
8188 while (pointer < diffs.length) {
8189 switch (diffs[pointer][0]) {
8190 case DIFF_INSERT:
8191 count_insert++;
8192 text_insert += diffs[pointer][1];
8193 pointer++;
8194 break;
8195 case DIFF_DELETE:
8196 count_delete++;
8197 text_delete += diffs[pointer][1];
8198 pointer++;
8199 break;
8200 case DIFF_EQUAL:
8201 // Upon reaching an equality, check for prior redundancies.
8202 if (count_delete + count_insert > 1) {
8203 if (count_delete !== 0 && count_insert !== 0) {
8204 // Factor out any common prefixies.
8205 commonlength = diff_commonPrefix(text_insert, text_delete);
8206 if (commonlength !== 0) {
8207 if ((pointer - count_delete - count_insert) > 0 &&
8208 diffs[pointer - count_delete - count_insert - 1][0] ==
8209 DIFF_EQUAL) {
8210 diffs[pointer - count_delete - count_insert - 1][1] +=
8211 text_insert.substring(0, commonlength);
8212 } else {
8213 diffs.splice(0, 0, [DIFF_EQUAL,
8214 text_insert.substring(0, commonlength)]);
8215 pointer++;
8216 }
8217 text_insert = text_insert.substring(commonlength);
8218 text_delete = text_delete.substring(commonlength);
8219 }
8220 // Factor out any common suffixies.
8221 commonlength = diff_commonSuffix(text_insert, text_delete);
8222 if (commonlength !== 0) {
8223 diffs[pointer][1] = text_insert.substring(text_insert.length -
8224 commonlength) + diffs[pointer][1];
8225 text_insert = text_insert.substring(0, text_insert.length -
8226 commonlength);
8227 text_delete = text_delete.substring(0, text_delete.length -
8228 commonlength);
8229 }
8230 }
8231 // Delete the offending records and add the merged ones.
8232 if (count_delete === 0) {
8233 diffs.splice(pointer - count_insert,
8234 count_delete + count_insert, [DIFF_INSERT, text_insert]);
8235 } else if (count_insert === 0) {
8236 diffs.splice(pointer - count_delete,
8237 count_delete + count_insert, [DIFF_DELETE, text_delete]);
8238 } else {
8239 diffs.splice(pointer - count_delete - count_insert,
8240 count_delete + count_insert, [DIFF_DELETE, text_delete],
8241 [DIFF_INSERT, text_insert]);
8242 }
8243 pointer = pointer - count_delete - count_insert +
8244 (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
8245 } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
8246 // Merge this equality with the previous one.
8247 diffs[pointer - 1][1] += diffs[pointer][1];
8248 diffs.splice(pointer, 1);
8249 } else {
8250 pointer++;
8251 }
8252 count_insert = 0;
8253 count_delete = 0;
8254 text_delete = '';
8255 text_insert = '';
8256 break;
8257 }
8258 }
8259 if (diffs[diffs.length - 1][1] === '') {
8260 diffs.pop(); // Remove the dummy entry at the end.
8261 }
8262
8263 // Second pass: look for single edits surrounded on both sides by equalities
8264 // which can be shifted sideways to eliminate an equality.
8265 // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
8266 var changes = false;
8267 pointer = 1;
8268 // Intentionally ignore the first and last element (don't need checking).
8269 while (pointer < diffs.length - 1) {
8270 if (diffs[pointer - 1][0] == DIFF_EQUAL &&
8271 diffs[pointer + 1][0] == DIFF_EQUAL) {
8272 // This is a single edit surrounded by equalities.
8273 if (diffs[pointer][1].substring(diffs[pointer][1].length -
8274 diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
8275 // Shift the edit over the previous equality.
8276 diffs[pointer][1] = diffs[pointer - 1][1] +
8277 diffs[pointer][1].substring(0, diffs[pointer][1].length -
8278 diffs[pointer - 1][1].length);
8279 diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
8280 diffs.splice(pointer - 1, 1);
8281 changes = true;
8282 } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
8283 diffs[pointer + 1][1]) {
8284 // Shift the edit over the next equality.
8285 diffs[pointer - 1][1] += diffs[pointer + 1][1];
8286 diffs[pointer][1] =
8287 diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
8288 diffs[pointer + 1][1];
8289 diffs.splice(pointer + 1, 1);
8290 changes = true;
8291 }
8292 }
8293 pointer++;
8294 }
8295 // If shifts were made, the diff needs reordering and another shift sweep.
8296 if (changes) {
8297 diff_cleanupMerge(diffs);
8298 }
8299};
8300
8301
8302var diff = diff_main;
8303diff.INSERT = DIFF_INSERT;
8304diff.DELETE = DIFF_DELETE;
8305diff.EQUAL = DIFF_EQUAL;
8306
8307module.exports = diff;
8308
8309/*
8310 * Modify a diff such that the cursor position points to the start of a change:
8311 * E.g.
8312 * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
8313 * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
8314 * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
8315 * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
8316 *
8317 * @param {Array} diffs Array of diff tuples
8318 * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
8319 * @return {Array} A tuple [cursor location in the modified diff, modified diff]
8320 */
8321function cursor_normalize_diff (diffs, cursor_pos) {
8322 if (cursor_pos === 0) {
8323 return [DIFF_EQUAL, diffs];
8324 }
8325 for (var current_pos = 0, i = 0; i < diffs.length; i++) {
8326 var d = diffs[i];
8327 if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
8328 var next_pos = current_pos + d[1].length;
8329 if (cursor_pos === next_pos) {
8330 return [i + 1, diffs];
8331 } else if (cursor_pos < next_pos) {
8332 // copy to prevent side effects
8333 diffs = diffs.slice();
8334 // split d into two diff changes
8335 var split_pos = cursor_pos - current_pos;
8336 var d_left = [d[0], d[1].slice(0, split_pos)];
8337 var d_right = [d[0], d[1].slice(split_pos)];
8338 diffs.splice(i, 1, d_left, d_right);
8339 return [i + 1, diffs];
8340 } else {
8341 current_pos = next_pos;
8342 }
8343 }
8344 }
8345 throw new Error('cursor_pos is out of bounds!')
8346}
8347
8348/*
8349 * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
8350 *
8351 * Case 1)
8352 * Check if a naive shift is possible:
8353 * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
8354 * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
8355 * Case 2)
8356 * Check if the following shifts are possible:
8357 * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
8358 * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
8359 * ^ ^
8360 * d d_next
8361 *
8362 * @param {Array} diffs Array of diff tuples
8363 * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
8364 * @return {Array} Array of diff tuples
8365 */
8366function fix_cursor (diffs, cursor_pos) {
8367 var norm = cursor_normalize_diff(diffs, cursor_pos);
8368 var ndiffs = norm[1];
8369 var cursor_pointer = norm[0];
8370 var d = ndiffs[cursor_pointer];
8371 var d_next = ndiffs[cursor_pointer + 1];
8372
8373 if (d == null) {
8374 // Text was deleted from end of original string,
8375 // cursor is now out of bounds in new string
8376 return diffs;
8377 } else if (d[0] !== DIFF_EQUAL) {
8378 // A modification happened at the cursor location.
8379 // This is the expected outcome, so we can return the original diff.
8380 return diffs;
8381 } else {
8382 if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
8383 // Case 1)
8384 // It is possible to perform a naive shift
8385 ndiffs.splice(cursor_pointer, 2, d_next, d)
8386 return merge_tuples(ndiffs, cursor_pointer, 2)
8387 } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
8388 // Case 2)
8389 // d[1] is a prefix of d_next[1]
8390 // We can assume that d_next[0] !== 0, since d[0] === 0
8391 // Shift edit locations..
8392 ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
8393 var suffix = d_next[1].slice(d[1].length);
8394 if (suffix.length > 0) {
8395 ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
8396 }
8397 return merge_tuples(ndiffs, cursor_pointer, 3)
8398 } else {
8399 // Not possible to perform any modification
8400 return diffs;
8401 }
8402 }
8403}
8404
8405/*
8406 * Check diff did not split surrogate pairs.
8407 * Ex. [0, '\uD83D'], [-1, '\uDC36'], [1, '\uDC2F'] -> [-1, '\uD83D\uDC36'], [1, '\uD83D\uDC2F']
8408 * '\uD83D\uDC36' === '🐶', '\uD83D\uDC2F' === '🐯'
8409 *
8410 * @param {Array} diffs Array of diff tuples
8411 * @return {Array} Array of diff tuples
8412 */
8413function fix_emoji (diffs) {
8414 var compact = false;
8415 var starts_with_pair_end = function(str) {
8416 return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;
8417 }
8418 var ends_with_pair_start = function(str) {
8419 return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;
8420 }
8421 for (var i = 2; i < diffs.length; i += 1) {
8422 if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&
8423 diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&
8424 diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {
8425 compact = true;
8426
8427 diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];
8428 diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];
8429
8430 diffs[i-2][1] = diffs[i-2][1].slice(0, -1);
8431 }
8432 }
8433 if (!compact) {
8434 return diffs;
8435 }
8436 var fixed_diffs = [];
8437 for (var i = 0; i < diffs.length; i += 1) {
8438 if (diffs[i][1].length > 0) {
8439 fixed_diffs.push(diffs[i]);
8440 }
8441 }
8442 return fixed_diffs;
8443}
8444
8445/*
8446 * Try to merge tuples with their neigbors in a given range.
8447 * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
8448 *
8449 * @param {Array} diffs Array of diff tuples.
8450 * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
8451 * @param {Int} length Number of consecutive elements to check.
8452 * @return {Array} Array of merged diff tuples.
8453 */
8454function merge_tuples (diffs, start, length) {
8455 // Check from (start-1) to (start+length).
8456 for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
8457 if (i + 1 < diffs.length) {
8458 var left_d = diffs[i];
8459 var right_d = diffs[i+1];
8460 if (left_d[0] === right_d[1]) {
8461 diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
8462 }
8463 }
8464 }
8465 return diffs;
8466}
8467
8468
8469/***/ }),
8470/* 52 */
8471/***/ (function(module, exports) {
8472
8473exports = module.exports = typeof Object.keys === 'function'
8474 ? Object.keys : shim;
8475
8476exports.shim = shim;
8477function shim (obj) {
8478 var keys = [];
8479 for (var key in obj) keys.push(key);
8480 return keys;
8481}
8482
8483
8484/***/ }),
8485/* 53 */
8486/***/ (function(module, exports) {
8487
8488var supportsArgumentsClass = (function(){
8489 return Object.prototype.toString.call(arguments)
8490})() == '[object Arguments]';
8491
8492exports = module.exports = supportsArgumentsClass ? supported : unsupported;
8493
8494exports.supported = supported;
8495function supported(object) {
8496 return Object.prototype.toString.call(object) == '[object Arguments]';
8497};
8498
8499exports.unsupported = unsupported;
8500function unsupported(object){
8501 return object &&
8502 typeof object == 'object' &&
8503 typeof object.length == 'number' &&
8504 Object.prototype.hasOwnProperty.call(object, 'callee') &&
8505 !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
8506 false;
8507};
8508
8509
8510/***/ }),
8511/* 54 */
8512/***/ (function(module, exports) {
8513
8514'use strict';
8515
8516var has = Object.prototype.hasOwnProperty
8517 , prefix = '~';
8518
8519/**
8520 * Constructor to create a storage for our `EE` objects.
8521 * An `Events` instance is a plain object whose properties are event names.
8522 *
8523 * @constructor
8524 * @api private
8525 */
8526function Events() {}
8527
8528//
8529// We try to not inherit from `Object.prototype`. In some engines creating an
8530// instance in this way is faster than calling `Object.create(null)` directly.
8531// If `Object.create(null)` is not supported we prefix the event names with a
8532// character to make sure that the built-in object properties are not
8533// overridden or used as an attack vector.
8534//
8535if (Object.create) {
8536 Events.prototype = Object.create(null);
8537
8538 //
8539 // This hack is needed because the `__proto__` property is still inherited in
8540 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
8541 //
8542 if (!new Events().__proto__) prefix = false;
8543}
8544
8545/**
8546 * Representation of a single event listener.
8547 *
8548 * @param {Function} fn The listener function.
8549 * @param {Mixed} context The context to invoke the listener with.
8550 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
8551 * @constructor
8552 * @api private
8553 */
8554function EE(fn, context, once) {
8555 this.fn = fn;
8556 this.context = context;
8557 this.once = once || false;
8558}
8559
8560/**
8561 * Minimal `EventEmitter` interface that is molded against the Node.js
8562 * `EventEmitter` interface.
8563 *
8564 * @constructor
8565 * @api public
8566 */
8567function EventEmitter() {
8568 this._events = new Events();
8569 this._eventsCount = 0;
8570}
8571
8572/**
8573 * Return an array listing the events for which the emitter has registered
8574 * listeners.
8575 *
8576 * @returns {Array}
8577 * @api public
8578 */
8579EventEmitter.prototype.eventNames = function eventNames() {
8580 var names = []
8581 , events
8582 , name;
8583
8584 if (this._eventsCount === 0) return names;
8585
8586 for (name in (events = this._events)) {
8587 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
8588 }
8589
8590 if (Object.getOwnPropertySymbols) {
8591 return names.concat(Object.getOwnPropertySymbols(events));
8592 }
8593
8594 return names;
8595};
8596
8597/**
8598 * Return the listeners registered for a given event.
8599 *
8600 * @param {String|Symbol} event The event name.
8601 * @param {Boolean} exists Only check if there are listeners.
8602 * @returns {Array|Boolean}
8603 * @api public
8604 */
8605EventEmitter.prototype.listeners = function listeners(event, exists) {
8606 var evt = prefix ? prefix + event : event
8607 , available = this._events[evt];
8608
8609 if (exists) return !!available;
8610 if (!available) return [];
8611 if (available.fn) return [available.fn];
8612
8613 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
8614 ee[i] = available[i].fn;
8615 }
8616
8617 return ee;
8618};
8619
8620/**
8621 * Calls each of the listeners registered for a given event.
8622 *
8623 * @param {String|Symbol} event The event name.
8624 * @returns {Boolean} `true` if the event had listeners, else `false`.
8625 * @api public
8626 */
8627EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
8628 var evt = prefix ? prefix + event : event;
8629
8630 if (!this._events[evt]) return false;
8631
8632 var listeners = this._events[evt]
8633 , len = arguments.length
8634 , args
8635 , i;
8636
8637 if (listeners.fn) {
8638 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
8639
8640 switch (len) {
8641 case 1: return listeners.fn.call(listeners.context), true;
8642 case 2: return listeners.fn.call(listeners.context, a1), true;
8643 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
8644 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
8645 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
8646 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
8647 }
8648
8649 for (i = 1, args = new Array(len -1); i < len; i++) {
8650 args[i - 1] = arguments[i];
8651 }
8652
8653 listeners.fn.apply(listeners.context, args);
8654 } else {
8655 var length = listeners.length
8656 , j;
8657
8658 for (i = 0; i < length; i++) {
8659 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
8660
8661 switch (len) {
8662 case 1: listeners[i].fn.call(listeners[i].context); break;
8663 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
8664 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
8665 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
8666 default:
8667 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
8668 args[j - 1] = arguments[j];
8669 }
8670
8671 listeners[i].fn.apply(listeners[i].context, args);
8672 }
8673 }
8674 }
8675
8676 return true;
8677};
8678
8679/**
8680 * Add a listener for a given event.
8681 *
8682 * @param {String|Symbol} event The event name.
8683 * @param {Function} fn The listener function.
8684 * @param {Mixed} [context=this] The context to invoke the listener with.
8685 * @returns {EventEmitter} `this`.
8686 * @api public
8687 */
8688EventEmitter.prototype.on = function on(event, fn, context) {
8689 var listener = new EE(fn, context || this)
8690 , evt = prefix ? prefix + event : event;
8691
8692 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
8693 else if (!this._events[evt].fn) this._events[evt].push(listener);
8694 else this._events[evt] = [this._events[evt], listener];
8695
8696 return this;
8697};
8698
8699/**
8700 * Add a one-time listener for a given event.
8701 *
8702 * @param {String|Symbol} event The event name.
8703 * @param {Function} fn The listener function.
8704 * @param {Mixed} [context=this] The context to invoke the listener with.
8705 * @returns {EventEmitter} `this`.
8706 * @api public
8707 */
8708EventEmitter.prototype.once = function once(event, fn, context) {
8709 var listener = new EE(fn, context || this, true)
8710 , evt = prefix ? prefix + event : event;
8711
8712 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
8713 else if (!this._events[evt].fn) this._events[evt].push(listener);
8714 else this._events[evt] = [this._events[evt], listener];
8715
8716 return this;
8717};
8718
8719/**
8720 * Remove the listeners of a given event.
8721 *
8722 * @param {String|Symbol} event The event name.
8723 * @param {Function} fn Only remove the listeners that match this function.
8724 * @param {Mixed} context Only remove the listeners that have this context.
8725 * @param {Boolean} once Only remove one-time listeners.
8726 * @returns {EventEmitter} `this`.
8727 * @api public
8728 */
8729EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
8730 var evt = prefix ? prefix + event : event;
8731
8732 if (!this._events[evt]) return this;
8733 if (!fn) {
8734 if (--this._eventsCount === 0) this._events = new Events();
8735 else delete this._events[evt];
8736 return this;
8737 }
8738
8739 var listeners = this._events[evt];
8740
8741 if (listeners.fn) {
8742 if (
8743 listeners.fn === fn
8744 && (!once || listeners.once)
8745 && (!context || listeners.context === context)
8746 ) {
8747 if (--this._eventsCount === 0) this._events = new Events();
8748 else delete this._events[evt];
8749 }
8750 } else {
8751 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
8752 if (
8753 listeners[i].fn !== fn
8754 || (once && !listeners[i].once)
8755 || (context && listeners[i].context !== context)
8756 ) {
8757 events.push(listeners[i]);
8758 }
8759 }
8760
8761 //
8762 // Reset the array, or remove it completely if we have no more listeners.
8763 //
8764 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
8765 else if (--this._eventsCount === 0) this._events = new Events();
8766 else delete this._events[evt];
8767 }
8768
8769 return this;
8770};
8771
8772/**
8773 * Remove all listeners, or those of the specified event.
8774 *
8775 * @param {String|Symbol} [event] The event name.
8776 * @returns {EventEmitter} `this`.
8777 * @api public
8778 */
8779EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
8780 var evt;
8781
8782 if (event) {
8783 evt = prefix ? prefix + event : event;
8784 if (this._events[evt]) {
8785 if (--this._eventsCount === 0) this._events = new Events();
8786 else delete this._events[evt];
8787 }
8788 } else {
8789 this._events = new Events();
8790 this._eventsCount = 0;
8791 }
8792
8793 return this;
8794};
8795
8796//
8797// Alias methods names because people roll like that.
8798//
8799EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
8800EventEmitter.prototype.addListener = EventEmitter.prototype.on;
8801
8802//
8803// This function doesn't apply anymore.
8804//
8805EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
8806 return this;
8807};
8808
8809//
8810// Expose the prefix.
8811//
8812EventEmitter.prefixed = prefix;
8813
8814//
8815// Allow `EventEmitter` to be imported as module namespace.
8816//
8817EventEmitter.EventEmitter = EventEmitter;
8818
8819//
8820// Expose the module.
8821//
8822if ('undefined' !== typeof module) {
8823 module.exports = EventEmitter;
8824}
8825
8826
8827/***/ }),
8828/* 55 */
8829/***/ (function(module, exports, __webpack_require__) {
8830
8831"use strict";
8832
8833
8834Object.defineProperty(exports, "__esModule", {
8835 value: true
8836});
8837exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
8838
8839var _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; };
8840
8841var _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"); } }; }();
8842
8843var _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; }; }();
8844
8845var _extend2 = __webpack_require__(3);
8846
8847var _extend3 = _interopRequireDefault(_extend2);
8848
8849var _quillDelta = __webpack_require__(2);
8850
8851var _quillDelta2 = _interopRequireDefault(_quillDelta);
8852
8853var _parchment = __webpack_require__(0);
8854
8855var _parchment2 = _interopRequireDefault(_parchment);
8856
8857var _quill = __webpack_require__(5);
8858
8859var _quill2 = _interopRequireDefault(_quill);
8860
8861var _logger = __webpack_require__(10);
8862
8863var _logger2 = _interopRequireDefault(_logger);
8864
8865var _module = __webpack_require__(9);
8866
8867var _module2 = _interopRequireDefault(_module);
8868
8869var _align = __webpack_require__(36);
8870
8871var _background = __webpack_require__(37);
8872
8873var _code = __webpack_require__(13);
8874
8875var _code2 = _interopRequireDefault(_code);
8876
8877var _color = __webpack_require__(26);
8878
8879var _direction = __webpack_require__(38);
8880
8881var _font = __webpack_require__(39);
8882
8883var _size = __webpack_require__(40);
8884
8885function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8886
8887function _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; }
8888
8889function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8890
8891function _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; }
8892
8893function _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; }
8894
8895var debug = (0, _logger2.default)('quill:clipboard');
8896
8897var DOM_KEY = '__ql-matcher';
8898
8899var 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]];
8900
8901var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
8902 memo[attr.keyName] = attr;
8903 return memo;
8904}, {});
8905
8906var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
8907 memo[attr.keyName] = attr;
8908 return memo;
8909}, {});
8910
8911var Clipboard = function (_Module) {
8912 _inherits(Clipboard, _Module);
8913
8914 function Clipboard(quill, options) {
8915 _classCallCheck(this, Clipboard);
8916
8917 var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
8918
8919 _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
8920 _this.container = _this.quill.addContainer('ql-clipboard');
8921 _this.container.setAttribute('contenteditable', true);
8922 _this.container.setAttribute('tabindex', -1);
8923 _this.matchers = [];
8924 CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {
8925 var _ref2 = _slicedToArray(_ref, 2),
8926 selector = _ref2[0],
8927 matcher = _ref2[1];
8928
8929 if (!options.matchVisual && matcher === matchSpacing) return;
8930 _this.addMatcher(selector, matcher);
8931 });
8932 return _this;
8933 }
8934
8935 _createClass(Clipboard, [{
8936 key: 'addMatcher',
8937 value: function addMatcher(selector, matcher) {
8938 this.matchers.push([selector, matcher]);
8939 }
8940 }, {
8941 key: 'convert',
8942 value: function convert(html) {
8943 if (typeof html === 'string') {
8944 this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
8945 return this.convert();
8946 }
8947 var formats = this.quill.getFormat(this.quill.selection.savedRange.index);
8948 if (formats[_code2.default.blotName]) {
8949 var text = this.container.innerText;
8950 this.container.innerHTML = '';
8951 return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));
8952 }
8953
8954 var _prepareMatching = this.prepareMatching(),
8955 _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
8956 elementMatchers = _prepareMatching2[0],
8957 textMatchers = _prepareMatching2[1];
8958
8959 var delta = traverse(this.container, elementMatchers, textMatchers);
8960 // Remove trailing newline
8961 if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
8962 delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
8963 }
8964 debug.log('convert', this.container.innerHTML, delta);
8965 this.container.innerHTML = '';
8966 return delta;
8967 }
8968 }, {
8969 key: 'dangerouslyPasteHTML',
8970 value: function dangerouslyPasteHTML(index, html) {
8971 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
8972
8973 if (typeof index === 'string') {
8974 this.quill.setContents(this.convert(index), html);
8975 this.quill.setSelection(0, _quill2.default.sources.SILENT);
8976 } else {
8977 var paste = this.convert(html);
8978 this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
8979 this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);
8980 }
8981 }
8982 }, {
8983 key: 'onPaste',
8984 value: function onPaste(e) {
8985 var _this2 = this;
8986
8987 if (e.defaultPrevented || !this.quill.isEnabled()) return;
8988 var range = this.quill.getSelection();
8989 var delta = new _quillDelta2.default().retain(range.index);
8990 var scrollTop = this.quill.scrollingContainer.scrollTop;
8991 this.container.focus();
8992 this.quill.selection.update(_quill2.default.sources.SILENT);
8993 setTimeout(function () {
8994 delta = delta.concat(_this2.convert()).delete(range.length);
8995 _this2.quill.updateContents(delta, _quill2.default.sources.USER);
8996 // range.length contributes to delta.length()
8997 _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
8998 _this2.quill.scrollingContainer.scrollTop = scrollTop;
8999 _this2.quill.focus();
9000 }, 1);
9001 }
9002 }, {
9003 key: 'prepareMatching',
9004 value: function prepareMatching() {
9005 var _this3 = this;
9006
9007 var elementMatchers = [],
9008 textMatchers = [];
9009 this.matchers.forEach(function (pair) {
9010 var _pair = _slicedToArray(pair, 2),
9011 selector = _pair[0],
9012 matcher = _pair[1];
9013
9014 switch (selector) {
9015 case Node.TEXT_NODE:
9016 textMatchers.push(matcher);
9017 break;
9018 case Node.ELEMENT_NODE:
9019 elementMatchers.push(matcher);
9020 break;
9021 default:
9022 [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
9023 // TODO use weakmap
9024 node[DOM_KEY] = node[DOM_KEY] || [];
9025 node[DOM_KEY].push(matcher);
9026 });
9027 break;
9028 }
9029 });
9030 return [elementMatchers, textMatchers];
9031 }
9032 }]);
9033
9034 return Clipboard;
9035}(_module2.default);
9036
9037Clipboard.DEFAULTS = {
9038 matchers: [],
9039 matchVisual: true
9040};
9041
9042function applyFormat(delta, format, value) {
9043 if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
9044 return Object.keys(format).reduce(function (delta, key) {
9045 return applyFormat(delta, key, format[key]);
9046 }, delta);
9047 } else {
9048 return delta.reduce(function (delta, op) {
9049 if (op.attributes && op.attributes[format]) {
9050 return delta.push(op);
9051 } else {
9052 return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
9053 }
9054 }, new _quillDelta2.default());
9055 }
9056}
9057
9058function computeStyle(node) {
9059 if (node.nodeType !== Node.ELEMENT_NODE) return {};
9060 var DOM_KEY = '__ql-computed-style';
9061 return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
9062}
9063
9064function deltaEndsWith(delta, text) {
9065 var endText = "";
9066 for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
9067 var op = delta.ops[i];
9068 if (typeof op.insert !== 'string') break;
9069 endText = op.insert + endText;
9070 }
9071 return endText.slice(-1 * text.length) === text;
9072}
9073
9074function isLine(node) {
9075 if (node.childNodes.length === 0) return false; // Exclude embed blocks
9076 var style = computeStyle(node);
9077 return ['block', 'list-item'].indexOf(style.display) > -1;
9078}
9079
9080function traverse(node, elementMatchers, textMatchers) {
9081 // Post-order
9082 if (node.nodeType === node.TEXT_NODE) {
9083 return textMatchers.reduce(function (delta, matcher) {
9084 return matcher(node, delta);
9085 }, new _quillDelta2.default());
9086 } else if (node.nodeType === node.ELEMENT_NODE) {
9087 return [].reduce.call(node.childNodes || [], function (delta, childNode) {
9088 var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
9089 if (childNode.nodeType === node.ELEMENT_NODE) {
9090 childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
9091 return matcher(childNode, childrenDelta);
9092 }, childrenDelta);
9093 childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
9094 return matcher(childNode, childrenDelta);
9095 }, childrenDelta);
9096 }
9097 return delta.concat(childrenDelta);
9098 }, new _quillDelta2.default());
9099 } else {
9100 return new _quillDelta2.default();
9101 }
9102}
9103
9104function matchAlias(format, node, delta) {
9105 return applyFormat(delta, format, true);
9106}
9107
9108function matchAttributor(node, delta) {
9109 var attributes = _parchment2.default.Attributor.Attribute.keys(node);
9110 var classes = _parchment2.default.Attributor.Class.keys(node);
9111 var styles = _parchment2.default.Attributor.Style.keys(node);
9112 var formats = {};
9113 attributes.concat(classes).concat(styles).forEach(function (name) {
9114 var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
9115 if (attr != null) {
9116 formats[attr.attrName] = attr.value(node);
9117 if (formats[attr.attrName]) return;
9118 }
9119 attr = ATTRIBUTE_ATTRIBUTORS[name];
9120 if (attr != null && (attr.attrName === name || attr.keyName === name)) {
9121 formats[attr.attrName] = attr.value(node) || undefined;
9122 }
9123 attr = STYLE_ATTRIBUTORS[name];
9124 if (attr != null && (attr.attrName === name || attr.keyName === name)) {
9125 attr = STYLE_ATTRIBUTORS[name];
9126 formats[attr.attrName] = attr.value(node) || undefined;
9127 }
9128 });
9129 if (Object.keys(formats).length > 0) {
9130 delta = applyFormat(delta, formats);
9131 }
9132 return delta;
9133}
9134
9135function matchBlot(node, delta) {
9136 var match = _parchment2.default.query(node);
9137 if (match == null) return delta;
9138 if (match.prototype instanceof _parchment2.default.Embed) {
9139 var embed = {};
9140 var value = match.value(node);
9141 if (value != null) {
9142 embed[match.blotName] = value;
9143 delta = new _quillDelta2.default().insert(embed, match.formats(node));
9144 }
9145 } else if (typeof match.formats === 'function') {
9146 delta = applyFormat(delta, match.blotName, match.formats(node));
9147 }
9148 return delta;
9149}
9150
9151function matchBreak(node, delta) {
9152 if (!deltaEndsWith(delta, '\n')) {
9153 delta.insert('\n');
9154 }
9155 return delta;
9156}
9157
9158function matchIgnore() {
9159 return new _quillDelta2.default();
9160}
9161
9162function matchIndent(node, delta) {
9163 var match = _parchment2.default.query(node);
9164 if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
9165 return delta;
9166 }
9167 var indent = -1,
9168 parent = node.parentNode;
9169 while (!parent.classList.contains('ql-clipboard')) {
9170 if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
9171 indent += 1;
9172 }
9173 parent = parent.parentNode;
9174 }
9175 if (indent <= 0) return delta;
9176 return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
9177}
9178
9179function matchNewline(node, delta) {
9180 if (!deltaEndsWith(delta, '\n')) {
9181 if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
9182 delta.insert('\n');
9183 }
9184 }
9185 return delta;
9186}
9187
9188function matchSpacing(node, delta) {
9189 if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
9190 var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
9191 if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
9192 delta.insert('\n');
9193 }
9194 }
9195 return delta;
9196}
9197
9198function matchStyles(node, delta) {
9199 var formats = {};
9200 var style = node.style || {};
9201 if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
9202 formats.italic = true;
9203 }
9204 if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
9205 formats.bold = true;
9206 }
9207 if (Object.keys(formats).length > 0) {
9208 delta = applyFormat(delta, formats);
9209 }
9210 if (parseFloat(style.textIndent || 0) > 0) {
9211 // Could be 0.5in
9212 delta = new _quillDelta2.default().insert('\t').concat(delta);
9213 }
9214 return delta;
9215}
9216
9217function matchText(node, delta) {
9218 var text = node.data;
9219 // Word represents empty line with <o:p>&nbsp;</o:p>
9220 if (node.parentNode.tagName === 'O:P') {
9221 return delta.insert(text.trim());
9222 }
9223 if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
9224 return delta;
9225 }
9226 if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
9227 // eslint-disable-next-line func-style
9228 var replacer = function replacer(collapse, match) {
9229 match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
9230 return match.length < 1 && collapse ? ' ' : match;
9231 };
9232 text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
9233 text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
9234 if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
9235 text = text.replace(/^\s+/, replacer.bind(replacer, false));
9236 }
9237 if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
9238 text = text.replace(/\s+$/, replacer.bind(replacer, false));
9239 }
9240 }
9241 return delta.insert(text);
9242}
9243
9244exports.default = Clipboard;
9245exports.matchAttributor = matchAttributor;
9246exports.matchBlot = matchBlot;
9247exports.matchNewline = matchNewline;
9248exports.matchSpacing = matchSpacing;
9249exports.matchText = matchText;
9250
9251/***/ }),
9252/* 56 */
9253/***/ (function(module, exports, __webpack_require__) {
9254
9255"use strict";
9256
9257
9258Object.defineProperty(exports, "__esModule", {
9259 value: true
9260});
9261
9262var _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; }; }();
9263
9264var _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); } };
9265
9266var _inline = __webpack_require__(6);
9267
9268var _inline2 = _interopRequireDefault(_inline);
9269
9270function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9271
9272function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9273
9274function _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; }
9275
9276function _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; }
9277
9278var Bold = function (_Inline) {
9279 _inherits(Bold, _Inline);
9280
9281 function Bold() {
9282 _classCallCheck(this, Bold);
9283
9284 return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
9285 }
9286
9287 _createClass(Bold, [{
9288 key: 'optimize',
9289 value: function optimize(context) {
9290 _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);
9291 if (this.domNode.tagName !== this.statics.tagName[0]) {
9292 this.replaceWith(this.statics.blotName);
9293 }
9294 }
9295 }], [{
9296 key: 'create',
9297 value: function create() {
9298 return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
9299 }
9300 }, {
9301 key: 'formats',
9302 value: function formats() {
9303 return true;
9304 }
9305 }]);
9306
9307 return Bold;
9308}(_inline2.default);
9309
9310Bold.blotName = 'bold';
9311Bold.tagName = ['STRONG', 'B'];
9312
9313exports.default = Bold;
9314
9315/***/ }),
9316/* 57 */
9317/***/ (function(module, exports, __webpack_require__) {
9318
9319"use strict";
9320
9321
9322Object.defineProperty(exports, "__esModule", {
9323 value: true
9324});
9325exports.addControls = exports.default = undefined;
9326
9327var _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"); } }; }();
9328
9329var _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; }; }();
9330
9331var _quillDelta = __webpack_require__(2);
9332
9333var _quillDelta2 = _interopRequireDefault(_quillDelta);
9334
9335var _parchment = __webpack_require__(0);
9336
9337var _parchment2 = _interopRequireDefault(_parchment);
9338
9339var _quill = __webpack_require__(5);
9340
9341var _quill2 = _interopRequireDefault(_quill);
9342
9343var _logger = __webpack_require__(10);
9344
9345var _logger2 = _interopRequireDefault(_logger);
9346
9347var _module = __webpack_require__(9);
9348
9349var _module2 = _interopRequireDefault(_module);
9350
9351function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9352
9353function _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; }
9354
9355function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9356
9357function _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; }
9358
9359function _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; }
9360
9361var debug = (0, _logger2.default)('quill:toolbar');
9362
9363var Toolbar = function (_Module) {
9364 _inherits(Toolbar, _Module);
9365
9366 function Toolbar(quill, options) {
9367 _classCallCheck(this, Toolbar);
9368
9369 var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
9370
9371 if (Array.isArray(_this.options.container)) {
9372 var container = document.createElement('div');
9373 addControls(container, _this.options.container);
9374 quill.container.parentNode.insertBefore(container, quill.container);
9375 _this.container = container;
9376 } else if (typeof _this.options.container === 'string') {
9377 _this.container = document.querySelector(_this.options.container);
9378 } else {
9379 _this.container = _this.options.container;
9380 }
9381 if (!(_this.container instanceof HTMLElement)) {
9382 var _ret;
9383
9384 return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
9385 }
9386 _this.container.classList.add('ql-toolbar');
9387 _this.controls = [];
9388 _this.handlers = {};
9389 Object.keys(_this.options.handlers).forEach(function (format) {
9390 _this.addHandler(format, _this.options.handlers[format]);
9391 });
9392 [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
9393 _this.attach(input);
9394 });
9395 _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
9396 if (type === _quill2.default.events.SELECTION_CHANGE) {
9397 _this.update(range);
9398 }
9399 });
9400 _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
9401 var _this$quill$selection = _this.quill.selection.getRange(),
9402 _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
9403 range = _this$quill$selection2[0]; // quill.getSelection triggers update
9404
9405
9406 _this.update(range);
9407 });
9408 return _this;
9409 }
9410
9411 _createClass(Toolbar, [{
9412 key: 'addHandler',
9413 value: function addHandler(format, handler) {
9414 this.handlers[format] = handler;
9415 }
9416 }, {
9417 key: 'attach',
9418 value: function attach(input) {
9419 var _this2 = this;
9420
9421 var format = [].find.call(input.classList, function (className) {
9422 return className.indexOf('ql-') === 0;
9423 });
9424 if (!format) return;
9425 format = format.slice('ql-'.length);
9426 if (input.tagName === 'BUTTON') {
9427 input.setAttribute('type', 'button');
9428 }
9429 if (this.handlers[format] == null) {
9430 if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
9431 debug.warn('ignoring attaching to disabled format', format, input);
9432 return;
9433 }
9434 if (_parchment2.default.query(format) == null) {
9435 debug.warn('ignoring attaching to nonexistent format', format, input);
9436 return;
9437 }
9438 }
9439 var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
9440 input.addEventListener(eventName, function (e) {
9441 var value = void 0;
9442 if (input.tagName === 'SELECT') {
9443 if (input.selectedIndex < 0) return;
9444 var selected = input.options[input.selectedIndex];
9445 if (selected.hasAttribute('selected')) {
9446 value = false;
9447 } else {
9448 value = selected.value || false;
9449 }
9450 } else {
9451 if (input.classList.contains('ql-active')) {
9452 value = false;
9453 } else {
9454 value = input.value || !input.hasAttribute('value');
9455 }
9456 e.preventDefault();
9457 }
9458 _this2.quill.focus();
9459
9460 var _quill$selection$getR = _this2.quill.selection.getRange(),
9461 _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
9462 range = _quill$selection$getR2[0];
9463
9464 if (_this2.handlers[format] != null) {
9465 _this2.handlers[format].call(_this2, value);
9466 } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
9467 value = prompt('Enter ' + format);
9468 if (!value) return;
9469 _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
9470 } else {
9471 _this2.quill.format(format, value, _quill2.default.sources.USER);
9472 }
9473 _this2.update(range);
9474 });
9475 // TODO use weakmap
9476 this.controls.push([format, input]);
9477 }
9478 }, {
9479 key: 'update',
9480 value: function update(range) {
9481 var formats = range == null ? {} : this.quill.getFormat(range);
9482 this.controls.forEach(function (pair) {
9483 var _pair = _slicedToArray(pair, 2),
9484 format = _pair[0],
9485 input = _pair[1];
9486
9487 if (input.tagName === 'SELECT') {
9488 var option = void 0;
9489 if (range == null) {
9490 option = null;
9491 } else if (formats[format] == null) {
9492 option = input.querySelector('option[selected]');
9493 } else if (!Array.isArray(formats[format])) {
9494 var value = formats[format];
9495 if (typeof value === 'string') {
9496 value = value.replace(/\"/g, '\\"');
9497 }
9498 option = input.querySelector('option[value="' + value + '"]');
9499 }
9500 if (option == null) {
9501 input.value = ''; // TODO make configurable?
9502 input.selectedIndex = -1;
9503 } else {
9504 option.selected = true;
9505 }
9506 } else {
9507 if (range == null) {
9508 input.classList.remove('ql-active');
9509 } else if (input.hasAttribute('value')) {
9510 // both being null should match (default values)
9511 // '1' should match with 1 (headers)
9512 var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
9513 input.classList.toggle('ql-active', isActive);
9514 } else {
9515 input.classList.toggle('ql-active', formats[format] != null);
9516 }
9517 }
9518 });
9519 }
9520 }]);
9521
9522 return Toolbar;
9523}(_module2.default);
9524
9525Toolbar.DEFAULTS = {};
9526
9527function addButton(container, format, value) {
9528 var input = document.createElement('button');
9529 input.setAttribute('type', 'button');
9530 input.classList.add('ql-' + format);
9531 if (value != null) {
9532 input.value = value;
9533 }
9534 container.appendChild(input);
9535}
9536
9537function addControls(container, groups) {
9538 if (!Array.isArray(groups[0])) {
9539 groups = [groups];
9540 }
9541 groups.forEach(function (controls) {
9542 var group = document.createElement('span');
9543 group.classList.add('ql-formats');
9544 controls.forEach(function (control) {
9545 if (typeof control === 'string') {
9546 addButton(group, control);
9547 } else {
9548 var format = Object.keys(control)[0];
9549 var value = control[format];
9550 if (Array.isArray(value)) {
9551 addSelect(group, format, value);
9552 } else {
9553 addButton(group, format, value);
9554 }
9555 }
9556 });
9557 container.appendChild(group);
9558 });
9559}
9560
9561function addSelect(container, format, values) {
9562 var input = document.createElement('select');
9563 input.classList.add('ql-' + format);
9564 values.forEach(function (value) {
9565 var option = document.createElement('option');
9566 if (value !== false) {
9567 option.setAttribute('value', value);
9568 } else {
9569 option.setAttribute('selected', 'selected');
9570 }
9571 input.appendChild(option);
9572 });
9573 container.appendChild(input);
9574}
9575
9576Toolbar.DEFAULTS = {
9577 container: null,
9578 handlers: {
9579 clean: function clean() {
9580 var _this3 = this;
9581
9582 var range = this.quill.getSelection();
9583 if (range == null) return;
9584 if (range.length == 0) {
9585 var formats = this.quill.getFormat();
9586 Object.keys(formats).forEach(function (name) {
9587 // Clean functionality in existing apps only clean inline formats
9588 if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
9589 _this3.quill.format(name, false);
9590 }
9591 });
9592 } else {
9593 this.quill.removeFormat(range, _quill2.default.sources.USER);
9594 }
9595 },
9596 direction: function direction(value) {
9597 var align = this.quill.getFormat()['align'];
9598 if (value === 'rtl' && align == null) {
9599 this.quill.format('align', 'right', _quill2.default.sources.USER);
9600 } else if (!value && align === 'right') {
9601 this.quill.format('align', false, _quill2.default.sources.USER);
9602 }
9603 this.quill.format('direction', value, _quill2.default.sources.USER);
9604 },
9605 indent: function indent(value) {
9606 var range = this.quill.getSelection();
9607 var formats = this.quill.getFormat(range);
9608 var indent = parseInt(formats.indent || 0);
9609 if (value === '+1' || value === '-1') {
9610 var modifier = value === '+1' ? 1 : -1;
9611 if (formats.direction === 'rtl') modifier *= -1;
9612 this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
9613 }
9614 },
9615 link: function link(value) {
9616 if (value === true) {
9617 value = prompt('Enter link URL:');
9618 }
9619 this.quill.format('link', value, _quill2.default.sources.USER);
9620 },
9621 list: function list(value) {
9622 var range = this.quill.getSelection();
9623 var formats = this.quill.getFormat(range);
9624 if (value === 'check') {
9625 if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
9626 this.quill.format('list', false, _quill2.default.sources.USER);
9627 } else {
9628 this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
9629 }
9630 } else {
9631 this.quill.format('list', value, _quill2.default.sources.USER);
9632 }
9633 }
9634 }
9635};
9636
9637exports.default = Toolbar;
9638exports.addControls = addControls;
9639
9640/***/ }),
9641/* 58 */
9642/***/ (function(module, exports) {
9643
9644module.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>";
9645
9646/***/ }),
9647/* 59 */
9648/***/ (function(module, exports, __webpack_require__) {
9649
9650"use strict";
9651
9652
9653Object.defineProperty(exports, "__esModule", {
9654 value: true
9655});
9656
9657var _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; }; }();
9658
9659var _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); } };
9660
9661var _picker = __webpack_require__(28);
9662
9663var _picker2 = _interopRequireDefault(_picker);
9664
9665function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9666
9667function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9668
9669function _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; }
9670
9671function _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; }
9672
9673var ColorPicker = function (_Picker) {
9674 _inherits(ColorPicker, _Picker);
9675
9676 function ColorPicker(select, label) {
9677 _classCallCheck(this, ColorPicker);
9678
9679 var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
9680
9681 _this.label.innerHTML = label;
9682 _this.container.classList.add('ql-color-picker');
9683 [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
9684 item.classList.add('ql-primary');
9685 });
9686 return _this;
9687 }
9688
9689 _createClass(ColorPicker, [{
9690 key: 'buildItem',
9691 value: function buildItem(option) {
9692 var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
9693 item.style.backgroundColor = option.getAttribute('value') || '';
9694 return item;
9695 }
9696 }, {
9697 key: 'selectItem',
9698 value: function selectItem(item, trigger) {
9699 _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
9700 var colorLabel = this.label.querySelector('.ql-color-label');
9701 var value = item ? item.getAttribute('data-value') || '' : '';
9702 if (colorLabel) {
9703 if (colorLabel.tagName === 'line') {
9704 colorLabel.style.stroke = value;
9705 } else {
9706 colorLabel.style.fill = value;
9707 }
9708 }
9709 }
9710 }]);
9711
9712 return ColorPicker;
9713}(_picker2.default);
9714
9715exports.default = ColorPicker;
9716
9717/***/ }),
9718/* 60 */
9719/***/ (function(module, exports, __webpack_require__) {
9720
9721"use strict";
9722
9723
9724Object.defineProperty(exports, "__esModule", {
9725 value: true
9726});
9727
9728var _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; }; }();
9729
9730var _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); } };
9731
9732var _picker = __webpack_require__(28);
9733
9734var _picker2 = _interopRequireDefault(_picker);
9735
9736function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9737
9738function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9739
9740function _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; }
9741
9742function _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; }
9743
9744var IconPicker = function (_Picker) {
9745 _inherits(IconPicker, _Picker);
9746
9747 function IconPicker(select, icons) {
9748 _classCallCheck(this, IconPicker);
9749
9750 var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
9751
9752 _this.container.classList.add('ql-icon-picker');
9753 [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
9754 item.innerHTML = icons[item.getAttribute('data-value') || ''];
9755 });
9756 _this.defaultItem = _this.container.querySelector('.ql-selected');
9757 _this.selectItem(_this.defaultItem);
9758 return _this;
9759 }
9760
9761 _createClass(IconPicker, [{
9762 key: 'selectItem',
9763 value: function selectItem(item, trigger) {
9764 _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
9765 item = item || this.defaultItem;
9766 this.label.innerHTML = item.innerHTML;
9767 }
9768 }]);
9769
9770 return IconPicker;
9771}(_picker2.default);
9772
9773exports.default = IconPicker;
9774
9775/***/ }),
9776/* 61 */
9777/***/ (function(module, exports, __webpack_require__) {
9778
9779"use strict";
9780
9781
9782Object.defineProperty(exports, "__esModule", {
9783 value: true
9784});
9785
9786var _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; }; }();
9787
9788function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9789
9790var Tooltip = function () {
9791 function Tooltip(quill, boundsContainer) {
9792 var _this = this;
9793
9794 _classCallCheck(this, Tooltip);
9795
9796 this.quill = quill;
9797 this.boundsContainer = boundsContainer || document.body;
9798 this.root = quill.addContainer('ql-tooltip');
9799 this.root.innerHTML = this.constructor.TEMPLATE;
9800 if (this.quill.root === this.quill.scrollingContainer) {
9801 this.quill.root.addEventListener('scroll', function () {
9802 _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
9803 });
9804 }
9805 this.hide();
9806 }
9807
9808 _createClass(Tooltip, [{
9809 key: 'hide',
9810 value: function hide() {
9811 this.root.classList.add('ql-hidden');
9812 }
9813 }, {
9814 key: 'position',
9815 value: function position(reference) {
9816 var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
9817 // root.scrollTop should be 0 if scrollContainer !== root
9818 var top = reference.bottom + this.quill.root.scrollTop;
9819 this.root.style.left = left + 'px';
9820 this.root.style.top = top + 'px';
9821 this.root.classList.remove('ql-flip');
9822 var containerBounds = this.boundsContainer.getBoundingClientRect();
9823 var rootBounds = this.root.getBoundingClientRect();
9824 var shift = 0;
9825 if (rootBounds.right > containerBounds.right) {
9826 shift = containerBounds.right - rootBounds.right;
9827 this.root.style.left = left + shift + 'px';
9828 }
9829 if (rootBounds.left < containerBounds.left) {
9830 shift = containerBounds.left - rootBounds.left;
9831 this.root.style.left = left + shift + 'px';
9832 }
9833 if (rootBounds.bottom > containerBounds.bottom) {
9834 var height = rootBounds.bottom - rootBounds.top;
9835 var verticalShift = reference.bottom - reference.top + height;
9836 this.root.style.top = top - verticalShift + 'px';
9837 this.root.classList.add('ql-flip');
9838 }
9839 return shift;
9840 }
9841 }, {
9842 key: 'show',
9843 value: function show() {
9844 this.root.classList.remove('ql-editing');
9845 this.root.classList.remove('ql-hidden');
9846 }
9847 }]);
9848
9849 return Tooltip;
9850}();
9851
9852exports.default = Tooltip;
9853
9854/***/ }),
9855/* 62 */
9856/***/ (function(module, exports, __webpack_require__) {
9857
9858"use strict";
9859
9860
9861Object.defineProperty(exports, "__esModule", {
9862 value: true
9863});
9864
9865var _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"); } }; }();
9866
9867var _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); } };
9868
9869var _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; }; }();
9870
9871var _extend = __webpack_require__(3);
9872
9873var _extend2 = _interopRequireDefault(_extend);
9874
9875var _emitter = __webpack_require__(8);
9876
9877var _emitter2 = _interopRequireDefault(_emitter);
9878
9879var _base = __webpack_require__(43);
9880
9881var _base2 = _interopRequireDefault(_base);
9882
9883var _link = __webpack_require__(27);
9884
9885var _link2 = _interopRequireDefault(_link);
9886
9887var _selection = __webpack_require__(15);
9888
9889var _icons = __webpack_require__(41);
9890
9891var _icons2 = _interopRequireDefault(_icons);
9892
9893function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9894
9895function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9896
9897function _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; }
9898
9899function _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; }
9900
9901var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
9902
9903var SnowTheme = function (_BaseTheme) {
9904 _inherits(SnowTheme, _BaseTheme);
9905
9906 function SnowTheme(quill, options) {
9907 _classCallCheck(this, SnowTheme);
9908
9909 if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
9910 options.modules.toolbar.container = TOOLBAR_CONFIG;
9911 }
9912
9913 var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
9914
9915 _this.quill.container.classList.add('ql-snow');
9916 return _this;
9917 }
9918
9919 _createClass(SnowTheme, [{
9920 key: 'extendToolbar',
9921 value: function extendToolbar(toolbar) {
9922 toolbar.container.classList.add('ql-snow');
9923 this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
9924 this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
9925 this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
9926 if (toolbar.container.querySelector('.ql-link')) {
9927 this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
9928 toolbar.handlers['link'].call(toolbar, !context.format.link);
9929 });
9930 }
9931 }
9932 }]);
9933
9934 return SnowTheme;
9935}(_base2.default);
9936
9937SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
9938 modules: {
9939 toolbar: {
9940 handlers: {
9941 link: function link(value) {
9942 if (value) {
9943 var range = this.quill.getSelection();
9944 if (range == null || range.length == 0) return;
9945 var preview = this.quill.getText(range);
9946 if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
9947 preview = 'mailto:' + preview;
9948 }
9949 var tooltip = this.quill.theme.tooltip;
9950 tooltip.edit('link', preview);
9951 } else {
9952 this.quill.format('link', false);
9953 }
9954 }
9955 }
9956 }
9957 }
9958});
9959
9960var SnowTooltip = function (_BaseTooltip) {
9961 _inherits(SnowTooltip, _BaseTooltip);
9962
9963 function SnowTooltip(quill, bounds) {
9964 _classCallCheck(this, SnowTooltip);
9965
9966 var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
9967
9968 _this2.preview = _this2.root.querySelector('a.ql-preview');
9969 return _this2;
9970 }
9971
9972 _createClass(SnowTooltip, [{
9973 key: 'listen',
9974 value: function listen() {
9975 var _this3 = this;
9976
9977 _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
9978 this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
9979 if (_this3.root.classList.contains('ql-editing')) {
9980 _this3.save();
9981 } else {
9982 _this3.edit('link', _this3.preview.textContent);
9983 }
9984 event.preventDefault();
9985 });
9986 this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
9987 if (_this3.linkRange != null) {
9988 var range = _this3.linkRange;
9989 _this3.restoreFocus();
9990 _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
9991 delete _this3.linkRange;
9992 }
9993 event.preventDefault();
9994 _this3.hide();
9995 });
9996 this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
9997 if (range == null) return;
9998 if (range.length === 0 && source === _emitter2.default.sources.USER) {
9999 var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
10000 _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
10001 link = _quill$scroll$descend2[0],
10002 offset = _quill$scroll$descend2[1];
10003
10004 if (link != null) {
10005 _this3.linkRange = new _selection.Range(range.index - offset, link.length());
10006 var preview = _link2.default.formats(link.domNode);
10007 _this3.preview.textContent = preview;
10008 _this3.preview.setAttribute('href', preview);
10009 _this3.show();
10010 _this3.position(_this3.quill.getBounds(_this3.linkRange));
10011 return;
10012 }
10013 } else {
10014 delete _this3.linkRange;
10015 }
10016 _this3.hide();
10017 });
10018 }
10019 }, {
10020 key: 'show',
10021 value: function show() {
10022 _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
10023 this.root.removeAttribute('data-mode');
10024 }
10025 }]);
10026
10027 return SnowTooltip;
10028}(_base.BaseTooltip);
10029
10030SnowTooltip.TEMPLATE = ['<a class="ql-preview" rel="noopener noreferrer" 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('');
10031
10032exports.default = SnowTheme;
10033
10034/***/ }),
10035/* 63 */
10036/***/ (function(module, exports, __webpack_require__) {
10037
10038"use strict";
10039
10040
10041Object.defineProperty(exports, "__esModule", {
10042 value: true
10043});
10044
10045var _core = __webpack_require__(29);
10046
10047var _core2 = _interopRequireDefault(_core);
10048
10049var _align = __webpack_require__(36);
10050
10051var _direction = __webpack_require__(38);
10052
10053var _indent = __webpack_require__(64);
10054
10055var _blockquote = __webpack_require__(65);
10056
10057var _blockquote2 = _interopRequireDefault(_blockquote);
10058
10059var _header = __webpack_require__(66);
10060
10061var _header2 = _interopRequireDefault(_header);
10062
10063var _list = __webpack_require__(67);
10064
10065var _list2 = _interopRequireDefault(_list);
10066
10067var _background = __webpack_require__(37);
10068
10069var _color = __webpack_require__(26);
10070
10071var _font = __webpack_require__(39);
10072
10073var _size = __webpack_require__(40);
10074
10075var _bold = __webpack_require__(56);
10076
10077var _bold2 = _interopRequireDefault(_bold);
10078
10079var _italic = __webpack_require__(68);
10080
10081var _italic2 = _interopRequireDefault(_italic);
10082
10083var _link = __webpack_require__(27);
10084
10085var _link2 = _interopRequireDefault(_link);
10086
10087var _script = __webpack_require__(69);
10088
10089var _script2 = _interopRequireDefault(_script);
10090
10091var _strike = __webpack_require__(70);
10092
10093var _strike2 = _interopRequireDefault(_strike);
10094
10095var _underline = __webpack_require__(71);
10096
10097var _underline2 = _interopRequireDefault(_underline);
10098
10099var _image = __webpack_require__(72);
10100
10101var _image2 = _interopRequireDefault(_image);
10102
10103var _video = __webpack_require__(73);
10104
10105var _video2 = _interopRequireDefault(_video);
10106
10107var _code = __webpack_require__(13);
10108
10109var _code2 = _interopRequireDefault(_code);
10110
10111var _formula = __webpack_require__(74);
10112
10113var _formula2 = _interopRequireDefault(_formula);
10114
10115var _syntax = __webpack_require__(75);
10116
10117var _syntax2 = _interopRequireDefault(_syntax);
10118
10119var _toolbar = __webpack_require__(57);
10120
10121var _toolbar2 = _interopRequireDefault(_toolbar);
10122
10123var _icons = __webpack_require__(41);
10124
10125var _icons2 = _interopRequireDefault(_icons);
10126
10127var _picker = __webpack_require__(28);
10128
10129var _picker2 = _interopRequireDefault(_picker);
10130
10131var _colorPicker = __webpack_require__(59);
10132
10133var _colorPicker2 = _interopRequireDefault(_colorPicker);
10134
10135var _iconPicker = __webpack_require__(60);
10136
10137var _iconPicker2 = _interopRequireDefault(_iconPicker);
10138
10139var _tooltip = __webpack_require__(61);
10140
10141var _tooltip2 = _interopRequireDefault(_tooltip);
10142
10143var _bubble = __webpack_require__(108);
10144
10145var _bubble2 = _interopRequireDefault(_bubble);
10146
10147var _snow = __webpack_require__(62);
10148
10149var _snow2 = _interopRequireDefault(_snow);
10150
10151function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10152
10153_core2.default.register({
10154 'attributors/attribute/direction': _direction.DirectionAttribute,
10155
10156 'attributors/class/align': _align.AlignClass,
10157 'attributors/class/background': _background.BackgroundClass,
10158 'attributors/class/color': _color.ColorClass,
10159 'attributors/class/direction': _direction.DirectionClass,
10160 'attributors/class/font': _font.FontClass,
10161 'attributors/class/size': _size.SizeClass,
10162
10163 'attributors/style/align': _align.AlignStyle,
10164 'attributors/style/background': _background.BackgroundStyle,
10165 'attributors/style/color': _color.ColorStyle,
10166 'attributors/style/direction': _direction.DirectionStyle,
10167 'attributors/style/font': _font.FontStyle,
10168 'attributors/style/size': _size.SizeStyle
10169}, true);
10170
10171_core2.default.register({
10172 'formats/align': _align.AlignClass,
10173 'formats/direction': _direction.DirectionClass,
10174 'formats/indent': _indent.IndentClass,
10175
10176 'formats/background': _background.BackgroundStyle,
10177 'formats/color': _color.ColorStyle,
10178 'formats/font': _font.FontClass,
10179 'formats/size': _size.SizeClass,
10180
10181 'formats/blockquote': _blockquote2.default,
10182 'formats/code-block': _code2.default,
10183 'formats/header': _header2.default,
10184 'formats/list': _list2.default,
10185
10186 'formats/bold': _bold2.default,
10187 'formats/code': _code.Code,
10188 'formats/italic': _italic2.default,
10189 'formats/link': _link2.default,
10190 'formats/script': _script2.default,
10191 'formats/strike': _strike2.default,
10192 'formats/underline': _underline2.default,
10193
10194 'formats/image': _image2.default,
10195 'formats/video': _video2.default,
10196
10197 'formats/list/item': _list.ListItem,
10198
10199 'modules/formula': _formula2.default,
10200 'modules/syntax': _syntax2.default,
10201 'modules/toolbar': _toolbar2.default,
10202
10203 'themes/bubble': _bubble2.default,
10204 'themes/snow': _snow2.default,
10205
10206 'ui/icons': _icons2.default,
10207 'ui/picker': _picker2.default,
10208 'ui/icon-picker': _iconPicker2.default,
10209 'ui/color-picker': _colorPicker2.default,
10210 'ui/tooltip': _tooltip2.default
10211}, true);
10212
10213exports.default = _core2.default;
10214
10215/***/ }),
10216/* 64 */
10217/***/ (function(module, exports, __webpack_require__) {
10218
10219"use strict";
10220
10221
10222Object.defineProperty(exports, "__esModule", {
10223 value: true
10224});
10225exports.IndentClass = undefined;
10226
10227var _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; }; }();
10228
10229var _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); } };
10230
10231var _parchment = __webpack_require__(0);
10232
10233var _parchment2 = _interopRequireDefault(_parchment);
10234
10235function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10236
10237function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10238
10239function _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; }
10240
10241function _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; }
10242
10243var IdentAttributor = function (_Parchment$Attributor) {
10244 _inherits(IdentAttributor, _Parchment$Attributor);
10245
10246 function IdentAttributor() {
10247 _classCallCheck(this, IdentAttributor);
10248
10249 return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
10250 }
10251
10252 _createClass(IdentAttributor, [{
10253 key: 'add',
10254 value: function add(node, value) {
10255 if (value === '+1' || value === '-1') {
10256 var indent = this.value(node) || 0;
10257 value = value === '+1' ? indent + 1 : indent - 1;
10258 }
10259 if (value === 0) {
10260 this.remove(node);
10261 return true;
10262 } else {
10263 return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
10264 }
10265 }
10266 }, {
10267 key: 'canAdd',
10268 value: function canAdd(node, value) {
10269 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));
10270 }
10271 }, {
10272 key: 'value',
10273 value: function value(node) {
10274 return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
10275 }
10276 }]);
10277
10278 return IdentAttributor;
10279}(_parchment2.default.Attributor.Class);
10280
10281var IndentClass = new IdentAttributor('indent', 'ql-indent', {
10282 scope: _parchment2.default.Scope.BLOCK,
10283 whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
10284});
10285
10286exports.IndentClass = IndentClass;
10287
10288/***/ }),
10289/* 65 */
10290/***/ (function(module, exports, __webpack_require__) {
10291
10292"use strict";
10293
10294
10295Object.defineProperty(exports, "__esModule", {
10296 value: true
10297});
10298
10299var _block = __webpack_require__(4);
10300
10301var _block2 = _interopRequireDefault(_block);
10302
10303function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10304
10305function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10306
10307function _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; }
10308
10309function _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; }
10310
10311var Blockquote = function (_Block) {
10312 _inherits(Blockquote, _Block);
10313
10314 function Blockquote() {
10315 _classCallCheck(this, Blockquote);
10316
10317 return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
10318 }
10319
10320 return Blockquote;
10321}(_block2.default);
10322
10323Blockquote.blotName = 'blockquote';
10324Blockquote.tagName = 'blockquote';
10325
10326exports.default = Blockquote;
10327
10328/***/ }),
10329/* 66 */
10330/***/ (function(module, exports, __webpack_require__) {
10331
10332"use strict";
10333
10334
10335Object.defineProperty(exports, "__esModule", {
10336 value: true
10337});
10338
10339var _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; }; }();
10340
10341var _block = __webpack_require__(4);
10342
10343var _block2 = _interopRequireDefault(_block);
10344
10345function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10346
10347function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10348
10349function _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; }
10350
10351function _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; }
10352
10353var Header = function (_Block) {
10354 _inherits(Header, _Block);
10355
10356 function Header() {
10357 _classCallCheck(this, Header);
10358
10359 return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
10360 }
10361
10362 _createClass(Header, null, [{
10363 key: 'formats',
10364 value: function formats(domNode) {
10365 return this.tagName.indexOf(domNode.tagName) + 1;
10366 }
10367 }]);
10368
10369 return Header;
10370}(_block2.default);
10371
10372Header.blotName = 'header';
10373Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
10374
10375exports.default = Header;
10376
10377/***/ }),
10378/* 67 */
10379/***/ (function(module, exports, __webpack_require__) {
10380
10381"use strict";
10382
10383
10384Object.defineProperty(exports, "__esModule", {
10385 value: true
10386});
10387exports.default = exports.ListItem = undefined;
10388
10389var _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; }; }();
10390
10391var _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); } };
10392
10393var _parchment = __webpack_require__(0);
10394
10395var _parchment2 = _interopRequireDefault(_parchment);
10396
10397var _block = __webpack_require__(4);
10398
10399var _block2 = _interopRequireDefault(_block);
10400
10401var _container = __webpack_require__(25);
10402
10403var _container2 = _interopRequireDefault(_container);
10404
10405function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10406
10407function _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; }
10408
10409function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10410
10411function _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; }
10412
10413function _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; }
10414
10415var ListItem = function (_Block) {
10416 _inherits(ListItem, _Block);
10417
10418 function ListItem() {
10419 _classCallCheck(this, ListItem);
10420
10421 return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
10422 }
10423
10424 _createClass(ListItem, [{
10425 key: 'format',
10426 value: function format(name, value) {
10427 if (name === List.blotName && !value) {
10428 this.replaceWith(_parchment2.default.create(this.statics.scope));
10429 } else {
10430 _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
10431 }
10432 }
10433 }, {
10434 key: 'remove',
10435 value: function remove() {
10436 if (this.prev == null && this.next == null) {
10437 this.parent.remove();
10438 } else {
10439 _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
10440 }
10441 }
10442 }, {
10443 key: 'replaceWith',
10444 value: function replaceWith(name, value) {
10445 this.parent.isolate(this.offset(this.parent), this.length());
10446 if (name === this.parent.statics.blotName) {
10447 this.parent.replaceWith(name, value);
10448 return this;
10449 } else {
10450 this.parent.unwrap();
10451 return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
10452 }
10453 }
10454 }], [{
10455 key: 'formats',
10456 value: function formats(domNode) {
10457 return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
10458 }
10459 }]);
10460
10461 return ListItem;
10462}(_block2.default);
10463
10464ListItem.blotName = 'list-item';
10465ListItem.tagName = 'LI';
10466
10467var List = function (_Container) {
10468 _inherits(List, _Container);
10469
10470 _createClass(List, null, [{
10471 key: 'create',
10472 value: function create(value) {
10473 var tagName = value === 'ordered' ? 'OL' : 'UL';
10474 var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
10475 if (value === 'checked' || value === 'unchecked') {
10476 node.setAttribute('data-checked', value === 'checked');
10477 }
10478 return node;
10479 }
10480 }, {
10481 key: 'formats',
10482 value: function formats(domNode) {
10483 if (domNode.tagName === 'OL') return 'ordered';
10484 if (domNode.tagName === 'UL') {
10485 if (domNode.hasAttribute('data-checked')) {
10486 return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
10487 } else {
10488 return 'bullet';
10489 }
10490 }
10491 return undefined;
10492 }
10493 }]);
10494
10495 function List(domNode) {
10496 _classCallCheck(this, List);
10497
10498 var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
10499
10500 var listEventHandler = function listEventHandler(e) {
10501 if (e.target.parentNode !== domNode) return;
10502 var format = _this2.statics.formats(domNode);
10503 var blot = _parchment2.default.find(e.target);
10504 if (format === 'checked') {
10505 blot.format('list', 'unchecked');
10506 } else if (format === 'unchecked') {
10507 blot.format('list', 'checked');
10508 }
10509 };
10510
10511 domNode.addEventListener('touchstart', listEventHandler);
10512 domNode.addEventListener('mousedown', listEventHandler);
10513 return _this2;
10514 }
10515
10516 _createClass(List, [{
10517 key: 'format',
10518 value: function format(name, value) {
10519 if (this.children.length > 0) {
10520 this.children.tail.format(name, value);
10521 }
10522 }
10523 }, {
10524 key: 'formats',
10525 value: function formats() {
10526 // We don't inherit from FormatBlot
10527 return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
10528 }
10529 }, {
10530 key: 'insertBefore',
10531 value: function insertBefore(blot, ref) {
10532 if (blot instanceof ListItem) {
10533 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
10534 } else {
10535 var index = ref == null ? this.length() : ref.offset(this);
10536 var after = this.split(index);
10537 after.parent.insertBefore(blot, after);
10538 }
10539 }
10540 }, {
10541 key: 'optimize',
10542 value: function optimize(context) {
10543 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);
10544 var next = this.next;
10545 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')) {
10546 next.moveChildren(this);
10547 next.remove();
10548 }
10549 }
10550 }, {
10551 key: 'replace',
10552 value: function replace(target) {
10553 if (target.statics.blotName !== this.statics.blotName) {
10554 var item = _parchment2.default.create(this.statics.defaultChild);
10555 target.moveChildren(item);
10556 this.appendChild(item);
10557 }
10558 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
10559 }
10560 }]);
10561
10562 return List;
10563}(_container2.default);
10564
10565List.blotName = 'list';
10566List.scope = _parchment2.default.Scope.BLOCK_BLOT;
10567List.tagName = ['OL', 'UL'];
10568List.defaultChild = 'list-item';
10569List.allowedChildren = [ListItem];
10570
10571exports.ListItem = ListItem;
10572exports.default = List;
10573
10574/***/ }),
10575/* 68 */
10576/***/ (function(module, exports, __webpack_require__) {
10577
10578"use strict";
10579
10580
10581Object.defineProperty(exports, "__esModule", {
10582 value: true
10583});
10584
10585var _bold = __webpack_require__(56);
10586
10587var _bold2 = _interopRequireDefault(_bold);
10588
10589function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10590
10591function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10592
10593function _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; }
10594
10595function _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; }
10596
10597var Italic = function (_Bold) {
10598 _inherits(Italic, _Bold);
10599
10600 function Italic() {
10601 _classCallCheck(this, Italic);
10602
10603 return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
10604 }
10605
10606 return Italic;
10607}(_bold2.default);
10608
10609Italic.blotName = 'italic';
10610Italic.tagName = ['EM', 'I'];
10611
10612exports.default = Italic;
10613
10614/***/ }),
10615/* 69 */
10616/***/ (function(module, exports, __webpack_require__) {
10617
10618"use strict";
10619
10620
10621Object.defineProperty(exports, "__esModule", {
10622 value: true
10623});
10624
10625var _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; }; }();
10626
10627var _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); } };
10628
10629var _inline = __webpack_require__(6);
10630
10631var _inline2 = _interopRequireDefault(_inline);
10632
10633function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10634
10635function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10636
10637function _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; }
10638
10639function _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; }
10640
10641var Script = function (_Inline) {
10642 _inherits(Script, _Inline);
10643
10644 function Script() {
10645 _classCallCheck(this, Script);
10646
10647 return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
10648 }
10649
10650 _createClass(Script, null, [{
10651 key: 'create',
10652 value: function create(value) {
10653 if (value === 'super') {
10654 return document.createElement('sup');
10655 } else if (value === 'sub') {
10656 return document.createElement('sub');
10657 } else {
10658 return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
10659 }
10660 }
10661 }, {
10662 key: 'formats',
10663 value: function formats(domNode) {
10664 if (domNode.tagName === 'SUB') return 'sub';
10665 if (domNode.tagName === 'SUP') return 'super';
10666 return undefined;
10667 }
10668 }]);
10669
10670 return Script;
10671}(_inline2.default);
10672
10673Script.blotName = 'script';
10674Script.tagName = ['SUB', 'SUP'];
10675
10676exports.default = Script;
10677
10678/***/ }),
10679/* 70 */
10680/***/ (function(module, exports, __webpack_require__) {
10681
10682"use strict";
10683
10684
10685Object.defineProperty(exports, "__esModule", {
10686 value: true
10687});
10688
10689var _inline = __webpack_require__(6);
10690
10691var _inline2 = _interopRequireDefault(_inline);
10692
10693function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10694
10695function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10696
10697function _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; }
10698
10699function _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; }
10700
10701var Strike = function (_Inline) {
10702 _inherits(Strike, _Inline);
10703
10704 function Strike() {
10705 _classCallCheck(this, Strike);
10706
10707 return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
10708 }
10709
10710 return Strike;
10711}(_inline2.default);
10712
10713Strike.blotName = 'strike';
10714Strike.tagName = 'S';
10715
10716exports.default = Strike;
10717
10718/***/ }),
10719/* 71 */
10720/***/ (function(module, exports, __webpack_require__) {
10721
10722"use strict";
10723
10724
10725Object.defineProperty(exports, "__esModule", {
10726 value: true
10727});
10728
10729var _inline = __webpack_require__(6);
10730
10731var _inline2 = _interopRequireDefault(_inline);
10732
10733function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10734
10735function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10736
10737function _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; }
10738
10739function _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; }
10740
10741var Underline = function (_Inline) {
10742 _inherits(Underline, _Inline);
10743
10744 function Underline() {
10745 _classCallCheck(this, Underline);
10746
10747 return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
10748 }
10749
10750 return Underline;
10751}(_inline2.default);
10752
10753Underline.blotName = 'underline';
10754Underline.tagName = 'U';
10755
10756exports.default = Underline;
10757
10758/***/ }),
10759/* 72 */
10760/***/ (function(module, exports, __webpack_require__) {
10761
10762"use strict";
10763
10764
10765Object.defineProperty(exports, "__esModule", {
10766 value: true
10767});
10768
10769var _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; }; }();
10770
10771var _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); } };
10772
10773var _parchment = __webpack_require__(0);
10774
10775var _parchment2 = _interopRequireDefault(_parchment);
10776
10777var _link = __webpack_require__(27);
10778
10779function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10780
10781function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10782
10783function _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; }
10784
10785function _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; }
10786
10787var ATTRIBUTES = ['alt', 'height', 'width'];
10788
10789var Image = function (_Parchment$Embed) {
10790 _inherits(Image, _Parchment$Embed);
10791
10792 function Image() {
10793 _classCallCheck(this, Image);
10794
10795 return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
10796 }
10797
10798 _createClass(Image, [{
10799 key: 'format',
10800 value: function format(name, value) {
10801 if (ATTRIBUTES.indexOf(name) > -1) {
10802 if (value) {
10803 this.domNode.setAttribute(name, value);
10804 } else {
10805 this.domNode.removeAttribute(name);
10806 }
10807 } else {
10808 _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
10809 }
10810 }
10811 }], [{
10812 key: 'create',
10813 value: function create(value) {
10814 var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
10815 if (typeof value === 'string') {
10816 node.setAttribute('src', this.sanitize(value));
10817 }
10818 return node;
10819 }
10820 }, {
10821 key: 'formats',
10822 value: function formats(domNode) {
10823 return ATTRIBUTES.reduce(function (formats, attribute) {
10824 if (domNode.hasAttribute(attribute)) {
10825 formats[attribute] = domNode.getAttribute(attribute);
10826 }
10827 return formats;
10828 }, {});
10829 }
10830 }, {
10831 key: 'match',
10832 value: function match(url) {
10833 return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
10834 );
10835 }
10836 }, {
10837 key: 'sanitize',
10838 value: function sanitize(url) {
10839 return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
10840 }
10841 }, {
10842 key: 'value',
10843 value: function value(domNode) {
10844 return domNode.getAttribute('src');
10845 }
10846 }]);
10847
10848 return Image;
10849}(_parchment2.default.Embed);
10850
10851Image.blotName = 'image';
10852Image.tagName = 'IMG';
10853
10854exports.default = Image;
10855
10856/***/ }),
10857/* 73 */
10858/***/ (function(module, exports, __webpack_require__) {
10859
10860"use strict";
10861
10862
10863Object.defineProperty(exports, "__esModule", {
10864 value: true
10865});
10866
10867var _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; }; }();
10868
10869var _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); } };
10870
10871var _block = __webpack_require__(4);
10872
10873var _link = __webpack_require__(27);
10874
10875var _link2 = _interopRequireDefault(_link);
10876
10877function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10878
10879function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10880
10881function _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; }
10882
10883function _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; }
10884
10885var ATTRIBUTES = ['height', 'width'];
10886
10887var Video = function (_BlockEmbed) {
10888 _inherits(Video, _BlockEmbed);
10889
10890 function Video() {
10891 _classCallCheck(this, Video);
10892
10893 return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
10894 }
10895
10896 _createClass(Video, [{
10897 key: 'format',
10898 value: function format(name, value) {
10899 if (ATTRIBUTES.indexOf(name) > -1) {
10900 if (value) {
10901 this.domNode.setAttribute(name, value);
10902 } else {
10903 this.domNode.removeAttribute(name);
10904 }
10905 } else {
10906 _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
10907 }
10908 }
10909 }], [{
10910 key: 'create',
10911 value: function create(value) {
10912 var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
10913 node.setAttribute('frameborder', '0');
10914 node.setAttribute('allowfullscreen', true);
10915 node.setAttribute('src', this.sanitize(value));
10916 return node;
10917 }
10918 }, {
10919 key: 'formats',
10920 value: function formats(domNode) {
10921 return ATTRIBUTES.reduce(function (formats, attribute) {
10922 if (domNode.hasAttribute(attribute)) {
10923 formats[attribute] = domNode.getAttribute(attribute);
10924 }
10925 return formats;
10926 }, {});
10927 }
10928 }, {
10929 key: 'sanitize',
10930 value: function sanitize(url) {
10931 return _link2.default.sanitize(url);
10932 }
10933 }, {
10934 key: 'value',
10935 value: function value(domNode) {
10936 return domNode.getAttribute('src');
10937 }
10938 }]);
10939
10940 return Video;
10941}(_block.BlockEmbed);
10942
10943Video.blotName = 'video';
10944Video.className = 'ql-video';
10945Video.tagName = 'IFRAME';
10946
10947exports.default = Video;
10948
10949/***/ }),
10950/* 74 */
10951/***/ (function(module, exports, __webpack_require__) {
10952
10953"use strict";
10954
10955
10956Object.defineProperty(exports, "__esModule", {
10957 value: true
10958});
10959exports.default = exports.FormulaBlot = undefined;
10960
10961var _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; }; }();
10962
10963var _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); } };
10964
10965var _embed = __webpack_require__(35);
10966
10967var _embed2 = _interopRequireDefault(_embed);
10968
10969var _quill = __webpack_require__(5);
10970
10971var _quill2 = _interopRequireDefault(_quill);
10972
10973var _module = __webpack_require__(9);
10974
10975var _module2 = _interopRequireDefault(_module);
10976
10977function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10978
10979function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10980
10981function _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; }
10982
10983function _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; }
10984
10985var FormulaBlot = function (_Embed) {
10986 _inherits(FormulaBlot, _Embed);
10987
10988 function FormulaBlot() {
10989 _classCallCheck(this, FormulaBlot);
10990
10991 return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
10992 }
10993
10994 _createClass(FormulaBlot, null, [{
10995 key: 'create',
10996 value: function create(value) {
10997 var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
10998 if (typeof value === 'string') {
10999 window.katex.render(value, node, {
11000 throwOnError: false,
11001 errorColor: '#f00'
11002 });
11003 node.setAttribute('data-value', value);
11004 }
11005 return node;
11006 }
11007 }, {
11008 key: 'value',
11009 value: function value(domNode) {
11010 return domNode.getAttribute('data-value');
11011 }
11012 }]);
11013
11014 return FormulaBlot;
11015}(_embed2.default);
11016
11017FormulaBlot.blotName = 'formula';
11018FormulaBlot.className = 'ql-formula';
11019FormulaBlot.tagName = 'SPAN';
11020
11021var Formula = function (_Module) {
11022 _inherits(Formula, _Module);
11023
11024 _createClass(Formula, null, [{
11025 key: 'register',
11026 value: function register() {
11027 _quill2.default.register(FormulaBlot, true);
11028 }
11029 }]);
11030
11031 function Formula() {
11032 _classCallCheck(this, Formula);
11033
11034 var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
11035
11036 if (window.katex == null) {
11037 throw new Error('Formula module requires KaTeX.');
11038 }
11039 return _this2;
11040 }
11041
11042 return Formula;
11043}(_module2.default);
11044
11045exports.FormulaBlot = FormulaBlot;
11046exports.default = Formula;
11047
11048/***/ }),
11049/* 75 */
11050/***/ (function(module, exports, __webpack_require__) {
11051
11052"use strict";
11053
11054
11055Object.defineProperty(exports, "__esModule", {
11056 value: true
11057});
11058exports.default = exports.CodeToken = exports.CodeBlock = undefined;
11059
11060var _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; }; }();
11061
11062var _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); } };
11063
11064var _parchment = __webpack_require__(0);
11065
11066var _parchment2 = _interopRequireDefault(_parchment);
11067
11068var _quill = __webpack_require__(5);
11069
11070var _quill2 = _interopRequireDefault(_quill);
11071
11072var _module = __webpack_require__(9);
11073
11074var _module2 = _interopRequireDefault(_module);
11075
11076var _code = __webpack_require__(13);
11077
11078var _code2 = _interopRequireDefault(_code);
11079
11080function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11081
11082function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11083
11084function _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; }
11085
11086function _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; }
11087
11088var SyntaxCodeBlock = function (_CodeBlock) {
11089 _inherits(SyntaxCodeBlock, _CodeBlock);
11090
11091 function SyntaxCodeBlock() {
11092 _classCallCheck(this, SyntaxCodeBlock);
11093
11094 return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
11095 }
11096
11097 _createClass(SyntaxCodeBlock, [{
11098 key: 'replaceWith',
11099 value: function replaceWith(block) {
11100 this.domNode.textContent = this.domNode.textContent;
11101 this.attach();
11102 _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
11103 }
11104 }, {
11105 key: 'highlight',
11106 value: function highlight(_highlight) {
11107 var text = this.domNode.textContent;
11108 if (this.cachedText !== text) {
11109 if (text.trim().length > 0 || this.cachedText == null) {
11110 this.domNode.innerHTML = _highlight(text);
11111 this.domNode.normalize();
11112 this.attach();
11113 }
11114 this.cachedText = text;
11115 }
11116 }
11117 }]);
11118
11119 return SyntaxCodeBlock;
11120}(_code2.default);
11121
11122SyntaxCodeBlock.className = 'ql-syntax';
11123
11124var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
11125 scope: _parchment2.default.Scope.INLINE
11126});
11127
11128var Syntax = function (_Module) {
11129 _inherits(Syntax, _Module);
11130
11131 _createClass(Syntax, null, [{
11132 key: 'register',
11133 value: function register() {
11134 _quill2.default.register(CodeToken, true);
11135 _quill2.default.register(SyntaxCodeBlock, true);
11136 }
11137 }]);
11138
11139 function Syntax(quill, options) {
11140 _classCallCheck(this, Syntax);
11141
11142 var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
11143
11144 if (typeof _this2.options.highlight !== 'function') {
11145 throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
11146 }
11147 var timer = null;
11148 _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
11149 clearTimeout(timer);
11150 timer = setTimeout(function () {
11151 _this2.highlight();
11152 timer = null;
11153 }, _this2.options.interval);
11154 });
11155 _this2.highlight();
11156 return _this2;
11157 }
11158
11159 _createClass(Syntax, [{
11160 key: 'highlight',
11161 value: function highlight() {
11162 var _this3 = this;
11163
11164 if (this.quill.selection.composing) return;
11165 this.quill.update(_quill2.default.sources.USER);
11166 var range = this.quill.getSelection();
11167 this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
11168 code.highlight(_this3.options.highlight);
11169 });
11170 this.quill.update(_quill2.default.sources.SILENT);
11171 if (range != null) {
11172 this.quill.setSelection(range, _quill2.default.sources.SILENT);
11173 }
11174 }
11175 }]);
11176
11177 return Syntax;
11178}(_module2.default);
11179
11180Syntax.DEFAULTS = {
11181 highlight: function () {
11182 if (window.hljs == null) return null;
11183 return function (text) {
11184 var result = window.hljs.highlightAuto(text);
11185 return result.value;
11186 };
11187 }(),
11188 interval: 1000
11189};
11190
11191exports.CodeBlock = SyntaxCodeBlock;
11192exports.CodeToken = CodeToken;
11193exports.default = Syntax;
11194
11195/***/ }),
11196/* 76 */
11197/***/ (function(module, exports) {
11198
11199module.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>";
11200
11201/***/ }),
11202/* 77 */
11203/***/ (function(module, exports) {
11204
11205module.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>";
11206
11207/***/ }),
11208/* 78 */
11209/***/ (function(module, exports) {
11210
11211module.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>";
11212
11213/***/ }),
11214/* 79 */
11215/***/ (function(module, exports) {
11216
11217module.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>";
11218
11219/***/ }),
11220/* 80 */
11221/***/ (function(module, exports) {
11222
11223module.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>";
11224
11225/***/ }),
11226/* 81 */
11227/***/ (function(module, exports) {
11228
11229module.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>";
11230
11231/***/ }),
11232/* 82 */
11233/***/ (function(module, exports) {
11234
11235module.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>";
11236
11237/***/ }),
11238/* 83 */
11239/***/ (function(module, exports) {
11240
11241module.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>";
11242
11243/***/ }),
11244/* 84 */
11245/***/ (function(module, exports) {
11246
11247module.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>";
11248
11249/***/ }),
11250/* 85 */
11251/***/ (function(module, exports) {
11252
11253module.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>";
11254
11255/***/ }),
11256/* 86 */
11257/***/ (function(module, exports) {
11258
11259module.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>";
11260
11261/***/ }),
11262/* 87 */
11263/***/ (function(module, exports) {
11264
11265module.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>";
11266
11267/***/ }),
11268/* 88 */
11269/***/ (function(module, exports) {
11270
11271module.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>";
11272
11273/***/ }),
11274/* 89 */
11275/***/ (function(module, exports) {
11276
11277module.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>";
11278
11279/***/ }),
11280/* 90 */
11281/***/ (function(module, exports) {
11282
11283module.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>";
11284
11285/***/ }),
11286/* 91 */
11287/***/ (function(module, exports) {
11288
11289module.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>";
11290
11291/***/ }),
11292/* 92 */
11293/***/ (function(module, exports) {
11294
11295module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>";
11296
11297/***/ }),
11298/* 93 */
11299/***/ (function(module, exports) {
11300
11301module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>";
11302
11303/***/ }),
11304/* 94 */
11305/***/ (function(module, exports) {
11306
11307module.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>";
11308
11309/***/ }),
11310/* 95 */
11311/***/ (function(module, exports) {
11312
11313module.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>";
11314
11315/***/ }),
11316/* 96 */
11317/***/ (function(module, exports) {
11318
11319module.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>";
11320
11321/***/ }),
11322/* 97 */
11323/***/ (function(module, exports) {
11324
11325module.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>";
11326
11327/***/ }),
11328/* 98 */
11329/***/ (function(module, exports) {
11330
11331module.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>";
11332
11333/***/ }),
11334/* 99 */
11335/***/ (function(module, exports) {
11336
11337module.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>";
11338
11339/***/ }),
11340/* 100 */
11341/***/ (function(module, exports) {
11342
11343module.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>";
11344
11345/***/ }),
11346/* 101 */
11347/***/ (function(module, exports) {
11348
11349module.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>";
11350
11351/***/ }),
11352/* 102 */
11353/***/ (function(module, exports) {
11354
11355module.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>";
11356
11357/***/ }),
11358/* 103 */
11359/***/ (function(module, exports) {
11360
11361module.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>";
11362
11363/***/ }),
11364/* 104 */
11365/***/ (function(module, exports) {
11366
11367module.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>";
11368
11369/***/ }),
11370/* 105 */
11371/***/ (function(module, exports) {
11372
11373module.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>";
11374
11375/***/ }),
11376/* 106 */
11377/***/ (function(module, exports) {
11378
11379module.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>";
11380
11381/***/ }),
11382/* 107 */
11383/***/ (function(module, exports) {
11384
11385module.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>";
11386
11387/***/ }),
11388/* 108 */
11389/***/ (function(module, exports, __webpack_require__) {
11390
11391"use strict";
11392
11393
11394Object.defineProperty(exports, "__esModule", {
11395 value: true
11396});
11397exports.default = exports.BubbleTooltip = undefined;
11398
11399var _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); } };
11400
11401var _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; }; }();
11402
11403var _extend = __webpack_require__(3);
11404
11405var _extend2 = _interopRequireDefault(_extend);
11406
11407var _emitter = __webpack_require__(8);
11408
11409var _emitter2 = _interopRequireDefault(_emitter);
11410
11411var _base = __webpack_require__(43);
11412
11413var _base2 = _interopRequireDefault(_base);
11414
11415var _selection = __webpack_require__(15);
11416
11417var _icons = __webpack_require__(41);
11418
11419var _icons2 = _interopRequireDefault(_icons);
11420
11421function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11422
11423function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11424
11425function _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; }
11426
11427function _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; }
11428
11429var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
11430
11431var BubbleTheme = function (_BaseTheme) {
11432 _inherits(BubbleTheme, _BaseTheme);
11433
11434 function BubbleTheme(quill, options) {
11435 _classCallCheck(this, BubbleTheme);
11436
11437 if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
11438 options.modules.toolbar.container = TOOLBAR_CONFIG;
11439 }
11440
11441 var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
11442
11443 _this.quill.container.classList.add('ql-bubble');
11444 return _this;
11445 }
11446
11447 _createClass(BubbleTheme, [{
11448 key: 'extendToolbar',
11449 value: function extendToolbar(toolbar) {
11450 this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
11451 this.tooltip.root.appendChild(toolbar.container);
11452 this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
11453 this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
11454 }
11455 }]);
11456
11457 return BubbleTheme;
11458}(_base2.default);
11459
11460BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
11461 modules: {
11462 toolbar: {
11463 handlers: {
11464 link: function link(value) {
11465 if (!value) {
11466 this.quill.format('link', false);
11467 } else {
11468 this.quill.theme.tooltip.edit();
11469 }
11470 }
11471 }
11472 }
11473 }
11474});
11475
11476var BubbleTooltip = function (_BaseTooltip) {
11477 _inherits(BubbleTooltip, _BaseTooltip);
11478
11479 function BubbleTooltip(quill, bounds) {
11480 _classCallCheck(this, BubbleTooltip);
11481
11482 var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
11483
11484 _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
11485 if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
11486 if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
11487 _this2.show();
11488 // Lock our width so we will expand beyond our offsetParent boundaries
11489 _this2.root.style.left = '0px';
11490 _this2.root.style.width = '';
11491 _this2.root.style.width = _this2.root.offsetWidth + 'px';
11492 var lines = _this2.quill.getLines(range.index, range.length);
11493 if (lines.length === 1) {
11494 _this2.position(_this2.quill.getBounds(range));
11495 } else {
11496 var lastLine = lines[lines.length - 1];
11497 var index = _this2.quill.getIndex(lastLine);
11498 var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
11499 var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
11500 _this2.position(_bounds);
11501 }
11502 } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
11503 _this2.hide();
11504 }
11505 });
11506 return _this2;
11507 }
11508
11509 _createClass(BubbleTooltip, [{
11510 key: 'listen',
11511 value: function listen() {
11512 var _this3 = this;
11513
11514 _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
11515 this.root.querySelector('.ql-close').addEventListener('click', function () {
11516 _this3.root.classList.remove('ql-editing');
11517 });
11518 this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
11519 // Let selection be restored by toolbar handlers before repositioning
11520 setTimeout(function () {
11521 if (_this3.root.classList.contains('ql-hidden')) return;
11522 var range = _this3.quill.getSelection();
11523 if (range != null) {
11524 _this3.position(_this3.quill.getBounds(range));
11525 }
11526 }, 1);
11527 });
11528 }
11529 }, {
11530 key: 'cancel',
11531 value: function cancel() {
11532 this.show();
11533 }
11534 }, {
11535 key: 'position',
11536 value: function position(reference) {
11537 var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
11538 var arrow = this.root.querySelector('.ql-tooltip-arrow');
11539 arrow.style.marginLeft = '';
11540 if (shift === 0) return shift;
11541 arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
11542 }
11543 }]);
11544
11545 return BubbleTooltip;
11546}(_base.BaseTooltip);
11547
11548BubbleTooltip.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('');
11549
11550exports.BubbleTooltip = BubbleTooltip;
11551exports.default = BubbleTheme;
11552
11553/***/ }),
11554/* 109 */
11555/***/ (function(module, exports, __webpack_require__) {
11556
11557module.exports = __webpack_require__(63);
11558
11559
11560/***/ })
11561/******/ ])["default"];
11562});
\No newline at end of file