UNPKG

431 kBJavaScriptView Raw
1/*!
2 * Quill Editor v1.3.3
3 * https://quilljs.com/
4 * Copyright (c) 2014, Jason Chen
5 * Copyright (c) 2013, salesforce.com
6 */
7(function webpackUniversalModuleDefinition(root, factory) {
8 if(typeof exports === 'object' && typeof module === 'object')
9 module.exports = factory();
10 else if(typeof define === 'function' && define.amd)
11 define([], factory);
12 else if(typeof exports === 'object')
13 exports["Quill"] = factory();
14 else
15 root["Quill"] = factory();
16})(this, function() {
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 = {}));
175;
176function create(input, value) {
177 var match = query(input);
178 if (match == null) {
179 throw new ParchmentError("Unable to create " + input + " blot");
180 }
181 var BlotClass = match;
182 var node = (input instanceof Node || input['nodeType'] === Node.TEXT_NODE) ?
183 input :
184 BlotClass.create(value);
185 return new BlotClass(node, value);
186}
187exports.create = create;
188function find(node, bubble) {
189 if (bubble === void 0) { bubble = false; }
190 if (node == null)
191 return null;
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 }
205 else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
206 match = types['text'];
207 }
208 else if (typeof query === 'number') {
209 if (query & Scope.LEVEL & Scope.BLOCK) {
210 match = types['block'];
211 }
212 else if (query & Scope.LEVEL & Scope.INLINE) {
213 match = types['inline'];
214 }
215 }
216 else if (query instanceof HTMLElement) {
217 var names = (query.getAttribute('class') || '').split(/\s+/);
218 for (var i in names) {
219 match = classes[names[i]];
220 if (match)
221 break;
222 }
223 match = match || tags[query.tagName];
224 }
225 if (match == null)
226 return null;
227 if ((scope & Scope.LEVEL & match.scope) && (scope & Scope.TYPE & match.scope))
228 return match;
229 return null;
230}
231exports.query = query;
232function register() {
233 var Definitions = [];
234 for (var _i = 0; _i < arguments.length; _i++) {
235 Definitions[_i] = arguments[_i];
236 }
237 if (Definitions.length > 1) {
238 return Definitions.map(function (d) {
239 return register(d);
240 });
241 }
242 var Definition = Definitions[0];
243 if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
244 throw new ParchmentError('Invalid definition');
245 }
246 else if (Definition.blotName === 'abstract') {
247 throw new ParchmentError('Cannot register abstract class');
248 }
249 types[Definition.blotName || Definition.attrName] = Definition;
250 if (typeof Definition.keyName === 'string') {
251 attributes[Definition.keyName] = Definition;
252 }
253 else {
254 if (Definition.className != null) {
255 classes[Definition.className] = Definition;
256 }
257 if (Definition.tagName != null) {
258 if (Array.isArray(Definition.tagName)) {
259 Definition.tagName = Definition.tagName.map(function (tagName) {
260 return tagName.toUpperCase();
261 });
262 }
263 else {
264 Definition.tagName = Definition.tagName.toUpperCase();
265 }
266 var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
267 tagNames.forEach(function (tag) {
268 if (tags[tag] == null || Definition.className == null) {
269 tags[tag] = Definition;
270 }
271 });
272 }
273 }
274 return Definition;
275}
276exports.register = register;
277
278
279/***/ }),
280/* 2 */
281/***/ (function(module, exports, __webpack_require__) {
282
283var diff = __webpack_require__(51);
284var equal = __webpack_require__(11);
285var extend = __webpack_require__(3);
286var op = __webpack_require__(20);
287
288
289var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
290
291
292var Delta = function (ops) {
293 // Assume we are given a well formed ops
294 if (Array.isArray(ops)) {
295 this.ops = ops;
296 } else if (ops != null && Array.isArray(ops.ops)) {
297 this.ops = ops.ops;
298 } else {
299 this.ops = [];
300 }
301};
302
303
304Delta.prototype.insert = function (text, attributes) {
305 var newOp = {};
306 if (text.length === 0) return this;
307 newOp.insert = text;
308 if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
309 newOp.attributes = attributes;
310 }
311 return this.push(newOp);
312};
313
314Delta.prototype['delete'] = function (length) {
315 if (length <= 0) return this;
316 return this.push({ 'delete': length });
317};
318
319Delta.prototype.retain = function (length, attributes) {
320 if (length <= 0) return this;
321 var newOp = { retain: length };
322 if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
323 newOp.attributes = attributes;
324 }
325 return this.push(newOp);
326};
327
328Delta.prototype.push = function (newOp) {
329 var index = this.ops.length;
330 var lastOp = this.ops[index - 1];
331 newOp = extend(true, {}, newOp);
332 if (typeof lastOp === 'object') {
333 if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
334 this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
335 return this;
336 }
337 // Since it does not matter if we insert before or after deleting at the same index,
338 // always prefer to insert first
339 if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
340 index -= 1;
341 lastOp = this.ops[index - 1];
342 if (typeof lastOp !== 'object') {
343 this.ops.unshift(newOp);
344 return this;
345 }
346 }
347 if (equal(newOp.attributes, lastOp.attributes)) {
348 if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
349 this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
350 if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
351 return this;
352 } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
353 this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
354 if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
355 return this;
356 }
357 }
358 }
359 if (index === this.ops.length) {
360 this.ops.push(newOp);
361 } else {
362 this.ops.splice(index, 0, newOp);
363 }
364 return this;
365};
366
367Delta.prototype.chop = function () {
368 var lastOp = this.ops[this.ops.length - 1];
369 if (lastOp && lastOp.retain && !lastOp.attributes) {
370 this.ops.pop();
371 }
372 return this;
373};
374
375Delta.prototype.filter = function (predicate) {
376 return this.ops.filter(predicate);
377};
378
379Delta.prototype.forEach = function (predicate) {
380 this.ops.forEach(predicate);
381};
382
383Delta.prototype.map = function (predicate) {
384 return this.ops.map(predicate);
385};
386
387Delta.prototype.partition = function (predicate) {
388 var passed = [], failed = [];
389 this.forEach(function(op) {
390 var target = predicate(op) ? passed : failed;
391 target.push(op);
392 });
393 return [passed, failed];
394};
395
396Delta.prototype.reduce = function (predicate, initial) {
397 return this.ops.reduce(predicate, initial);
398};
399
400Delta.prototype.changeLength = function () {
401 return this.reduce(function (length, elem) {
402 if (elem.insert) {
403 return length + op.length(elem);
404 } else if (elem.delete) {
405 return length - elem.delete;
406 }
407 return length;
408 }, 0);
409};
410
411Delta.prototype.length = function () {
412 return this.reduce(function (length, elem) {
413 return length + op.length(elem);
414 }, 0);
415};
416
417Delta.prototype.slice = function (start, end) {
418 start = start || 0;
419 if (typeof end !== 'number') end = Infinity;
420 var ops = [];
421 var iter = op.iterator(this.ops);
422 var index = 0;
423 while (index < end && iter.hasNext()) {
424 var nextOp;
425 if (index < start) {
426 nextOp = iter.next(start - index);
427 } else {
428 nextOp = iter.next(end - index);
429 ops.push(nextOp);
430 }
431 index += op.length(nextOp);
432 }
433 return new Delta(ops);
434};
435
436
437Delta.prototype.compose = function (other) {
438 var thisIter = op.iterator(this.ops);
439 var otherIter = op.iterator(other.ops);
440 var delta = new Delta();
441 while (thisIter.hasNext() || otherIter.hasNext()) {
442 if (otherIter.peekType() === 'insert') {
443 delta.push(otherIter.next());
444 } else if (thisIter.peekType() === 'delete') {
445 delta.push(thisIter.next());
446 } else {
447 var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
448 var thisOp = thisIter.next(length);
449 var otherOp = otherIter.next(length);
450 if (typeof otherOp.retain === 'number') {
451 var newOp = {};
452 if (typeof thisOp.retain === 'number') {
453 newOp.retain = length;
454 } else {
455 newOp.insert = thisOp.insert;
456 }
457 // Preserve null when composing with a retain, otherwise remove it for inserts
458 var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
459 if (attributes) newOp.attributes = attributes;
460 delta.push(newOp);
461 // Other op should be delete, we could be an insert or retain
462 // Insert + delete cancels out
463 } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
464 delta.push(otherOp);
465 }
466 }
467 }
468 return delta.chop();
469};
470
471Delta.prototype.concat = function (other) {
472 var delta = new Delta(this.ops.slice());
473 if (other.ops.length > 0) {
474 delta.push(other.ops[0]);
475 delta.ops = delta.ops.concat(other.ops.slice(1));
476 }
477 return delta;
478};
479
480Delta.prototype.diff = function (other, index) {
481 if (this.ops === other.ops) {
482 return new Delta();
483 }
484 var strings = [this, other].map(function (delta) {
485 return delta.map(function (op) {
486 if (op.insert != null) {
487 return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
488 }
489 var prep = (delta === other) ? 'on' : 'with';
490 throw new Error('diff() called ' + prep + ' non-document');
491 }).join('');
492 });
493 var delta = new Delta();
494 var diffResult = diff(strings[0], strings[1], index);
495 var thisIter = op.iterator(this.ops);
496 var otherIter = op.iterator(other.ops);
497 diffResult.forEach(function (component) {
498 var length = component[1].length;
499 while (length > 0) {
500 var opLength = 0;
501 switch (component[0]) {
502 case diff.INSERT:
503 opLength = Math.min(otherIter.peekLength(), length);
504 delta.push(otherIter.next(opLength));
505 break;
506 case diff.DELETE:
507 opLength = Math.min(length, thisIter.peekLength());
508 thisIter.next(opLength);
509 delta['delete'](opLength);
510 break;
511 case diff.EQUAL:
512 opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
513 var thisOp = thisIter.next(opLength);
514 var otherOp = otherIter.next(opLength);
515 if (equal(thisOp.insert, otherOp.insert)) {
516 delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
517 } else {
518 delta.push(otherOp)['delete'](opLength);
519 }
520 break;
521 }
522 length -= opLength;
523 }
524 });
525 return delta.chop();
526};
527
528Delta.prototype.eachLine = function (predicate, newline) {
529 newline = newline || '\n';
530 var iter = op.iterator(this.ops);
531 var line = new Delta();
532 var i = 0;
533 while (iter.hasNext()) {
534 if (iter.peekType() !== 'insert') return;
535 var thisOp = iter.peek();
536 var start = op.length(thisOp) - iter.peekLength();
537 var index = typeof thisOp.insert === 'string' ?
538 thisOp.insert.indexOf(newline, start) - start : -1;
539 if (index < 0) {
540 line.push(iter.next());
541 } else if (index > 0) {
542 line.push(iter.next(index));
543 } else {
544 if (predicate(line, iter.next(1).attributes || {}, i) === false) {
545 return;
546 }
547 i += 1;
548 line = new Delta();
549 }
550 }
551 if (line.length() > 0) {
552 predicate(line, {}, i);
553 }
554};
555
556Delta.prototype.transform = function (other, priority) {
557 priority = !!priority;
558 if (typeof other === 'number') {
559 return this.transformPosition(other, priority);
560 }
561 var thisIter = op.iterator(this.ops);
562 var otherIter = op.iterator(other.ops);
563 var delta = new Delta();
564 while (thisIter.hasNext() || otherIter.hasNext()) {
565 if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
566 delta.retain(op.length(thisIter.next()));
567 } else if (otherIter.peekType() === 'insert') {
568 delta.push(otherIter.next());
569 } else {
570 var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
571 var thisOp = thisIter.next(length);
572 var otherOp = otherIter.next(length);
573 if (thisOp['delete']) {
574 // Our delete either makes their delete redundant or removes their retain
575 continue;
576 } else if (otherOp['delete']) {
577 delta.push(otherOp);
578 } else {
579 // We retain either their retain or insert
580 delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
581 }
582 }
583 }
584 return delta.chop();
585};
586
587Delta.prototype.transformPosition = function (index, priority) {
588 priority = !!priority;
589 var thisIter = op.iterator(this.ops);
590 var offset = 0;
591 while (thisIter.hasNext() && offset <= index) {
592 var length = thisIter.peekLength();
593 var nextType = thisIter.peekType();
594 thisIter.next();
595 if (nextType === 'delete') {
596 index -= Math.min(length, index - offset);
597 continue;
598 } else if (nextType === 'insert' && (offset < index || !priority)) {
599 index += length;
600 }
601 offset += length;
602 }
603 return index;
604};
605
606
607module.exports = Delta;
608
609
610/***/ }),
611/* 3 */
612/***/ (function(module, exports) {
613
614'use strict';
615
616var hasOwn = Object.prototype.hasOwnProperty;
617var toStr = Object.prototype.toString;
618
619var isArray = function isArray(arr) {
620 if (typeof Array.isArray === 'function') {
621 return Array.isArray(arr);
622 }
623
624 return toStr.call(arr) === '[object Array]';
625};
626
627var isPlainObject = function isPlainObject(obj) {
628 if (!obj || toStr.call(obj) !== '[object Object]') {
629 return false;
630 }
631
632 var hasOwnConstructor = hasOwn.call(obj, 'constructor');
633 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
634 // Not own constructor property must be Object
635 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
636 return false;
637 }
638
639 // Own properties are enumerated firstly, so to speed up,
640 // if last one is own, then all properties are own.
641 var key;
642 for (key in obj) { /**/ }
643
644 return typeof key === 'undefined' || hasOwn.call(obj, key);
645};
646
647module.exports = function extend() {
648 var options, name, src, copy, copyIsArray, clone;
649 var target = arguments[0];
650 var i = 1;
651 var length = arguments.length;
652 var deep = false;
653
654 // Handle a deep copy situation
655 if (typeof target === 'boolean') {
656 deep = target;
657 target = arguments[1] || {};
658 // skip the boolean and the target
659 i = 2;
660 }
661 if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
662 target = {};
663 }
664
665 for (; i < length; ++i) {
666 options = arguments[i];
667 // Only deal with non-null/undefined values
668 if (options != null) {
669 // Extend the base object
670 for (name in options) {
671 src = target[name];
672 copy = options[name];
673
674 // Prevent never-ending loop
675 if (target !== copy) {
676 // Recurse if we're merging plain objects or arrays
677 if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
678 if (copyIsArray) {
679 copyIsArray = false;
680 clone = src && isArray(src) ? src : [];
681 } else {
682 clone = src && isPlainObject(src) ? src : {};
683 }
684
685 // Never move original objects, clone them
686 target[name] = extend(deep, clone, copy);
687
688 // Don't bring in undefined values
689 } else if (typeof copy !== 'undefined') {
690 target[name] = copy;
691 }
692 }
693 }
694 }
695 }
696
697 // Return the modified object
698 return target;
699};
700
701
702/***/ }),
703/* 4 */
704/***/ (function(module, exports, __webpack_require__) {
705
706"use strict";
707
708
709Object.defineProperty(exports, "__esModule", {
710 value: true
711});
712exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
713
714var _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; }; }();
715
716var _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); } };
717
718var _extend = __webpack_require__(3);
719
720var _extend2 = _interopRequireDefault(_extend);
721
722var _quillDelta = __webpack_require__(2);
723
724var _quillDelta2 = _interopRequireDefault(_quillDelta);
725
726var _parchment = __webpack_require__(0);
727
728var _parchment2 = _interopRequireDefault(_parchment);
729
730var _break = __webpack_require__(16);
731
732var _break2 = _interopRequireDefault(_break);
733
734var _inline = __webpack_require__(6);
735
736var _inline2 = _interopRequireDefault(_inline);
737
738var _text = __webpack_require__(7);
739
740var _text2 = _interopRequireDefault(_text);
741
742function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
743
744function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
745
746function _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; }
747
748function _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; }
749
750var NEWLINE_LENGTH = 1;
751
752var BlockEmbed = function (_Parchment$Embed) {
753 _inherits(BlockEmbed, _Parchment$Embed);
754
755 function BlockEmbed() {
756 _classCallCheck(this, BlockEmbed);
757
758 return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
759 }
760
761 _createClass(BlockEmbed, [{
762 key: 'attach',
763 value: function attach() {
764 _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
765 this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
766 }
767 }, {
768 key: 'delta',
769 value: function delta() {
770 return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
771 }
772 }, {
773 key: 'format',
774 value: function format(name, value) {
775 var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
776 if (attribute != null) {
777 this.attributes.attribute(attribute, value);
778 }
779 }
780 }, {
781 key: 'formatAt',
782 value: function formatAt(index, length, name, value) {
783 this.format(name, value);
784 }
785 }, {
786 key: 'insertAt',
787 value: function insertAt(index, value, def) {
788 if (typeof value === 'string' && value.endsWith('\n')) {
789 var block = _parchment2.default.create(Block.blotName);
790 this.parent.insertBefore(block, index === 0 ? this : this.next);
791 block.insertAt(0, value.slice(0, -1));
792 } else {
793 _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
794 }
795 }
796 }]);
797
798 return BlockEmbed;
799}(_parchment2.default.Embed);
800
801BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
802// It is important for cursor behavior BlockEmbeds use tags that are block level elements
803
804
805var Block = function (_Parchment$Block) {
806 _inherits(Block, _Parchment$Block);
807
808 function Block(domNode) {
809 _classCallCheck(this, Block);
810
811 var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
812
813 _this2.cache = {};
814 return _this2;
815 }
816
817 _createClass(Block, [{
818 key: 'delta',
819 value: function delta() {
820 if (this.cache.delta == null) {
821 this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
822 if (leaf.length() === 0) {
823 return delta;
824 } else {
825 return delta.insert(leaf.value(), bubbleFormats(leaf));
826 }
827 }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
828 }
829 return this.cache.delta;
830 }
831 }, {
832 key: 'deleteAt',
833 value: function deleteAt(index, length) {
834 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
835 this.cache = {};
836 }
837 }, {
838 key: 'formatAt',
839 value: function formatAt(index, length, name, value) {
840 if (length <= 0) return;
841 if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
842 if (index + length === this.length()) {
843 this.format(name, value);
844 }
845 } else {
846 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
847 }
848 this.cache = {};
849 }
850 }, {
851 key: 'insertAt',
852 value: function insertAt(index, value, def) {
853 if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
854 if (value.length === 0) return;
855 var lines = value.split('\n');
856 var text = lines.shift();
857 if (text.length > 0) {
858 if (index < this.length() - 1 || this.children.tail == null) {
859 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
860 } else {
861 this.children.tail.insertAt(this.children.tail.length(), text);
862 }
863 this.cache = {};
864 }
865 var block = this;
866 lines.reduce(function (index, line) {
867 block = block.split(index, true);
868 block.insertAt(0, line);
869 return line.length;
870 }, index + text.length);
871 }
872 }, {
873 key: 'insertBefore',
874 value: function insertBefore(blot, ref) {
875 var head = this.children.head;
876 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
877 if (head instanceof _break2.default) {
878 head.remove();
879 }
880 this.cache = {};
881 }
882 }, {
883 key: 'length',
884 value: function length() {
885 if (this.cache.length == null) {
886 this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
887 }
888 return this.cache.length;
889 }
890 }, {
891 key: 'moveChildren',
892 value: function moveChildren(target, ref) {
893 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
894 this.cache = {};
895 }
896 }, {
897 key: 'optimize',
898 value: function optimize(context) {
899 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);
900 this.cache = {};
901 }
902 }, {
903 key: 'path',
904 value: function path(index) {
905 return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
906 }
907 }, {
908 key: 'removeChild',
909 value: function removeChild(child) {
910 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
911 this.cache = {};
912 }
913 }, {
914 key: 'split',
915 value: function split(index) {
916 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
917
918 if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
919 var clone = this.clone();
920 if (index === 0) {
921 this.parent.insertBefore(clone, this);
922 return this;
923 } else {
924 this.parent.insertBefore(clone, this.next);
925 return clone;
926 }
927 } else {
928 var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
929 this.cache = {};
930 return next;
931 }
932 }
933 }]);
934
935 return Block;
936}(_parchment2.default.Block);
937
938Block.blotName = 'block';
939Block.tagName = 'P';
940Block.defaultChild = 'break';
941Block.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];
942
943function bubbleFormats(blot) {
944 var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
945
946 if (blot == null) return formats;
947 if (typeof blot.formats === 'function') {
948 formats = (0, _extend2.default)(formats, blot.formats());
949 }
950 if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
951 return formats;
952 }
953 return bubbleFormats(blot.parent, formats);
954}
955
956exports.bubbleFormats = bubbleFormats;
957exports.BlockEmbed = BlockEmbed;
958exports.default = Block;
959
960/***/ }),
961/* 5 */
962/***/ (function(module, exports, __webpack_require__) {
963
964"use strict";
965
966
967Object.defineProperty(exports, "__esModule", {
968 value: true
969});
970exports.default = exports.overload = exports.expandConfig = undefined;
971
972var _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; };
973
974var _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"); } }; }();
975
976var _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; }; }();
977
978__webpack_require__(50);
979
980var _quillDelta = __webpack_require__(2);
981
982var _quillDelta2 = _interopRequireDefault(_quillDelta);
983
984var _editor = __webpack_require__(14);
985
986var _editor2 = _interopRequireDefault(_editor);
987
988var _emitter3 = __webpack_require__(8);
989
990var _emitter4 = _interopRequireDefault(_emitter3);
991
992var _module = __webpack_require__(9);
993
994var _module2 = _interopRequireDefault(_module);
995
996var _parchment = __webpack_require__(0);
997
998var _parchment2 = _interopRequireDefault(_parchment);
999
1000var _selection = __webpack_require__(15);
1001
1002var _selection2 = _interopRequireDefault(_selection);
1003
1004var _extend = __webpack_require__(3);
1005
1006var _extend2 = _interopRequireDefault(_extend);
1007
1008var _logger = __webpack_require__(10);
1009
1010var _logger2 = _interopRequireDefault(_logger);
1011
1012var _theme = __webpack_require__(34);
1013
1014var _theme2 = _interopRequireDefault(_theme);
1015
1016function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1017
1018function _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; }
1019
1020function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1021
1022var debug = (0, _logger2.default)('quill');
1023
1024var Quill = function () {
1025 _createClass(Quill, null, [{
1026 key: 'debug',
1027 value: function debug(limit) {
1028 if (limit === true) {
1029 limit = 'log';
1030 }
1031 _logger2.default.level(limit);
1032 }
1033 }, {
1034 key: 'find',
1035 value: function find(node) {
1036 return node.__quill || _parchment2.default.find(node);
1037 }
1038 }, {
1039 key: 'import',
1040 value: function _import(name) {
1041 if (this.imports[name] == null) {
1042 debug.error('Cannot import ' + name + '. Are you sure it was registered?');
1043 }
1044 return this.imports[name];
1045 }
1046 }, {
1047 key: 'register',
1048 value: function register(path, target) {
1049 var _this = this;
1050
1051 var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1052
1053 if (typeof path !== 'string') {
1054 var name = path.attrName || path.blotName;
1055 if (typeof name === 'string') {
1056 // register(Blot | Attributor, overwrite)
1057 this.register('formats/' + name, path, target);
1058 } else {
1059 Object.keys(path).forEach(function (key) {
1060 _this.register(key, path[key], target);
1061 });
1062 }
1063 } else {
1064 if (this.imports[path] != null && !overwrite) {
1065 debug.warn('Overwriting ' + path + ' with', target);
1066 }
1067 this.imports[path] = target;
1068 if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
1069 _parchment2.default.register(target);
1070 } else if (path.startsWith('modules') && typeof target.register === 'function') {
1071 target.register();
1072 }
1073 }
1074 }
1075 }]);
1076
1077 function Quill(container) {
1078 var _this2 = this;
1079
1080 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1081
1082 _classCallCheck(this, Quill);
1083
1084 this.options = expandConfig(container, options);
1085 this.container = this.options.container;
1086 if (this.container == null) {
1087 return debug.error('Invalid Quill container', container);
1088 }
1089 if (this.options.debug) {
1090 Quill.debug(this.options.debug);
1091 }
1092 var html = this.container.innerHTML.trim();
1093 this.container.classList.add('ql-container');
1094 this.container.innerHTML = '';
1095 this.container.__quill = this;
1096 this.root = this.addContainer('ql-editor');
1097 this.root.classList.add('ql-blank');
1098 this.root.setAttribute('data-gramm', false);
1099 this.scrollingContainer = this.options.scrollingContainer || this.root;
1100 this.emitter = new _emitter4.default();
1101 this.scroll = _parchment2.default.create(this.root, {
1102 emitter: this.emitter,
1103 whitelist: this.options.formats
1104 });
1105 this.editor = new _editor2.default(this.scroll);
1106 this.selection = new _selection2.default(this.scroll, this.emitter);
1107 this.theme = new this.options.theme(this, this.options);
1108 this.keyboard = this.theme.addModule('keyboard');
1109 this.clipboard = this.theme.addModule('clipboard');
1110 this.history = this.theme.addModule('history');
1111 this.theme.init();
1112 this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
1113 if (type === _emitter4.default.events.TEXT_CHANGE) {
1114 _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
1115 }
1116 });
1117 this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
1118 var range = _this2.selection.lastRange;
1119 var index = range && range.length === 0 ? range.index : undefined;
1120 modify.call(_this2, function () {
1121 return _this2.editor.update(null, mutations, index);
1122 }, source);
1123 });
1124 var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
1125 this.setContents(contents);
1126 this.history.clear();
1127 if (this.options.placeholder) {
1128 this.root.setAttribute('data-placeholder', this.options.placeholder);
1129 }
1130 if (this.options.readOnly) {
1131 this.disable();
1132 }
1133 }
1134
1135 _createClass(Quill, [{
1136 key: 'addContainer',
1137 value: function addContainer(container) {
1138 var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1139
1140 if (typeof container === 'string') {
1141 var className = container;
1142 container = document.createElement('div');
1143 container.classList.add(className);
1144 }
1145 this.container.insertBefore(container, refNode);
1146 return container;
1147 }
1148 }, {
1149 key: 'blur',
1150 value: function blur() {
1151 this.selection.setRange(null);
1152 }
1153 }, {
1154 key: 'deleteText',
1155 value: function deleteText(index, length, source) {
1156 var _this3 = this;
1157
1158 var _overload = overload(index, length, source);
1159
1160 var _overload2 = _slicedToArray(_overload, 4);
1161
1162 index = _overload2[0];
1163 length = _overload2[1];
1164 source = _overload2[3];
1165
1166 return modify.call(this, function () {
1167 return _this3.editor.deleteText(index, length);
1168 }, source, index, -1 * length);
1169 }
1170 }, {
1171 key: 'disable',
1172 value: function disable() {
1173 this.enable(false);
1174 }
1175 }, {
1176 key: 'enable',
1177 value: function enable() {
1178 var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1179
1180 this.scroll.enable(enabled);
1181 this.container.classList.toggle('ql-disabled', !enabled);
1182 }
1183 }, {
1184 key: 'focus',
1185 value: function focus() {
1186 var scrollTop = this.scrollingContainer.scrollTop;
1187 this.selection.focus();
1188 this.scrollingContainer.scrollTop = scrollTop;
1189 this.scrollIntoView();
1190 }
1191 }, {
1192 key: 'format',
1193 value: function format(name, value) {
1194 var _this4 = this;
1195
1196 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
1197
1198 return modify.call(this, function () {
1199 var range = _this4.getSelection(true);
1200 var change = new _quillDelta2.default();
1201 if (range == null) {
1202 return change;
1203 } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
1204 change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
1205 } else if (range.length === 0) {
1206 _this4.selection.format(name, value);
1207 return change;
1208 } else {
1209 change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
1210 }
1211 _this4.setSelection(range, _emitter4.default.sources.SILENT);
1212 return change;
1213 }, source);
1214 }
1215 }, {
1216 key: 'formatLine',
1217 value: function formatLine(index, length, name, value, source) {
1218 var _this5 = this;
1219
1220 var formats = void 0;
1221
1222 var _overload3 = overload(index, length, name, value, source);
1223
1224 var _overload4 = _slicedToArray(_overload3, 4);
1225
1226 index = _overload4[0];
1227 length = _overload4[1];
1228 formats = _overload4[2];
1229 source = _overload4[3];
1230
1231 return modify.call(this, function () {
1232 return _this5.editor.formatLine(index, length, formats);
1233 }, source, index, 0);
1234 }
1235 }, {
1236 key: 'formatText',
1237 value: function formatText(index, length, name, value, source) {
1238 var _this6 = this;
1239
1240 var formats = void 0;
1241
1242 var _overload5 = overload(index, length, name, value, source);
1243
1244 var _overload6 = _slicedToArray(_overload5, 4);
1245
1246 index = _overload6[0];
1247 length = _overload6[1];
1248 formats = _overload6[2];
1249 source = _overload6[3];
1250
1251 return modify.call(this, function () {
1252 return _this6.editor.formatText(index, length, formats);
1253 }, source, index, 0);
1254 }
1255 }, {
1256 key: 'getBounds',
1257 value: function getBounds(index) {
1258 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1259
1260 var bounds = void 0;
1261 if (typeof index === 'number') {
1262 bounds = this.selection.getBounds(index, length);
1263 } else {
1264 bounds = this.selection.getBounds(index.index, index.length);
1265 }
1266 var containerBounds = this.container.getBoundingClientRect();
1267 return {
1268 bottom: bounds.bottom - containerBounds.top,
1269 height: bounds.height,
1270 left: bounds.left - containerBounds.left,
1271 right: bounds.right - containerBounds.left,
1272 top: bounds.top - containerBounds.top,
1273 width: bounds.width
1274 };
1275 }
1276 }, {
1277 key: 'getContents',
1278 value: function getContents() {
1279 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1280 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
1281
1282 var _overload7 = overload(index, length);
1283
1284 var _overload8 = _slicedToArray(_overload7, 2);
1285
1286 index = _overload8[0];
1287 length = _overload8[1];
1288
1289 return this.editor.getContents(index, length);
1290 }
1291 }, {
1292 key: 'getFormat',
1293 value: function getFormat() {
1294 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);
1295 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1296
1297 if (typeof index === 'number') {
1298 return this.editor.getFormat(index, length);
1299 } else {
1300 return this.editor.getFormat(index.index, index.length);
1301 }
1302 }
1303 }, {
1304 key: 'getIndex',
1305 value: function getIndex(blot) {
1306 return blot.offset(this.scroll);
1307 }
1308 }, {
1309 key: 'getLength',
1310 value: function getLength() {
1311 return this.scroll.length();
1312 }
1313 }, {
1314 key: 'getLeaf',
1315 value: function getLeaf(index) {
1316 return this.scroll.leaf(index);
1317 }
1318 }, {
1319 key: 'getLine',
1320 value: function getLine(index) {
1321 return this.scroll.line(index);
1322 }
1323 }, {
1324 key: 'getLines',
1325 value: function getLines() {
1326 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1327 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
1328
1329 if (typeof index !== 'number') {
1330 return this.scroll.lines(index.index, index.length);
1331 } else {
1332 return this.scroll.lines(index, length);
1333 }
1334 }
1335 }, {
1336 key: 'getModule',
1337 value: function getModule(name) {
1338 return this.theme.modules[name];
1339 }
1340 }, {
1341 key: 'getSelection',
1342 value: function getSelection() {
1343 var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1344
1345 if (focus) this.focus();
1346 this.update(); // Make sure we access getRange with editor in consistent state
1347 return this.selection.getRange()[0];
1348 }
1349 }, {
1350 key: 'getText',
1351 value: function getText() {
1352 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1353 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
1354
1355 var _overload9 = overload(index, length);
1356
1357 var _overload10 = _slicedToArray(_overload9, 2);
1358
1359 index = _overload10[0];
1360 length = _overload10[1];
1361
1362 return this.editor.getText(index, length);
1363 }
1364 }, {
1365 key: 'hasFocus',
1366 value: function hasFocus() {
1367 return this.selection.hasFocus();
1368 }
1369 }, {
1370 key: 'insertEmbed',
1371 value: function insertEmbed(index, embed, value) {
1372 var _this7 = this;
1373
1374 var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
1375
1376 return modify.call(this, function () {
1377 return _this7.editor.insertEmbed(index, embed, value);
1378 }, source, index);
1379 }
1380 }, {
1381 key: 'insertText',
1382 value: function insertText(index, text, name, value, source) {
1383 var _this8 = this;
1384
1385 var formats = void 0;
1386
1387 var _overload11 = overload(index, 0, name, value, source);
1388
1389 var _overload12 = _slicedToArray(_overload11, 4);
1390
1391 index = _overload12[0];
1392 formats = _overload12[2];
1393 source = _overload12[3];
1394
1395 return modify.call(this, function () {
1396 return _this8.editor.insertText(index, text, formats);
1397 }, source, index, text.length);
1398 }
1399 }, {
1400 key: 'isEnabled',
1401 value: function isEnabled() {
1402 return !this.container.classList.contains('ql-disabled');
1403 }
1404 }, {
1405 key: 'off',
1406 value: function off() {
1407 return this.emitter.off.apply(this.emitter, arguments);
1408 }
1409 }, {
1410 key: 'on',
1411 value: function on() {
1412 return this.emitter.on.apply(this.emitter, arguments);
1413 }
1414 }, {
1415 key: 'once',
1416 value: function once() {
1417 return this.emitter.once.apply(this.emitter, arguments);
1418 }
1419 }, {
1420 key: 'pasteHTML',
1421 value: function pasteHTML(index, html, source) {
1422 this.clipboard.dangerouslyPasteHTML(index, html, source);
1423 }
1424 }, {
1425 key: 'removeFormat',
1426 value: function removeFormat(index, length, source) {
1427 var _this9 = this;
1428
1429 var _overload13 = overload(index, length, source);
1430
1431 var _overload14 = _slicedToArray(_overload13, 4);
1432
1433 index = _overload14[0];
1434 length = _overload14[1];
1435 source = _overload14[3];
1436
1437 return modify.call(this, function () {
1438 return _this9.editor.removeFormat(index, length);
1439 }, source, index);
1440 }
1441 }, {
1442 key: 'scrollIntoView',
1443 value: function scrollIntoView() {
1444 this.selection.scrollIntoView(this.scrollingContainer);
1445 }
1446 }, {
1447 key: 'setContents',
1448 value: function setContents(delta) {
1449 var _this10 = this;
1450
1451 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1452
1453 return modify.call(this, function () {
1454 delta = new _quillDelta2.default(delta);
1455 var length = _this10.getLength();
1456 var deleted = _this10.editor.deleteText(0, length);
1457 var applied = _this10.editor.applyDelta(delta);
1458 var lastOp = applied.ops[applied.ops.length - 1];
1459 if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
1460 _this10.editor.deleteText(_this10.getLength() - 1, 1);
1461 applied.delete(1);
1462 }
1463 var ret = deleted.compose(applied);
1464 return ret;
1465 }, source);
1466 }
1467 }, {
1468 key: 'setSelection',
1469 value: function setSelection(index, length, source) {
1470 if (index == null) {
1471 this.selection.setRange(null, length || Quill.sources.API);
1472 } else {
1473 var _overload15 = overload(index, length, source);
1474
1475 var _overload16 = _slicedToArray(_overload15, 4);
1476
1477 index = _overload16[0];
1478 length = _overload16[1];
1479 source = _overload16[3];
1480
1481 this.selection.setRange(new _selection.Range(index, length), source);
1482 if (source !== _emitter4.default.sources.SILENT) {
1483 this.selection.scrollIntoView(this.scrollingContainer);
1484 }
1485 }
1486 }
1487 }, {
1488 key: 'setText',
1489 value: function setText(text) {
1490 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1491
1492 var delta = new _quillDelta2.default().insert(text);
1493 return this.setContents(delta, source);
1494 }
1495 }, {
1496 key: 'update',
1497 value: function update() {
1498 var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
1499
1500 var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
1501 this.selection.update(source);
1502 return change;
1503 }
1504 }, {
1505 key: 'updateContents',
1506 value: function updateContents(delta) {
1507 var _this11 = this;
1508
1509 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1510
1511 return modify.call(this, function () {
1512 delta = new _quillDelta2.default(delta);
1513 return _this11.editor.applyDelta(delta, source);
1514 }, source, true);
1515 }
1516 }]);
1517
1518 return Quill;
1519}();
1520
1521Quill.DEFAULTS = {
1522 bounds: null,
1523 formats: null,
1524 modules: {},
1525 placeholder: '',
1526 readOnly: false,
1527 scrollingContainer: null,
1528 strict: true,
1529 theme: 'default'
1530};
1531Quill.events = _emitter4.default.events;
1532Quill.sources = _emitter4.default.sources;
1533// eslint-disable-next-line no-undef
1534Quill.version = false ? 'dev' : "1.3.3";
1535
1536Quill.imports = {
1537 'delta': _quillDelta2.default,
1538 'parchment': _parchment2.default,
1539 'core/module': _module2.default,
1540 'core/theme': _theme2.default
1541};
1542
1543function expandConfig(container, userConfig) {
1544 userConfig = (0, _extend2.default)(true, {
1545 container: container,
1546 modules: {
1547 clipboard: true,
1548 keyboard: true,
1549 history: true
1550 }
1551 }, userConfig);
1552 if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
1553 userConfig.theme = _theme2.default;
1554 } else {
1555 userConfig.theme = Quill.import('themes/' + userConfig.theme);
1556 if (userConfig.theme == null) {
1557 throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
1558 }
1559 }
1560 var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
1561 [themeConfig, userConfig].forEach(function (config) {
1562 config.modules = config.modules || {};
1563 Object.keys(config.modules).forEach(function (module) {
1564 if (config.modules[module] === true) {
1565 config.modules[module] = {};
1566 }
1567 });
1568 });
1569 var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
1570 var moduleConfig = moduleNames.reduce(function (config, name) {
1571 var moduleClass = Quill.import('modules/' + name);
1572 if (moduleClass == null) {
1573 debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
1574 } else {
1575 config[name] = moduleClass.DEFAULTS || {};
1576 }
1577 return config;
1578 }, {});
1579 // Special case toolbar shorthand
1580 if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
1581 userConfig.modules.toolbar = {
1582 container: userConfig.modules.toolbar
1583 };
1584 }
1585 userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
1586 ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
1587 if (typeof userConfig[key] === 'string') {
1588 userConfig[key] = document.querySelector(userConfig[key]);
1589 }
1590 });
1591 userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
1592 if (userConfig.modules[name]) {
1593 config[name] = userConfig.modules[name];
1594 }
1595 return config;
1596 }, {});
1597 return userConfig;
1598}
1599
1600// Handle selection preservation and TEXT_CHANGE emission
1601// common to modification APIs
1602function modify(modifier, source, index, shift) {
1603 if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
1604 return new _quillDelta2.default();
1605 }
1606 var range = index == null ? null : this.getSelection();
1607 var oldDelta = this.editor.delta;
1608 var change = modifier();
1609 if (range != null) {
1610 if (index === true) index = range.index;
1611 if (shift == null) {
1612 range = shiftRange(range, change, source);
1613 } else if (shift !== 0) {
1614 range = shiftRange(range, index, shift, source);
1615 }
1616 this.setSelection(range, _emitter4.default.sources.SILENT);
1617 }
1618 if (change.length() > 0) {
1619 var _emitter;
1620
1621 var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
1622 (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
1623 if (source !== _emitter4.default.sources.SILENT) {
1624 var _emitter2;
1625
1626 (_emitter2 = this.emitter).emit.apply(_emitter2, args);
1627 }
1628 }
1629 return change;
1630}
1631
1632function overload(index, length, name, value, source) {
1633 var formats = {};
1634 if (typeof index.index === 'number' && typeof index.length === 'number') {
1635 // Allow for throwaway end (used by insertText/insertEmbed)
1636 if (typeof length !== 'number') {
1637 source = value, value = name, name = length, length = index.length, index = index.index;
1638 } else {
1639 length = index.length, index = index.index;
1640 }
1641 } else if (typeof length !== 'number') {
1642 source = value, value = name, name = length, length = 0;
1643 }
1644 // Handle format being object, two format name/value strings or excluded
1645 if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
1646 formats = name;
1647 source = value;
1648 } else if (typeof name === 'string') {
1649 if (value != null) {
1650 formats[name] = value;
1651 } else {
1652 source = name;
1653 }
1654 }
1655 // Handle optional source
1656 source = source || _emitter4.default.sources.API;
1657 return [index, length, formats, source];
1658}
1659
1660function shiftRange(range, index, length, source) {
1661 if (range == null) return null;
1662 var start = void 0,
1663 end = void 0;
1664 if (index instanceof _quillDelta2.default) {
1665 var _map = [range.index, range.index + range.length].map(function (pos) {
1666 return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
1667 });
1668
1669 var _map2 = _slicedToArray(_map, 2);
1670
1671 start = _map2[0];
1672 end = _map2[1];
1673 } else {
1674 var _map3 = [range.index, range.index + range.length].map(function (pos) {
1675 if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
1676 if (length >= 0) {
1677 return pos + length;
1678 } else {
1679 return Math.max(index, pos + length);
1680 }
1681 });
1682
1683 var _map4 = _slicedToArray(_map3, 2);
1684
1685 start = _map4[0];
1686 end = _map4[1];
1687 }
1688 return new _selection.Range(start, end - start);
1689}
1690
1691exports.expandConfig = expandConfig;
1692exports.overload = overload;
1693exports.default = Quill;
1694
1695/***/ }),
1696/* 6 */
1697/***/ (function(module, exports, __webpack_require__) {
1698
1699"use strict";
1700
1701
1702Object.defineProperty(exports, "__esModule", {
1703 value: true
1704});
1705
1706var _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; }; }();
1707
1708var _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); } };
1709
1710var _text = __webpack_require__(7);
1711
1712var _text2 = _interopRequireDefault(_text);
1713
1714var _parchment = __webpack_require__(0);
1715
1716var _parchment2 = _interopRequireDefault(_parchment);
1717
1718function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1719
1720function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1721
1722function _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; }
1723
1724function _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; }
1725
1726var Inline = function (_Parchment$Inline) {
1727 _inherits(Inline, _Parchment$Inline);
1728
1729 function Inline() {
1730 _classCallCheck(this, Inline);
1731
1732 return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
1733 }
1734
1735 _createClass(Inline, [{
1736 key: 'formatAt',
1737 value: function formatAt(index, length, name, value) {
1738 if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
1739 var blot = this.isolate(index, length);
1740 if (value) {
1741 blot.wrap(name, value);
1742 }
1743 } else {
1744 _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
1745 }
1746 }
1747 }, {
1748 key: 'optimize',
1749 value: function optimize(context) {
1750 _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);
1751 if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
1752 var parent = this.parent.isolate(this.offset(), this.length());
1753 this.moveChildren(parent);
1754 parent.wrap(this);
1755 }
1756 }
1757 }], [{
1758 key: 'compare',
1759 value: function compare(self, other) {
1760 var selfIndex = Inline.order.indexOf(self);
1761 var otherIndex = Inline.order.indexOf(other);
1762 if (selfIndex >= 0 || otherIndex >= 0) {
1763 return selfIndex - otherIndex;
1764 } else if (self === other) {
1765 return 0;
1766 } else if (self < other) {
1767 return -1;
1768 } else {
1769 return 1;
1770 }
1771 }
1772 }]);
1773
1774 return Inline;
1775}(_parchment2.default.Inline);
1776
1777Inline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];
1778// Lower index means deeper in the DOM tree, since not found (-1) is for embeds
1779Inline.order = ['cursor', 'inline', // Must be lower
1780'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher
1781];
1782
1783exports.default = Inline;
1784
1785/***/ }),
1786/* 7 */
1787/***/ (function(module, exports, __webpack_require__) {
1788
1789"use strict";
1790
1791
1792Object.defineProperty(exports, "__esModule", {
1793 value: true
1794});
1795
1796var _parchment = __webpack_require__(0);
1797
1798var _parchment2 = _interopRequireDefault(_parchment);
1799
1800function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1801
1802function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1803
1804function _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; }
1805
1806function _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; }
1807
1808var TextBlot = function (_Parchment$Text) {
1809 _inherits(TextBlot, _Parchment$Text);
1810
1811 function TextBlot() {
1812 _classCallCheck(this, TextBlot);
1813
1814 return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
1815 }
1816
1817 return TextBlot;
1818}(_parchment2.default.Text);
1819
1820exports.default = TextBlot;
1821
1822/***/ }),
1823/* 8 */
1824/***/ (function(module, exports, __webpack_require__) {
1825
1826"use strict";
1827
1828
1829Object.defineProperty(exports, "__esModule", {
1830 value: true
1831});
1832
1833var _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; }; }();
1834
1835var _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); } };
1836
1837var _eventemitter = __webpack_require__(54);
1838
1839var _eventemitter2 = _interopRequireDefault(_eventemitter);
1840
1841var _logger = __webpack_require__(10);
1842
1843var _logger2 = _interopRequireDefault(_logger);
1844
1845function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1846
1847function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1848
1849function _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; }
1850
1851function _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; }
1852
1853var debug = (0, _logger2.default)('quill:events');
1854
1855var EVENTS = ['selectionchange', 'mousedown', 'mouseup'];
1856
1857EVENTS.forEach(function (eventName) {
1858 document.addEventListener(eventName, function () {
1859 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1860 args[_key] = arguments[_key];
1861 }
1862
1863 [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {
1864 // TODO use WeakMap
1865 if (node.__quill && node.__quill.emitter) {
1866 var _node$__quill$emitter;
1867
1868 (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);
1869 }
1870 });
1871 });
1872});
1873
1874var Emitter = function (_EventEmitter) {
1875 _inherits(Emitter, _EventEmitter);
1876
1877 function Emitter() {
1878 _classCallCheck(this, Emitter);
1879
1880 var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
1881
1882 _this.listeners = {};
1883 _this.on('error', debug.error);
1884 return _this;
1885 }
1886
1887 _createClass(Emitter, [{
1888 key: 'emit',
1889 value: function emit() {
1890 debug.log.apply(debug, arguments);
1891 _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
1892 }
1893 }, {
1894 key: 'handleDOM',
1895 value: function handleDOM(event) {
1896 for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1897 args[_key2 - 1] = arguments[_key2];
1898 }
1899
1900 (this.listeners[event.type] || []).forEach(function (_ref) {
1901 var node = _ref.node,
1902 handler = _ref.handler;
1903
1904 if (event.target === node || node.contains(event.target)) {
1905 handler.apply(undefined, [event].concat(args));
1906 }
1907 });
1908 }
1909 }, {
1910 key: 'listenDOM',
1911 value: function listenDOM(eventName, node, handler) {
1912 if (!this.listeners[eventName]) {
1913 this.listeners[eventName] = [];
1914 }
1915 this.listeners[eventName].push({ node: node, handler: handler });
1916 }
1917 }]);
1918
1919 return Emitter;
1920}(_eventemitter2.default);
1921
1922Emitter.events = {
1923 EDITOR_CHANGE: 'editor-change',
1924 SCROLL_BEFORE_UPDATE: 'scroll-before-update',
1925 SCROLL_OPTIMIZE: 'scroll-optimize',
1926 SCROLL_UPDATE: 'scroll-update',
1927 SELECTION_CHANGE: 'selection-change',
1928 TEXT_CHANGE: 'text-change'
1929};
1930Emitter.sources = {
1931 API: 'api',
1932 SILENT: 'silent',
1933 USER: 'user'
1934};
1935
1936exports.default = Emitter;
1937
1938/***/ }),
1939/* 9 */
1940/***/ (function(module, exports, __webpack_require__) {
1941
1942"use strict";
1943
1944
1945Object.defineProperty(exports, "__esModule", {
1946 value: true
1947});
1948
1949function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1950
1951var Module = function Module(quill) {
1952 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1953
1954 _classCallCheck(this, Module);
1955
1956 this.quill = quill;
1957 this.options = options;
1958};
1959
1960Module.DEFAULTS = {};
1961
1962exports.default = Module;
1963
1964/***/ }),
1965/* 10 */
1966/***/ (function(module, exports, __webpack_require__) {
1967
1968"use strict";
1969
1970
1971Object.defineProperty(exports, "__esModule", {
1972 value: true
1973});
1974var levels = ['error', 'warn', 'log', 'info'];
1975var level = 'warn';
1976
1977function debug(method) {
1978 if (levels.indexOf(method) <= levels.indexOf(level)) {
1979 var _console;
1980
1981 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1982 args[_key - 1] = arguments[_key];
1983 }
1984
1985 (_console = console)[method].apply(_console, args); // eslint-disable-line no-console
1986 }
1987}
1988
1989function namespace(ns) {
1990 return levels.reduce(function (logger, method) {
1991 logger[method] = debug.bind(console, method, ns);
1992 return logger;
1993 }, {});
1994}
1995
1996debug.level = namespace.level = function (newLevel) {
1997 level = newLevel;
1998};
1999
2000exports.default = namespace;
2001
2002/***/ }),
2003/* 11 */
2004/***/ (function(module, exports, __webpack_require__) {
2005
2006var pSlice = Array.prototype.slice;
2007var objectKeys = __webpack_require__(52);
2008var isArguments = __webpack_require__(53);
2009
2010var deepEqual = module.exports = function (actual, expected, opts) {
2011 if (!opts) opts = {};
2012 // 7.1. All identical values are equivalent, as determined by ===.
2013 if (actual === expected) {
2014 return true;
2015
2016 } else if (actual instanceof Date && expected instanceof Date) {
2017 return actual.getTime() === expected.getTime();
2018
2019 // 7.3. Other pairs that do not both pass typeof value == 'object',
2020 // equivalence is determined by ==.
2021 } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
2022 return opts.strict ? actual === expected : actual == expected;
2023
2024 // 7.4. For all other Object pairs, including Array objects, equivalence is
2025 // determined by having the same number of owned properties (as verified
2026 // with Object.prototype.hasOwnProperty.call), the same set of keys
2027 // (although not necessarily the same order), equivalent values for every
2028 // corresponding key, and an identical 'prototype' property. Note: this
2029 // accounts for both named and indexed properties on Arrays.
2030 } else {
2031 return objEquiv(actual, expected, opts);
2032 }
2033}
2034
2035function isUndefinedOrNull(value) {
2036 return value === null || value === undefined;
2037}
2038
2039function isBuffer (x) {
2040 if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
2041 if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
2042 return false;
2043 }
2044 if (x.length > 0 && typeof x[0] !== 'number') return false;
2045 return true;
2046}
2047
2048function objEquiv(a, b, opts) {
2049 var i, key;
2050 if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
2051 return false;
2052 // an identical 'prototype' property.
2053 if (a.prototype !== b.prototype) return false;
2054 //~~~I've managed to break Object.keys through screwy arguments passing.
2055 // Converting to array solves the problem.
2056 if (isArguments(a)) {
2057 if (!isArguments(b)) {
2058 return false;
2059 }
2060 a = pSlice.call(a);
2061 b = pSlice.call(b);
2062 return deepEqual(a, b, opts);
2063 }
2064 if (isBuffer(a)) {
2065 if (!isBuffer(b)) {
2066 return false;
2067 }
2068 if (a.length !== b.length) return false;
2069 for (i = 0; i < a.length; i++) {
2070 if (a[i] !== b[i]) return false;
2071 }
2072 return true;
2073 }
2074 try {
2075 var ka = objectKeys(a),
2076 kb = objectKeys(b);
2077 } catch (e) {//happens when one is a string literal and the other isn't
2078 return false;
2079 }
2080 // having the same number of owned properties (keys incorporates
2081 // hasOwnProperty)
2082 if (ka.length != kb.length)
2083 return false;
2084 //the same set of keys (although not necessarily the same order),
2085 ka.sort();
2086 kb.sort();
2087 //~~~cheap key test
2088 for (i = ka.length - 1; i >= 0; i--) {
2089 if (ka[i] != kb[i])
2090 return false;
2091 }
2092 //equivalent values for every corresponding key, and
2093 //~~~possibly expensive deep test
2094 for (i = ka.length - 1; i >= 0; i--) {
2095 key = ka[i];
2096 if (!deepEqual(a[key], b[key], opts)) return false;
2097 }
2098 return typeof a === typeof b;
2099}
2100
2101
2102/***/ }),
2103/* 12 */
2104/***/ (function(module, exports, __webpack_require__) {
2105
2106"use strict";
2107
2108Object.defineProperty(exports, "__esModule", { value: true });
2109var Registry = __webpack_require__(1);
2110var Attributor = /** @class */ (function () {
2111 function Attributor(attrName, keyName, options) {
2112 if (options === void 0) { options = {}; }
2113 this.attrName = attrName;
2114 this.keyName = keyName;
2115 var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
2116 if (options.scope != null) {
2117 // Ignore type bits, force attribute bit
2118 this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
2119 }
2120 else {
2121 this.scope = Registry.Scope.ATTRIBUTE;
2122 }
2123 if (options.whitelist != null)
2124 this.whitelist = options.whitelist;
2125 }
2126 Attributor.keys = function (node) {
2127 return [].map.call(node.attributes, function (item) {
2128 return item.name;
2129 });
2130 };
2131 Attributor.prototype.add = function (node, value) {
2132 if (!this.canAdd(node, value))
2133 return false;
2134 node.setAttribute(this.keyName, value);
2135 return true;
2136 };
2137 Attributor.prototype.canAdd = function (node, value) {
2138 var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
2139 if (match != null && (this.whitelist == null || this.whitelist.indexOf(value) > -1)) {
2140 return true;
2141 }
2142 return false;
2143 };
2144 Attributor.prototype.remove = function (node) {
2145 node.removeAttribute(this.keyName);
2146 };
2147 Attributor.prototype.value = function (node) {
2148 var value = node.getAttribute(this.keyName);
2149 return this.canAdd(node, value) ? value : '';
2150 };
2151 return Attributor;
2152}());
2153exports.default = Attributor;
2154
2155
2156/***/ }),
2157/* 13 */
2158/***/ (function(module, exports, __webpack_require__) {
2159
2160"use strict";
2161
2162
2163Object.defineProperty(exports, "__esModule", {
2164 value: true
2165});
2166exports.default = exports.Code = undefined;
2167
2168var _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"); } }; }();
2169
2170var _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; }; }();
2171
2172var _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); } };
2173
2174var _quillDelta = __webpack_require__(2);
2175
2176var _quillDelta2 = _interopRequireDefault(_quillDelta);
2177
2178var _parchment = __webpack_require__(0);
2179
2180var _parchment2 = _interopRequireDefault(_parchment);
2181
2182var _block = __webpack_require__(4);
2183
2184var _block2 = _interopRequireDefault(_block);
2185
2186var _inline = __webpack_require__(6);
2187
2188var _inline2 = _interopRequireDefault(_inline);
2189
2190var _text = __webpack_require__(7);
2191
2192var _text2 = _interopRequireDefault(_text);
2193
2194function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2195
2196function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2197
2198function _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; }
2199
2200function _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; }
2201
2202var Code = function (_Inline) {
2203 _inherits(Code, _Inline);
2204
2205 function Code() {
2206 _classCallCheck(this, Code);
2207
2208 return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
2209 }
2210
2211 return Code;
2212}(_inline2.default);
2213
2214Code.blotName = 'code';
2215Code.tagName = 'CODE';
2216
2217var CodeBlock = function (_Block) {
2218 _inherits(CodeBlock, _Block);
2219
2220 function CodeBlock() {
2221 _classCallCheck(this, CodeBlock);
2222
2223 return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
2224 }
2225
2226 _createClass(CodeBlock, [{
2227 key: 'delta',
2228 value: function delta() {
2229 var _this3 = this;
2230
2231 var text = this.domNode.textContent;
2232 if (text.endsWith('\n')) {
2233 // Should always be true
2234 text = text.slice(0, -1);
2235 }
2236 return text.split('\n').reduce(function (delta, frag) {
2237 return delta.insert(frag).insert('\n', _this3.formats());
2238 }, new _quillDelta2.default());
2239 }
2240 }, {
2241 key: 'format',
2242 value: function format(name, value) {
2243 if (name === this.statics.blotName && value) return;
2244
2245 var _descendant = this.descendant(_text2.default, this.length() - 1),
2246 _descendant2 = _slicedToArray(_descendant, 1),
2247 text = _descendant2[0];
2248
2249 if (text != null) {
2250 text.deleteAt(text.length() - 1, 1);
2251 }
2252 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
2253 }
2254 }, {
2255 key: 'formatAt',
2256 value: function formatAt(index, length, name, value) {
2257 if (length === 0) return;
2258 if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
2259 return;
2260 }
2261 var nextNewline = this.newlineIndex(index);
2262 if (nextNewline < 0 || nextNewline >= index + length) return;
2263 var prevNewline = this.newlineIndex(index, true) + 1;
2264 var isolateLength = nextNewline - prevNewline + 1;
2265 var blot = this.isolate(prevNewline, isolateLength);
2266 var next = blot.next;
2267 blot.format(name, value);
2268 if (next instanceof CodeBlock) {
2269 next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
2270 }
2271 }
2272 }, {
2273 key: 'insertAt',
2274 value: function insertAt(index, value, def) {
2275 if (def != null) return;
2276
2277 var _descendant3 = this.descendant(_text2.default, index),
2278 _descendant4 = _slicedToArray(_descendant3, 2),
2279 text = _descendant4[0],
2280 offset = _descendant4[1];
2281
2282 text.insertAt(offset, value);
2283 }
2284 }, {
2285 key: 'length',
2286 value: function length() {
2287 var length = this.domNode.textContent.length;
2288 if (!this.domNode.textContent.endsWith('\n')) {
2289 return length + 1;
2290 }
2291 return length;
2292 }
2293 }, {
2294 key: 'newlineIndex',
2295 value: function newlineIndex(searchIndex) {
2296 var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2297
2298 if (!reverse) {
2299 var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
2300 return offset > -1 ? searchIndex + offset : -1;
2301 } else {
2302 return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
2303 }
2304 }
2305 }, {
2306 key: 'optimize',
2307 value: function optimize(context) {
2308 if (!this.domNode.textContent.endsWith('\n')) {
2309 this.appendChild(_parchment2.default.create('text', '\n'));
2310 }
2311 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);
2312 var next = this.next;
2313 if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
2314 next.optimize(context);
2315 next.moveChildren(this);
2316 next.remove();
2317 }
2318 }
2319 }, {
2320 key: 'replace',
2321 value: function replace(target) {
2322 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
2323 [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
2324 var blot = _parchment2.default.find(node);
2325 if (blot == null) {
2326 node.parentNode.removeChild(node);
2327 } else if (blot instanceof _parchment2.default.Embed) {
2328 blot.remove();
2329 } else {
2330 blot.unwrap();
2331 }
2332 });
2333 }
2334 }], [{
2335 key: 'create',
2336 value: function create(value) {
2337 var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
2338 domNode.setAttribute('spellcheck', false);
2339 return domNode;
2340 }
2341 }, {
2342 key: 'formats',
2343 value: function formats() {
2344 return true;
2345 }
2346 }]);
2347
2348 return CodeBlock;
2349}(_block2.default);
2350
2351CodeBlock.blotName = 'code-block';
2352CodeBlock.tagName = 'PRE';
2353CodeBlock.TAB = ' ';
2354
2355exports.Code = Code;
2356exports.default = CodeBlock;
2357
2358/***/ }),
2359/* 14 */
2360/***/ (function(module, exports, __webpack_require__) {
2361
2362"use strict";
2363
2364
2365Object.defineProperty(exports, "__esModule", {
2366 value: true
2367});
2368
2369var _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; };
2370
2371var _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"); } }; }();
2372
2373var _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; }; }();
2374
2375var _quillDelta = __webpack_require__(2);
2376
2377var _quillDelta2 = _interopRequireDefault(_quillDelta);
2378
2379var _op = __webpack_require__(20);
2380
2381var _op2 = _interopRequireDefault(_op);
2382
2383var _parchment = __webpack_require__(0);
2384
2385var _parchment2 = _interopRequireDefault(_parchment);
2386
2387var _code = __webpack_require__(13);
2388
2389var _code2 = _interopRequireDefault(_code);
2390
2391var _cursor = __webpack_require__(23);
2392
2393var _cursor2 = _interopRequireDefault(_cursor);
2394
2395var _block = __webpack_require__(4);
2396
2397var _block2 = _interopRequireDefault(_block);
2398
2399var _break = __webpack_require__(16);
2400
2401var _break2 = _interopRequireDefault(_break);
2402
2403var _clone = __webpack_require__(21);
2404
2405var _clone2 = _interopRequireDefault(_clone);
2406
2407var _deepEqual = __webpack_require__(11);
2408
2409var _deepEqual2 = _interopRequireDefault(_deepEqual);
2410
2411var _extend = __webpack_require__(3);
2412
2413var _extend2 = _interopRequireDefault(_extend);
2414
2415function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2416
2417function _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; }
2418
2419function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2420
2421var ASCII = /^[ -~]*$/;
2422
2423var Editor = function () {
2424 function Editor(scroll) {
2425 _classCallCheck(this, Editor);
2426
2427 this.scroll = scroll;
2428 this.delta = this.getDelta();
2429 }
2430
2431 _createClass(Editor, [{
2432 key: 'applyDelta',
2433 value: function applyDelta(delta) {
2434 var _this = this;
2435
2436 var consumeNextNewline = false;
2437 this.scroll.update();
2438 var scrollLength = this.scroll.length();
2439 this.scroll.batchStart();
2440 delta = normalizeDelta(delta);
2441 delta.reduce(function (index, op) {
2442 var length = op.retain || op.delete || op.insert.length || 1;
2443 var attributes = op.attributes || {};
2444 if (op.insert != null) {
2445 if (typeof op.insert === 'string') {
2446 var text = op.insert;
2447 if (text.endsWith('\n') && consumeNextNewline) {
2448 consumeNextNewline = false;
2449 text = text.slice(0, -1);
2450 }
2451 if (index >= scrollLength && !text.endsWith('\n')) {
2452 consumeNextNewline = true;
2453 }
2454 _this.scroll.insertAt(index, text);
2455
2456 var _scroll$line = _this.scroll.line(index),
2457 _scroll$line2 = _slicedToArray(_scroll$line, 2),
2458 line = _scroll$line2[0],
2459 offset = _scroll$line2[1];
2460
2461 var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
2462 if (line instanceof _block2.default) {
2463 var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
2464 _line$descendant2 = _slicedToArray(_line$descendant, 1),
2465 leaf = _line$descendant2[0];
2466
2467 formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
2468 }
2469 attributes = _op2.default.attributes.diff(formats, attributes) || {};
2470 } else if (_typeof(op.insert) === 'object') {
2471 var key = Object.keys(op.insert)[0]; // There should only be one key
2472 if (key == null) return index;
2473 _this.scroll.insertAt(index, key, op.insert[key]);
2474 }
2475 scrollLength += length;
2476 }
2477 Object.keys(attributes).forEach(function (name) {
2478 _this.scroll.formatAt(index, length, name, attributes[name]);
2479 });
2480 return index + length;
2481 }, 0);
2482 delta.reduce(function (index, op) {
2483 if (typeof op.delete === 'number') {
2484 _this.scroll.deleteAt(index, op.delete);
2485 return index;
2486 }
2487 return index + (op.retain || op.insert.length || 1);
2488 }, 0);
2489 this.scroll.batchEnd();
2490 return this.update(delta);
2491 }
2492 }, {
2493 key: 'deleteText',
2494 value: function deleteText(index, length) {
2495 this.scroll.deleteAt(index, length);
2496 return this.update(new _quillDelta2.default().retain(index).delete(length));
2497 }
2498 }, {
2499 key: 'formatLine',
2500 value: function formatLine(index, length) {
2501 var _this2 = this;
2502
2503 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2504
2505 this.scroll.update();
2506 Object.keys(formats).forEach(function (format) {
2507 if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
2508 var lines = _this2.scroll.lines(index, Math.max(length, 1));
2509 var lengthRemaining = length;
2510 lines.forEach(function (line) {
2511 var lineLength = line.length();
2512 if (!(line instanceof _code2.default)) {
2513 line.format(format, formats[format]);
2514 } else {
2515 var codeIndex = index - line.offset(_this2.scroll);
2516 var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
2517 line.formatAt(codeIndex, codeLength, format, formats[format]);
2518 }
2519 lengthRemaining -= lineLength;
2520 });
2521 });
2522 this.scroll.optimize();
2523 return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
2524 }
2525 }, {
2526 key: 'formatText',
2527 value: function formatText(index, length) {
2528 var _this3 = this;
2529
2530 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2531
2532 Object.keys(formats).forEach(function (format) {
2533 _this3.scroll.formatAt(index, length, format, formats[format]);
2534 });
2535 return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
2536 }
2537 }, {
2538 key: 'getContents',
2539 value: function getContents(index, length) {
2540 return this.delta.slice(index, index + length);
2541 }
2542 }, {
2543 key: 'getDelta',
2544 value: function getDelta() {
2545 return this.scroll.lines().reduce(function (delta, line) {
2546 return delta.concat(line.delta());
2547 }, new _quillDelta2.default());
2548 }
2549 }, {
2550 key: 'getFormat',
2551 value: function getFormat(index) {
2552 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2553
2554 var lines = [],
2555 leaves = [];
2556 if (length === 0) {
2557 this.scroll.path(index).forEach(function (path) {
2558 var _path = _slicedToArray(path, 1),
2559 blot = _path[0];
2560
2561 if (blot instanceof _block2.default) {
2562 lines.push(blot);
2563 } else if (blot instanceof _parchment2.default.Leaf) {
2564 leaves.push(blot);
2565 }
2566 });
2567 } else {
2568 lines = this.scroll.lines(index, length);
2569 leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
2570 }
2571 var formatsArr = [lines, leaves].map(function (blots) {
2572 if (blots.length === 0) return {};
2573 var formats = (0, _block.bubbleFormats)(blots.shift());
2574 while (Object.keys(formats).length > 0) {
2575 var blot = blots.shift();
2576 if (blot == null) return formats;
2577 formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
2578 }
2579 return formats;
2580 });
2581 return _extend2.default.apply(_extend2.default, formatsArr);
2582 }
2583 }, {
2584 key: 'getText',
2585 value: function getText(index, length) {
2586 return this.getContents(index, length).filter(function (op) {
2587 return typeof op.insert === 'string';
2588 }).map(function (op) {
2589 return op.insert;
2590 }).join('');
2591 }
2592 }, {
2593 key: 'insertEmbed',
2594 value: function insertEmbed(index, embed, value) {
2595 this.scroll.insertAt(index, embed, value);
2596 return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
2597 }
2598 }, {
2599 key: 'insertText',
2600 value: function insertText(index, text) {
2601 var _this4 = this;
2602
2603 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2604
2605 text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2606 this.scroll.insertAt(index, text);
2607 Object.keys(formats).forEach(function (format) {
2608 _this4.scroll.formatAt(index, text.length, format, formats[format]);
2609 });
2610 return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
2611 }
2612 }, {
2613 key: 'isBlank',
2614 value: function isBlank() {
2615 if (this.scroll.children.length == 0) return true;
2616 if (this.scroll.children.length > 1) return false;
2617 var block = this.scroll.children.head;
2618 if (block.statics.blotName !== _block2.default.blotName) return false;
2619 if (block.children.length > 1) return false;
2620 return block.children.head instanceof _break2.default;
2621 }
2622 }, {
2623 key: 'removeFormat',
2624 value: function removeFormat(index, length) {
2625 var text = this.getText(index, length);
2626
2627 var _scroll$line3 = this.scroll.line(index + length),
2628 _scroll$line4 = _slicedToArray(_scroll$line3, 2),
2629 line = _scroll$line4[0],
2630 offset = _scroll$line4[1];
2631
2632 var suffixLength = 0,
2633 suffix = new _quillDelta2.default();
2634 if (line != null) {
2635 if (!(line instanceof _code2.default)) {
2636 suffixLength = line.length() - offset;
2637 } else {
2638 suffixLength = line.newlineIndex(offset) - offset + 1;
2639 }
2640 suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
2641 }
2642 var contents = this.getContents(index, length + suffixLength);
2643 var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
2644 var delta = new _quillDelta2.default().retain(index).concat(diff);
2645 return this.applyDelta(delta);
2646 }
2647 }, {
2648 key: 'update',
2649 value: function update(change) {
2650 var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
2651 var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
2652
2653 var oldDelta = this.delta;
2654 if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
2655 // Optimization for character changes
2656 var textBlot = _parchment2.default.find(mutations[0].target);
2657 var formats = (0, _block.bubbleFormats)(textBlot);
2658 var index = textBlot.offset(this.scroll);
2659 var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
2660 var oldText = new _quillDelta2.default().insert(oldValue);
2661 var newText = new _quillDelta2.default().insert(textBlot.value());
2662 var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
2663 change = diffDelta.reduce(function (delta, op) {
2664 if (op.insert) {
2665 return delta.insert(op.insert, formats);
2666 } else {
2667 return delta.push(op);
2668 }
2669 }, new _quillDelta2.default());
2670 this.delta = oldDelta.compose(change);
2671 } else {
2672 this.delta = this.getDelta();
2673 if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
2674 change = oldDelta.diff(this.delta, cursorIndex);
2675 }
2676 }
2677 return change;
2678 }
2679 }]);
2680
2681 return Editor;
2682}();
2683
2684function combineFormats(formats, combined) {
2685 return Object.keys(combined).reduce(function (merged, name) {
2686 if (formats[name] == null) return merged;
2687 if (combined[name] === formats[name]) {
2688 merged[name] = combined[name];
2689 } else if (Array.isArray(combined[name])) {
2690 if (combined[name].indexOf(formats[name]) < 0) {
2691 merged[name] = combined[name].concat([formats[name]]);
2692 }
2693 } else {
2694 merged[name] = [combined[name], formats[name]];
2695 }
2696 return merged;
2697 }, {});
2698}
2699
2700function normalizeDelta(delta) {
2701 return delta.reduce(function (delta, op) {
2702 if (op.insert === 1) {
2703 var attributes = (0, _clone2.default)(op.attributes);
2704 delete attributes['image'];
2705 return delta.insert({ image: op.attributes.image }, attributes);
2706 }
2707 if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
2708 op = (0, _clone2.default)(op);
2709 if (op.attributes.list) {
2710 op.attributes.list = 'ordered';
2711 } else {
2712 op.attributes.list = 'bullet';
2713 delete op.attributes.bullet;
2714 }
2715 }
2716 if (typeof op.insert === 'string') {
2717 var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2718 return delta.insert(text, op.attributes);
2719 }
2720 return delta.push(op);
2721 }, new _quillDelta2.default());
2722}
2723
2724exports.default = Editor;
2725
2726/***/ }),
2727/* 15 */
2728/***/ (function(module, exports, __webpack_require__) {
2729
2730"use strict";
2731
2732
2733Object.defineProperty(exports, "__esModule", {
2734 value: true
2735});
2736exports.default = exports.Range = undefined;
2737
2738var _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"); } }; }();
2739
2740var _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; }; }();
2741
2742var _parchment = __webpack_require__(0);
2743
2744var _parchment2 = _interopRequireDefault(_parchment);
2745
2746var _clone = __webpack_require__(21);
2747
2748var _clone2 = _interopRequireDefault(_clone);
2749
2750var _deepEqual = __webpack_require__(11);
2751
2752var _deepEqual2 = _interopRequireDefault(_deepEqual);
2753
2754var _emitter3 = __webpack_require__(8);
2755
2756var _emitter4 = _interopRequireDefault(_emitter3);
2757
2758var _logger = __webpack_require__(10);
2759
2760var _logger2 = _interopRequireDefault(_logger);
2761
2762function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2763
2764function _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); } }
2765
2766function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2767
2768var debug = (0, _logger2.default)('quill:selection');
2769
2770var Range = function Range(index) {
2771 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2772
2773 _classCallCheck(this, Range);
2774
2775 this.index = index;
2776 this.length = length;
2777};
2778
2779var Selection = function () {
2780 function Selection(scroll, emitter) {
2781 var _this = this;
2782
2783 _classCallCheck(this, Selection);
2784
2785 this.emitter = emitter;
2786 this.scroll = scroll;
2787 this.composing = false;
2788 this.mouseDown = false;
2789 this.root = this.scroll.domNode;
2790 this.cursor = _parchment2.default.create('cursor', this);
2791 // savedRange is last non-null range
2792 this.lastRange = this.savedRange = new Range(0, 0);
2793 this.handleComposition();
2794 this.handleDragging();
2795 this.emitter.listenDOM('selectionchange', document, function () {
2796 if (!_this.mouseDown) {
2797 setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
2798 }
2799 });
2800 this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
2801 if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
2802 _this.update(_emitter4.default.sources.SILENT);
2803 }
2804 });
2805 this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
2806 if (!_this.hasFocus()) return;
2807 var native = _this.getNativeRange();
2808 if (native == null) return;
2809 if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
2810 // TODO unclear if this has negative side effects
2811 _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
2812 try {
2813 _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
2814 } catch (ignored) {}
2815 });
2816 });
2817 this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {
2818 if (context.range) {
2819 var _context$range = context.range,
2820 startNode = _context$range.startNode,
2821 startOffset = _context$range.startOffset,
2822 endNode = _context$range.endNode,
2823 endOffset = _context$range.endOffset;
2824
2825 _this.setNativeRange(startNode, startOffset, endNode, endOffset);
2826 }
2827 });
2828 this.update(_emitter4.default.sources.SILENT);
2829 }
2830
2831 _createClass(Selection, [{
2832 key: 'handleComposition',
2833 value: function handleComposition() {
2834 var _this2 = this;
2835
2836 this.root.addEventListener('compositionstart', function () {
2837 _this2.composing = true;
2838 });
2839 this.root.addEventListener('compositionend', function () {
2840 _this2.composing = false;
2841 if (_this2.cursor.parent) {
2842 var range = _this2.cursor.restore();
2843 if (!range) return;
2844 setTimeout(function () {
2845 _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);
2846 }, 1);
2847 }
2848 });
2849 }
2850 }, {
2851 key: 'handleDragging',
2852 value: function handleDragging() {
2853 var _this3 = this;
2854
2855 this.emitter.listenDOM('mousedown', document.body, function () {
2856 _this3.mouseDown = true;
2857 });
2858 this.emitter.listenDOM('mouseup', document.body, function () {
2859 _this3.mouseDown = false;
2860 _this3.update(_emitter4.default.sources.USER);
2861 });
2862 }
2863 }, {
2864 key: 'focus',
2865 value: function focus() {
2866 if (this.hasFocus()) return;
2867 this.root.focus();
2868 this.setRange(this.savedRange);
2869 }
2870 }, {
2871 key: 'format',
2872 value: function format(_format, value) {
2873 if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
2874 this.scroll.update();
2875 var nativeRange = this.getNativeRange();
2876 if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
2877 if (nativeRange.start.node !== this.cursor.textNode) {
2878 var blot = _parchment2.default.find(nativeRange.start.node, false);
2879 if (blot == null) return;
2880 // TODO Give blot ability to not split
2881 if (blot instanceof _parchment2.default.Leaf) {
2882 var after = blot.split(nativeRange.start.offset);
2883 blot.parent.insertBefore(this.cursor, after);
2884 } else {
2885 blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
2886 }
2887 this.cursor.attach();
2888 }
2889 this.cursor.format(_format, value);
2890 this.scroll.optimize();
2891 this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
2892 this.update();
2893 }
2894 }, {
2895 key: 'getBounds',
2896 value: function getBounds(index) {
2897 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2898
2899 var scrollLength = this.scroll.length();
2900 index = Math.min(index, scrollLength - 1);
2901 length = Math.min(index + length, scrollLength - 1) - index;
2902 var node = void 0,
2903 _scroll$leaf = this.scroll.leaf(index),
2904 _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
2905 leaf = _scroll$leaf2[0],
2906 offset = _scroll$leaf2[1];
2907 if (leaf == null) return null;
2908
2909 var _leaf$position = leaf.position(offset, true);
2910
2911 var _leaf$position2 = _slicedToArray(_leaf$position, 2);
2912
2913 node = _leaf$position2[0];
2914 offset = _leaf$position2[1];
2915
2916 var range = document.createRange();
2917 if (length > 0) {
2918 range.setStart(node, offset);
2919
2920 var _scroll$leaf3 = this.scroll.leaf(index + length);
2921
2922 var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
2923
2924 leaf = _scroll$leaf4[0];
2925 offset = _scroll$leaf4[1];
2926
2927 if (leaf == null) return null;
2928
2929 var _leaf$position3 = leaf.position(offset, true);
2930
2931 var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
2932
2933 node = _leaf$position4[0];
2934 offset = _leaf$position4[1];
2935
2936 range.setEnd(node, offset);
2937 return range.getBoundingClientRect();
2938 } else {
2939 var side = 'left';
2940 var rect = void 0;
2941 if (node instanceof Text) {
2942 if (offset < node.data.length) {
2943 range.setStart(node, offset);
2944 range.setEnd(node, offset + 1);
2945 } else {
2946 range.setStart(node, offset - 1);
2947 range.setEnd(node, offset);
2948 side = 'right';
2949 }
2950 rect = range.getBoundingClientRect();
2951 } else {
2952 rect = leaf.domNode.getBoundingClientRect();
2953 if (offset > 0) side = 'right';
2954 }
2955 return {
2956 bottom: rect.top + rect.height,
2957 height: rect.height,
2958 left: rect[side],
2959 right: rect[side],
2960 top: rect.top,
2961 width: 0
2962 };
2963 }
2964 }
2965 }, {
2966 key: 'getNativeRange',
2967 value: function getNativeRange() {
2968 var selection = document.getSelection();
2969 if (selection == null || selection.rangeCount <= 0) return null;
2970 var nativeRange = selection.getRangeAt(0);
2971 if (nativeRange == null) return null;
2972 var range = this.normalizeNative(nativeRange);
2973 debug.info('getNativeRange', range);
2974 return range;
2975 }
2976 }, {
2977 key: 'getRange',
2978 value: function getRange() {
2979 var normalized = this.getNativeRange();
2980 if (normalized == null) return [null, null];
2981 var range = this.normalizedToRange(normalized);
2982 return [range, normalized];
2983 }
2984 }, {
2985 key: 'hasFocus',
2986 value: function hasFocus() {
2987 return document.activeElement === this.root;
2988 }
2989 }, {
2990 key: 'normalizedToRange',
2991 value: function normalizedToRange(range) {
2992 var _this4 = this;
2993
2994 var positions = [[range.start.node, range.start.offset]];
2995 if (!range.native.collapsed) {
2996 positions.push([range.end.node, range.end.offset]);
2997 }
2998 var indexes = positions.map(function (position) {
2999 var _position = _slicedToArray(position, 2),
3000 node = _position[0],
3001 offset = _position[1];
3002
3003 var blot = _parchment2.default.find(node, true);
3004 var index = blot.offset(_this4.scroll);
3005 if (offset === 0) {
3006 return index;
3007 } else if (blot instanceof _parchment2.default.Container) {
3008 return index + blot.length();
3009 } else {
3010 return index + blot.index(node, offset);
3011 }
3012 });
3013 var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
3014 var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
3015 return new Range(start, end - start);
3016 }
3017 }, {
3018 key: 'normalizeNative',
3019 value: function normalizeNative(nativeRange) {
3020 if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
3021 return null;
3022 }
3023 var range = {
3024 start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
3025 end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
3026 native: nativeRange
3027 };
3028 [range.start, range.end].forEach(function (position) {
3029 var node = position.node,
3030 offset = position.offset;
3031 while (!(node instanceof Text) && node.childNodes.length > 0) {
3032 if (node.childNodes.length > offset) {
3033 node = node.childNodes[offset];
3034 offset = 0;
3035 } else if (node.childNodes.length === offset) {
3036 node = node.lastChild;
3037 offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
3038 } else {
3039 break;
3040 }
3041 }
3042 position.node = node, position.offset = offset;
3043 });
3044 return range;
3045 }
3046 }, {
3047 key: 'rangeToNative',
3048 value: function rangeToNative(range) {
3049 var _this5 = this;
3050
3051 var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
3052 var args = [];
3053 var scrollLength = this.scroll.length();
3054 indexes.forEach(function (index, i) {
3055 index = Math.min(scrollLength - 1, index);
3056 var node = void 0,
3057 _scroll$leaf5 = _this5.scroll.leaf(index),
3058 _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
3059 leaf = _scroll$leaf6[0],
3060 offset = _scroll$leaf6[1];
3061 var _leaf$position5 = leaf.position(offset, i !== 0);
3062
3063 var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
3064
3065 node = _leaf$position6[0];
3066 offset = _leaf$position6[1];
3067
3068 args.push(node, offset);
3069 });
3070 if (args.length < 2) {
3071 args = args.concat(args);
3072 }
3073 return args;
3074 }
3075 }, {
3076 key: 'scrollIntoView',
3077 value: function scrollIntoView(scrollingContainer) {
3078 var range = this.lastRange;
3079 if (range == null) return;
3080 var bounds = this.getBounds(range.index, range.length);
3081 if (bounds == null) return;
3082 var limit = this.scroll.length() - 1;
3083
3084 var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
3085 _scroll$line2 = _slicedToArray(_scroll$line, 1),
3086 first = _scroll$line2[0];
3087
3088 var last = first;
3089 if (range.length > 0) {
3090 var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
3091
3092 var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
3093
3094 last = _scroll$line4[0];
3095 }
3096 if (first == null || last == null) return;
3097 var scrollBounds = scrollingContainer.getBoundingClientRect();
3098 if (bounds.top < scrollBounds.top) {
3099 scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;
3100 } else if (bounds.bottom > scrollBounds.bottom) {
3101 scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;
3102 }
3103 }
3104 }, {
3105 key: 'setNativeRange',
3106 value: function setNativeRange(startNode, startOffset) {
3107 var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
3108 var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
3109 var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
3110
3111 debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
3112 if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
3113 return;
3114 }
3115 var selection = document.getSelection();
3116 if (selection == null) return;
3117 if (startNode != null) {
3118 if (!this.hasFocus()) this.root.focus();
3119 var native = (this.getNativeRange() || {}).native;
3120 if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
3121
3122 if (startNode.tagName == "BR") {
3123 startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
3124 startNode = startNode.parentNode;
3125 }
3126 if (endNode.tagName == "BR") {
3127 endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
3128 endNode = endNode.parentNode;
3129 }
3130 var range = document.createRange();
3131 range.setStart(startNode, startOffset);
3132 range.setEnd(endNode, endOffset);
3133 selection.removeAllRanges();
3134 selection.addRange(range);
3135 }
3136 } else {
3137 selection.removeAllRanges();
3138 this.root.blur();
3139 document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
3140 }
3141 }
3142 }, {
3143 key: 'setRange',
3144 value: function setRange(range) {
3145 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3146 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
3147
3148 if (typeof force === 'string') {
3149 source = force;
3150 force = false;
3151 }
3152 debug.info('setRange', range);
3153 if (range != null) {
3154 var args = this.rangeToNative(range);
3155 this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
3156 } else {
3157 this.setNativeRange(null);
3158 }
3159 this.update(source);
3160 }
3161 }, {
3162 key: 'update',
3163 value: function update() {
3164 var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
3165
3166 var oldRange = this.lastRange;
3167
3168 var _getRange = this.getRange(),
3169 _getRange2 = _slicedToArray(_getRange, 2),
3170 lastRange = _getRange2[0],
3171 nativeRange = _getRange2[1];
3172
3173 this.lastRange = lastRange;
3174 if (this.lastRange != null) {
3175 this.savedRange = this.lastRange;
3176 }
3177 if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
3178 var _emitter;
3179
3180 if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
3181 this.cursor.restore();
3182 }
3183 var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
3184 (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
3185 if (source !== _emitter4.default.sources.SILENT) {
3186 var _emitter2;
3187
3188 (_emitter2 = this.emitter).emit.apply(_emitter2, args);
3189 }
3190 }
3191 }
3192 }]);
3193
3194 return Selection;
3195}();
3196
3197function contains(parent, descendant) {
3198 try {
3199 // Firefox inserts inaccessible nodes around video elements
3200 descendant.parentNode;
3201 } catch (e) {
3202 return false;
3203 }
3204 // IE11 has bug with Text nodes
3205 // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
3206 if (descendant instanceof Text) {
3207 descendant = descendant.parentNode;
3208 }
3209 return parent.contains(descendant);
3210}
3211
3212exports.Range = Range;
3213exports.default = Selection;
3214
3215/***/ }),
3216/* 16 */
3217/***/ (function(module, exports, __webpack_require__) {
3218
3219"use strict";
3220
3221
3222Object.defineProperty(exports, "__esModule", {
3223 value: true
3224});
3225
3226var _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; }; }();
3227
3228var _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); } };
3229
3230var _parchment = __webpack_require__(0);
3231
3232var _parchment2 = _interopRequireDefault(_parchment);
3233
3234function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3235
3236function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3237
3238function _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; }
3239
3240function _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; }
3241
3242var Break = function (_Parchment$Embed) {
3243 _inherits(Break, _Parchment$Embed);
3244
3245 function Break() {
3246 _classCallCheck(this, Break);
3247
3248 return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
3249 }
3250
3251 _createClass(Break, [{
3252 key: 'insertInto',
3253 value: function insertInto(parent, ref) {
3254 if (parent.children.length === 0) {
3255 _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
3256 } else {
3257 this.remove();
3258 }
3259 }
3260 }, {
3261 key: 'length',
3262 value: function length() {
3263 return 0;
3264 }
3265 }, {
3266 key: 'value',
3267 value: function value() {
3268 return '';
3269 }
3270 }], [{
3271 key: 'value',
3272 value: function value() {
3273 return undefined;
3274 }
3275 }]);
3276
3277 return Break;
3278}(_parchment2.default.Embed);
3279
3280Break.blotName = 'break';
3281Break.tagName = 'BR';
3282
3283exports.default = Break;
3284
3285/***/ }),
3286/* 17 */
3287/***/ (function(module, exports, __webpack_require__) {
3288
3289"use strict";
3290
3291var __extends = (this && this.__extends) || (function () {
3292 var extendStatics = Object.setPrototypeOf ||
3293 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3294 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3295 return function (d, b) {
3296 extendStatics(d, b);
3297 function __() { this.constructor = d; }
3298 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3299 };
3300})();
3301Object.defineProperty(exports, "__esModule", { value: true });
3302var linked_list_1 = __webpack_require__(44);
3303var shadow_1 = __webpack_require__(30);
3304var Registry = __webpack_require__(1);
3305var ContainerBlot = /** @class */ (function (_super) {
3306 __extends(ContainerBlot, _super);
3307 function ContainerBlot() {
3308 return _super !== null && _super.apply(this, arguments) || this;
3309 }
3310 ContainerBlot.prototype.appendChild = function (other) {
3311 this.insertBefore(other);
3312 };
3313 ContainerBlot.prototype.attach = function () {
3314 var _this = this;
3315 _super.prototype.attach.call(this);
3316 this.children = new linked_list_1.default();
3317 // Need to be reversed for if DOM nodes already in order
3318 [].slice.call(this.domNode.childNodes).reverse().forEach(function (node) {
3319 try {
3320 var child = makeBlot(node);
3321 _this.insertBefore(child, _this.children.head);
3322 }
3323 catch (err) {
3324 if (err instanceof Registry.ParchmentError)
3325 return;
3326 else
3327 throw err;
3328 }
3329 });
3330 };
3331 ContainerBlot.prototype.deleteAt = function (index, length) {
3332 if (index === 0 && length === this.length()) {
3333 return this.remove();
3334 }
3335 this.children.forEachAt(index, length, function (child, offset, length) {
3336 child.deleteAt(offset, length);
3337 });
3338 };
3339 ContainerBlot.prototype.descendant = function (criteria, index) {
3340 var _a = this.children.find(index), child = _a[0], offset = _a[1];
3341 if ((criteria.blotName == null && criteria(child)) ||
3342 (criteria.blotName != null && child instanceof criteria)) {
3343 return [child, offset];
3344 }
3345 else if (child instanceof ContainerBlot) {
3346 return child.descendant(criteria, offset);
3347 }
3348 else {
3349 return [null, -1];
3350 }
3351 };
3352 ContainerBlot.prototype.descendants = function (criteria, index, length) {
3353 if (index === void 0) { index = 0; }
3354 if (length === void 0) { length = Number.MAX_VALUE; }
3355 var descendants = [], lengthLeft = length;
3356 this.children.forEachAt(index, length, function (child, index, length) {
3357 if ((criteria.blotName == null && criteria(child)) ||
3358 (criteria.blotName != null && child instanceof criteria)) {
3359 descendants.push(child);
3360 }
3361 if (child instanceof ContainerBlot) {
3362 descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
3363 }
3364 lengthLeft -= length;
3365 });
3366 return descendants;
3367 };
3368 ContainerBlot.prototype.detach = function () {
3369 this.children.forEach(function (child) {
3370 child.detach();
3371 });
3372 _super.prototype.detach.call(this);
3373 };
3374 ContainerBlot.prototype.formatAt = function (index, length, name, value) {
3375 this.children.forEachAt(index, length, function (child, offset, length) {
3376 child.formatAt(offset, length, name, value);
3377 });
3378 };
3379 ContainerBlot.prototype.insertAt = function (index, value, def) {
3380 var _a = this.children.find(index), child = _a[0], offset = _a[1];
3381 if (child) {
3382 child.insertAt(offset, value, def);
3383 }
3384 else {
3385 var blot = (def == null) ? Registry.create('text', value) : Registry.create(value, def);
3386 this.appendChild(blot);
3387 }
3388 };
3389 ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
3390 if (this.statics.allowedChildren != null && !this.statics.allowedChildren.some(function (child) {
3391 return childBlot instanceof child;
3392 })) {
3393 throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
3394 }
3395 childBlot.insertInto(this, refBlot);
3396 };
3397 ContainerBlot.prototype.length = function () {
3398 return this.children.reduce(function (memo, child) {
3399 return memo + child.length();
3400 }, 0);
3401 };
3402 ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
3403 this.children.forEach(function (child) {
3404 targetParent.insertBefore(child, refNode);
3405 });
3406 };
3407 ContainerBlot.prototype.optimize = function (context) {
3408 _super.prototype.optimize.call(this, context);
3409 if (this.children.length === 0) {
3410 if (this.statics.defaultChild != null) {
3411 var child = Registry.create(this.statics.defaultChild);
3412 this.appendChild(child);
3413 child.optimize(context);
3414 }
3415 else {
3416 this.remove();
3417 }
3418 }
3419 };
3420 ContainerBlot.prototype.path = function (index, inclusive) {
3421 if (inclusive === void 0) { inclusive = false; }
3422 var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
3423 var position = [[this, index]];
3424 if (child instanceof ContainerBlot) {
3425 return position.concat(child.path(offset, inclusive));
3426 }
3427 else if (child != null) {
3428 position.push([child, offset]);
3429 }
3430 return position;
3431 };
3432 ContainerBlot.prototype.removeChild = function (child) {
3433 this.children.remove(child);
3434 };
3435 ContainerBlot.prototype.replace = function (target) {
3436 if (target instanceof ContainerBlot) {
3437 target.moveChildren(this);
3438 }
3439 _super.prototype.replace.call(this, target);
3440 };
3441 ContainerBlot.prototype.split = function (index, force) {
3442 if (force === void 0) { force = false; }
3443 if (!force) {
3444 if (index === 0)
3445 return this;
3446 if (index === this.length())
3447 return this.next;
3448 }
3449 var after = this.clone();
3450 this.parent.insertBefore(after, this.next);
3451 this.children.forEachAt(index, this.length(), function (child, offset, length) {
3452 child = child.split(offset, force);
3453 after.appendChild(child);
3454 });
3455 return after;
3456 };
3457 ContainerBlot.prototype.unwrap = function () {
3458 this.moveChildren(this.parent, this.next);
3459 this.remove();
3460 };
3461 ContainerBlot.prototype.update = function (mutations, context) {
3462 var _this = this;
3463 var addedNodes = [], removedNodes = [];
3464 mutations.forEach(function (mutation) {
3465 if (mutation.target === _this.domNode && mutation.type === 'childList') {
3466 addedNodes.push.apply(addedNodes, mutation.addedNodes);
3467 removedNodes.push.apply(removedNodes, mutation.removedNodes);
3468 }
3469 });
3470 removedNodes.forEach(function (node) {
3471 // Check node has actually been removed
3472 // One exception is Chrome does not immediately remove IFRAMEs
3473 // from DOM but MutationRecord is correct in its reported removal
3474 if (node.parentNode != null && node.tagName !== 'IFRAME' &&
3475 (document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY)) {
3476 return;
3477 }
3478 var blot = Registry.find(node);
3479 if (blot == null)
3480 return;
3481 if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
3482 blot.detach();
3483 }
3484 });
3485 addedNodes.filter(function (node) {
3486 return node.parentNode == _this.domNode;
3487 }).sort(function (a, b) {
3488 if (a === b)
3489 return 0;
3490 if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
3491 return 1;
3492 }
3493 return -1;
3494 }).forEach(function (node) {
3495 var refBlot = null;
3496 if (node.nextSibling != null) {
3497 refBlot = Registry.find(node.nextSibling);
3498 }
3499 var blot = makeBlot(node);
3500 if (blot.next != refBlot || blot.next == null) {
3501 if (blot.parent != null) {
3502 blot.parent.removeChild(_this);
3503 }
3504 _this.insertBefore(blot, refBlot);
3505 }
3506 });
3507 };
3508 return ContainerBlot;
3509}(shadow_1.default));
3510function makeBlot(node) {
3511 var blot = Registry.find(node);
3512 if (blot == null) {
3513 try {
3514 blot = Registry.create(node);
3515 }
3516 catch (e) {
3517 blot = Registry.create(Registry.Scope.INLINE);
3518 [].slice.call(node.childNodes).forEach(function (child) {
3519 blot.domNode.appendChild(child);
3520 });
3521 node.parentNode.replaceChild(blot.domNode, node);
3522 blot.attach();
3523 }
3524 }
3525 return blot;
3526}
3527exports.default = ContainerBlot;
3528
3529
3530/***/ }),
3531/* 18 */
3532/***/ (function(module, exports, __webpack_require__) {
3533
3534"use strict";
3535
3536var __extends = (this && this.__extends) || (function () {
3537 var extendStatics = Object.setPrototypeOf ||
3538 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3539 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3540 return function (d, b) {
3541 extendStatics(d, b);
3542 function __() { this.constructor = d; }
3543 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3544 };
3545})();
3546Object.defineProperty(exports, "__esModule", { value: true });
3547var attributor_1 = __webpack_require__(12);
3548var store_1 = __webpack_require__(31);
3549var container_1 = __webpack_require__(17);
3550var Registry = __webpack_require__(1);
3551var FormatBlot = /** @class */ (function (_super) {
3552 __extends(FormatBlot, _super);
3553 function FormatBlot() {
3554 return _super !== null && _super.apply(this, arguments) || this;
3555 }
3556 FormatBlot.formats = function (domNode) {
3557 if (typeof this.tagName === 'string') {
3558 return true;
3559 }
3560 else if (Array.isArray(this.tagName)) {
3561 return domNode.tagName.toLowerCase();
3562 }
3563 return undefined;
3564 };
3565 FormatBlot.prototype.attach = function () {
3566 _super.prototype.attach.call(this);
3567 this.attributes = new store_1.default(this.domNode);
3568 };
3569 FormatBlot.prototype.format = function (name, value) {
3570 var format = Registry.query(name);
3571 if (format instanceof attributor_1.default) {
3572 this.attributes.attribute(format, value);
3573 }
3574 else if (value) {
3575 if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
3576 this.replaceWith(name, value);
3577 }
3578 }
3579 };
3580 FormatBlot.prototype.formats = function () {
3581 var formats = this.attributes.values();
3582 var format = this.statics.formats(this.domNode);
3583 if (format != null) {
3584 formats[this.statics.blotName] = format;
3585 }
3586 return formats;
3587 };
3588 FormatBlot.prototype.replaceWith = function (name, value) {
3589 var replacement = _super.prototype.replaceWith.call(this, name, value);
3590 this.attributes.copy(replacement);
3591 return replacement;
3592 };
3593 FormatBlot.prototype.update = function (mutations, context) {
3594 var _this = this;
3595 _super.prototype.update.call(this, mutations, context);
3596 if (mutations.some(function (mutation) {
3597 return mutation.target === _this.domNode && mutation.type === 'attributes';
3598 })) {
3599 this.attributes.build();
3600 }
3601 };
3602 FormatBlot.prototype.wrap = function (name, value) {
3603 var wrapper = _super.prototype.wrap.call(this, name, value);
3604 if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
3605 this.attributes.move(wrapper);
3606 }
3607 return wrapper;
3608 };
3609 return FormatBlot;
3610}(container_1.default));
3611exports.default = FormatBlot;
3612
3613
3614/***/ }),
3615/* 19 */
3616/***/ (function(module, exports, __webpack_require__) {
3617
3618"use strict";
3619
3620var __extends = (this && this.__extends) || (function () {
3621 var extendStatics = Object.setPrototypeOf ||
3622 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3623 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3624 return function (d, b) {
3625 extendStatics(d, b);
3626 function __() { this.constructor = d; }
3627 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3628 };
3629})();
3630Object.defineProperty(exports, "__esModule", { value: true });
3631var shadow_1 = __webpack_require__(30);
3632var Registry = __webpack_require__(1);
3633var LeafBlot = /** @class */ (function (_super) {
3634 __extends(LeafBlot, _super);
3635 function LeafBlot() {
3636 return _super !== null && _super.apply(this, arguments) || this;
3637 }
3638 LeafBlot.value = function (domNode) {
3639 return true;
3640 };
3641 LeafBlot.prototype.index = function (node, offset) {
3642 if (this.domNode === node ||
3643 this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
3644 return Math.min(offset, 1);
3645 }
3646 return -1;
3647 };
3648 LeafBlot.prototype.position = function (index, inclusive) {
3649 var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
3650 if (index > 0)
3651 offset += 1;
3652 return [this.parent.domNode, offset];
3653 };
3654 LeafBlot.prototype.value = function () {
3655 return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
3656 var _a;
3657 };
3658 LeafBlot.scope = Registry.Scope.INLINE_BLOT;
3659 return LeafBlot;
3660}(shadow_1.default));
3661exports.default = LeafBlot;
3662
3663
3664/***/ }),
3665/* 20 */
3666/***/ (function(module, exports, __webpack_require__) {
3667
3668var equal = __webpack_require__(11);
3669var extend = __webpack_require__(3);
3670
3671
3672var lib = {
3673 attributes: {
3674 compose: function (a, b, keepNull) {
3675 if (typeof a !== 'object') a = {};
3676 if (typeof b !== 'object') b = {};
3677 var attributes = extend(true, {}, b);
3678 if (!keepNull) {
3679 attributes = Object.keys(attributes).reduce(function (copy, key) {
3680 if (attributes[key] != null) {
3681 copy[key] = attributes[key];
3682 }
3683 return copy;
3684 }, {});
3685 }
3686 for (var key in a) {
3687 if (a[key] !== undefined && b[key] === undefined) {
3688 attributes[key] = a[key];
3689 }
3690 }
3691 return Object.keys(attributes).length > 0 ? attributes : undefined;
3692 },
3693
3694 diff: function(a, b) {
3695 if (typeof a !== 'object') a = {};
3696 if (typeof b !== 'object') b = {};
3697 var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
3698 if (!equal(a[key], b[key])) {
3699 attributes[key] = b[key] === undefined ? null : b[key];
3700 }
3701 return attributes;
3702 }, {});
3703 return Object.keys(attributes).length > 0 ? attributes : undefined;
3704 },
3705
3706 transform: function (a, b, priority) {
3707 if (typeof a !== 'object') return b;
3708 if (typeof b !== 'object') return undefined;
3709 if (!priority) return b; // b simply overwrites us without priority
3710 var attributes = Object.keys(b).reduce(function (attributes, key) {
3711 if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
3712 return attributes;
3713 }, {});
3714 return Object.keys(attributes).length > 0 ? attributes : undefined;
3715 }
3716 },
3717
3718 iterator: function (ops) {
3719 return new Iterator(ops);
3720 },
3721
3722 length: function (op) {
3723 if (typeof op['delete'] === 'number') {
3724 return op['delete'];
3725 } else if (typeof op.retain === 'number') {
3726 return op.retain;
3727 } else {
3728 return typeof op.insert === 'string' ? op.insert.length : 1;
3729 }
3730 }
3731};
3732
3733
3734function Iterator(ops) {
3735 this.ops = ops;
3736 this.index = 0;
3737 this.offset = 0;
3738};
3739
3740Iterator.prototype.hasNext = function () {
3741 return this.peekLength() < Infinity;
3742};
3743
3744Iterator.prototype.next = function (length) {
3745 if (!length) length = Infinity;
3746 var nextOp = this.ops[this.index];
3747 if (nextOp) {
3748 var offset = this.offset;
3749 var opLength = lib.length(nextOp)
3750 if (length >= opLength - offset) {
3751 length = opLength - offset;
3752 this.index += 1;
3753 this.offset = 0;
3754 } else {
3755 this.offset += length;
3756 }
3757 if (typeof nextOp['delete'] === 'number') {
3758 return { 'delete': length };
3759 } else {
3760 var retOp = {};
3761 if (nextOp.attributes) {
3762 retOp.attributes = nextOp.attributes;
3763 }
3764 if (typeof nextOp.retain === 'number') {
3765 retOp.retain = length;
3766 } else if (typeof nextOp.insert === 'string') {
3767 retOp.insert = nextOp.insert.substr(offset, length);
3768 } else {
3769 // offset should === 0, length should === 1
3770 retOp.insert = nextOp.insert;
3771 }
3772 return retOp;
3773 }
3774 } else {
3775 return { retain: Infinity };
3776 }
3777};
3778
3779Iterator.prototype.peek = function () {
3780 return this.ops[this.index];
3781};
3782
3783Iterator.prototype.peekLength = function () {
3784 if (this.ops[this.index]) {
3785 // Should never return 0 if our index is being managed correctly
3786 return lib.length(this.ops[this.index]) - this.offset;
3787 } else {
3788 return Infinity;
3789 }
3790};
3791
3792Iterator.prototype.peekType = function () {
3793 if (this.ops[this.index]) {
3794 if (typeof this.ops[this.index]['delete'] === 'number') {
3795 return 'delete';
3796 } else if (typeof this.ops[this.index].retain === 'number') {
3797 return 'retain';
3798 } else {
3799 return 'insert';
3800 }
3801 }
3802 return 'retain';
3803};
3804
3805
3806module.exports = lib;
3807
3808
3809/***/ }),
3810/* 21 */
3811/***/ (function(module, exports) {
3812
3813var clone = (function() {
3814'use strict';
3815
3816function _instanceof(obj, type) {
3817 return type != null && obj instanceof type;
3818}
3819
3820var nativeMap;
3821try {
3822 nativeMap = Map;
3823} catch(_) {
3824 // maybe a reference error because no `Map`. Give it a dummy value that no
3825 // value will ever be an instanceof.
3826 nativeMap = function() {};
3827}
3828
3829var nativeSet;
3830try {
3831 nativeSet = Set;
3832} catch(_) {
3833 nativeSet = function() {};
3834}
3835
3836var nativePromise;
3837try {
3838 nativePromise = Promise;
3839} catch(_) {
3840 nativePromise = function() {};
3841}
3842
3843/**
3844 * Clones (copies) an Object using deep copying.
3845 *
3846 * This function supports circular references by default, but if you are certain
3847 * there are no circular references in your object, you can save some CPU time
3848 * by calling clone(obj, false).
3849 *
3850 * Caution: if `circular` is false and `parent` contains circular references,
3851 * your program may enter an infinite loop and crash.
3852 *
3853 * @param `parent` - the object to be cloned
3854 * @param `circular` - set to true if the object to be cloned may contain
3855 * circular references. (optional - true by default)
3856 * @param `depth` - set to a number if the object is only to be cloned to
3857 * a particular depth. (optional - defaults to Infinity)
3858 * @param `prototype` - sets the prototype to be used when cloning an object.
3859 * (optional - defaults to parent prototype).
3860 * @param `includeNonEnumerable` - set to true if the non-enumerable properties
3861 * should be cloned as well. Non-enumerable properties on the prototype
3862 * chain will be ignored. (optional - false by default)
3863*/
3864function clone(parent, circular, depth, prototype, includeNonEnumerable) {
3865 if (typeof circular === 'object') {
3866 depth = circular.depth;
3867 prototype = circular.prototype;
3868 includeNonEnumerable = circular.includeNonEnumerable;
3869 circular = circular.circular;
3870 }
3871 // maintain two arrays for circular references, where corresponding parents
3872 // and children have the same index
3873 var allParents = [];
3874 var allChildren = [];
3875
3876 var useBuffer = typeof Buffer != 'undefined';
3877
3878 if (typeof circular == 'undefined')
3879 circular = true;
3880
3881 if (typeof depth == 'undefined')
3882 depth = Infinity;
3883
3884 // recurse this function so we don't reset allParents and allChildren
3885 function _clone(parent, depth) {
3886 // cloning null always returns null
3887 if (parent === null)
3888 return null;
3889
3890 if (depth === 0)
3891 return parent;
3892
3893 var child;
3894 var proto;
3895 if (typeof parent != 'object') {
3896 return parent;
3897 }
3898
3899 if (_instanceof(parent, nativeMap)) {
3900 child = new nativeMap();
3901 } else if (_instanceof(parent, nativeSet)) {
3902 child = new nativeSet();
3903 } else if (_instanceof(parent, nativePromise)) {
3904 child = new nativePromise(function (resolve, reject) {
3905 parent.then(function(value) {
3906 resolve(_clone(value, depth - 1));
3907 }, function(err) {
3908 reject(_clone(err, depth - 1));
3909 });
3910 });
3911 } else if (clone.__isArray(parent)) {
3912 child = [];
3913 } else if (clone.__isRegExp(parent)) {
3914 child = new RegExp(parent.source, __getRegExpFlags(parent));
3915 if (parent.lastIndex) child.lastIndex = parent.lastIndex;
3916 } else if (clone.__isDate(parent)) {
3917 child = new Date(parent.getTime());
3918 } else if (useBuffer && Buffer.isBuffer(parent)) {
3919 child = new Buffer(parent.length);
3920 parent.copy(child);
3921 return child;
3922 } else if (_instanceof(parent, Error)) {
3923 child = Object.create(parent);
3924 } else {
3925 if (typeof prototype == 'undefined') {
3926 proto = Object.getPrototypeOf(parent);
3927 child = Object.create(proto);
3928 }
3929 else {
3930 child = Object.create(prototype);
3931 proto = prototype;
3932 }
3933 }
3934
3935 if (circular) {
3936 var index = allParents.indexOf(parent);
3937
3938 if (index != -1) {
3939 return allChildren[index];
3940 }
3941 allParents.push(parent);
3942 allChildren.push(child);
3943 }
3944
3945 if (_instanceof(parent, nativeMap)) {
3946 parent.forEach(function(value, key) {
3947 var keyChild = _clone(key, depth - 1);
3948 var valueChild = _clone(value, depth - 1);
3949 child.set(keyChild, valueChild);
3950 });
3951 }
3952 if (_instanceof(parent, nativeSet)) {
3953 parent.forEach(function(value) {
3954 var entryChild = _clone(value, depth - 1);
3955 child.add(entryChild);
3956 });
3957 }
3958
3959 for (var i in parent) {
3960 var attrs;
3961 if (proto) {
3962 attrs = Object.getOwnPropertyDescriptor(proto, i);
3963 }
3964
3965 if (attrs && attrs.set == null) {
3966 continue;
3967 }
3968 child[i] = _clone(parent[i], depth - 1);
3969 }
3970
3971 if (Object.getOwnPropertySymbols) {
3972 var symbols = Object.getOwnPropertySymbols(parent);
3973 for (var i = 0; i < symbols.length; i++) {
3974 // Don't need to worry about cloning a symbol because it is a primitive,
3975 // like a number or string.
3976 var symbol = symbols[i];
3977 var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
3978 if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
3979 continue;
3980 }
3981 child[symbol] = _clone(parent[symbol], depth - 1);
3982 if (!descriptor.enumerable) {
3983 Object.defineProperty(child, symbol, {
3984 enumerable: false
3985 });
3986 }
3987 }
3988 }
3989
3990 if (includeNonEnumerable) {
3991 var allPropertyNames = Object.getOwnPropertyNames(parent);
3992 for (var i = 0; i < allPropertyNames.length; i++) {
3993 var propertyName = allPropertyNames[i];
3994 var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
3995 if (descriptor && descriptor.enumerable) {
3996 continue;
3997 }
3998 child[propertyName] = _clone(parent[propertyName], depth - 1);
3999 Object.defineProperty(child, propertyName, {
4000 enumerable: false
4001 });
4002 }
4003 }
4004
4005 return child;
4006 }
4007
4008 return _clone(parent, depth);
4009}
4010
4011/**
4012 * Simple flat clone using prototype, accepts only objects, usefull for property
4013 * override on FLAT configuration object (no nested props).
4014 *
4015 * USE WITH CAUTION! This may not behave as you wish if you do not know how this
4016 * works.
4017 */
4018clone.clonePrototype = function clonePrototype(parent) {
4019 if (parent === null)
4020 return null;
4021
4022 var c = function () {};
4023 c.prototype = parent;
4024 return new c();
4025};
4026
4027// private utility functions
4028
4029function __objToStr(o) {
4030 return Object.prototype.toString.call(o);
4031}
4032clone.__objToStr = __objToStr;
4033
4034function __isDate(o) {
4035 return typeof o === 'object' && __objToStr(o) === '[object Date]';
4036}
4037clone.__isDate = __isDate;
4038
4039function __isArray(o) {
4040 return typeof o === 'object' && __objToStr(o) === '[object Array]';
4041}
4042clone.__isArray = __isArray;
4043
4044function __isRegExp(o) {
4045 return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
4046}
4047clone.__isRegExp = __isRegExp;
4048
4049function __getRegExpFlags(re) {
4050 var flags = '';
4051 if (re.global) flags += 'g';
4052 if (re.ignoreCase) flags += 'i';
4053 if (re.multiline) flags += 'm';
4054 return flags;
4055}
4056clone.__getRegExpFlags = __getRegExpFlags;
4057
4058return clone;
4059})();
4060
4061if (typeof module === 'object' && module.exports) {
4062 module.exports = clone;
4063}
4064
4065
4066/***/ }),
4067/* 22 */
4068/***/ (function(module, exports, __webpack_require__) {
4069
4070"use strict";
4071
4072
4073Object.defineProperty(exports, "__esModule", {
4074 value: true
4075});
4076
4077var _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"); } }; }();
4078
4079var _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; }; }();
4080
4081var _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); } };
4082
4083var _parchment = __webpack_require__(0);
4084
4085var _parchment2 = _interopRequireDefault(_parchment);
4086
4087var _emitter = __webpack_require__(8);
4088
4089var _emitter2 = _interopRequireDefault(_emitter);
4090
4091var _block = __webpack_require__(4);
4092
4093var _block2 = _interopRequireDefault(_block);
4094
4095var _break = __webpack_require__(16);
4096
4097var _break2 = _interopRequireDefault(_break);
4098
4099var _code = __webpack_require__(13);
4100
4101var _code2 = _interopRequireDefault(_code);
4102
4103var _container = __webpack_require__(24);
4104
4105var _container2 = _interopRequireDefault(_container);
4106
4107function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4108
4109function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4110
4111function _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; }
4112
4113function _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; }
4114
4115function isLine(blot) {
4116 return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
4117}
4118
4119var Scroll = function (_Parchment$Scroll) {
4120 _inherits(Scroll, _Parchment$Scroll);
4121
4122 function Scroll(domNode, config) {
4123 _classCallCheck(this, Scroll);
4124
4125 var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
4126
4127 _this.emitter = config.emitter;
4128 if (Array.isArray(config.whitelist)) {
4129 _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
4130 whitelist[format] = true;
4131 return whitelist;
4132 }, {});
4133 }
4134 // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
4135 _this.domNode.addEventListener('DOMNodeInserted', function () {});
4136 _this.optimize();
4137 _this.enable();
4138 return _this;
4139 }
4140
4141 _createClass(Scroll, [{
4142 key: 'batchStart',
4143 value: function batchStart() {
4144 this.batch = true;
4145 }
4146 }, {
4147 key: 'batchEnd',
4148 value: function batchEnd() {
4149 this.batch = false;
4150 this.optimize();
4151 }
4152 }, {
4153 key: 'deleteAt',
4154 value: function deleteAt(index, length) {
4155 var _line = this.line(index),
4156 _line2 = _slicedToArray(_line, 2),
4157 first = _line2[0],
4158 offset = _line2[1];
4159
4160 var _line3 = this.line(index + length),
4161 _line4 = _slicedToArray(_line3, 1),
4162 last = _line4[0];
4163
4164 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
4165 if (last != null && first !== last && offset > 0) {
4166 if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {
4167 this.optimize();
4168 return;
4169 }
4170 if (first instanceof _code2.default) {
4171 var newlineIndex = first.newlineIndex(first.length(), true);
4172 if (newlineIndex > -1) {
4173 first = first.split(newlineIndex + 1);
4174 if (first === last) {
4175 this.optimize();
4176 return;
4177 }
4178 }
4179 } else if (last instanceof _code2.default) {
4180 var _newlineIndex = last.newlineIndex(0);
4181 if (_newlineIndex > -1) {
4182 last.split(_newlineIndex + 1);
4183 }
4184 }
4185 var ref = last.children.head instanceof _break2.default ? null : last.children.head;
4186 first.moveChildren(last, ref);
4187 first.remove();
4188 }
4189 this.optimize();
4190 }
4191 }, {
4192 key: 'enable',
4193 value: function enable() {
4194 var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4195
4196 this.domNode.setAttribute('contenteditable', enabled);
4197 }
4198 }, {
4199 key: 'formatAt',
4200 value: function formatAt(index, length, format, value) {
4201 if (this.whitelist != null && !this.whitelist[format]) return;
4202 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
4203 this.optimize();
4204 }
4205 }, {
4206 key: 'insertAt',
4207 value: function insertAt(index, value, def) {
4208 if (def != null && this.whitelist != null && !this.whitelist[value]) return;
4209 if (index >= this.length()) {
4210 if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
4211 var blot = _parchment2.default.create(this.statics.defaultChild);
4212 this.appendChild(blot);
4213 if (def == null && value.endsWith('\n')) {
4214 value = value.slice(0, -1);
4215 }
4216 blot.insertAt(0, value, def);
4217 } else {
4218 var embed = _parchment2.default.create(value, def);
4219 this.appendChild(embed);
4220 }
4221 } else {
4222 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
4223 }
4224 this.optimize();
4225 }
4226 }, {
4227 key: 'insertBefore',
4228 value: function insertBefore(blot, ref) {
4229 if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
4230 var wrapper = _parchment2.default.create(this.statics.defaultChild);
4231 wrapper.appendChild(blot);
4232 blot = wrapper;
4233 }
4234 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
4235 }
4236 }, {
4237 key: 'leaf',
4238 value: function leaf(index) {
4239 return this.path(index).pop() || [null, -1];
4240 }
4241 }, {
4242 key: 'line',
4243 value: function line(index) {
4244 if (index === this.length()) {
4245 return this.line(index - 1);
4246 }
4247 return this.descendant(isLine, index);
4248 }
4249 }, {
4250 key: 'lines',
4251 value: function lines() {
4252 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
4253 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
4254
4255 var getLines = function getLines(blot, index, length) {
4256 var lines = [],
4257 lengthLeft = length;
4258 blot.children.forEachAt(index, length, function (child, index, length) {
4259 if (isLine(child)) {
4260 lines.push(child);
4261 } else if (child instanceof _parchment2.default.Container) {
4262 lines = lines.concat(getLines(child, index, lengthLeft));
4263 }
4264 lengthLeft -= length;
4265 });
4266 return lines;
4267 };
4268 return getLines(this, index, length);
4269 }
4270 }, {
4271 key: 'optimize',
4272 value: function optimize() {
4273 var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4274 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4275
4276 if (this.batch === true) return;
4277 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);
4278 if (mutations.length > 0) {
4279 this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);
4280 }
4281 }
4282 }, {
4283 key: 'path',
4284 value: function path(index) {
4285 return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
4286 }
4287 }, {
4288 key: 'update',
4289 value: function update(mutations) {
4290 if (this.batch === true) return;
4291 var source = _emitter2.default.sources.USER;
4292 if (typeof mutations === 'string') {
4293 source = mutations;
4294 }
4295 if (!Array.isArray(mutations)) {
4296 mutations = this.observer.takeRecords();
4297 }
4298 if (mutations.length > 0) {
4299 this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
4300 }
4301 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
4302 if (mutations.length > 0) {
4303 this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
4304 }
4305 }
4306 }]);
4307
4308 return Scroll;
4309}(_parchment2.default.Scroll);
4310
4311Scroll.blotName = 'scroll';
4312Scroll.className = 'ql-editor';
4313Scroll.tagName = 'DIV';
4314Scroll.defaultChild = 'block';
4315Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
4316
4317exports.default = Scroll;
4318
4319/***/ }),
4320/* 23 */
4321/***/ (function(module, exports, __webpack_require__) {
4322
4323"use strict";
4324
4325
4326Object.defineProperty(exports, "__esModule", {
4327 value: true
4328});
4329
4330var _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"); } }; }();
4331
4332var _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); } };
4333
4334var _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; }; }();
4335
4336var _parchment = __webpack_require__(0);
4337
4338var _parchment2 = _interopRequireDefault(_parchment);
4339
4340var _text = __webpack_require__(7);
4341
4342var _text2 = _interopRequireDefault(_text);
4343
4344function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4345
4346function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4347
4348function _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; }
4349
4350function _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; }
4351
4352var Cursor = function (_Parchment$Embed) {
4353 _inherits(Cursor, _Parchment$Embed);
4354
4355 _createClass(Cursor, null, [{
4356 key: 'value',
4357 value: function value() {
4358 return undefined;
4359 }
4360 }]);
4361
4362 function Cursor(domNode, selection) {
4363 _classCallCheck(this, Cursor);
4364
4365 var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
4366
4367 _this.selection = selection;
4368 _this.textNode = document.createTextNode(Cursor.CONTENTS);
4369 _this.domNode.appendChild(_this.textNode);
4370 _this._length = 0;
4371 return _this;
4372 }
4373
4374 _createClass(Cursor, [{
4375 key: 'detach',
4376 value: function detach() {
4377 // super.detach() will also clear domNode.__blot
4378 if (this.parent != null) this.parent.removeChild(this);
4379 }
4380 }, {
4381 key: 'format',
4382 value: function format(name, value) {
4383 if (this._length !== 0) {
4384 return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
4385 }
4386 var target = this,
4387 index = 0;
4388 while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
4389 index += target.offset(target.parent);
4390 target = target.parent;
4391 }
4392 if (target != null) {
4393 this._length = Cursor.CONTENTS.length;
4394 target.optimize();
4395 target.formatAt(index, Cursor.CONTENTS.length, name, value);
4396 this._length = 0;
4397 }
4398 }
4399 }, {
4400 key: 'index',
4401 value: function index(node, offset) {
4402 if (node === this.textNode) return 0;
4403 return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
4404 }
4405 }, {
4406 key: 'length',
4407 value: function length() {
4408 return this._length;
4409 }
4410 }, {
4411 key: 'position',
4412 value: function position() {
4413 return [this.textNode, this.textNode.data.length];
4414 }
4415 }, {
4416 key: 'remove',
4417 value: function remove() {
4418 _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
4419 this.parent = null;
4420 }
4421 }, {
4422 key: 'restore',
4423 value: function restore() {
4424 if (this.selection.composing || this.parent == null) return;
4425 var textNode = this.textNode;
4426 var range = this.selection.getNativeRange();
4427 var restoreText = void 0,
4428 start = void 0,
4429 end = void 0;
4430 if (range != null && range.start.node === textNode && range.end.node === textNode) {
4431 var _ref = [textNode, range.start.offset, range.end.offset];
4432 restoreText = _ref[0];
4433 start = _ref[1];
4434 end = _ref[2];
4435 }
4436 // Link format will insert text outside of anchor tag
4437 while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
4438 this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
4439 }
4440 if (this.textNode.data !== Cursor.CONTENTS) {
4441 var text = this.textNode.data.split(Cursor.CONTENTS).join('');
4442 if (this.next instanceof _text2.default) {
4443 restoreText = this.next.domNode;
4444 this.next.insertAt(0, text);
4445 this.textNode.data = Cursor.CONTENTS;
4446 } else {
4447 this.textNode.data = text;
4448 this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
4449 this.textNode = document.createTextNode(Cursor.CONTENTS);
4450 this.domNode.appendChild(this.textNode);
4451 }
4452 }
4453 this.remove();
4454 if (start != null) {
4455 var _map = [start, end].map(function (offset) {
4456 return Math.max(0, Math.min(restoreText.data.length, offset - 1));
4457 });
4458
4459 var _map2 = _slicedToArray(_map, 2);
4460
4461 start = _map2[0];
4462 end = _map2[1];
4463
4464 return {
4465 startNode: restoreText,
4466 startOffset: start,
4467 endNode: restoreText,
4468 endOffset: end
4469 };
4470 }
4471 }
4472 }, {
4473 key: 'update',
4474 value: function update(mutations, context) {
4475 var _this2 = this;
4476
4477 if (mutations.some(function (mutation) {
4478 return mutation.type === 'characterData' && mutation.target === _this2.textNode;
4479 })) {
4480 var range = this.restore();
4481 if (range) context.range = range;
4482 }
4483 }
4484 }, {
4485 key: 'value',
4486 value: function value() {
4487 return '';
4488 }
4489 }]);
4490
4491 return Cursor;
4492}(_parchment2.default.Embed);
4493
4494Cursor.blotName = 'cursor';
4495Cursor.className = 'ql-cursor';
4496Cursor.tagName = 'span';
4497Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
4498
4499
4500exports.default = Cursor;
4501
4502/***/ }),
4503/* 24 */
4504/***/ (function(module, exports, __webpack_require__) {
4505
4506"use strict";
4507
4508
4509Object.defineProperty(exports, "__esModule", {
4510 value: true
4511});
4512
4513var _parchment = __webpack_require__(0);
4514
4515var _parchment2 = _interopRequireDefault(_parchment);
4516
4517var _block = __webpack_require__(4);
4518
4519var _block2 = _interopRequireDefault(_block);
4520
4521function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4522
4523function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4524
4525function _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; }
4526
4527function _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; }
4528
4529var Container = function (_Parchment$Container) {
4530 _inherits(Container, _Parchment$Container);
4531
4532 function Container() {
4533 _classCallCheck(this, Container);
4534
4535 return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
4536 }
4537
4538 return Container;
4539}(_parchment2.default.Container);
4540
4541Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
4542
4543exports.default = Container;
4544
4545/***/ }),
4546/* 25 */
4547/***/ (function(module, exports, __webpack_require__) {
4548
4549"use strict";
4550
4551
4552Object.defineProperty(exports, "__esModule", {
4553 value: true
4554});
4555
4556var _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; }; }();
4557
4558var _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); } };
4559
4560var _parchment = __webpack_require__(0);
4561
4562var _parchment2 = _interopRequireDefault(_parchment);
4563
4564var _text = __webpack_require__(7);
4565
4566var _text2 = _interopRequireDefault(_text);
4567
4568function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4569
4570function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4571
4572function _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; }
4573
4574function _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; }
4575
4576var GUARD_TEXT = '\uFEFF';
4577
4578var Embed = function (_Parchment$Embed) {
4579 _inherits(Embed, _Parchment$Embed);
4580
4581 function Embed(node) {
4582 _classCallCheck(this, Embed);
4583
4584 var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));
4585
4586 _this.contentNode = document.createElement('span');
4587 _this.contentNode.setAttribute('contenteditable', false);
4588 [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {
4589 _this.contentNode.appendChild(childNode);
4590 });
4591 _this.leftGuard = document.createTextNode(GUARD_TEXT);
4592 _this.rightGuard = document.createTextNode(GUARD_TEXT);
4593 _this.domNode.appendChild(_this.leftGuard);
4594 _this.domNode.appendChild(_this.contentNode);
4595 _this.domNode.appendChild(_this.rightGuard);
4596 return _this;
4597 }
4598
4599 _createClass(Embed, [{
4600 key: 'index',
4601 value: function index(node, offset) {
4602 if (node === this.leftGuard) return 0;
4603 if (node === this.rightGuard) return 1;
4604 return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);
4605 }
4606 }, {
4607 key: 'restore',
4608 value: function restore(node) {
4609 var range = void 0,
4610 textNode = void 0;
4611 var text = node.data.split(GUARD_TEXT).join('');
4612 if (node === this.leftGuard) {
4613 if (this.prev instanceof _text2.default) {
4614 var prevLength = this.prev.length();
4615 this.prev.insertAt(prevLength, text);
4616 range = {
4617 startNode: this.prev.domNode,
4618 startOffset: prevLength + text.length
4619 };
4620 } else {
4621 textNode = document.createTextNode(text);
4622 this.parent.insertBefore(_parchment2.default.create(textNode), this);
4623 range = {
4624 startNode: textNode,
4625 startOffset: text.length
4626 };
4627 }
4628 } else if (node === this.rightGuard) {
4629 if (this.next instanceof _text2.default) {
4630 this.next.insertAt(0, text);
4631 range = {
4632 startNode: this.next.domNode,
4633 startOffset: text.length
4634 };
4635 } else {
4636 textNode = document.createTextNode(text);
4637 this.parent.insertBefore(_parchment2.default.create(textNode), this.next);
4638 range = {
4639 startNode: textNode,
4640 startOffset: text.length
4641 };
4642 }
4643 }
4644 node.data = GUARD_TEXT;
4645 return range;
4646 }
4647 }, {
4648 key: 'update',
4649 value: function update(mutations, context) {
4650 var _this2 = this;
4651
4652 mutations.forEach(function (mutation) {
4653 if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {
4654 var range = _this2.restore(mutation.target);
4655 if (range) context.range = range;
4656 }
4657 });
4658 }
4659 }]);
4660
4661 return Embed;
4662}(_parchment2.default.Embed);
4663
4664exports.default = Embed;
4665
4666/***/ }),
4667/* 26 */
4668/***/ (function(module, exports, __webpack_require__) {
4669
4670"use strict";
4671
4672
4673Object.defineProperty(exports, "__esModule", {
4674 value: true
4675});
4676exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
4677
4678var _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; }; }();
4679
4680var _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); } };
4681
4682var _parchment = __webpack_require__(0);
4683
4684var _parchment2 = _interopRequireDefault(_parchment);
4685
4686function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4687
4688function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4689
4690function _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; }
4691
4692function _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; }
4693
4694var ColorAttributor = function (_Parchment$Attributor) {
4695 _inherits(ColorAttributor, _Parchment$Attributor);
4696
4697 function ColorAttributor() {
4698 _classCallCheck(this, ColorAttributor);
4699
4700 return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
4701 }
4702
4703 _createClass(ColorAttributor, [{
4704 key: 'value',
4705 value: function value(domNode) {
4706 var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
4707 if (!value.startsWith('rgb(')) return value;
4708 value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
4709 return '#' + value.split(',').map(function (component) {
4710 return ('00' + parseInt(component).toString(16)).slice(-2);
4711 }).join('');
4712 }
4713 }]);
4714
4715 return ColorAttributor;
4716}(_parchment2.default.Attributor.Style);
4717
4718var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
4719 scope: _parchment2.default.Scope.INLINE
4720});
4721var ColorStyle = new ColorAttributor('color', 'color', {
4722 scope: _parchment2.default.Scope.INLINE
4723});
4724
4725exports.ColorAttributor = ColorAttributor;
4726exports.ColorClass = ColorClass;
4727exports.ColorStyle = ColorStyle;
4728
4729/***/ }),
4730/* 27 */
4731/***/ (function(module, exports, __webpack_require__) {
4732
4733"use strict";
4734
4735
4736Object.defineProperty(exports, "__esModule", {
4737 value: true
4738});
4739exports.sanitize = exports.default = undefined;
4740
4741var _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; }; }();
4742
4743var _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); } };
4744
4745var _inline = __webpack_require__(6);
4746
4747var _inline2 = _interopRequireDefault(_inline);
4748
4749function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4750
4751function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4752
4753function _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; }
4754
4755function _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; }
4756
4757var Link = function (_Inline) {
4758 _inherits(Link, _Inline);
4759
4760 function Link() {
4761 _classCallCheck(this, Link);
4762
4763 return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
4764 }
4765
4766 _createClass(Link, [{
4767 key: 'format',
4768 value: function format(name, value) {
4769 if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
4770 value = this.constructor.sanitize(value);
4771 this.domNode.setAttribute('href', value);
4772 }
4773 }], [{
4774 key: 'create',
4775 value: function create(value) {
4776 var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
4777 value = this.sanitize(value);
4778 node.setAttribute('href', value);
4779 node.setAttribute('target', '_blank');
4780 return node;
4781 }
4782 }, {
4783 key: 'formats',
4784 value: function formats(domNode) {
4785 return domNode.getAttribute('href');
4786 }
4787 }, {
4788 key: 'sanitize',
4789 value: function sanitize(url) {
4790 return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
4791 }
4792 }]);
4793
4794 return Link;
4795}(_inline2.default);
4796
4797Link.blotName = 'link';
4798Link.tagName = 'A';
4799Link.SANITIZED_URL = 'about:blank';
4800Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];
4801
4802function _sanitize(url, protocols) {
4803 var anchor = document.createElement('a');
4804 anchor.href = url;
4805 var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
4806 return protocols.indexOf(protocol) > -1;
4807}
4808
4809exports.default = Link;
4810exports.sanitize = _sanitize;
4811
4812/***/ }),
4813/* 28 */
4814/***/ (function(module, exports, __webpack_require__) {
4815
4816"use strict";
4817
4818
4819Object.defineProperty(exports, "__esModule", {
4820 value: true
4821});
4822
4823var _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; };
4824
4825var _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; }; }();
4826
4827var _dropdown = __webpack_require__(107);
4828
4829var _dropdown2 = _interopRequireDefault(_dropdown);
4830
4831function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4832
4833function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4834
4835var Picker = function () {
4836 function Picker(select) {
4837 var _this = this;
4838
4839 _classCallCheck(this, Picker);
4840
4841 this.select = select;
4842 this.container = document.createElement('span');
4843 this.buildPicker();
4844 this.select.style.display = 'none';
4845 this.select.parentNode.insertBefore(this.container, this.select);
4846 this.label.addEventListener('mousedown', function () {
4847 _this.container.classList.toggle('ql-expanded');
4848 });
4849 this.select.addEventListener('change', this.update.bind(this));
4850 }
4851
4852 _createClass(Picker, [{
4853 key: 'buildItem',
4854 value: function buildItem(option) {
4855 var _this2 = this;
4856
4857 var item = document.createElement('span');
4858 item.classList.add('ql-picker-item');
4859 if (option.hasAttribute('value')) {
4860 item.setAttribute('data-value', option.getAttribute('value'));
4861 }
4862 if (option.textContent) {
4863 item.setAttribute('data-label', option.textContent);
4864 }
4865 item.addEventListener('click', function () {
4866 _this2.selectItem(item, true);
4867 });
4868 return item;
4869 }
4870 }, {
4871 key: 'buildLabel',
4872 value: function buildLabel() {
4873 var label = document.createElement('span');
4874 label.classList.add('ql-picker-label');
4875 label.innerHTML = _dropdown2.default;
4876 this.container.appendChild(label);
4877 return label;
4878 }
4879 }, {
4880 key: 'buildOptions',
4881 value: function buildOptions() {
4882 var _this3 = this;
4883
4884 var options = document.createElement('span');
4885 options.classList.add('ql-picker-options');
4886 [].slice.call(this.select.options).forEach(function (option) {
4887 var item = _this3.buildItem(option);
4888 options.appendChild(item);
4889 if (option.selected === true) {
4890 _this3.selectItem(item);
4891 }
4892 });
4893 this.container.appendChild(options);
4894 }
4895 }, {
4896 key: 'buildPicker',
4897 value: function buildPicker() {
4898 var _this4 = this;
4899
4900 [].slice.call(this.select.attributes).forEach(function (item) {
4901 _this4.container.setAttribute(item.name, item.value);
4902 });
4903 this.container.classList.add('ql-picker');
4904 this.label = this.buildLabel();
4905 this.buildOptions();
4906 }
4907 }, {
4908 key: 'close',
4909 value: function close() {
4910 this.container.classList.remove('ql-expanded');
4911 }
4912 }, {
4913 key: 'selectItem',
4914 value: function selectItem(item) {
4915 var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4916
4917 var selected = this.container.querySelector('.ql-selected');
4918 if (item === selected) return;
4919 if (selected != null) {
4920 selected.classList.remove('ql-selected');
4921 }
4922 if (item == null) return;
4923 item.classList.add('ql-selected');
4924 this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
4925 if (item.hasAttribute('data-value')) {
4926 this.label.setAttribute('data-value', item.getAttribute('data-value'));
4927 } else {
4928 this.label.removeAttribute('data-value');
4929 }
4930 if (item.hasAttribute('data-label')) {
4931 this.label.setAttribute('data-label', item.getAttribute('data-label'));
4932 } else {
4933 this.label.removeAttribute('data-label');
4934 }
4935 if (trigger) {
4936 if (typeof Event === 'function') {
4937 this.select.dispatchEvent(new Event('change'));
4938 } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
4939 // IE11
4940 var event = document.createEvent('Event');
4941 event.initEvent('change', true, true);
4942 this.select.dispatchEvent(event);
4943 }
4944 this.close();
4945 }
4946 }
4947 }, {
4948 key: 'update',
4949 value: function update() {
4950 var option = void 0;
4951 if (this.select.selectedIndex > -1) {
4952 var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
4953 option = this.select.options[this.select.selectedIndex];
4954 this.selectItem(item);
4955 } else {
4956 this.selectItem(null);
4957 }
4958 var isActive = option != null && option !== this.select.querySelector('option[selected]');
4959 this.label.classList.toggle('ql-active', isActive);
4960 }
4961 }]);
4962
4963 return Picker;
4964}();
4965
4966exports.default = Picker;
4967
4968/***/ }),
4969/* 29 */
4970/***/ (function(module, exports, __webpack_require__) {
4971
4972"use strict";
4973
4974
4975var _parchment = __webpack_require__(0);
4976
4977var _parchment2 = _interopRequireDefault(_parchment);
4978
4979var _quill = __webpack_require__(5);
4980
4981var _quill2 = _interopRequireDefault(_quill);
4982
4983var _block = __webpack_require__(4);
4984
4985var _block2 = _interopRequireDefault(_block);
4986
4987var _break = __webpack_require__(16);
4988
4989var _break2 = _interopRequireDefault(_break);
4990
4991var _container = __webpack_require__(24);
4992
4993var _container2 = _interopRequireDefault(_container);
4994
4995var _cursor = __webpack_require__(23);
4996
4997var _cursor2 = _interopRequireDefault(_cursor);
4998
4999var _embed = __webpack_require__(25);
5000
5001var _embed2 = _interopRequireDefault(_embed);
5002
5003var _inline = __webpack_require__(6);
5004
5005var _inline2 = _interopRequireDefault(_inline);
5006
5007var _scroll = __webpack_require__(22);
5008
5009var _scroll2 = _interopRequireDefault(_scroll);
5010
5011var _text = __webpack_require__(7);
5012
5013var _text2 = _interopRequireDefault(_text);
5014
5015var _clipboard = __webpack_require__(55);
5016
5017var _clipboard2 = _interopRequireDefault(_clipboard);
5018
5019var _history = __webpack_require__(42);
5020
5021var _history2 = _interopRequireDefault(_history);
5022
5023var _keyboard = __webpack_require__(35);
5024
5025var _keyboard2 = _interopRequireDefault(_keyboard);
5026
5027function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5028
5029_quill2.default.register({
5030 'blots/block': _block2.default,
5031 'blots/block/embed': _block.BlockEmbed,
5032 'blots/break': _break2.default,
5033 'blots/container': _container2.default,
5034 'blots/cursor': _cursor2.default,
5035 'blots/embed': _embed2.default,
5036 'blots/inline': _inline2.default,
5037 'blots/scroll': _scroll2.default,
5038 'blots/text': _text2.default,
5039
5040 'modules/clipboard': _clipboard2.default,
5041 'modules/history': _history2.default,
5042 'modules/keyboard': _keyboard2.default
5043});
5044
5045_parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
5046
5047module.exports = _quill2.default;
5048
5049/***/ }),
5050/* 30 */
5051/***/ (function(module, exports, __webpack_require__) {
5052
5053"use strict";
5054
5055Object.defineProperty(exports, "__esModule", { value: true });
5056var Registry = __webpack_require__(1);
5057var ShadowBlot = /** @class */ (function () {
5058 function ShadowBlot(domNode) {
5059 this.domNode = domNode;
5060 this.attach();
5061 }
5062 Object.defineProperty(ShadowBlot.prototype, "statics", {
5063 // Hack for accessing inherited static methods
5064 get: function () {
5065 return this.constructor;
5066 },
5067 enumerable: true,
5068 configurable: true
5069 });
5070 ShadowBlot.create = function (value) {
5071 if (this.tagName == null) {
5072 throw new Registry.ParchmentError('Blot definition missing tagName');
5073 }
5074 var node;
5075 if (Array.isArray(this.tagName)) {
5076 if (typeof value === 'string') {
5077 value = value.toUpperCase();
5078 if (parseInt(value).toString() === value) {
5079 value = parseInt(value);
5080 }
5081 }
5082 if (typeof value === 'number') {
5083 node = document.createElement(this.tagName[value - 1]);
5084 }
5085 else if (this.tagName.indexOf(value) > -1) {
5086 node = document.createElement(value);
5087 }
5088 else {
5089 node = document.createElement(this.tagName[0]);
5090 }
5091 }
5092 else {
5093 node = document.createElement(this.tagName);
5094 }
5095 if (this.className) {
5096 node.classList.add(this.className);
5097 }
5098 return node;
5099 };
5100 ShadowBlot.prototype.attach = function () {
5101 this.domNode[Registry.DATA_KEY] = { blot: this };
5102 };
5103 ShadowBlot.prototype.clone = function () {
5104 var domNode = this.domNode.cloneNode(false);
5105 return Registry.create(domNode);
5106 };
5107 ShadowBlot.prototype.detach = function () {
5108 if (this.parent != null)
5109 this.parent.removeChild(this);
5110 delete this.domNode[Registry.DATA_KEY];
5111 };
5112 ShadowBlot.prototype.deleteAt = function (index, length) {
5113 var blot = this.isolate(index, length);
5114 blot.remove();
5115 };
5116 ShadowBlot.prototype.formatAt = function (index, length, name, value) {
5117 var blot = this.isolate(index, length);
5118 if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
5119 blot.wrap(name, value);
5120 }
5121 else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
5122 var parent = Registry.create(this.statics.scope);
5123 blot.wrap(parent);
5124 parent.format(name, value);
5125 }
5126 };
5127 ShadowBlot.prototype.insertAt = function (index, value, def) {
5128 var blot = (def == null) ? Registry.create('text', value) : Registry.create(value, def);
5129 var ref = this.split(index);
5130 this.parent.insertBefore(blot, ref);
5131 };
5132 ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
5133 if (this.parent != null) {
5134 this.parent.children.remove(this);
5135 }
5136 parentBlot.children.insertBefore(this, refBlot);
5137 if (refBlot != null) {
5138 var refDomNode = refBlot.domNode;
5139 }
5140 if (this.next == null || this.domNode.nextSibling != refDomNode) {
5141 parentBlot.domNode.insertBefore(this.domNode, (typeof refDomNode !== 'undefined') ? refDomNode : null);
5142 }
5143 this.parent = parentBlot;
5144 };
5145 ShadowBlot.prototype.isolate = function (index, length) {
5146 var target = this.split(index);
5147 target.split(length);
5148 return target;
5149 };
5150 ShadowBlot.prototype.length = function () {
5151 return 1;
5152 };
5153 ;
5154 ShadowBlot.prototype.offset = function (root) {
5155 if (root === void 0) { root = this.parent; }
5156 if (this.parent == null || this == root)
5157 return 0;
5158 return this.parent.children.offset(this) + this.parent.offset(root);
5159 };
5160 ShadowBlot.prototype.optimize = function (context) {
5161 // TODO clean up once we use WeakMap
5162 if (this.domNode[Registry.DATA_KEY] != null) {
5163 delete this.domNode[Registry.DATA_KEY].mutations;
5164 }
5165 };
5166 ShadowBlot.prototype.remove = function () {
5167 if (this.domNode.parentNode != null) {
5168 this.domNode.parentNode.removeChild(this.domNode);
5169 }
5170 this.detach();
5171 };
5172 ShadowBlot.prototype.replace = function (target) {
5173 if (target.parent == null)
5174 return;
5175 target.parent.insertBefore(this, target.next);
5176 target.remove();
5177 };
5178 ShadowBlot.prototype.replaceWith = function (name, value) {
5179 var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
5180 replacement.replace(this);
5181 return replacement;
5182 };
5183 ShadowBlot.prototype.split = function (index, force) {
5184 return index === 0 ? this : this.next;
5185 };
5186 ShadowBlot.prototype.update = function (mutations, context) {
5187 // Nothing to do by default
5188 };
5189 ShadowBlot.prototype.wrap = function (name, value) {
5190 var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
5191 if (this.parent != null) {
5192 this.parent.insertBefore(wrapper, this.next);
5193 }
5194 wrapper.appendChild(this);
5195 return wrapper;
5196 };
5197 ShadowBlot.blotName = 'abstract';
5198 return ShadowBlot;
5199}());
5200exports.default = ShadowBlot;
5201
5202
5203/***/ }),
5204/* 31 */
5205/***/ (function(module, exports, __webpack_require__) {
5206
5207"use strict";
5208
5209Object.defineProperty(exports, "__esModule", { value: true });
5210var attributor_1 = __webpack_require__(12);
5211var class_1 = __webpack_require__(32);
5212var style_1 = __webpack_require__(33);
5213var Registry = __webpack_require__(1);
5214var AttributorStore = /** @class */ (function () {
5215 function AttributorStore(domNode) {
5216 this.attributes = {};
5217 this.domNode = domNode;
5218 this.build();
5219 }
5220 AttributorStore.prototype.attribute = function (attribute, value) {
5221 if (value) {
5222 if (attribute.add(this.domNode, value)) {
5223 if (attribute.value(this.domNode) != null) {
5224 this.attributes[attribute.attrName] = attribute;
5225 }
5226 else {
5227 delete this.attributes[attribute.attrName];
5228 }
5229 }
5230 }
5231 else {
5232 attribute.remove(this.domNode);
5233 delete this.attributes[attribute.attrName];
5234 }
5235 };
5236 AttributorStore.prototype.build = function () {
5237 var _this = this;
5238 this.attributes = {};
5239 var attributes = attributor_1.default.keys(this.domNode);
5240 var classes = class_1.default.keys(this.domNode);
5241 var styles = style_1.default.keys(this.domNode);
5242 attributes.concat(classes).concat(styles).forEach(function (name) {
5243 var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
5244 if (attr instanceof attributor_1.default) {
5245 _this.attributes[attr.attrName] = attr;
5246 }
5247 });
5248 };
5249 AttributorStore.prototype.copy = function (target) {
5250 var _this = this;
5251 Object.keys(this.attributes).forEach(function (key) {
5252 var value = _this.attributes[key].value(_this.domNode);
5253 target.format(key, value);
5254 });
5255 };
5256 AttributorStore.prototype.move = function (target) {
5257 var _this = this;
5258 this.copy(target);
5259 Object.keys(this.attributes).forEach(function (key) {
5260 _this.attributes[key].remove(_this.domNode);
5261 });
5262 this.attributes = {};
5263 };
5264 AttributorStore.prototype.values = function () {
5265 var _this = this;
5266 return Object.keys(this.attributes).reduce(function (attributes, name) {
5267 attributes[name] = _this.attributes[name].value(_this.domNode);
5268 return attributes;
5269 }, {});
5270 };
5271 return AttributorStore;
5272}());
5273exports.default = AttributorStore;
5274
5275
5276/***/ }),
5277/* 32 */
5278/***/ (function(module, exports, __webpack_require__) {
5279
5280"use strict";
5281
5282var __extends = (this && this.__extends) || (function () {
5283 var extendStatics = Object.setPrototypeOf ||
5284 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5285 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5286 return function (d, b) {
5287 extendStatics(d, b);
5288 function __() { this.constructor = d; }
5289 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5290 };
5291})();
5292Object.defineProperty(exports, "__esModule", { value: true });
5293var attributor_1 = __webpack_require__(12);
5294function match(node, prefix) {
5295 var className = node.getAttribute('class') || '';
5296 return className.split(/\s+/).filter(function (name) {
5297 return name.indexOf(prefix + "-") === 0;
5298 });
5299}
5300var ClassAttributor = /** @class */ (function (_super) {
5301 __extends(ClassAttributor, _super);
5302 function ClassAttributor() {
5303 return _super !== null && _super.apply(this, arguments) || this;
5304 }
5305 ClassAttributor.keys = function (node) {
5306 return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
5307 return name.split('-').slice(0, -1).join('-');
5308 });
5309 };
5310 ClassAttributor.prototype.add = function (node, value) {
5311 if (!this.canAdd(node, value))
5312 return false;
5313 this.remove(node);
5314 node.classList.add(this.keyName + "-" + value);
5315 return true;
5316 };
5317 ClassAttributor.prototype.remove = function (node) {
5318 var matches = match(node, this.keyName);
5319 matches.forEach(function (name) {
5320 node.classList.remove(name);
5321 });
5322 if (node.classList.length === 0) {
5323 node.removeAttribute('class');
5324 }
5325 };
5326 ClassAttributor.prototype.value = function (node) {
5327 var result = match(node, this.keyName)[0] || '';
5328 var value = result.slice(this.keyName.length + 1); // +1 for hyphen
5329 return this.canAdd(node, value) ? value : '';
5330 };
5331 return ClassAttributor;
5332}(attributor_1.default));
5333exports.default = ClassAttributor;
5334
5335
5336/***/ }),
5337/* 33 */
5338/***/ (function(module, exports, __webpack_require__) {
5339
5340"use strict";
5341
5342var __extends = (this && this.__extends) || (function () {
5343 var extendStatics = Object.setPrototypeOf ||
5344 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5345 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5346 return function (d, b) {
5347 extendStatics(d, b);
5348 function __() { this.constructor = d; }
5349 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5350 };
5351})();
5352Object.defineProperty(exports, "__esModule", { value: true });
5353var attributor_1 = __webpack_require__(12);
5354function camelize(name) {
5355 var parts = name.split('-');
5356 var rest = parts.slice(1).map(function (part) {
5357 return part[0].toUpperCase() + part.slice(1);
5358 }).join('');
5359 return parts[0] + rest;
5360}
5361var StyleAttributor = /** @class */ (function (_super) {
5362 __extends(StyleAttributor, _super);
5363 function StyleAttributor() {
5364 return _super !== null && _super.apply(this, arguments) || this;
5365 }
5366 StyleAttributor.keys = function (node) {
5367 return (node.getAttribute('style') || '').split(';').map(function (value) {
5368 var arr = value.split(':');
5369 return arr[0].trim();
5370 });
5371 };
5372 StyleAttributor.prototype.add = function (node, value) {
5373 if (!this.canAdd(node, value))
5374 return false;
5375 node.style[camelize(this.keyName)] = value;
5376 return true;
5377 };
5378 StyleAttributor.prototype.remove = function (node) {
5379 node.style[camelize(this.keyName)] = '';
5380 if (!node.getAttribute('style')) {
5381 node.removeAttribute('style');
5382 }
5383 };
5384 StyleAttributor.prototype.value = function (node) {
5385 var value = node.style[camelize(this.keyName)];
5386 return this.canAdd(node, value) ? value : '';
5387 };
5388 return StyleAttributor;
5389}(attributor_1.default));
5390exports.default = StyleAttributor;
5391
5392
5393/***/ }),
5394/* 34 */
5395/***/ (function(module, exports, __webpack_require__) {
5396
5397"use strict";
5398
5399
5400Object.defineProperty(exports, "__esModule", {
5401 value: true
5402});
5403
5404var _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; }; }();
5405
5406function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5407
5408var Theme = function () {
5409 function Theme(quill, options) {
5410 _classCallCheck(this, Theme);
5411
5412 this.quill = quill;
5413 this.options = options;
5414 this.modules = {};
5415 }
5416
5417 _createClass(Theme, [{
5418 key: 'init',
5419 value: function init() {
5420 var _this = this;
5421
5422 Object.keys(this.options.modules).forEach(function (name) {
5423 if (_this.modules[name] == null) {
5424 _this.addModule(name);
5425 }
5426 });
5427 }
5428 }, {
5429 key: 'addModule',
5430 value: function addModule(name) {
5431 var moduleClass = this.quill.constructor.import('modules/' + name);
5432 this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
5433 return this.modules[name];
5434 }
5435 }]);
5436
5437 return Theme;
5438}();
5439
5440Theme.DEFAULTS = {
5441 modules: {}
5442};
5443Theme.themes = {
5444 'default': Theme
5445};
5446
5447exports.default = Theme;
5448
5449/***/ }),
5450/* 35 */
5451/***/ (function(module, exports, __webpack_require__) {
5452
5453"use strict";
5454
5455
5456Object.defineProperty(exports, "__esModule", {
5457 value: true
5458});
5459exports.SHORTKEY = exports.default = undefined;
5460
5461var _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; };
5462
5463var _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"); } }; }();
5464
5465var _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; }; }();
5466
5467var _clone = __webpack_require__(21);
5468
5469var _clone2 = _interopRequireDefault(_clone);
5470
5471var _deepEqual = __webpack_require__(11);
5472
5473var _deepEqual2 = _interopRequireDefault(_deepEqual);
5474
5475var _extend = __webpack_require__(3);
5476
5477var _extend2 = _interopRequireDefault(_extend);
5478
5479var _quillDelta = __webpack_require__(2);
5480
5481var _quillDelta2 = _interopRequireDefault(_quillDelta);
5482
5483var _op = __webpack_require__(20);
5484
5485var _op2 = _interopRequireDefault(_op);
5486
5487var _parchment = __webpack_require__(0);
5488
5489var _parchment2 = _interopRequireDefault(_parchment);
5490
5491var _embed = __webpack_require__(25);
5492
5493var _embed2 = _interopRequireDefault(_embed);
5494
5495var _quill = __webpack_require__(5);
5496
5497var _quill2 = _interopRequireDefault(_quill);
5498
5499var _logger = __webpack_require__(10);
5500
5501var _logger2 = _interopRequireDefault(_logger);
5502
5503var _module = __webpack_require__(9);
5504
5505var _module2 = _interopRequireDefault(_module);
5506
5507function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5508
5509function _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; }
5510
5511function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5512
5513function _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; }
5514
5515function _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; }
5516
5517var debug = (0, _logger2.default)('quill:keyboard');
5518
5519var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
5520
5521var Keyboard = function (_Module) {
5522 _inherits(Keyboard, _Module);
5523
5524 _createClass(Keyboard, null, [{
5525 key: 'match',
5526 value: function match(evt, binding) {
5527 binding = normalize(binding);
5528 if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
5529 return !!binding[key] !== evt[key] && binding[key] !== null;
5530 })) {
5531 return false;
5532 }
5533 return binding.key === (evt.which || evt.keyCode);
5534 }
5535 }]);
5536
5537 function Keyboard(quill, options) {
5538 _classCallCheck(this, Keyboard);
5539
5540 var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
5541
5542 _this.bindings = {};
5543 Object.keys(_this.options.bindings).forEach(function (name) {
5544 if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {
5545 return;
5546 }
5547 if (_this.options.bindings[name]) {
5548 _this.addBinding(_this.options.bindings[name]);
5549 }
5550 });
5551 _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
5552 _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
5553 if (/Firefox/i.test(navigator.userAgent)) {
5554 // Need to handle delete and backspace for Firefox in the general case #1171
5555 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
5556 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
5557 } else {
5558 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
5559 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
5560 }
5561 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
5562 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
5563 _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
5564 _this.listen();
5565 return _this;
5566 }
5567
5568 _createClass(Keyboard, [{
5569 key: 'addBinding',
5570 value: function addBinding(key) {
5571 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5572 var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5573
5574 var binding = normalize(key);
5575 if (binding == null || binding.key == null) {
5576 return debug.warn('Attempted to add invalid keyboard binding', binding);
5577 }
5578 if (typeof context === 'function') {
5579 context = { handler: context };
5580 }
5581 if (typeof handler === 'function') {
5582 handler = { handler: handler };
5583 }
5584 binding = (0, _extend2.default)(binding, context, handler);
5585 this.bindings[binding.key] = this.bindings[binding.key] || [];
5586 this.bindings[binding.key].push(binding);
5587 }
5588 }, {
5589 key: 'listen',
5590 value: function listen() {
5591 var _this2 = this;
5592
5593 this.quill.root.addEventListener('keydown', function (evt) {
5594 if (evt.defaultPrevented) return;
5595 var which = evt.which || evt.keyCode;
5596 var bindings = (_this2.bindings[which] || []).filter(function (binding) {
5597 return Keyboard.match(evt, binding);
5598 });
5599 if (bindings.length === 0) return;
5600 var range = _this2.quill.getSelection();
5601 if (range == null || !_this2.quill.hasFocus()) return;
5602
5603 var _quill$getLine = _this2.quill.getLine(range.index),
5604 _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
5605 line = _quill$getLine2[0],
5606 offset = _quill$getLine2[1];
5607
5608 var _quill$getLeaf = _this2.quill.getLeaf(range.index),
5609 _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
5610 leafStart = _quill$getLeaf2[0],
5611 offsetStart = _quill$getLeaf2[1];
5612
5613 var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
5614 _ref2 = _slicedToArray(_ref, 2),
5615 leafEnd = _ref2[0],
5616 offsetEnd = _ref2[1];
5617
5618 var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
5619 var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
5620 var curContext = {
5621 collapsed: range.length === 0,
5622 empty: range.length === 0 && line.length() <= 1,
5623 format: _this2.quill.getFormat(range),
5624 offset: offset,
5625 prefix: prefixText,
5626 suffix: suffixText
5627 };
5628 var prevented = bindings.some(function (binding) {
5629 if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
5630 if (binding.empty != null && binding.empty !== curContext.empty) return false;
5631 if (binding.offset != null && binding.offset !== curContext.offset) return false;
5632 if (Array.isArray(binding.format)) {
5633 // any format is present
5634 if (binding.format.every(function (name) {
5635 return curContext.format[name] == null;
5636 })) {
5637 return false;
5638 }
5639 } else if (_typeof(binding.format) === 'object') {
5640 // all formats must match
5641 if (!Object.keys(binding.format).every(function (name) {
5642 if (binding.format[name] === true) return curContext.format[name] != null;
5643 if (binding.format[name] === false) return curContext.format[name] == null;
5644 return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
5645 })) {
5646 return false;
5647 }
5648 }
5649 if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
5650 if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
5651 return binding.handler.call(_this2, range, curContext) !== true;
5652 });
5653 if (prevented) {
5654 evt.preventDefault();
5655 }
5656 });
5657 }
5658 }]);
5659
5660 return Keyboard;
5661}(_module2.default);
5662
5663Keyboard.keys = {
5664 BACKSPACE: 8,
5665 TAB: 9,
5666 ENTER: 13,
5667 ESCAPE: 27,
5668 LEFT: 37,
5669 UP: 38,
5670 RIGHT: 39,
5671 DOWN: 40,
5672 DELETE: 46
5673};
5674
5675Keyboard.DEFAULTS = {
5676 bindings: {
5677 'bold': makeFormatHandler('bold'),
5678 'italic': makeFormatHandler('italic'),
5679 'underline': makeFormatHandler('underline'),
5680 'indent': {
5681 // highlight tab or tab at beginning of list, indent or blockquote
5682 key: Keyboard.keys.TAB,
5683 format: ['blockquote', 'indent', 'list'],
5684 handler: function handler(range, context) {
5685 if (context.collapsed && context.offset !== 0) return true;
5686 this.quill.format('indent', '+1', _quill2.default.sources.USER);
5687 }
5688 },
5689 'outdent': {
5690 key: Keyboard.keys.TAB,
5691 shiftKey: true,
5692 format: ['blockquote', 'indent', 'list'],
5693 // highlight tab or tab at beginning of list, indent or blockquote
5694 handler: function handler(range, context) {
5695 if (context.collapsed && context.offset !== 0) return true;
5696 this.quill.format('indent', '-1', _quill2.default.sources.USER);
5697 }
5698 },
5699 'outdent backspace': {
5700 key: Keyboard.keys.BACKSPACE,
5701 collapsed: true,
5702 shiftKey: null,
5703 metaKey: null,
5704 ctrlKey: null,
5705 altKey: null,
5706 format: ['indent', 'list'],
5707 offset: 0,
5708 handler: function handler(range, context) {
5709 if (context.format.indent != null) {
5710 this.quill.format('indent', '-1', _quill2.default.sources.USER);
5711 } else if (context.format.list != null) {
5712 this.quill.format('list', false, _quill2.default.sources.USER);
5713 }
5714 }
5715 },
5716 'indent code-block': makeCodeBlockHandler(true),
5717 'outdent code-block': makeCodeBlockHandler(false),
5718 'remove tab': {
5719 key: Keyboard.keys.TAB,
5720 shiftKey: true,
5721 collapsed: true,
5722 prefix: /\t$/,
5723 handler: function handler(range) {
5724 this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
5725 }
5726 },
5727 'tab': {
5728 key: Keyboard.keys.TAB,
5729 handler: function handler(range) {
5730 this.quill.history.cutoff();
5731 var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\t');
5732 this.quill.updateContents(delta, _quill2.default.sources.USER);
5733 this.quill.history.cutoff();
5734 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
5735 }
5736 },
5737 'list empty enter': {
5738 key: Keyboard.keys.ENTER,
5739 collapsed: true,
5740 format: ['list'],
5741 empty: true,
5742 handler: function handler(range, context) {
5743 this.quill.format('list', false, _quill2.default.sources.USER);
5744 if (context.format.indent) {
5745 this.quill.format('indent', false, _quill2.default.sources.USER);
5746 }
5747 }
5748 },
5749 'checklist enter': {
5750 key: Keyboard.keys.ENTER,
5751 collapsed: true,
5752 format: { list: 'checked' },
5753 handler: function handler(range) {
5754 var _quill$getLine3 = this.quill.getLine(range.index),
5755 _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),
5756 line = _quill$getLine4[0],
5757 offset = _quill$getLine4[1];
5758
5759 var delta = new _quillDelta2.default().retain(range.index).insert('\n', { list: 'checked' }).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });
5760 this.quill.updateContents(delta, _quill2.default.sources.USER);
5761 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
5762 this.quill.scrollIntoView();
5763 }
5764 },
5765 'header enter': {
5766 key: Keyboard.keys.ENTER,
5767 collapsed: true,
5768 format: ['header'],
5769 suffix: /^$/,
5770 handler: function handler(range, context) {
5771 var _quill$getLine5 = this.quill.getLine(range.index),
5772 _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),
5773 line = _quill$getLine6[0],
5774 offset = _quill$getLine6[1];
5775
5776 var delta = new _quillDelta2.default().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });
5777 this.quill.updateContents(delta, _quill2.default.sources.USER);
5778 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
5779 this.quill.scrollIntoView();
5780 }
5781 },
5782 'list autofill': {
5783 key: ' ',
5784 collapsed: true,
5785 format: { list: false },
5786 prefix: /^\s*?(1\.|-|\[ ?\]|\[x\])$/,
5787 handler: function handler(range, context) {
5788 var length = context.prefix.length;
5789
5790 var _quill$getLine7 = this.quill.getLine(range.index),
5791 _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),
5792 line = _quill$getLine8[0],
5793 offset = _quill$getLine8[1];
5794
5795 if (offset > length) return true;
5796 var value = void 0;
5797 switch (context.prefix.trim()) {
5798 case '[]':case '[ ]':
5799 value = 'unchecked';
5800 break;
5801 case '[x]':
5802 value = 'checked';
5803 break;
5804 case '-':
5805 value = 'bullet';
5806 break;
5807 default:
5808 value = 'ordered';
5809 }
5810 this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);
5811 this.quill.history.cutoff();
5812 var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });
5813 this.quill.updateContents(delta, _quill2.default.sources.USER);
5814 this.quill.history.cutoff();
5815 this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
5816 }
5817 },
5818 'code exit': {
5819 key: Keyboard.keys.ENTER,
5820 collapsed: true,
5821 format: ['code-block'],
5822 prefix: /\n\n$/,
5823 suffix: /^\s+$/,
5824 handler: function handler(range) {
5825 var _quill$getLine9 = this.quill.getLine(range.index),
5826 _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),
5827 line = _quill$getLine10[0],
5828 offset = _quill$getLine10[1];
5829
5830 var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);
5831 this.quill.updateContents(delta, _quill2.default.sources.USER);
5832 }
5833 },
5834 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),
5835 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),
5836 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),
5837 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)
5838 }
5839};
5840
5841function makeEmbedArrowHandler(key, shiftKey) {
5842 var _ref3;
5843
5844 var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';
5845 return _ref3 = {
5846 key: key,
5847 shiftKey: shiftKey
5848 }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {
5849 var index = range.index;
5850 if (key === Keyboard.keys.RIGHT) {
5851 index += range.length + 1;
5852 }
5853
5854 var _quill$getLeaf3 = this.quill.getLeaf(index),
5855 _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),
5856 leaf = _quill$getLeaf4[0];
5857
5858 if (!(leaf instanceof _embed2.default)) return true;
5859 if (key === Keyboard.keys.LEFT) {
5860 if (shiftKey) {
5861 this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);
5862 } else {
5863 this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);
5864 }
5865 } else {
5866 if (shiftKey) {
5867 this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);
5868 } else {
5869 this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);
5870 }
5871 }
5872 return false;
5873 }), _ref3;
5874}
5875
5876function handleBackspace(range, context) {
5877 if (range.index === 0 || this.quill.getLength() <= 1) return;
5878
5879 var _quill$getLine11 = this.quill.getLine(range.index),
5880 _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
5881 line = _quill$getLine12[0];
5882
5883 var formats = {};
5884 if (context.offset === 0) {
5885 var _quill$getLine13 = this.quill.getLine(range.index - 1),
5886 _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),
5887 prev = _quill$getLine14[0];
5888
5889 if (prev != null && prev.length() > 1) {
5890 var curFormats = line.formats();
5891 var prevFormats = this.quill.getFormat(range.index - 1, 1);
5892 formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
5893 }
5894 }
5895 // Check for astral symbols
5896 var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
5897 this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
5898 if (Object.keys(formats).length > 0) {
5899 this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
5900 }
5901 this.quill.focus();
5902}
5903
5904function handleDelete(range, context) {
5905 // Check for astral symbols
5906 var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
5907 if (range.index >= this.quill.getLength() - length) return;
5908 var formats = {},
5909 nextLength = 0;
5910
5911 var _quill$getLine15 = this.quill.getLine(range.index),
5912 _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),
5913 line = _quill$getLine16[0];
5914
5915 if (context.offset >= line.length() - 1) {
5916 var _quill$getLine17 = this.quill.getLine(range.index + 1),
5917 _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),
5918 next = _quill$getLine18[0];
5919
5920 if (next) {
5921 var curFormats = line.formats();
5922 var nextFormats = this.quill.getFormat(range.index, 1);
5923 formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
5924 nextLength = next.length();
5925 }
5926 }
5927 this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
5928 if (Object.keys(formats).length > 0) {
5929 this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
5930 }
5931}
5932
5933function handleDeleteRange(range) {
5934 var lines = this.quill.getLines(range);
5935 var formats = {};
5936 if (lines.length > 1) {
5937 var firstFormats = lines[0].formats();
5938 var lastFormats = lines[lines.length - 1].formats();
5939 formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};
5940 }
5941 this.quill.deleteText(range, _quill2.default.sources.USER);
5942 if (Object.keys(formats).length > 0) {
5943 this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);
5944 }
5945 this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
5946 this.quill.focus();
5947}
5948
5949function handleEnter(range, context) {
5950 var _this3 = this;
5951
5952 if (range.length > 0) {
5953 this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
5954 }
5955 var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
5956 if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
5957 lineFormats[format] = context.format[format];
5958 }
5959 return lineFormats;
5960 }, {});
5961 this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
5962 // Earlier scroll.deleteAt might have messed up our selection,
5963 // so insertText's built in selection preservation is not reliable
5964 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
5965 this.quill.focus();
5966 Object.keys(context.format).forEach(function (name) {
5967 if (lineFormats[name] != null) return;
5968 if (Array.isArray(context.format[name])) return;
5969 if (name === 'link') return;
5970 _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
5971 });
5972}
5973
5974function makeCodeBlockHandler(indent) {
5975 return {
5976 key: Keyboard.keys.TAB,
5977 shiftKey: !indent,
5978 format: { 'code-block': true },
5979 handler: function handler(range) {
5980 var CodeBlock = _parchment2.default.query('code-block');
5981 var index = range.index,
5982 length = range.length;
5983
5984 var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
5985 _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
5986 block = _quill$scroll$descend2[0],
5987 offset = _quill$scroll$descend2[1];
5988
5989 if (block == null) return;
5990 var scrollIndex = this.quill.getIndex(block);
5991 var start = block.newlineIndex(offset, true) + 1;
5992 var end = block.newlineIndex(scrollIndex + offset + length);
5993 var lines = block.domNode.textContent.slice(start, end).split('\n');
5994 offset = 0;
5995 lines.forEach(function (line, i) {
5996 if (indent) {
5997 block.insertAt(start + offset, CodeBlock.TAB);
5998 offset += CodeBlock.TAB.length;
5999 if (i === 0) {
6000 index += CodeBlock.TAB.length;
6001 } else {
6002 length += CodeBlock.TAB.length;
6003 }
6004 } else if (line.startsWith(CodeBlock.TAB)) {
6005 block.deleteAt(start + offset, CodeBlock.TAB.length);
6006 offset -= CodeBlock.TAB.length;
6007 if (i === 0) {
6008 index -= CodeBlock.TAB.length;
6009 } else {
6010 length -= CodeBlock.TAB.length;
6011 }
6012 }
6013 offset += line.length + 1;
6014 });
6015 this.quill.update(_quill2.default.sources.USER);
6016 this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
6017 }
6018 };
6019}
6020
6021function makeFormatHandler(format) {
6022 return {
6023 key: format[0].toUpperCase(),
6024 shortKey: true,
6025 handler: function handler(range, context) {
6026 this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
6027 }
6028 };
6029}
6030
6031function normalize(binding) {
6032 if (typeof binding === 'string' || typeof binding === 'number') {
6033 return normalize({ key: binding });
6034 }
6035 if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
6036 binding = (0, _clone2.default)(binding, false);
6037 }
6038 if (typeof binding.key === 'string') {
6039 if (Keyboard.keys[binding.key.toUpperCase()] != null) {
6040 binding.key = Keyboard.keys[binding.key.toUpperCase()];
6041 } else if (binding.key.length === 1) {
6042 binding.key = binding.key.toUpperCase().charCodeAt(0);
6043 } else {
6044 return null;
6045 }
6046 }
6047 if (binding.shortKey) {
6048 binding[SHORTKEY] = binding.shortKey;
6049 delete binding.shortKey;
6050 }
6051 return binding;
6052}
6053
6054exports.default = Keyboard;
6055exports.SHORTKEY = SHORTKEY;
6056
6057/***/ }),
6058/* 36 */
6059/***/ (function(module, exports, __webpack_require__) {
6060
6061"use strict";
6062
6063
6064Object.defineProperty(exports, "__esModule", {
6065 value: true
6066});
6067exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
6068
6069var _parchment = __webpack_require__(0);
6070
6071var _parchment2 = _interopRequireDefault(_parchment);
6072
6073function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6074
6075var config = {
6076 scope: _parchment2.default.Scope.BLOCK,
6077 whitelist: ['right', 'center', 'justify']
6078};
6079
6080var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
6081var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
6082var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
6083
6084exports.AlignAttribute = AlignAttribute;
6085exports.AlignClass = AlignClass;
6086exports.AlignStyle = AlignStyle;
6087
6088/***/ }),
6089/* 37 */
6090/***/ (function(module, exports, __webpack_require__) {
6091
6092"use strict";
6093
6094
6095Object.defineProperty(exports, "__esModule", {
6096 value: true
6097});
6098exports.BackgroundStyle = exports.BackgroundClass = undefined;
6099
6100var _parchment = __webpack_require__(0);
6101
6102var _parchment2 = _interopRequireDefault(_parchment);
6103
6104var _color = __webpack_require__(26);
6105
6106function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6107
6108var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
6109 scope: _parchment2.default.Scope.INLINE
6110});
6111var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
6112 scope: _parchment2.default.Scope.INLINE
6113});
6114
6115exports.BackgroundClass = BackgroundClass;
6116exports.BackgroundStyle = BackgroundStyle;
6117
6118/***/ }),
6119/* 38 */
6120/***/ (function(module, exports, __webpack_require__) {
6121
6122"use strict";
6123
6124
6125Object.defineProperty(exports, "__esModule", {
6126 value: true
6127});
6128exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
6129
6130var _parchment = __webpack_require__(0);
6131
6132var _parchment2 = _interopRequireDefault(_parchment);
6133
6134function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6135
6136var config = {
6137 scope: _parchment2.default.Scope.BLOCK,
6138 whitelist: ['rtl']
6139};
6140
6141var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
6142var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
6143var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
6144
6145exports.DirectionAttribute = DirectionAttribute;
6146exports.DirectionClass = DirectionClass;
6147exports.DirectionStyle = DirectionStyle;
6148
6149/***/ }),
6150/* 39 */
6151/***/ (function(module, exports, __webpack_require__) {
6152
6153"use strict";
6154
6155
6156Object.defineProperty(exports, "__esModule", {
6157 value: true
6158});
6159exports.FontClass = exports.FontStyle = undefined;
6160
6161var _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; }; }();
6162
6163var _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); } };
6164
6165var _parchment = __webpack_require__(0);
6166
6167var _parchment2 = _interopRequireDefault(_parchment);
6168
6169function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6170
6171function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6172
6173function _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; }
6174
6175function _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; }
6176
6177var config = {
6178 scope: _parchment2.default.Scope.INLINE,
6179 whitelist: ['serif', 'monospace']
6180};
6181
6182var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
6183
6184var FontStyleAttributor = function (_Parchment$Attributor) {
6185 _inherits(FontStyleAttributor, _Parchment$Attributor);
6186
6187 function FontStyleAttributor() {
6188 _classCallCheck(this, FontStyleAttributor);
6189
6190 return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
6191 }
6192
6193 _createClass(FontStyleAttributor, [{
6194 key: 'value',
6195 value: function value(node) {
6196 return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
6197 }
6198 }]);
6199
6200 return FontStyleAttributor;
6201}(_parchment2.default.Attributor.Style);
6202
6203var FontStyle = new FontStyleAttributor('font', 'font-family', config);
6204
6205exports.FontStyle = FontStyle;
6206exports.FontClass = FontClass;
6207
6208/***/ }),
6209/* 40 */
6210/***/ (function(module, exports, __webpack_require__) {
6211
6212"use strict";
6213
6214
6215Object.defineProperty(exports, "__esModule", {
6216 value: true
6217});
6218exports.SizeStyle = exports.SizeClass = undefined;
6219
6220var _parchment = __webpack_require__(0);
6221
6222var _parchment2 = _interopRequireDefault(_parchment);
6223
6224function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6225
6226var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
6227 scope: _parchment2.default.Scope.INLINE,
6228 whitelist: ['small', 'large', 'huge']
6229});
6230var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
6231 scope: _parchment2.default.Scope.INLINE,
6232 whitelist: ['10px', '18px', '32px']
6233});
6234
6235exports.SizeClass = SizeClass;
6236exports.SizeStyle = SizeStyle;
6237
6238/***/ }),
6239/* 41 */
6240/***/ (function(module, exports, __webpack_require__) {
6241
6242"use strict";
6243
6244
6245module.exports = {
6246 'align': {
6247 '': __webpack_require__(76),
6248 'center': __webpack_require__(77),
6249 'right': __webpack_require__(78),
6250 'justify': __webpack_require__(79)
6251 },
6252 'background': __webpack_require__(80),
6253 'blockquote': __webpack_require__(81),
6254 'bold': __webpack_require__(82),
6255 'clean': __webpack_require__(83),
6256 'code': __webpack_require__(58),
6257 'code-block': __webpack_require__(58),
6258 'color': __webpack_require__(84),
6259 'direction': {
6260 '': __webpack_require__(85),
6261 'rtl': __webpack_require__(86)
6262 },
6263 'float': {
6264 'center': __webpack_require__(87),
6265 'full': __webpack_require__(88),
6266 'left': __webpack_require__(89),
6267 'right': __webpack_require__(90)
6268 },
6269 'formula': __webpack_require__(91),
6270 'header': {
6271 '1': __webpack_require__(92),
6272 '2': __webpack_require__(93)
6273 },
6274 'italic': __webpack_require__(94),
6275 'image': __webpack_require__(95),
6276 'indent': {
6277 '+1': __webpack_require__(96),
6278 '-1': __webpack_require__(97)
6279 },
6280 'link': __webpack_require__(98),
6281 'list': {
6282 'ordered': __webpack_require__(99),
6283 'bullet': __webpack_require__(100),
6284 'check': __webpack_require__(101)
6285 },
6286 'script': {
6287 'sub': __webpack_require__(102),
6288 'super': __webpack_require__(103)
6289 },
6290 'strike': __webpack_require__(104),
6291 'underline': __webpack_require__(105),
6292 'video': __webpack_require__(106)
6293};
6294
6295/***/ }),
6296/* 42 */
6297/***/ (function(module, exports, __webpack_require__) {
6298
6299"use strict";
6300
6301
6302Object.defineProperty(exports, "__esModule", {
6303 value: true
6304});
6305exports.getLastChangeIndex = exports.default = undefined;
6306
6307var _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; }; }();
6308
6309var _parchment = __webpack_require__(0);
6310
6311var _parchment2 = _interopRequireDefault(_parchment);
6312
6313var _quill = __webpack_require__(5);
6314
6315var _quill2 = _interopRequireDefault(_quill);
6316
6317var _module = __webpack_require__(9);
6318
6319var _module2 = _interopRequireDefault(_module);
6320
6321function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6322
6323function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6324
6325function _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; }
6326
6327function _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; }
6328
6329var History = function (_Module) {
6330 _inherits(History, _Module);
6331
6332 function History(quill, options) {
6333 _classCallCheck(this, History);
6334
6335 var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
6336
6337 _this.lastRecorded = 0;
6338 _this.ignoreChange = false;
6339 _this.clear();
6340 _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
6341 if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
6342 if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
6343 _this.record(delta, oldDelta);
6344 } else {
6345 _this.transform(delta);
6346 }
6347 });
6348 _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
6349 _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
6350 if (/Win/i.test(navigator.platform)) {
6351 _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
6352 }
6353 return _this;
6354 }
6355
6356 _createClass(History, [{
6357 key: 'change',
6358 value: function change(source, dest) {
6359 if (this.stack[source].length === 0) return;
6360 var delta = this.stack[source].pop();
6361 this.lastRecorded = 0;
6362 this.ignoreChange = true;
6363 this.quill.updateContents(delta[source], _quill2.default.sources.USER);
6364 this.ignoreChange = false;
6365 var index = getLastChangeIndex(delta[source]);
6366 this.quill.setSelection(index);
6367 this.stack[dest].push(delta);
6368 }
6369 }, {
6370 key: 'clear',
6371 value: function clear() {
6372 this.stack = { undo: [], redo: [] };
6373 }
6374 }, {
6375 key: 'cutoff',
6376 value: function cutoff() {
6377 this.lastRecorded = 0;
6378 }
6379 }, {
6380 key: 'record',
6381 value: function record(changeDelta, oldDelta) {
6382 if (changeDelta.ops.length === 0) return;
6383 this.stack.redo = [];
6384 var undoDelta = this.quill.getContents().diff(oldDelta);
6385 var timestamp = Date.now();
6386 if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
6387 var delta = this.stack.undo.pop();
6388 undoDelta = undoDelta.compose(delta.undo);
6389 changeDelta = delta.redo.compose(changeDelta);
6390 } else {
6391 this.lastRecorded = timestamp;
6392 }
6393 this.stack.undo.push({
6394 redo: changeDelta,
6395 undo: undoDelta
6396 });
6397 if (this.stack.undo.length > this.options.maxStack) {
6398 this.stack.undo.shift();
6399 }
6400 }
6401 }, {
6402 key: 'redo',
6403 value: function redo() {
6404 this.change('redo', 'undo');
6405 }
6406 }, {
6407 key: 'transform',
6408 value: function transform(delta) {
6409 this.stack.undo.forEach(function (change) {
6410 change.undo = delta.transform(change.undo, true);
6411 change.redo = delta.transform(change.redo, true);
6412 });
6413 this.stack.redo.forEach(function (change) {
6414 change.undo = delta.transform(change.undo, true);
6415 change.redo = delta.transform(change.redo, true);
6416 });
6417 }
6418 }, {
6419 key: 'undo',
6420 value: function undo() {
6421 this.change('undo', 'redo');
6422 }
6423 }]);
6424
6425 return History;
6426}(_module2.default);
6427
6428History.DEFAULTS = {
6429 delay: 1000,
6430 maxStack: 100,
6431 userOnly: false
6432};
6433
6434function endsWithNewlineChange(delta) {
6435 var lastOp = delta.ops[delta.ops.length - 1];
6436 if (lastOp == null) return false;
6437 if (lastOp.insert != null) {
6438 return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
6439 }
6440 if (lastOp.attributes != null) {
6441 return Object.keys(lastOp.attributes).some(function (attr) {
6442 return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
6443 });
6444 }
6445 return false;
6446}
6447
6448function getLastChangeIndex(delta) {
6449 var deleteLength = delta.reduce(function (length, op) {
6450 length += op.delete || 0;
6451 return length;
6452 }, 0);
6453 var changeIndex = delta.length() - deleteLength;
6454 if (endsWithNewlineChange(delta)) {
6455 changeIndex -= 1;
6456 }
6457 return changeIndex;
6458}
6459
6460exports.default = History;
6461exports.getLastChangeIndex = getLastChangeIndex;
6462
6463/***/ }),
6464/* 43 */
6465/***/ (function(module, exports, __webpack_require__) {
6466
6467"use strict";
6468
6469
6470Object.defineProperty(exports, "__esModule", {
6471 value: true
6472});
6473exports.default = exports.BaseTooltip = undefined;
6474
6475var _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; }; }();
6476
6477var _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); } };
6478
6479var _extend = __webpack_require__(3);
6480
6481var _extend2 = _interopRequireDefault(_extend);
6482
6483var _quillDelta = __webpack_require__(2);
6484
6485var _quillDelta2 = _interopRequireDefault(_quillDelta);
6486
6487var _emitter = __webpack_require__(8);
6488
6489var _emitter2 = _interopRequireDefault(_emitter);
6490
6491var _keyboard = __webpack_require__(35);
6492
6493var _keyboard2 = _interopRequireDefault(_keyboard);
6494
6495var _theme = __webpack_require__(34);
6496
6497var _theme2 = _interopRequireDefault(_theme);
6498
6499var _colorPicker = __webpack_require__(59);
6500
6501var _colorPicker2 = _interopRequireDefault(_colorPicker);
6502
6503var _iconPicker = __webpack_require__(60);
6504
6505var _iconPicker2 = _interopRequireDefault(_iconPicker);
6506
6507var _picker = __webpack_require__(28);
6508
6509var _picker2 = _interopRequireDefault(_picker);
6510
6511var _tooltip = __webpack_require__(61);
6512
6513var _tooltip2 = _interopRequireDefault(_tooltip);
6514
6515function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6516
6517function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6518
6519function _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; }
6520
6521function _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; }
6522
6523var ALIGNS = [false, 'center', 'right', 'justify'];
6524
6525var 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"];
6526
6527var FONTS = [false, 'serif', 'monospace'];
6528
6529var HEADERS = ['1', '2', '3', false];
6530
6531var SIZES = ['small', false, 'large', 'huge'];
6532
6533var BaseTheme = function (_Theme) {
6534 _inherits(BaseTheme, _Theme);
6535
6536 function BaseTheme(quill, options) {
6537 _classCallCheck(this, BaseTheme);
6538
6539 var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
6540
6541 var listener = function listener(e) {
6542 if (!document.body.contains(quill.root)) {
6543 return document.body.removeEventListener('click', listener);
6544 }
6545 if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
6546 _this.tooltip.hide();
6547 }
6548 if (_this.pickers != null) {
6549 _this.pickers.forEach(function (picker) {
6550 if (!picker.container.contains(e.target)) {
6551 picker.close();
6552 }
6553 });
6554 }
6555 };
6556 document.body.addEventListener('click', listener);
6557 return _this;
6558 }
6559
6560 _createClass(BaseTheme, [{
6561 key: 'addModule',
6562 value: function addModule(name) {
6563 var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
6564 if (name === 'toolbar') {
6565 this.extendToolbar(module);
6566 }
6567 return module;
6568 }
6569 }, {
6570 key: 'buildButtons',
6571 value: function buildButtons(buttons, icons) {
6572 buttons.forEach(function (button) {
6573 var className = button.getAttribute('class') || '';
6574 className.split(/\s+/).forEach(function (name) {
6575 if (!name.startsWith('ql-')) return;
6576 name = name.slice('ql-'.length);
6577 if (icons[name] == null) return;
6578 if (name === 'direction') {
6579 button.innerHTML = icons[name][''] + icons[name]['rtl'];
6580 } else if (typeof icons[name] === 'string') {
6581 button.innerHTML = icons[name];
6582 } else {
6583 var value = button.value || '';
6584 if (value != null && icons[name][value]) {
6585 button.innerHTML = icons[name][value];
6586 }
6587 }
6588 });
6589 });
6590 }
6591 }, {
6592 key: 'buildPickers',
6593 value: function buildPickers(selects, icons) {
6594 var _this2 = this;
6595
6596 this.pickers = selects.map(function (select) {
6597 if (select.classList.contains('ql-align')) {
6598 if (select.querySelector('option') == null) {
6599 fillSelect(select, ALIGNS);
6600 }
6601 return new _iconPicker2.default(select, icons.align);
6602 } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
6603 var format = select.classList.contains('ql-background') ? 'background' : 'color';
6604 if (select.querySelector('option') == null) {
6605 fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
6606 }
6607 return new _colorPicker2.default(select, icons[format]);
6608 } else {
6609 if (select.querySelector('option') == null) {
6610 if (select.classList.contains('ql-font')) {
6611 fillSelect(select, FONTS);
6612 } else if (select.classList.contains('ql-header')) {
6613 fillSelect(select, HEADERS);
6614 } else if (select.classList.contains('ql-size')) {
6615 fillSelect(select, SIZES);
6616 }
6617 }
6618 return new _picker2.default(select);
6619 }
6620 });
6621 var update = function update() {
6622 _this2.pickers.forEach(function (picker) {
6623 picker.update();
6624 });
6625 };
6626 this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
6627 }
6628 }]);
6629
6630 return BaseTheme;
6631}(_theme2.default);
6632
6633BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
6634 modules: {
6635 toolbar: {
6636 handlers: {
6637 formula: function formula() {
6638 this.quill.theme.tooltip.edit('formula');
6639 },
6640 image: function image() {
6641 var _this3 = this;
6642
6643 var fileInput = this.container.querySelector('input.ql-image[type=file]');
6644 if (fileInput == null) {
6645 fileInput = document.createElement('input');
6646 fileInput.setAttribute('type', 'file');
6647 fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
6648 fileInput.classList.add('ql-image');
6649 fileInput.addEventListener('change', function () {
6650 if (fileInput.files != null && fileInput.files[0] != null) {
6651 var reader = new FileReader();
6652 reader.onload = function (e) {
6653 var range = _this3.quill.getSelection(true);
6654 _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
6655 _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);
6656 fileInput.value = "";
6657 };
6658 reader.readAsDataURL(fileInput.files[0]);
6659 }
6660 });
6661 this.container.appendChild(fileInput);
6662 }
6663 fileInput.click();
6664 },
6665 video: function video() {
6666 this.quill.theme.tooltip.edit('video');
6667 }
6668 }
6669 }
6670 }
6671});
6672
6673var BaseTooltip = function (_Tooltip) {
6674 _inherits(BaseTooltip, _Tooltip);
6675
6676 function BaseTooltip(quill, boundsContainer) {
6677 _classCallCheck(this, BaseTooltip);
6678
6679 var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
6680
6681 _this4.textbox = _this4.root.querySelector('input[type="text"]');
6682 _this4.listen();
6683 return _this4;
6684 }
6685
6686 _createClass(BaseTooltip, [{
6687 key: 'listen',
6688 value: function listen() {
6689 var _this5 = this;
6690
6691 this.textbox.addEventListener('keydown', function (event) {
6692 if (_keyboard2.default.match(event, 'enter')) {
6693 _this5.save();
6694 event.preventDefault();
6695 } else if (_keyboard2.default.match(event, 'escape')) {
6696 _this5.cancel();
6697 event.preventDefault();
6698 }
6699 });
6700 }
6701 }, {
6702 key: 'cancel',
6703 value: function cancel() {
6704 this.hide();
6705 }
6706 }, {
6707 key: 'edit',
6708 value: function edit() {
6709 var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
6710 var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
6711
6712 this.root.classList.remove('ql-hidden');
6713 this.root.classList.add('ql-editing');
6714 if (preview != null) {
6715 this.textbox.value = preview;
6716 } else if (mode !== this.root.getAttribute('data-mode')) {
6717 this.textbox.value = '';
6718 }
6719 this.position(this.quill.getBounds(this.quill.selection.savedRange));
6720 this.textbox.select();
6721 this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
6722 this.root.setAttribute('data-mode', mode);
6723 }
6724 }, {
6725 key: 'restoreFocus',
6726 value: function restoreFocus() {
6727 var scrollTop = this.quill.scrollingContainer.scrollTop;
6728 this.quill.focus();
6729 this.quill.scrollingContainer.scrollTop = scrollTop;
6730 }
6731 }, {
6732 key: 'save',
6733 value: function save() {
6734 var value = this.textbox.value;
6735 switch (this.root.getAttribute('data-mode')) {
6736 case 'link':
6737 {
6738 var scrollTop = this.quill.root.scrollTop;
6739 if (this.linkRange) {
6740 this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
6741 delete this.linkRange;
6742 } else {
6743 this.restoreFocus();
6744 this.quill.format('link', value, _emitter2.default.sources.USER);
6745 }
6746 this.quill.root.scrollTop = scrollTop;
6747 break;
6748 }
6749 case 'video':
6750 {
6751 value = extractVideoUrl(value);
6752 } // eslint-disable-next-line no-fallthrough
6753 case 'formula':
6754 {
6755 if (!value) break;
6756 var range = this.quill.getSelection(true);
6757 if (range != null) {
6758 var index = range.index + range.length;
6759 this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
6760 if (this.root.getAttribute('data-mode') === 'formula') {
6761 this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
6762 }
6763 this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
6764 }
6765 break;
6766 }
6767 default:
6768 }
6769 this.textbox.value = '';
6770 this.hide();
6771 }
6772 }]);
6773
6774 return BaseTooltip;
6775}(_tooltip2.default);
6776
6777function extractVideoUrl(url) {
6778 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_-]+)/);
6779 if (match) {
6780 return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
6781 }
6782 if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
6783 // eslint-disable-line no-cond-assign
6784 return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';
6785 }
6786 return url;
6787}
6788
6789function fillSelect(select, values) {
6790 var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6791
6792 values.forEach(function (value) {
6793 var option = document.createElement('option');
6794 if (value === defaultValue) {
6795 option.setAttribute('selected', 'selected');
6796 } else {
6797 option.setAttribute('value', value);
6798 }
6799 select.appendChild(option);
6800 });
6801}
6802
6803exports.BaseTooltip = BaseTooltip;
6804exports.default = BaseTheme;
6805
6806/***/ }),
6807/* 44 */
6808/***/ (function(module, exports, __webpack_require__) {
6809
6810"use strict";
6811
6812Object.defineProperty(exports, "__esModule", { value: true });
6813var LinkedList = /** @class */ (function () {
6814 function LinkedList() {
6815 this.head = this.tail = undefined;
6816 this.length = 0;
6817 }
6818 LinkedList.prototype.append = function () {
6819 var nodes = [];
6820 for (var _i = 0; _i < arguments.length; _i++) {
6821 nodes[_i] = arguments[_i];
6822 }
6823 this.insertBefore(nodes[0], undefined);
6824 if (nodes.length > 1) {
6825 this.append.apply(this, nodes.slice(1));
6826 }
6827 };
6828 LinkedList.prototype.contains = function (node) {
6829 var cur, next = this.iterator();
6830 while (cur = next()) {
6831 if (cur === node)
6832 return true;
6833 }
6834 return false;
6835 };
6836 LinkedList.prototype.insertBefore = function (node, refNode) {
6837 node.next = refNode;
6838 if (refNode != null) {
6839 node.prev = refNode.prev;
6840 if (refNode.prev != null) {
6841 refNode.prev.next = node;
6842 }
6843 refNode.prev = node;
6844 if (refNode === this.head) {
6845 this.head = node;
6846 }
6847 }
6848 else if (this.tail != null) {
6849 this.tail.next = node;
6850 node.prev = this.tail;
6851 this.tail = node;
6852 }
6853 else {
6854 node.prev = undefined;
6855 this.head = this.tail = node;
6856 }
6857 this.length += 1;
6858 };
6859 LinkedList.prototype.offset = function (target) {
6860 var index = 0, cur = this.head;
6861 while (cur != null) {
6862 if (cur === target)
6863 return index;
6864 index += cur.length();
6865 cur = cur.next;
6866 }
6867 return -1;
6868 };
6869 LinkedList.prototype.remove = function (node) {
6870 if (!this.contains(node))
6871 return;
6872 if (node.prev != null)
6873 node.prev.next = node.next;
6874 if (node.next != null)
6875 node.next.prev = node.prev;
6876 if (node === this.head)
6877 this.head = node.next;
6878 if (node === this.tail)
6879 this.tail = node.prev;
6880 this.length -= 1;
6881 };
6882 LinkedList.prototype.iterator = function (curNode) {
6883 if (curNode === void 0) { curNode = this.head; }
6884 // TODO use yield when we can
6885 return function () {
6886 var ret = curNode;
6887 if (curNode != null)
6888 curNode = curNode.next;
6889 return ret;
6890 };
6891 };
6892 LinkedList.prototype.find = function (index, inclusive) {
6893 if (inclusive === void 0) { inclusive = false; }
6894 var cur, next = this.iterator();
6895 while (cur = next()) {
6896 var length = cur.length();
6897 if (index < length || (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
6898 return [cur, index];
6899 }
6900 index -= length;
6901 }
6902 return [null, 0];
6903 };
6904 LinkedList.prototype.forEach = function (callback) {
6905 var cur, next = this.iterator();
6906 while (cur = next()) {
6907 callback(cur);
6908 }
6909 };
6910 LinkedList.prototype.forEachAt = function (index, length, callback) {
6911 if (length <= 0)
6912 return;
6913 var _a = this.find(index), startNode = _a[0], offset = _a[1];
6914 var cur, curIndex = index - offset, next = this.iterator(startNode);
6915 while ((cur = next()) && curIndex < index + length) {
6916 var curLength = cur.length();
6917 if (index > curIndex) {
6918 callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
6919 }
6920 else {
6921 callback(cur, 0, Math.min(curLength, index + length - curIndex));
6922 }
6923 curIndex += curLength;
6924 }
6925 };
6926 LinkedList.prototype.map = function (callback) {
6927 return this.reduce(function (memo, cur) {
6928 memo.push(callback(cur));
6929 return memo;
6930 }, []);
6931 };
6932 LinkedList.prototype.reduce = function (callback, memo) {
6933 var cur, next = this.iterator();
6934 while (cur = next()) {
6935 memo = callback(memo, cur);
6936 }
6937 return memo;
6938 };
6939 return LinkedList;
6940}());
6941exports.default = LinkedList;
6942
6943
6944/***/ }),
6945/* 45 */
6946/***/ (function(module, exports, __webpack_require__) {
6947
6948"use strict";
6949
6950var __extends = (this && this.__extends) || (function () {
6951 var extendStatics = Object.setPrototypeOf ||
6952 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6953 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6954 return function (d, b) {
6955 extendStatics(d, b);
6956 function __() { this.constructor = d; }
6957 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6958 };
6959})();
6960Object.defineProperty(exports, "__esModule", { value: true });
6961var container_1 = __webpack_require__(17);
6962var Registry = __webpack_require__(1);
6963var OBSERVER_CONFIG = {
6964 attributes: true,
6965 characterData: true,
6966 characterDataOldValue: true,
6967 childList: true,
6968 subtree: true
6969};
6970var MAX_OPTIMIZE_ITERATIONS = 100;
6971var ScrollBlot = /** @class */ (function (_super) {
6972 __extends(ScrollBlot, _super);
6973 function ScrollBlot(node) {
6974 var _this = _super.call(this, node) || this;
6975 _this.parent = null;
6976 _this.observer = new MutationObserver(function (mutations) {
6977 _this.update(mutations);
6978 });
6979 _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
6980 return _this;
6981 }
6982 ScrollBlot.prototype.detach = function () {
6983 _super.prototype.detach.call(this);
6984 this.observer.disconnect();
6985 };
6986 ScrollBlot.prototype.deleteAt = function (index, length) {
6987 this.update();
6988 if (index === 0 && length === this.length()) {
6989 this.children.forEach(function (child) {
6990 child.remove();
6991 });
6992 }
6993 else {
6994 _super.prototype.deleteAt.call(this, index, length);
6995 }
6996 };
6997 ScrollBlot.prototype.formatAt = function (index, length, name, value) {
6998 this.update();
6999 _super.prototype.formatAt.call(this, index, length, name, value);
7000 };
7001 ScrollBlot.prototype.insertAt = function (index, value, def) {
7002 this.update();
7003 _super.prototype.insertAt.call(this, index, value, def);
7004 };
7005 ScrollBlot.prototype.optimize = function (mutations, context) {
7006 var _this = this;
7007 if (mutations === void 0) { mutations = []; }
7008 if (context === void 0) { context = {}; }
7009 _super.prototype.optimize.call(this, context);
7010 // We must modify mutations directly, cannot make copy and then modify
7011 var records = [].slice.call(this.observer.takeRecords());
7012 // Array.push currently seems to be implemented by a non-tail recursive function
7013 // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
7014 while (records.length > 0)
7015 mutations.push(records.pop());
7016 // TODO use WeakMap
7017 var mark = function (blot, markParent) {
7018 if (markParent === void 0) { markParent = true; }
7019 if (blot == null || blot === _this)
7020 return;
7021 if (blot.domNode.parentNode == null)
7022 return;
7023 if (blot.domNode[Registry.DATA_KEY].mutations == null) {
7024 blot.domNode[Registry.DATA_KEY].mutations = [];
7025 }
7026 if (markParent)
7027 mark(blot.parent);
7028 };
7029 var optimize = function (blot) {
7030 if (blot.domNode[Registry.DATA_KEY] == null || blot.domNode[Registry.DATA_KEY].mutations == null) {
7031 return;
7032 }
7033 if (blot instanceof container_1.default) {
7034 blot.children.forEach(optimize);
7035 }
7036 blot.optimize(context);
7037 };
7038 var remaining = mutations;
7039 for (var i = 0; remaining.length > 0; i += 1) {
7040 if (i >= MAX_OPTIMIZE_ITERATIONS) {
7041 throw new Error('[Parchment] Maximum optimize iterations reached');
7042 }
7043 remaining.forEach(function (mutation) {
7044 var blot = Registry.find(mutation.target, true);
7045 if (blot == null)
7046 return;
7047 if (blot.domNode === mutation.target) {
7048 if (mutation.type === 'childList') {
7049 mark(Registry.find(mutation.previousSibling, false));
7050 [].forEach.call(mutation.addedNodes, function (node) {
7051 var child = Registry.find(node, false);
7052 mark(child, false);
7053 if (child instanceof container_1.default) {
7054 child.children.forEach(function (grandChild) {
7055 mark(grandChild, false);
7056 });
7057 }
7058 });
7059 }
7060 else if (mutation.type === 'attributes') {
7061 mark(blot.prev);
7062 }
7063 }
7064 mark(blot);
7065 });
7066 this.children.forEach(optimize);
7067 remaining = [].slice.call(this.observer.takeRecords());
7068 records = remaining.slice();
7069 while (records.length > 0)
7070 mutations.push(records.pop());
7071 }
7072 };
7073 ScrollBlot.prototype.update = function (mutations, context) {
7074 var _this = this;
7075 if (context === void 0) { context = {}; }
7076 mutations = mutations || this.observer.takeRecords();
7077 // TODO use WeakMap
7078 mutations.map(function (mutation) {
7079 var blot = Registry.find(mutation.target, true);
7080 if (blot == null)
7081 return;
7082 if (blot.domNode[Registry.DATA_KEY].mutations == null) {
7083 blot.domNode[Registry.DATA_KEY].mutations = [mutation];
7084 return blot;
7085 }
7086 else {
7087 blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
7088 return null;
7089 }
7090 }).forEach(function (blot) {
7091 if (blot == null || blot === _this || blot.domNode[Registry.DATA_KEY] == null)
7092 return;
7093 blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);
7094 });
7095 if (this.domNode[Registry.DATA_KEY].mutations != null) {
7096 _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);
7097 }
7098 this.optimize(mutations, context);
7099 };
7100 ScrollBlot.blotName = 'scroll';
7101 ScrollBlot.defaultChild = 'block';
7102 ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
7103 ScrollBlot.tagName = 'DIV';
7104 return ScrollBlot;
7105}(container_1.default));
7106exports.default = ScrollBlot;
7107
7108
7109/***/ }),
7110/* 46 */
7111/***/ (function(module, exports, __webpack_require__) {
7112
7113"use strict";
7114
7115var __extends = (this && this.__extends) || (function () {
7116 var extendStatics = Object.setPrototypeOf ||
7117 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7118 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7119 return function (d, b) {
7120 extendStatics(d, b);
7121 function __() { this.constructor = d; }
7122 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7123 };
7124})();
7125Object.defineProperty(exports, "__esModule", { value: true });
7126var format_1 = __webpack_require__(18);
7127var Registry = __webpack_require__(1);
7128// Shallow object comparison
7129function isEqual(obj1, obj2) {
7130 if (Object.keys(obj1).length !== Object.keys(obj2).length)
7131 return false;
7132 for (var prop in obj1) {
7133 if (obj1[prop] !== obj2[prop])
7134 return false;
7135 }
7136 return true;
7137}
7138var InlineBlot = /** @class */ (function (_super) {
7139 __extends(InlineBlot, _super);
7140 function InlineBlot() {
7141 return _super !== null && _super.apply(this, arguments) || this;
7142 }
7143 InlineBlot.formats = function (domNode) {
7144 if (domNode.tagName === InlineBlot.tagName)
7145 return undefined;
7146 return _super.formats.call(this, domNode);
7147 };
7148 InlineBlot.prototype.format = function (name, value) {
7149 var _this = this;
7150 if (name === this.statics.blotName && !value) {
7151 this.children.forEach(function (child) {
7152 if (!(child instanceof format_1.default)) {
7153 child = child.wrap(InlineBlot.blotName, true);
7154 }
7155 _this.attributes.copy(child);
7156 });
7157 this.unwrap();
7158 }
7159 else {
7160 _super.prototype.format.call(this, name, value);
7161 }
7162 };
7163 InlineBlot.prototype.formatAt = function (index, length, name, value) {
7164 if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
7165 var blot = this.isolate(index, length);
7166 blot.format(name, value);
7167 }
7168 else {
7169 _super.prototype.formatAt.call(this, index, length, name, value);
7170 }
7171 };
7172 InlineBlot.prototype.optimize = function (context) {
7173 _super.prototype.optimize.call(this, context);
7174 var formats = this.formats();
7175 if (Object.keys(formats).length === 0) {
7176 return this.unwrap(); // unformatted span
7177 }
7178 var next = this.next;
7179 if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
7180 next.moveChildren(this);
7181 next.remove();
7182 }
7183 };
7184 InlineBlot.blotName = 'inline';
7185 InlineBlot.scope = Registry.Scope.INLINE_BLOT;
7186 InlineBlot.tagName = 'SPAN';
7187 return InlineBlot;
7188}(format_1.default));
7189exports.default = InlineBlot;
7190
7191
7192/***/ }),
7193/* 47 */
7194/***/ (function(module, exports, __webpack_require__) {
7195
7196"use strict";
7197
7198var __extends = (this && this.__extends) || (function () {
7199 var extendStatics = Object.setPrototypeOf ||
7200 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7201 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7202 return function (d, b) {
7203 extendStatics(d, b);
7204 function __() { this.constructor = d; }
7205 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7206 };
7207})();
7208Object.defineProperty(exports, "__esModule", { value: true });
7209var format_1 = __webpack_require__(18);
7210var Registry = __webpack_require__(1);
7211var BlockBlot = /** @class */ (function (_super) {
7212 __extends(BlockBlot, _super);
7213 function BlockBlot() {
7214 return _super !== null && _super.apply(this, arguments) || this;
7215 }
7216 BlockBlot.formats = function (domNode) {
7217 var tagName = Registry.query(BlockBlot.blotName).tagName;
7218 if (domNode.tagName === tagName)
7219 return undefined;
7220 return _super.formats.call(this, domNode);
7221 };
7222 BlockBlot.prototype.format = function (name, value) {
7223 if (Registry.query(name, Registry.Scope.BLOCK) == null) {
7224 return;
7225 }
7226 else if (name === this.statics.blotName && !value) {
7227 this.replaceWith(BlockBlot.blotName);
7228 }
7229 else {
7230 _super.prototype.format.call(this, name, value);
7231 }
7232 };
7233 BlockBlot.prototype.formatAt = function (index, length, name, value) {
7234 if (Registry.query(name, Registry.Scope.BLOCK) != null) {
7235 this.format(name, value);
7236 }
7237 else {
7238 _super.prototype.formatAt.call(this, index, length, name, value);
7239 }
7240 };
7241 BlockBlot.prototype.insertAt = function (index, value, def) {
7242 if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
7243 // Insert text or inline
7244 _super.prototype.insertAt.call(this, index, value, def);
7245 }
7246 else {
7247 var after = this.split(index);
7248 var blot = Registry.create(value, def);
7249 after.parent.insertBefore(blot, after);
7250 }
7251 };
7252 BlockBlot.prototype.update = function (mutations, context) {
7253 if (navigator.userAgent.match(/Trident/)) {
7254 this.attach();
7255 }
7256 else {
7257 _super.prototype.update.call(this, mutations, context);
7258 }
7259 };
7260 BlockBlot.blotName = 'block';
7261 BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
7262 BlockBlot.tagName = 'P';
7263 return BlockBlot;
7264}(format_1.default));
7265exports.default = BlockBlot;
7266
7267
7268/***/ }),
7269/* 48 */
7270/***/ (function(module, exports, __webpack_require__) {
7271
7272"use strict";
7273
7274var __extends = (this && this.__extends) || (function () {
7275 var extendStatics = Object.setPrototypeOf ||
7276 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7277 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7278 return function (d, b) {
7279 extendStatics(d, b);
7280 function __() { this.constructor = d; }
7281 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7282 };
7283})();
7284Object.defineProperty(exports, "__esModule", { value: true });
7285var leaf_1 = __webpack_require__(19);
7286var EmbedBlot = /** @class */ (function (_super) {
7287 __extends(EmbedBlot, _super);
7288 function EmbedBlot() {
7289 return _super !== null && _super.apply(this, arguments) || this;
7290 }
7291 EmbedBlot.formats = function (domNode) {
7292 return undefined;
7293 };
7294 EmbedBlot.prototype.format = function (name, value) {
7295 // super.formatAt wraps, which is what we want in general,
7296 // but this allows subclasses to overwrite for formats
7297 // that just apply to particular embeds
7298 _super.prototype.formatAt.call(this, 0, this.length(), name, value);
7299 };
7300 EmbedBlot.prototype.formatAt = function (index, length, name, value) {
7301 if (index === 0 && length === this.length()) {
7302 this.format(name, value);
7303 }
7304 else {
7305 _super.prototype.formatAt.call(this, index, length, name, value);
7306 }
7307 };
7308 EmbedBlot.prototype.formats = function () {
7309 return this.statics.formats(this.domNode);
7310 };
7311 return EmbedBlot;
7312}(leaf_1.default));
7313exports.default = EmbedBlot;
7314
7315
7316/***/ }),
7317/* 49 */
7318/***/ (function(module, exports, __webpack_require__) {
7319
7320"use strict";
7321
7322var __extends = (this && this.__extends) || (function () {
7323 var extendStatics = Object.setPrototypeOf ||
7324 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7325 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7326 return function (d, b) {
7327 extendStatics(d, b);
7328 function __() { this.constructor = d; }
7329 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7330 };
7331})();
7332Object.defineProperty(exports, "__esModule", { value: true });
7333var leaf_1 = __webpack_require__(19);
7334var Registry = __webpack_require__(1);
7335var TextBlot = /** @class */ (function (_super) {
7336 __extends(TextBlot, _super);
7337 function TextBlot(node) {
7338 var _this = _super.call(this, node) || this;
7339 _this.text = _this.statics.value(_this.domNode);
7340 return _this;
7341 }
7342 TextBlot.create = function (value) {
7343 return document.createTextNode(value);
7344 };
7345 TextBlot.value = function (domNode) {
7346 var text = domNode.data;
7347 if (text["normalize"])
7348 text = text["normalize"]();
7349 return text;
7350 };
7351 TextBlot.prototype.deleteAt = function (index, length) {
7352 this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
7353 };
7354 TextBlot.prototype.index = function (node, offset) {
7355 if (this.domNode === node) {
7356 return offset;
7357 }
7358 return -1;
7359 };
7360 TextBlot.prototype.insertAt = function (index, value, def) {
7361 if (def == null) {
7362 this.text = this.text.slice(0, index) + value + this.text.slice(index);
7363 this.domNode.data = this.text;
7364 }
7365 else {
7366 _super.prototype.insertAt.call(this, index, value, def);
7367 }
7368 };
7369 TextBlot.prototype.length = function () {
7370 return this.text.length;
7371 };
7372 TextBlot.prototype.optimize = function (context) {
7373 _super.prototype.optimize.call(this, context);
7374 this.text = this.statics.value(this.domNode);
7375 if (this.text.length === 0) {
7376 this.remove();
7377 }
7378 else if (this.next instanceof TextBlot && this.next.prev === this) {
7379 this.insertAt(this.length(), this.next.value());
7380 this.next.remove();
7381 }
7382 };
7383 TextBlot.prototype.position = function (index, inclusive) {
7384 if (inclusive === void 0) { inclusive = false; }
7385 return [this.domNode, index];
7386 };
7387 TextBlot.prototype.split = function (index, force) {
7388 if (force === void 0) { force = false; }
7389 if (!force) {
7390 if (index === 0)
7391 return this;
7392 if (index === this.length())
7393 return this.next;
7394 }
7395 var after = Registry.create(this.domNode.splitText(index));
7396 this.parent.insertBefore(after, this.next);
7397 this.text = this.statics.value(this.domNode);
7398 return after;
7399 };
7400 TextBlot.prototype.update = function (mutations, context) {
7401 var _this = this;
7402 if (mutations.some(function (mutation) {
7403 return mutation.type === 'characterData' && mutation.target === _this.domNode;
7404 })) {
7405 this.text = this.statics.value(this.domNode);
7406 }
7407 };
7408 TextBlot.prototype.value = function () {
7409 return this.text;
7410 };
7411 TextBlot.blotName = 'text';
7412 TextBlot.scope = Registry.Scope.INLINE_BLOT;
7413 return TextBlot;
7414}(leaf_1.default));
7415exports.default = TextBlot;
7416
7417
7418/***/ }),
7419/* 50 */
7420/***/ (function(module, exports, __webpack_require__) {
7421
7422"use strict";
7423
7424
7425var elem = document.createElement('div');
7426elem.classList.toggle('test-class', false);
7427if (elem.classList.contains('test-class')) {
7428 var _toggle = DOMTokenList.prototype.toggle;
7429 DOMTokenList.prototype.toggle = function (token, force) {
7430 if (arguments.length > 1 && !this.contains(token) === !force) {
7431 return force;
7432 } else {
7433 return _toggle.call(this, token);
7434 }
7435 };
7436}
7437
7438if (!String.prototype.startsWith) {
7439 String.prototype.startsWith = function (searchString, position) {
7440 position = position || 0;
7441 return this.substr(position, searchString.length) === searchString;
7442 };
7443}
7444
7445if (!String.prototype.endsWith) {
7446 String.prototype.endsWith = function (searchString, position) {
7447 var subjectString = this.toString();
7448 if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
7449 position = subjectString.length;
7450 }
7451 position -= searchString.length;
7452 var lastIndex = subjectString.indexOf(searchString, position);
7453 return lastIndex !== -1 && lastIndex === position;
7454 };
7455}
7456
7457if (!Array.prototype.find) {
7458 Object.defineProperty(Array.prototype, "find", {
7459 value: function value(predicate) {
7460 if (this === null) {
7461 throw new TypeError('Array.prototype.find called on null or undefined');
7462 }
7463 if (typeof predicate !== 'function') {
7464 throw new TypeError('predicate must be a function');
7465 }
7466 var list = Object(this);
7467 var length = list.length >>> 0;
7468 var thisArg = arguments[1];
7469 var value;
7470
7471 for (var i = 0; i < length; i++) {
7472 value = list[i];
7473 if (predicate.call(thisArg, value, i, list)) {
7474 return value;
7475 }
7476 }
7477 return undefined;
7478 }
7479 });
7480}
7481
7482document.addEventListener("DOMContentLoaded", function () {
7483 // Disable resizing in Firefox
7484 document.execCommand("enableObjectResizing", false, false);
7485 // Disable automatic linkifying in IE11
7486 document.execCommand("autoUrlDetect", false, false);
7487});
7488
7489/***/ }),
7490/* 51 */
7491/***/ (function(module, exports) {
7492
7493/**
7494 * This library modifies the diff-patch-match library by Neil Fraser
7495 * by removing the patch and match functionality and certain advanced
7496 * options in the diff function. The original license is as follows:
7497 *
7498 * ===
7499 *
7500 * Diff Match and Patch
7501 *
7502 * Copyright 2006 Google Inc.
7503 * http://code.google.com/p/google-diff-match-patch/
7504 *
7505 * Licensed under the Apache License, Version 2.0 (the "License");
7506 * you may not use this file except in compliance with the License.
7507 * You may obtain a copy of the License at
7508 *
7509 * http://www.apache.org/licenses/LICENSE-2.0
7510 *
7511 * Unless required by applicable law or agreed to in writing, software
7512 * distributed under the License is distributed on an "AS IS" BASIS,
7513 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7514 * See the License for the specific language governing permissions and
7515 * limitations under the License.
7516 */
7517
7518
7519/**
7520 * The data structure representing a diff is an array of tuples:
7521 * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
7522 * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
7523 */
7524var DIFF_DELETE = -1;
7525var DIFF_INSERT = 1;
7526var DIFF_EQUAL = 0;
7527
7528
7529/**
7530 * Find the differences between two texts. Simplifies the problem by stripping
7531 * any common prefix or suffix off the texts before diffing.
7532 * @param {string} text1 Old string to be diffed.
7533 * @param {string} text2 New string to be diffed.
7534 * @param {Int} cursor_pos Expected edit position in text1 (optional)
7535 * @return {Array} Array of diff tuples.
7536 */
7537function diff_main(text1, text2, cursor_pos) {
7538 // Check for equality (speedup).
7539 if (text1 == text2) {
7540 if (text1) {
7541 return [[DIFF_EQUAL, text1]];
7542 }
7543 return [];
7544 }
7545
7546 // Check cursor_pos within bounds
7547 if (cursor_pos < 0 || text1.length < cursor_pos) {
7548 cursor_pos = null;
7549 }
7550
7551 // Trim off common prefix (speedup).
7552 var commonlength = diff_commonPrefix(text1, text2);
7553 var commonprefix = text1.substring(0, commonlength);
7554 text1 = text1.substring(commonlength);
7555 text2 = text2.substring(commonlength);
7556
7557 // Trim off common suffix (speedup).
7558 commonlength = diff_commonSuffix(text1, text2);
7559 var commonsuffix = text1.substring(text1.length - commonlength);
7560 text1 = text1.substring(0, text1.length - commonlength);
7561 text2 = text2.substring(0, text2.length - commonlength);
7562
7563 // Compute the diff on the middle block.
7564 var diffs = diff_compute_(text1, text2);
7565
7566 // Restore the prefix and suffix.
7567 if (commonprefix) {
7568 diffs.unshift([DIFF_EQUAL, commonprefix]);
7569 }
7570 if (commonsuffix) {
7571 diffs.push([DIFF_EQUAL, commonsuffix]);
7572 }
7573 diff_cleanupMerge(diffs);
7574 if (cursor_pos != null) {
7575 diffs = fix_cursor(diffs, cursor_pos);
7576 }
7577 return diffs;
7578};
7579
7580
7581/**
7582 * Find the differences between two texts. Assumes that the texts do not
7583 * have any common prefix or suffix.
7584 * @param {string} text1 Old string to be diffed.
7585 * @param {string} text2 New string to be diffed.
7586 * @return {Array} Array of diff tuples.
7587 */
7588function diff_compute_(text1, text2) {
7589 var diffs;
7590
7591 if (!text1) {
7592 // Just add some text (speedup).
7593 return [[DIFF_INSERT, text2]];
7594 }
7595
7596 if (!text2) {
7597 // Just delete some text (speedup).
7598 return [[DIFF_DELETE, text1]];
7599 }
7600
7601 var longtext = text1.length > text2.length ? text1 : text2;
7602 var shorttext = text1.length > text2.length ? text2 : text1;
7603 var i = longtext.indexOf(shorttext);
7604 if (i != -1) {
7605 // Shorter text is inside the longer text (speedup).
7606 diffs = [[DIFF_INSERT, longtext.substring(0, i)],
7607 [DIFF_EQUAL, shorttext],
7608 [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
7609 // Swap insertions for deletions if diff is reversed.
7610 if (text1.length > text2.length) {
7611 diffs[0][0] = diffs[2][0] = DIFF_DELETE;
7612 }
7613 return diffs;
7614 }
7615
7616 if (shorttext.length == 1) {
7617 // Single character string.
7618 // After the previous speedup, the character can't be an equality.
7619 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
7620 }
7621
7622 // Check to see if the problem can be split in two.
7623 var hm = diff_halfMatch_(text1, text2);
7624 if (hm) {
7625 // A half-match was found, sort out the return data.
7626 var text1_a = hm[0];
7627 var text1_b = hm[1];
7628 var text2_a = hm[2];
7629 var text2_b = hm[3];
7630 var mid_common = hm[4];
7631 // Send both pairs off for separate processing.
7632 var diffs_a = diff_main(text1_a, text2_a);
7633 var diffs_b = diff_main(text1_b, text2_b);
7634 // Merge the results.
7635 return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
7636 }
7637
7638 return diff_bisect_(text1, text2);
7639};
7640
7641
7642/**
7643 * Find the 'middle snake' of a diff, split the problem in two
7644 * and return the recursively constructed diff.
7645 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
7646 * @param {string} text1 Old string to be diffed.
7647 * @param {string} text2 New string to be diffed.
7648 * @return {Array} Array of diff tuples.
7649 * @private
7650 */
7651function diff_bisect_(text1, text2) {
7652 // Cache the text lengths to prevent multiple calls.
7653 var text1_length = text1.length;
7654 var text2_length = text2.length;
7655 var max_d = Math.ceil((text1_length + text2_length) / 2);
7656 var v_offset = max_d;
7657 var v_length = 2 * max_d;
7658 var v1 = new Array(v_length);
7659 var v2 = new Array(v_length);
7660 // Setting all elements to -1 is faster in Chrome & Firefox than mixing
7661 // integers and undefined.
7662 for (var x = 0; x < v_length; x++) {
7663 v1[x] = -1;
7664 v2[x] = -1;
7665 }
7666 v1[v_offset + 1] = 0;
7667 v2[v_offset + 1] = 0;
7668 var delta = text1_length - text2_length;
7669 // If the total number of characters is odd, then the front path will collide
7670 // with the reverse path.
7671 var front = (delta % 2 != 0);
7672 // Offsets for start and end of k loop.
7673 // Prevents mapping of space beyond the grid.
7674 var k1start = 0;
7675 var k1end = 0;
7676 var k2start = 0;
7677 var k2end = 0;
7678 for (var d = 0; d < max_d; d++) {
7679 // Walk the front path one step.
7680 for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
7681 var k1_offset = v_offset + k1;
7682 var x1;
7683 if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
7684 x1 = v1[k1_offset + 1];
7685 } else {
7686 x1 = v1[k1_offset - 1] + 1;
7687 }
7688 var y1 = x1 - k1;
7689 while (x1 < text1_length && y1 < text2_length &&
7690 text1.charAt(x1) == text2.charAt(y1)) {
7691 x1++;
7692 y1++;
7693 }
7694 v1[k1_offset] = x1;
7695 if (x1 > text1_length) {
7696 // Ran off the right of the graph.
7697 k1end += 2;
7698 } else if (y1 > text2_length) {
7699 // Ran off the bottom of the graph.
7700 k1start += 2;
7701 } else if (front) {
7702 var k2_offset = v_offset + delta - k1;
7703 if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
7704 // Mirror x2 onto top-left coordinate system.
7705 var x2 = text1_length - v2[k2_offset];
7706 if (x1 >= x2) {
7707 // Overlap detected.
7708 return diff_bisectSplit_(text1, text2, x1, y1);
7709 }
7710 }
7711 }
7712 }
7713
7714 // Walk the reverse path one step.
7715 for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
7716 var k2_offset = v_offset + k2;
7717 var x2;
7718 if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
7719 x2 = v2[k2_offset + 1];
7720 } else {
7721 x2 = v2[k2_offset - 1] + 1;
7722 }
7723 var y2 = x2 - k2;
7724 while (x2 < text1_length && y2 < text2_length &&
7725 text1.charAt(text1_length - x2 - 1) ==
7726 text2.charAt(text2_length - y2 - 1)) {
7727 x2++;
7728 y2++;
7729 }
7730 v2[k2_offset] = x2;
7731 if (x2 > text1_length) {
7732 // Ran off the left of the graph.
7733 k2end += 2;
7734 } else if (y2 > text2_length) {
7735 // Ran off the top of the graph.
7736 k2start += 2;
7737 } else if (!front) {
7738 var k1_offset = v_offset + delta - k2;
7739 if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
7740 var x1 = v1[k1_offset];
7741 var y1 = v_offset + x1 - k1_offset;
7742 // Mirror x2 onto top-left coordinate system.
7743 x2 = text1_length - x2;
7744 if (x1 >= x2) {
7745 // Overlap detected.
7746 return diff_bisectSplit_(text1, text2, x1, y1);
7747 }
7748 }
7749 }
7750 }
7751 }
7752 // Diff took too long and hit the deadline or
7753 // number of diffs equals number of characters, no commonality at all.
7754 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
7755};
7756
7757
7758/**
7759 * Given the location of the 'middle snake', split the diff in two parts
7760 * and recurse.
7761 * @param {string} text1 Old string to be diffed.
7762 * @param {string} text2 New string to be diffed.
7763 * @param {number} x Index of split point in text1.
7764 * @param {number} y Index of split point in text2.
7765 * @return {Array} Array of diff tuples.
7766 */
7767function diff_bisectSplit_(text1, text2, x, y) {
7768 var text1a = text1.substring(0, x);
7769 var text2a = text2.substring(0, y);
7770 var text1b = text1.substring(x);
7771 var text2b = text2.substring(y);
7772
7773 // Compute both diffs serially.
7774 var diffs = diff_main(text1a, text2a);
7775 var diffsb = diff_main(text1b, text2b);
7776
7777 return diffs.concat(diffsb);
7778};
7779
7780
7781/**
7782 * Determine the common prefix of two strings.
7783 * @param {string} text1 First string.
7784 * @param {string} text2 Second string.
7785 * @return {number} The number of characters common to the start of each
7786 * string.
7787 */
7788function diff_commonPrefix(text1, text2) {
7789 // Quick check for common null cases.
7790 if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
7791 return 0;
7792 }
7793 // Binary search.
7794 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
7795 var pointermin = 0;
7796 var pointermax = Math.min(text1.length, text2.length);
7797 var pointermid = pointermax;
7798 var pointerstart = 0;
7799 while (pointermin < pointermid) {
7800 if (text1.substring(pointerstart, pointermid) ==
7801 text2.substring(pointerstart, pointermid)) {
7802 pointermin = pointermid;
7803 pointerstart = pointermin;
7804 } else {
7805 pointermax = pointermid;
7806 }
7807 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
7808 }
7809 return pointermid;
7810};
7811
7812
7813/**
7814 * Determine the common suffix of two strings.
7815 * @param {string} text1 First string.
7816 * @param {string} text2 Second string.
7817 * @return {number} The number of characters common to the end of each string.
7818 */
7819function diff_commonSuffix(text1, text2) {
7820 // Quick check for common null cases.
7821 if (!text1 || !text2 ||
7822 text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
7823 return 0;
7824 }
7825 // Binary search.
7826 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
7827 var pointermin = 0;
7828 var pointermax = Math.min(text1.length, text2.length);
7829 var pointermid = pointermax;
7830 var pointerend = 0;
7831 while (pointermin < pointermid) {
7832 if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
7833 text2.substring(text2.length - pointermid, text2.length - pointerend)) {
7834 pointermin = pointermid;
7835 pointerend = pointermin;
7836 } else {
7837 pointermax = pointermid;
7838 }
7839 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
7840 }
7841 return pointermid;
7842};
7843
7844
7845/**
7846 * Do the two texts share a substring which is at least half the length of the
7847 * longer text?
7848 * This speedup can produce non-minimal diffs.
7849 * @param {string} text1 First string.
7850 * @param {string} text2 Second string.
7851 * @return {Array.<string>} Five element Array, containing the prefix of
7852 * text1, the suffix of text1, the prefix of text2, the suffix of
7853 * text2 and the common middle. Or null if there was no match.
7854 */
7855function diff_halfMatch_(text1, text2) {
7856 var longtext = text1.length > text2.length ? text1 : text2;
7857 var shorttext = text1.length > text2.length ? text2 : text1;
7858 if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
7859 return null; // Pointless.
7860 }
7861
7862 /**
7863 * Does a substring of shorttext exist within longtext such that the substring
7864 * is at least half the length of longtext?
7865 * Closure, but does not reference any external variables.
7866 * @param {string} longtext Longer string.
7867 * @param {string} shorttext Shorter string.
7868 * @param {number} i Start index of quarter length substring within longtext.
7869 * @return {Array.<string>} Five element Array, containing the prefix of
7870 * longtext, the suffix of longtext, the prefix of shorttext, the suffix
7871 * of shorttext and the common middle. Or null if there was no match.
7872 * @private
7873 */
7874 function diff_halfMatchI_(longtext, shorttext, i) {
7875 // Start with a 1/4 length substring at position i as a seed.
7876 var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
7877 var j = -1;
7878 var best_common = '';
7879 var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
7880 while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
7881 var prefixLength = diff_commonPrefix(longtext.substring(i),
7882 shorttext.substring(j));
7883 var suffixLength = diff_commonSuffix(longtext.substring(0, i),
7884 shorttext.substring(0, j));
7885 if (best_common.length < suffixLength + prefixLength) {
7886 best_common = shorttext.substring(j - suffixLength, j) +
7887 shorttext.substring(j, j + prefixLength);
7888 best_longtext_a = longtext.substring(0, i - suffixLength);
7889 best_longtext_b = longtext.substring(i + prefixLength);
7890 best_shorttext_a = shorttext.substring(0, j - suffixLength);
7891 best_shorttext_b = shorttext.substring(j + prefixLength);
7892 }
7893 }
7894 if (best_common.length * 2 >= longtext.length) {
7895 return [best_longtext_a, best_longtext_b,
7896 best_shorttext_a, best_shorttext_b, best_common];
7897 } else {
7898 return null;
7899 }
7900 }
7901
7902 // First check if the second quarter is the seed for a half-match.
7903 var hm1 = diff_halfMatchI_(longtext, shorttext,
7904 Math.ceil(longtext.length / 4));
7905 // Check again based on the third quarter.
7906 var hm2 = diff_halfMatchI_(longtext, shorttext,
7907 Math.ceil(longtext.length / 2));
7908 var hm;
7909 if (!hm1 && !hm2) {
7910 return null;
7911 } else if (!hm2) {
7912 hm = hm1;
7913 } else if (!hm1) {
7914 hm = hm2;
7915 } else {
7916 // Both matched. Select the longest.
7917 hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
7918 }
7919
7920 // A half-match was found, sort out the return data.
7921 var text1_a, text1_b, text2_a, text2_b;
7922 if (text1.length > text2.length) {
7923 text1_a = hm[0];
7924 text1_b = hm[1];
7925 text2_a = hm[2];
7926 text2_b = hm[3];
7927 } else {
7928 text2_a = hm[0];
7929 text2_b = hm[1];
7930 text1_a = hm[2];
7931 text1_b = hm[3];
7932 }
7933 var mid_common = hm[4];
7934 return [text1_a, text1_b, text2_a, text2_b, mid_common];
7935};
7936
7937
7938/**
7939 * Reorder and merge like edit sections. Merge equalities.
7940 * Any edit section can move as long as it doesn't cross an equality.
7941 * @param {Array} diffs Array of diff tuples.
7942 */
7943function diff_cleanupMerge(diffs) {
7944 diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
7945 var pointer = 0;
7946 var count_delete = 0;
7947 var count_insert = 0;
7948 var text_delete = '';
7949 var text_insert = '';
7950 var commonlength;
7951 while (pointer < diffs.length) {
7952 switch (diffs[pointer][0]) {
7953 case DIFF_INSERT:
7954 count_insert++;
7955 text_insert += diffs[pointer][1];
7956 pointer++;
7957 break;
7958 case DIFF_DELETE:
7959 count_delete++;
7960 text_delete += diffs[pointer][1];
7961 pointer++;
7962 break;
7963 case DIFF_EQUAL:
7964 // Upon reaching an equality, check for prior redundancies.
7965 if (count_delete + count_insert > 1) {
7966 if (count_delete !== 0 && count_insert !== 0) {
7967 // Factor out any common prefixies.
7968 commonlength = diff_commonPrefix(text_insert, text_delete);
7969 if (commonlength !== 0) {
7970 if ((pointer - count_delete - count_insert) > 0 &&
7971 diffs[pointer - count_delete - count_insert - 1][0] ==
7972 DIFF_EQUAL) {
7973 diffs[pointer - count_delete - count_insert - 1][1] +=
7974 text_insert.substring(0, commonlength);
7975 } else {
7976 diffs.splice(0, 0, [DIFF_EQUAL,
7977 text_insert.substring(0, commonlength)]);
7978 pointer++;
7979 }
7980 text_insert = text_insert.substring(commonlength);
7981 text_delete = text_delete.substring(commonlength);
7982 }
7983 // Factor out any common suffixies.
7984 commonlength = diff_commonSuffix(text_insert, text_delete);
7985 if (commonlength !== 0) {
7986 diffs[pointer][1] = text_insert.substring(text_insert.length -
7987 commonlength) + diffs[pointer][1];
7988 text_insert = text_insert.substring(0, text_insert.length -
7989 commonlength);
7990 text_delete = text_delete.substring(0, text_delete.length -
7991 commonlength);
7992 }
7993 }
7994 // Delete the offending records and add the merged ones.
7995 if (count_delete === 0) {
7996 diffs.splice(pointer - count_insert,
7997 count_delete + count_insert, [DIFF_INSERT, text_insert]);
7998 } else if (count_insert === 0) {
7999 diffs.splice(pointer - count_delete,
8000 count_delete + count_insert, [DIFF_DELETE, text_delete]);
8001 } else {
8002 diffs.splice(pointer - count_delete - count_insert,
8003 count_delete + count_insert, [DIFF_DELETE, text_delete],
8004 [DIFF_INSERT, text_insert]);
8005 }
8006 pointer = pointer - count_delete - count_insert +
8007 (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
8008 } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
8009 // Merge this equality with the previous one.
8010 diffs[pointer - 1][1] += diffs[pointer][1];
8011 diffs.splice(pointer, 1);
8012 } else {
8013 pointer++;
8014 }
8015 count_insert = 0;
8016 count_delete = 0;
8017 text_delete = '';
8018 text_insert = '';
8019 break;
8020 }
8021 }
8022 if (diffs[diffs.length - 1][1] === '') {
8023 diffs.pop(); // Remove the dummy entry at the end.
8024 }
8025
8026 // Second pass: look for single edits surrounded on both sides by equalities
8027 // which can be shifted sideways to eliminate an equality.
8028 // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
8029 var changes = false;
8030 pointer = 1;
8031 // Intentionally ignore the first and last element (don't need checking).
8032 while (pointer < diffs.length - 1) {
8033 if (diffs[pointer - 1][0] == DIFF_EQUAL &&
8034 diffs[pointer + 1][0] == DIFF_EQUAL) {
8035 // This is a single edit surrounded by equalities.
8036 if (diffs[pointer][1].substring(diffs[pointer][1].length -
8037 diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
8038 // Shift the edit over the previous equality.
8039 diffs[pointer][1] = diffs[pointer - 1][1] +
8040 diffs[pointer][1].substring(0, diffs[pointer][1].length -
8041 diffs[pointer - 1][1].length);
8042 diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
8043 diffs.splice(pointer - 1, 1);
8044 changes = true;
8045 } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
8046 diffs[pointer + 1][1]) {
8047 // Shift the edit over the next equality.
8048 diffs[pointer - 1][1] += diffs[pointer + 1][1];
8049 diffs[pointer][1] =
8050 diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
8051 diffs[pointer + 1][1];
8052 diffs.splice(pointer + 1, 1);
8053 changes = true;
8054 }
8055 }
8056 pointer++;
8057 }
8058 // If shifts were made, the diff needs reordering and another shift sweep.
8059 if (changes) {
8060 diff_cleanupMerge(diffs);
8061 }
8062};
8063
8064
8065var diff = diff_main;
8066diff.INSERT = DIFF_INSERT;
8067diff.DELETE = DIFF_DELETE;
8068diff.EQUAL = DIFF_EQUAL;
8069
8070module.exports = diff;
8071
8072/*
8073 * Modify a diff such that the cursor position points to the start of a change:
8074 * E.g.
8075 * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
8076 * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
8077 * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
8078 * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
8079 *
8080 * @param {Array} diffs Array of diff tuples
8081 * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
8082 * @return {Array} A tuple [cursor location in the modified diff, modified diff]
8083 */
8084function cursor_normalize_diff (diffs, cursor_pos) {
8085 if (cursor_pos === 0) {
8086 return [DIFF_EQUAL, diffs];
8087 }
8088 for (var current_pos = 0, i = 0; i < diffs.length; i++) {
8089 var d = diffs[i];
8090 if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
8091 var next_pos = current_pos + d[1].length;
8092 if (cursor_pos === next_pos) {
8093 return [i + 1, diffs];
8094 } else if (cursor_pos < next_pos) {
8095 // copy to prevent side effects
8096 diffs = diffs.slice();
8097 // split d into two diff changes
8098 var split_pos = cursor_pos - current_pos;
8099 var d_left = [d[0], d[1].slice(0, split_pos)];
8100 var d_right = [d[0], d[1].slice(split_pos)];
8101 diffs.splice(i, 1, d_left, d_right);
8102 return [i + 1, diffs];
8103 } else {
8104 current_pos = next_pos;
8105 }
8106 }
8107 }
8108 throw new Error('cursor_pos is out of bounds!')
8109}
8110
8111/*
8112 * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
8113 *
8114 * Case 1)
8115 * Check if a naive shift is possible:
8116 * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
8117 * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
8118 * Case 2)
8119 * Check if the following shifts are possible:
8120 * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
8121 * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
8122 * ^ ^
8123 * d d_next
8124 *
8125 * @param {Array} diffs Array of diff tuples
8126 * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
8127 * @return {Array} Array of diff tuples
8128 */
8129function fix_cursor (diffs, cursor_pos) {
8130 var norm = cursor_normalize_diff(diffs, cursor_pos);
8131 var ndiffs = norm[1];
8132 var cursor_pointer = norm[0];
8133 var d = ndiffs[cursor_pointer];
8134 var d_next = ndiffs[cursor_pointer + 1];
8135
8136 if (d == null) {
8137 // Text was deleted from end of original string,
8138 // cursor is now out of bounds in new string
8139 return diffs;
8140 } else if (d[0] !== DIFF_EQUAL) {
8141 // A modification happened at the cursor location.
8142 // This is the expected outcome, so we can return the original diff.
8143 return diffs;
8144 } else {
8145 if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
8146 // Case 1)
8147 // It is possible to perform a naive shift
8148 ndiffs.splice(cursor_pointer, 2, d_next, d)
8149 return merge_tuples(ndiffs, cursor_pointer, 2)
8150 } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
8151 // Case 2)
8152 // d[1] is a prefix of d_next[1]
8153 // We can assume that d_next[0] !== 0, since d[0] === 0
8154 // Shift edit locations..
8155 ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
8156 var suffix = d_next[1].slice(d[1].length);
8157 if (suffix.length > 0) {
8158 ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
8159 }
8160 return merge_tuples(ndiffs, cursor_pointer, 3)
8161 } else {
8162 // Not possible to perform any modification
8163 return diffs;
8164 }
8165 }
8166
8167}
8168
8169/*
8170 * Try to merge tuples with their neigbors in a given range.
8171 * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
8172 *
8173 * @param {Array} diffs Array of diff tuples.
8174 * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
8175 * @param {Int} length Number of consecutive elements to check.
8176 * @return {Array} Array of merged diff tuples.
8177 */
8178function merge_tuples (diffs, start, length) {
8179 // Check from (start-1) to (start+length).
8180 for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
8181 if (i + 1 < diffs.length) {
8182 var left_d = diffs[i];
8183 var right_d = diffs[i+1];
8184 if (left_d[0] === right_d[1]) {
8185 diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
8186 }
8187 }
8188 }
8189 return diffs;
8190}
8191
8192
8193/***/ }),
8194/* 52 */
8195/***/ (function(module, exports) {
8196
8197exports = module.exports = typeof Object.keys === 'function'
8198 ? Object.keys : shim;
8199
8200exports.shim = shim;
8201function shim (obj) {
8202 var keys = [];
8203 for (var key in obj) keys.push(key);
8204 return keys;
8205}
8206
8207
8208/***/ }),
8209/* 53 */
8210/***/ (function(module, exports) {
8211
8212var supportsArgumentsClass = (function(){
8213 return Object.prototype.toString.call(arguments)
8214})() == '[object Arguments]';
8215
8216exports = module.exports = supportsArgumentsClass ? supported : unsupported;
8217
8218exports.supported = supported;
8219function supported(object) {
8220 return Object.prototype.toString.call(object) == '[object Arguments]';
8221};
8222
8223exports.unsupported = unsupported;
8224function unsupported(object){
8225 return object &&
8226 typeof object == 'object' &&
8227 typeof object.length == 'number' &&
8228 Object.prototype.hasOwnProperty.call(object, 'callee') &&
8229 !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
8230 false;
8231};
8232
8233
8234/***/ }),
8235/* 54 */
8236/***/ (function(module, exports) {
8237
8238'use strict';
8239
8240var has = Object.prototype.hasOwnProperty
8241 , prefix = '~';
8242
8243/**
8244 * Constructor to create a storage for our `EE` objects.
8245 * An `Events` instance is a plain object whose properties are event names.
8246 *
8247 * @constructor
8248 * @api private
8249 */
8250function Events() {}
8251
8252//
8253// We try to not inherit from `Object.prototype`. In some engines creating an
8254// instance in this way is faster than calling `Object.create(null)` directly.
8255// If `Object.create(null)` is not supported we prefix the event names with a
8256// character to make sure that the built-in object properties are not
8257// overridden or used as an attack vector.
8258//
8259if (Object.create) {
8260 Events.prototype = Object.create(null);
8261
8262 //
8263 // This hack is needed because the `__proto__` property is still inherited in
8264 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
8265 //
8266 if (!new Events().__proto__) prefix = false;
8267}
8268
8269/**
8270 * Representation of a single event listener.
8271 *
8272 * @param {Function} fn The listener function.
8273 * @param {Mixed} context The context to invoke the listener with.
8274 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
8275 * @constructor
8276 * @api private
8277 */
8278function EE(fn, context, once) {
8279 this.fn = fn;
8280 this.context = context;
8281 this.once = once || false;
8282}
8283
8284/**
8285 * Minimal `EventEmitter` interface that is molded against the Node.js
8286 * `EventEmitter` interface.
8287 *
8288 * @constructor
8289 * @api public
8290 */
8291function EventEmitter() {
8292 this._events = new Events();
8293 this._eventsCount = 0;
8294}
8295
8296/**
8297 * Return an array listing the events for which the emitter has registered
8298 * listeners.
8299 *
8300 * @returns {Array}
8301 * @api public
8302 */
8303EventEmitter.prototype.eventNames = function eventNames() {
8304 var names = []
8305 , events
8306 , name;
8307
8308 if (this._eventsCount === 0) return names;
8309
8310 for (name in (events = this._events)) {
8311 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
8312 }
8313
8314 if (Object.getOwnPropertySymbols) {
8315 return names.concat(Object.getOwnPropertySymbols(events));
8316 }
8317
8318 return names;
8319};
8320
8321/**
8322 * Return the listeners registered for a given event.
8323 *
8324 * @param {String|Symbol} event The event name.
8325 * @param {Boolean} exists Only check if there are listeners.
8326 * @returns {Array|Boolean}
8327 * @api public
8328 */
8329EventEmitter.prototype.listeners = function listeners(event, exists) {
8330 var evt = prefix ? prefix + event : event
8331 , available = this._events[evt];
8332
8333 if (exists) return !!available;
8334 if (!available) return [];
8335 if (available.fn) return [available.fn];
8336
8337 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
8338 ee[i] = available[i].fn;
8339 }
8340
8341 return ee;
8342};
8343
8344/**
8345 * Calls each of the listeners registered for a given event.
8346 *
8347 * @param {String|Symbol} event The event name.
8348 * @returns {Boolean} `true` if the event had listeners, else `false`.
8349 * @api public
8350 */
8351EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
8352 var evt = prefix ? prefix + event : event;
8353
8354 if (!this._events[evt]) return false;
8355
8356 var listeners = this._events[evt]
8357 , len = arguments.length
8358 , args
8359 , i;
8360
8361 if (listeners.fn) {
8362 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
8363
8364 switch (len) {
8365 case 1: return listeners.fn.call(listeners.context), true;
8366 case 2: return listeners.fn.call(listeners.context, a1), true;
8367 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
8368 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
8369 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
8370 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
8371 }
8372
8373 for (i = 1, args = new Array(len -1); i < len; i++) {
8374 args[i - 1] = arguments[i];
8375 }
8376
8377 listeners.fn.apply(listeners.context, args);
8378 } else {
8379 var length = listeners.length
8380 , j;
8381
8382 for (i = 0; i < length; i++) {
8383 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
8384
8385 switch (len) {
8386 case 1: listeners[i].fn.call(listeners[i].context); break;
8387 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
8388 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
8389 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
8390 default:
8391 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
8392 args[j - 1] = arguments[j];
8393 }
8394
8395 listeners[i].fn.apply(listeners[i].context, args);
8396 }
8397 }
8398 }
8399
8400 return true;
8401};
8402
8403/**
8404 * Add a listener for a given event.
8405 *
8406 * @param {String|Symbol} event The event name.
8407 * @param {Function} fn The listener function.
8408 * @param {Mixed} [context=this] The context to invoke the listener with.
8409 * @returns {EventEmitter} `this`.
8410 * @api public
8411 */
8412EventEmitter.prototype.on = function on(event, fn, context) {
8413 var listener = new EE(fn, context || this)
8414 , evt = prefix ? prefix + event : event;
8415
8416 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
8417 else if (!this._events[evt].fn) this._events[evt].push(listener);
8418 else this._events[evt] = [this._events[evt], listener];
8419
8420 return this;
8421};
8422
8423/**
8424 * Add a one-time listener for a given event.
8425 *
8426 * @param {String|Symbol} event The event name.
8427 * @param {Function} fn The listener function.
8428 * @param {Mixed} [context=this] The context to invoke the listener with.
8429 * @returns {EventEmitter} `this`.
8430 * @api public
8431 */
8432EventEmitter.prototype.once = function once(event, fn, context) {
8433 var listener = new EE(fn, context || this, true)
8434 , evt = prefix ? prefix + event : event;
8435
8436 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
8437 else if (!this._events[evt].fn) this._events[evt].push(listener);
8438 else this._events[evt] = [this._events[evt], listener];
8439
8440 return this;
8441};
8442
8443/**
8444 * Remove the listeners of a given event.
8445 *
8446 * @param {String|Symbol} event The event name.
8447 * @param {Function} fn Only remove the listeners that match this function.
8448 * @param {Mixed} context Only remove the listeners that have this context.
8449 * @param {Boolean} once Only remove one-time listeners.
8450 * @returns {EventEmitter} `this`.
8451 * @api public
8452 */
8453EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
8454 var evt = prefix ? prefix + event : event;
8455
8456 if (!this._events[evt]) return this;
8457 if (!fn) {
8458 if (--this._eventsCount === 0) this._events = new Events();
8459 else delete this._events[evt];
8460 return this;
8461 }
8462
8463 var listeners = this._events[evt];
8464
8465 if (listeners.fn) {
8466 if (
8467 listeners.fn === fn
8468 && (!once || listeners.once)
8469 && (!context || listeners.context === context)
8470 ) {
8471 if (--this._eventsCount === 0) this._events = new Events();
8472 else delete this._events[evt];
8473 }
8474 } else {
8475 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
8476 if (
8477 listeners[i].fn !== fn
8478 || (once && !listeners[i].once)
8479 || (context && listeners[i].context !== context)
8480 ) {
8481 events.push(listeners[i]);
8482 }
8483 }
8484
8485 //
8486 // Reset the array, or remove it completely if we have no more listeners.
8487 //
8488 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
8489 else if (--this._eventsCount === 0) this._events = new Events();
8490 else delete this._events[evt];
8491 }
8492
8493 return this;
8494};
8495
8496/**
8497 * Remove all listeners, or those of the specified event.
8498 *
8499 * @param {String|Symbol} [event] The event name.
8500 * @returns {EventEmitter} `this`.
8501 * @api public
8502 */
8503EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
8504 var evt;
8505
8506 if (event) {
8507 evt = prefix ? prefix + event : event;
8508 if (this._events[evt]) {
8509 if (--this._eventsCount === 0) this._events = new Events();
8510 else delete this._events[evt];
8511 }
8512 } else {
8513 this._events = new Events();
8514 this._eventsCount = 0;
8515 }
8516
8517 return this;
8518};
8519
8520//
8521// Alias methods names because people roll like that.
8522//
8523EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
8524EventEmitter.prototype.addListener = EventEmitter.prototype.on;
8525
8526//
8527// This function doesn't apply anymore.
8528//
8529EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
8530 return this;
8531};
8532
8533//
8534// Expose the prefix.
8535//
8536EventEmitter.prefixed = prefix;
8537
8538//
8539// Allow `EventEmitter` to be imported as module namespace.
8540//
8541EventEmitter.EventEmitter = EventEmitter;
8542
8543//
8544// Expose the module.
8545//
8546if ('undefined' !== typeof module) {
8547 module.exports = EventEmitter;
8548}
8549
8550
8551/***/ }),
8552/* 55 */
8553/***/ (function(module, exports, __webpack_require__) {
8554
8555"use strict";
8556
8557
8558Object.defineProperty(exports, "__esModule", {
8559 value: true
8560});
8561exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
8562
8563var _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; };
8564
8565var _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"); } }; }();
8566
8567var _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; }; }();
8568
8569var _extend2 = __webpack_require__(3);
8570
8571var _extend3 = _interopRequireDefault(_extend2);
8572
8573var _quillDelta = __webpack_require__(2);
8574
8575var _quillDelta2 = _interopRequireDefault(_quillDelta);
8576
8577var _parchment = __webpack_require__(0);
8578
8579var _parchment2 = _interopRequireDefault(_parchment);
8580
8581var _quill = __webpack_require__(5);
8582
8583var _quill2 = _interopRequireDefault(_quill);
8584
8585var _logger = __webpack_require__(10);
8586
8587var _logger2 = _interopRequireDefault(_logger);
8588
8589var _module = __webpack_require__(9);
8590
8591var _module2 = _interopRequireDefault(_module);
8592
8593var _align = __webpack_require__(36);
8594
8595var _background = __webpack_require__(37);
8596
8597var _code = __webpack_require__(13);
8598
8599var _code2 = _interopRequireDefault(_code);
8600
8601var _color = __webpack_require__(26);
8602
8603var _direction = __webpack_require__(38);
8604
8605var _font = __webpack_require__(39);
8606
8607var _size = __webpack_require__(40);
8608
8609function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8610
8611function _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; }
8612
8613function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8614
8615function _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; }
8616
8617function _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; }
8618
8619var debug = (0, _logger2.default)('quill:clipboard');
8620
8621var DOM_KEY = '__ql-matcher';
8622
8623var 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]];
8624
8625var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
8626 memo[attr.keyName] = attr;
8627 return memo;
8628}, {});
8629
8630var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
8631 memo[attr.keyName] = attr;
8632 return memo;
8633}, {});
8634
8635var Clipboard = function (_Module) {
8636 _inherits(Clipboard, _Module);
8637
8638 function Clipboard(quill, options) {
8639 _classCallCheck(this, Clipboard);
8640
8641 var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
8642
8643 _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
8644 _this.container = _this.quill.addContainer('ql-clipboard');
8645 _this.container.setAttribute('contenteditable', true);
8646 _this.container.setAttribute('tabindex', -1);
8647 _this.matchers = [];
8648 CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {
8649 var _ref2 = _slicedToArray(_ref, 2),
8650 selector = _ref2[0],
8651 matcher = _ref2[1];
8652
8653 if (!options.matchVisual && matcher === matchSpacing) return;
8654 _this.addMatcher(selector, matcher);
8655 });
8656 return _this;
8657 }
8658
8659 _createClass(Clipboard, [{
8660 key: 'addMatcher',
8661 value: function addMatcher(selector, matcher) {
8662 this.matchers.push([selector, matcher]);
8663 }
8664 }, {
8665 key: 'convert',
8666 value: function convert(html) {
8667 if (typeof html === 'string') {
8668 this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
8669 return this.convert();
8670 }
8671 var formats = this.quill.getFormat(this.quill.selection.savedRange.index);
8672 if (formats[_code2.default.blotName]) {
8673 var text = this.container.innerText;
8674 this.container.innerHTML = '';
8675 return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));
8676 }
8677
8678 var _prepareMatching = this.prepareMatching(),
8679 _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
8680 elementMatchers = _prepareMatching2[0],
8681 textMatchers = _prepareMatching2[1];
8682
8683 var delta = traverse(this.container, elementMatchers, textMatchers);
8684 // Remove trailing newline
8685 if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
8686 delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
8687 }
8688 debug.log('convert', this.container.innerHTML, delta);
8689 this.container.innerHTML = '';
8690 return delta;
8691 }
8692 }, {
8693 key: 'dangerouslyPasteHTML',
8694 value: function dangerouslyPasteHTML(index, html) {
8695 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
8696
8697 if (typeof index === 'string') {
8698 return this.quill.setContents(this.convert(index), html);
8699 } else {
8700 var paste = this.convert(html);
8701 return this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
8702 }
8703 }
8704 }, {
8705 key: 'onPaste',
8706 value: function onPaste(e) {
8707 var _this2 = this;
8708
8709 if (e.defaultPrevented || !this.quill.isEnabled()) return;
8710 var range = this.quill.getSelection();
8711 var delta = new _quillDelta2.default().retain(range.index);
8712 var scrollTop = this.quill.scrollingContainer.scrollTop;
8713 this.container.focus();
8714 this.quill.selection.update(_quill2.default.sources.SILENT);
8715 setTimeout(function () {
8716 delta = delta.concat(_this2.convert()).delete(range.length);
8717 _this2.quill.updateContents(delta, _quill2.default.sources.USER);
8718 // range.length contributes to delta.length()
8719 _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
8720 _this2.quill.scrollingContainer.scrollTop = scrollTop;
8721 _this2.quill.focus();
8722 }, 1);
8723 }
8724 }, {
8725 key: 'prepareMatching',
8726 value: function prepareMatching() {
8727 var _this3 = this;
8728
8729 var elementMatchers = [],
8730 textMatchers = [];
8731 this.matchers.forEach(function (pair) {
8732 var _pair = _slicedToArray(pair, 2),
8733 selector = _pair[0],
8734 matcher = _pair[1];
8735
8736 switch (selector) {
8737 case Node.TEXT_NODE:
8738 textMatchers.push(matcher);
8739 break;
8740 case Node.ELEMENT_NODE:
8741 elementMatchers.push(matcher);
8742 break;
8743 default:
8744 [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
8745 // TODO use weakmap
8746 node[DOM_KEY] = node[DOM_KEY] || [];
8747 node[DOM_KEY].push(matcher);
8748 });
8749 break;
8750 }
8751 });
8752 return [elementMatchers, textMatchers];
8753 }
8754 }]);
8755
8756 return Clipboard;
8757}(_module2.default);
8758
8759Clipboard.DEFAULTS = {
8760 matchers: [],
8761 matchVisual: true
8762};
8763
8764function applyFormat(delta, format, value) {
8765 if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
8766 return Object.keys(format).reduce(function (delta, key) {
8767 return applyFormat(delta, key, format[key]);
8768 }, delta);
8769 } else {
8770 return delta.reduce(function (delta, op) {
8771 if (op.attributes && op.attributes[format]) {
8772 return delta.push(op);
8773 } else {
8774 return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
8775 }
8776 }, new _quillDelta2.default());
8777 }
8778}
8779
8780function computeStyle(node) {
8781 if (node.nodeType !== Node.ELEMENT_NODE) return {};
8782 var DOM_KEY = '__ql-computed-style';
8783 return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
8784}
8785
8786function deltaEndsWith(delta, text) {
8787 var endText = "";
8788 for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
8789 var op = delta.ops[i];
8790 if (typeof op.insert !== 'string') break;
8791 endText = op.insert + endText;
8792 }
8793 return endText.slice(-1 * text.length) === text;
8794}
8795
8796function isLine(node) {
8797 if (node.childNodes.length === 0) return false; // Exclude embed blocks
8798 var style = computeStyle(node);
8799 return ['block', 'list-item'].indexOf(style.display) > -1;
8800}
8801
8802function traverse(node, elementMatchers, textMatchers) {
8803 // Post-order
8804 if (node.nodeType === node.TEXT_NODE) {
8805 return textMatchers.reduce(function (delta, matcher) {
8806 return matcher(node, delta);
8807 }, new _quillDelta2.default());
8808 } else if (node.nodeType === node.ELEMENT_NODE) {
8809 return [].reduce.call(node.childNodes || [], function (delta, childNode) {
8810 var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
8811 if (childNode.nodeType === node.ELEMENT_NODE) {
8812 childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
8813 return matcher(childNode, childrenDelta);
8814 }, childrenDelta);
8815 childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
8816 return matcher(childNode, childrenDelta);
8817 }, childrenDelta);
8818 }
8819 return delta.concat(childrenDelta);
8820 }, new _quillDelta2.default());
8821 } else {
8822 return new _quillDelta2.default();
8823 }
8824}
8825
8826function matchAlias(format, node, delta) {
8827 return applyFormat(delta, format, true);
8828}
8829
8830function matchAttributor(node, delta) {
8831 var attributes = _parchment2.default.Attributor.Attribute.keys(node);
8832 var classes = _parchment2.default.Attributor.Class.keys(node);
8833 var styles = _parchment2.default.Attributor.Style.keys(node);
8834 var formats = {};
8835 attributes.concat(classes).concat(styles).forEach(function (name) {
8836 var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
8837 if (attr != null) {
8838 formats[attr.attrName] = attr.value(node);
8839 if (formats[attr.attrName]) return;
8840 }
8841 attr = ATTRIBUTE_ATTRIBUTORS[name];
8842 if (attr != null && attr.attrName === name) {
8843 formats[attr.attrName] = attr.value(node) || undefined;
8844 }
8845 attr = STYLE_ATTRIBUTORS[name];
8846 if (attr != null && attr.attrName === name) {
8847 attr = STYLE_ATTRIBUTORS[name];
8848 formats[attr.attrName] = attr.value(node) || undefined;
8849 }
8850 });
8851 if (Object.keys(formats).length > 0) {
8852 delta = applyFormat(delta, formats);
8853 }
8854 return delta;
8855}
8856
8857function matchBlot(node, delta) {
8858 var match = _parchment2.default.query(node);
8859 if (match == null) return delta;
8860 if (match.prototype instanceof _parchment2.default.Embed) {
8861 var embed = {};
8862 var value = match.value(node);
8863 if (value != null) {
8864 embed[match.blotName] = value;
8865 delta = new _quillDelta2.default().insert(embed, match.formats(node));
8866 }
8867 } else if (typeof match.formats === 'function') {
8868 delta = applyFormat(delta, match.blotName, match.formats(node));
8869 }
8870 return delta;
8871}
8872
8873function matchBreak(node, delta) {
8874 if (!deltaEndsWith(delta, '\n')) {
8875 delta.insert('\n');
8876 }
8877 return delta;
8878}
8879
8880function matchIgnore() {
8881 return new _quillDelta2.default();
8882}
8883
8884function matchIndent(node, delta) {
8885 var match = _parchment2.default.query(node);
8886 if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
8887 return delta;
8888 }
8889 var indent = -1,
8890 parent = node.parentNode;
8891 while (!parent.classList.contains('ql-clipboard')) {
8892 if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
8893 indent += 1;
8894 }
8895 parent = parent.parentNode;
8896 }
8897 if (indent <= 0) return delta;
8898 return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
8899}
8900
8901function matchNewline(node, delta) {
8902 if (!deltaEndsWith(delta, '\n')) {
8903 if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
8904 delta.insert('\n');
8905 }
8906 }
8907 return delta;
8908}
8909
8910function matchSpacing(node, delta) {
8911 if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
8912 var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
8913 if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
8914 delta.insert('\n');
8915 }
8916 }
8917 return delta;
8918}
8919
8920function matchStyles(node, delta) {
8921 var formats = {};
8922 var style = node.style || {};
8923 if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
8924 formats.italic = true;
8925 }
8926 if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
8927 formats.bold = true;
8928 }
8929 if (Object.keys(formats).length > 0) {
8930 delta = applyFormat(delta, formats);
8931 }
8932 if (parseFloat(style.textIndent || 0) > 0) {
8933 // Could be 0.5in
8934 delta = new _quillDelta2.default().insert('\t').concat(delta);
8935 }
8936 return delta;
8937}
8938
8939function matchText(node, delta) {
8940 var text = node.data;
8941 // Word represents empty line with <o:p>&nbsp;</o:p>
8942 if (node.parentNode.tagName === 'O:P') {
8943 return delta.insert(text.trim());
8944 }
8945 if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
8946 return delta;
8947 }
8948 if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
8949 // eslint-disable-next-line func-style
8950 var replacer = function replacer(collapse, match) {
8951 match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
8952 return match.length < 1 && collapse ? ' ' : match;
8953 };
8954 text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
8955 text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
8956 if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
8957 text = text.replace(/^\s+/, replacer.bind(replacer, false));
8958 }
8959 if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
8960 text = text.replace(/\s+$/, replacer.bind(replacer, false));
8961 }
8962 }
8963 return delta.insert(text);
8964}
8965
8966exports.default = Clipboard;
8967exports.matchAttributor = matchAttributor;
8968exports.matchBlot = matchBlot;
8969exports.matchNewline = matchNewline;
8970exports.matchSpacing = matchSpacing;
8971exports.matchText = matchText;
8972
8973/***/ }),
8974/* 56 */
8975/***/ (function(module, exports, __webpack_require__) {
8976
8977"use strict";
8978
8979
8980Object.defineProperty(exports, "__esModule", {
8981 value: true
8982});
8983
8984var _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; }; }();
8985
8986var _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); } };
8987
8988var _inline = __webpack_require__(6);
8989
8990var _inline2 = _interopRequireDefault(_inline);
8991
8992function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8993
8994function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8995
8996function _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; }
8997
8998function _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; }
8999
9000var Bold = function (_Inline) {
9001 _inherits(Bold, _Inline);
9002
9003 function Bold() {
9004 _classCallCheck(this, Bold);
9005
9006 return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
9007 }
9008
9009 _createClass(Bold, [{
9010 key: 'optimize',
9011 value: function optimize(context) {
9012 _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);
9013 if (this.domNode.tagName !== this.statics.tagName[0]) {
9014 this.replaceWith(this.statics.blotName);
9015 }
9016 }
9017 }], [{
9018 key: 'create',
9019 value: function create() {
9020 return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
9021 }
9022 }, {
9023 key: 'formats',
9024 value: function formats() {
9025 return true;
9026 }
9027 }]);
9028
9029 return Bold;
9030}(_inline2.default);
9031
9032Bold.blotName = 'bold';
9033Bold.tagName = ['STRONG', 'B'];
9034
9035exports.default = Bold;
9036
9037/***/ }),
9038/* 57 */
9039/***/ (function(module, exports, __webpack_require__) {
9040
9041"use strict";
9042
9043
9044Object.defineProperty(exports, "__esModule", {
9045 value: true
9046});
9047exports.addControls = exports.default = undefined;
9048
9049var _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"); } }; }();
9050
9051var _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; }; }();
9052
9053var _quillDelta = __webpack_require__(2);
9054
9055var _quillDelta2 = _interopRequireDefault(_quillDelta);
9056
9057var _parchment = __webpack_require__(0);
9058
9059var _parchment2 = _interopRequireDefault(_parchment);
9060
9061var _quill = __webpack_require__(5);
9062
9063var _quill2 = _interopRequireDefault(_quill);
9064
9065var _logger = __webpack_require__(10);
9066
9067var _logger2 = _interopRequireDefault(_logger);
9068
9069var _module = __webpack_require__(9);
9070
9071var _module2 = _interopRequireDefault(_module);
9072
9073function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9074
9075function _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; }
9076
9077function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9078
9079function _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; }
9080
9081function _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; }
9082
9083var debug = (0, _logger2.default)('quill:toolbar');
9084
9085var Toolbar = function (_Module) {
9086 _inherits(Toolbar, _Module);
9087
9088 function Toolbar(quill, options) {
9089 _classCallCheck(this, Toolbar);
9090
9091 var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
9092
9093 if (Array.isArray(_this.options.container)) {
9094 var container = document.createElement('div');
9095 addControls(container, _this.options.container);
9096 quill.container.parentNode.insertBefore(container, quill.container);
9097 _this.container = container;
9098 } else if (typeof _this.options.container === 'string') {
9099 _this.container = document.querySelector(_this.options.container);
9100 } else {
9101 _this.container = _this.options.container;
9102 }
9103 if (!(_this.container instanceof HTMLElement)) {
9104 var _ret;
9105
9106 return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
9107 }
9108 _this.container.classList.add('ql-toolbar');
9109 _this.controls = [];
9110 _this.handlers = {};
9111 Object.keys(_this.options.handlers).forEach(function (format) {
9112 _this.addHandler(format, _this.options.handlers[format]);
9113 });
9114 [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
9115 _this.attach(input);
9116 });
9117 _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
9118 if (type === _quill2.default.events.SELECTION_CHANGE) {
9119 _this.update(range);
9120 }
9121 });
9122 _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
9123 var _this$quill$selection = _this.quill.selection.getRange(),
9124 _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
9125 range = _this$quill$selection2[0]; // quill.getSelection triggers update
9126
9127
9128 _this.update(range);
9129 });
9130 return _this;
9131 }
9132
9133 _createClass(Toolbar, [{
9134 key: 'addHandler',
9135 value: function addHandler(format, handler) {
9136 this.handlers[format] = handler;
9137 }
9138 }, {
9139 key: 'attach',
9140 value: function attach(input) {
9141 var _this2 = this;
9142
9143 var format = [].find.call(input.classList, function (className) {
9144 return className.indexOf('ql-') === 0;
9145 });
9146 if (!format) return;
9147 format = format.slice('ql-'.length);
9148 if (input.tagName === 'BUTTON') {
9149 input.setAttribute('type', 'button');
9150 }
9151 if (this.handlers[format] == null) {
9152 if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
9153 debug.warn('ignoring attaching to disabled format', format, input);
9154 return;
9155 }
9156 if (_parchment2.default.query(format) == null) {
9157 debug.warn('ignoring attaching to nonexistent format', format, input);
9158 return;
9159 }
9160 }
9161 var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
9162 input.addEventListener(eventName, function (e) {
9163 var value = void 0;
9164 if (input.tagName === 'SELECT') {
9165 if (input.selectedIndex < 0) return;
9166 var selected = input.options[input.selectedIndex];
9167 if (selected.hasAttribute('selected')) {
9168 value = false;
9169 } else {
9170 value = selected.value || false;
9171 }
9172 } else {
9173 if (input.classList.contains('ql-active')) {
9174 value = false;
9175 } else {
9176 value = input.value || !input.hasAttribute('value');
9177 }
9178 e.preventDefault();
9179 }
9180 _this2.quill.focus();
9181
9182 var _quill$selection$getR = _this2.quill.selection.getRange(),
9183 _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
9184 range = _quill$selection$getR2[0];
9185
9186 if (_this2.handlers[format] != null) {
9187 _this2.handlers[format].call(_this2, value);
9188 } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
9189 value = prompt('Enter ' + format);
9190 if (!value) return;
9191 _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
9192 } else {
9193 _this2.quill.format(format, value, _quill2.default.sources.USER);
9194 }
9195 _this2.update(range);
9196 });
9197 // TODO use weakmap
9198 this.controls.push([format, input]);
9199 }
9200 }, {
9201 key: 'update',
9202 value: function update(range) {
9203 var formats = range == null ? {} : this.quill.getFormat(range);
9204 this.controls.forEach(function (pair) {
9205 var _pair = _slicedToArray(pair, 2),
9206 format = _pair[0],
9207 input = _pair[1];
9208
9209 if (input.tagName === 'SELECT') {
9210 var option = void 0;
9211 if (range == null) {
9212 option = null;
9213 } else if (formats[format] == null) {
9214 option = input.querySelector('option[selected]');
9215 } else if (!Array.isArray(formats[format])) {
9216 var value = formats[format];
9217 if (typeof value === 'string') {
9218 value = value.replace(/\"/g, '\\"');
9219 }
9220 option = input.querySelector('option[value="' + value + '"]');
9221 }
9222 if (option == null) {
9223 input.value = ''; // TODO make configurable?
9224 input.selectedIndex = -1;
9225 } else {
9226 option.selected = true;
9227 }
9228 } else {
9229 if (range == null) {
9230 input.classList.remove('ql-active');
9231 } else if (input.hasAttribute('value')) {
9232 // both being null should match (default values)
9233 // '1' should match with 1 (headers)
9234 var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
9235 input.classList.toggle('ql-active', isActive);
9236 } else {
9237 input.classList.toggle('ql-active', formats[format] != null);
9238 }
9239 }
9240 });
9241 }
9242 }]);
9243
9244 return Toolbar;
9245}(_module2.default);
9246
9247Toolbar.DEFAULTS = {};
9248
9249function addButton(container, format, value) {
9250 var input = document.createElement('button');
9251 input.setAttribute('type', 'button');
9252 input.classList.add('ql-' + format);
9253 if (value != null) {
9254 input.value = value;
9255 }
9256 container.appendChild(input);
9257}
9258
9259function addControls(container, groups) {
9260 if (!Array.isArray(groups[0])) {
9261 groups = [groups];
9262 }
9263 groups.forEach(function (controls) {
9264 var group = document.createElement('span');
9265 group.classList.add('ql-formats');
9266 controls.forEach(function (control) {
9267 if (typeof control === 'string') {
9268 addButton(group, control);
9269 } else {
9270 var format = Object.keys(control)[0];
9271 var value = control[format];
9272 if (Array.isArray(value)) {
9273 addSelect(group, format, value);
9274 } else {
9275 addButton(group, format, value);
9276 }
9277 }
9278 });
9279 container.appendChild(group);
9280 });
9281}
9282
9283function addSelect(container, format, values) {
9284 var input = document.createElement('select');
9285 input.classList.add('ql-' + format);
9286 values.forEach(function (value) {
9287 var option = document.createElement('option');
9288 if (value !== false) {
9289 option.setAttribute('value', value);
9290 } else {
9291 option.setAttribute('selected', 'selected');
9292 }
9293 input.appendChild(option);
9294 });
9295 container.appendChild(input);
9296}
9297
9298Toolbar.DEFAULTS = {
9299 container: null,
9300 handlers: {
9301 clean: function clean() {
9302 var _this3 = this;
9303
9304 var range = this.quill.getSelection();
9305 if (range == null) return;
9306 if (range.length == 0) {
9307 var formats = this.quill.getFormat();
9308 Object.keys(formats).forEach(function (name) {
9309 // Clean functionality in existing apps only clean inline formats
9310 if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
9311 _this3.quill.format(name, false);
9312 }
9313 });
9314 } else {
9315 this.quill.removeFormat(range, _quill2.default.sources.USER);
9316 }
9317 },
9318 direction: function direction(value) {
9319 var align = this.quill.getFormat()['align'];
9320 if (value === 'rtl' && align == null) {
9321 this.quill.format('align', 'right', _quill2.default.sources.USER);
9322 } else if (!value && align === 'right') {
9323 this.quill.format('align', false, _quill2.default.sources.USER);
9324 }
9325 this.quill.format('direction', value, _quill2.default.sources.USER);
9326 },
9327 indent: function indent(value) {
9328 var range = this.quill.getSelection();
9329 var formats = this.quill.getFormat(range);
9330 var indent = parseInt(formats.indent || 0);
9331 if (value === '+1' || value === '-1') {
9332 var modifier = value === '+1' ? 1 : -1;
9333 if (formats.direction === 'rtl') modifier *= -1;
9334 this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
9335 }
9336 },
9337 link: function link(value) {
9338 if (value === true) {
9339 value = prompt('Enter link URL:');
9340 }
9341 this.quill.format('link', value, _quill2.default.sources.USER);
9342 },
9343 list: function list(value) {
9344 var range = this.quill.getSelection();
9345 var formats = this.quill.getFormat(range);
9346 if (value === 'check') {
9347 if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
9348 this.quill.format('list', false, _quill2.default.sources.USER);
9349 } else {
9350 this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
9351 }
9352 } else {
9353 this.quill.format('list', value, _quill2.default.sources.USER);
9354 }
9355 }
9356 }
9357};
9358
9359exports.default = Toolbar;
9360exports.addControls = addControls;
9361
9362/***/ }),
9363/* 58 */
9364/***/ (function(module, exports) {
9365
9366module.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>";
9367
9368/***/ }),
9369/* 59 */
9370/***/ (function(module, exports, __webpack_require__) {
9371
9372"use strict";
9373
9374
9375Object.defineProperty(exports, "__esModule", {
9376 value: true
9377});
9378
9379var _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; }; }();
9380
9381var _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); } };
9382
9383var _picker = __webpack_require__(28);
9384
9385var _picker2 = _interopRequireDefault(_picker);
9386
9387function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9388
9389function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9390
9391function _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; }
9392
9393function _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; }
9394
9395var ColorPicker = function (_Picker) {
9396 _inherits(ColorPicker, _Picker);
9397
9398 function ColorPicker(select, label) {
9399 _classCallCheck(this, ColorPicker);
9400
9401 var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
9402
9403 _this.label.innerHTML = label;
9404 _this.container.classList.add('ql-color-picker');
9405 [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
9406 item.classList.add('ql-primary');
9407 });
9408 return _this;
9409 }
9410
9411 _createClass(ColorPicker, [{
9412 key: 'buildItem',
9413 value: function buildItem(option) {
9414 var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
9415 item.style.backgroundColor = option.getAttribute('value') || '';
9416 return item;
9417 }
9418 }, {
9419 key: 'selectItem',
9420 value: function selectItem(item, trigger) {
9421 _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
9422 var colorLabel = this.label.querySelector('.ql-color-label');
9423 var value = item ? item.getAttribute('data-value') || '' : '';
9424 if (colorLabel) {
9425 if (colorLabel.tagName === 'line') {
9426 colorLabel.style.stroke = value;
9427 } else {
9428 colorLabel.style.fill = value;
9429 }
9430 }
9431 }
9432 }]);
9433
9434 return ColorPicker;
9435}(_picker2.default);
9436
9437exports.default = ColorPicker;
9438
9439/***/ }),
9440/* 60 */
9441/***/ (function(module, exports, __webpack_require__) {
9442
9443"use strict";
9444
9445
9446Object.defineProperty(exports, "__esModule", {
9447 value: true
9448});
9449
9450var _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; }; }();
9451
9452var _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); } };
9453
9454var _picker = __webpack_require__(28);
9455
9456var _picker2 = _interopRequireDefault(_picker);
9457
9458function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9459
9460function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9461
9462function _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; }
9463
9464function _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; }
9465
9466var IconPicker = function (_Picker) {
9467 _inherits(IconPicker, _Picker);
9468
9469 function IconPicker(select, icons) {
9470 _classCallCheck(this, IconPicker);
9471
9472 var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
9473
9474 _this.container.classList.add('ql-icon-picker');
9475 [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
9476 item.innerHTML = icons[item.getAttribute('data-value') || ''];
9477 });
9478 _this.defaultItem = _this.container.querySelector('.ql-selected');
9479 _this.selectItem(_this.defaultItem);
9480 return _this;
9481 }
9482
9483 _createClass(IconPicker, [{
9484 key: 'selectItem',
9485 value: function selectItem(item, trigger) {
9486 _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
9487 item = item || this.defaultItem;
9488 this.label.innerHTML = item.innerHTML;
9489 }
9490 }]);
9491
9492 return IconPicker;
9493}(_picker2.default);
9494
9495exports.default = IconPicker;
9496
9497/***/ }),
9498/* 61 */
9499/***/ (function(module, exports, __webpack_require__) {
9500
9501"use strict";
9502
9503
9504Object.defineProperty(exports, "__esModule", {
9505 value: true
9506});
9507
9508var _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; }; }();
9509
9510function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9511
9512var Tooltip = function () {
9513 function Tooltip(quill, boundsContainer) {
9514 var _this = this;
9515
9516 _classCallCheck(this, Tooltip);
9517
9518 this.quill = quill;
9519 this.boundsContainer = boundsContainer || document.body;
9520 this.root = quill.addContainer('ql-tooltip');
9521 this.root.innerHTML = this.constructor.TEMPLATE;
9522 if (this.quill.root === this.quill.scrollingContainer) {
9523 this.quill.root.addEventListener('scroll', function () {
9524 _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
9525 });
9526 }
9527 this.hide();
9528 }
9529
9530 _createClass(Tooltip, [{
9531 key: 'hide',
9532 value: function hide() {
9533 this.root.classList.add('ql-hidden');
9534 }
9535 }, {
9536 key: 'position',
9537 value: function position(reference) {
9538 var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
9539 // root.scrollTop should be 0 if scrollContainer !== root
9540 var top = reference.bottom + this.quill.root.scrollTop;
9541 this.root.style.left = left + 'px';
9542 this.root.style.top = top + 'px';
9543 this.root.classList.remove('ql-flip');
9544 var containerBounds = this.boundsContainer.getBoundingClientRect();
9545 var rootBounds = this.root.getBoundingClientRect();
9546 var shift = 0;
9547 if (rootBounds.right > containerBounds.right) {
9548 shift = containerBounds.right - rootBounds.right;
9549 this.root.style.left = left + shift + 'px';
9550 }
9551 if (rootBounds.left < containerBounds.left) {
9552 shift = containerBounds.left - rootBounds.left;
9553 this.root.style.left = left + shift + 'px';
9554 }
9555 if (rootBounds.bottom > containerBounds.bottom) {
9556 var height = rootBounds.bottom - rootBounds.top;
9557 var verticalShift = reference.bottom - reference.top + height;
9558 this.root.style.top = top - verticalShift + 'px';
9559 this.root.classList.add('ql-flip');
9560 }
9561 return shift;
9562 }
9563 }, {
9564 key: 'show',
9565 value: function show() {
9566 this.root.classList.remove('ql-editing');
9567 this.root.classList.remove('ql-hidden');
9568 }
9569 }]);
9570
9571 return Tooltip;
9572}();
9573
9574exports.default = Tooltip;
9575
9576/***/ }),
9577/* 62 */
9578/***/ (function(module, exports, __webpack_require__) {
9579
9580"use strict";
9581
9582
9583Object.defineProperty(exports, "__esModule", {
9584 value: true
9585});
9586
9587var _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"); } }; }();
9588
9589var _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); } };
9590
9591var _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; }; }();
9592
9593var _extend = __webpack_require__(3);
9594
9595var _extend2 = _interopRequireDefault(_extend);
9596
9597var _emitter = __webpack_require__(8);
9598
9599var _emitter2 = _interopRequireDefault(_emitter);
9600
9601var _base = __webpack_require__(43);
9602
9603var _base2 = _interopRequireDefault(_base);
9604
9605var _link = __webpack_require__(27);
9606
9607var _link2 = _interopRequireDefault(_link);
9608
9609var _selection = __webpack_require__(15);
9610
9611var _icons = __webpack_require__(41);
9612
9613var _icons2 = _interopRequireDefault(_icons);
9614
9615function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9616
9617function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9618
9619function _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; }
9620
9621function _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; }
9622
9623var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
9624
9625var SnowTheme = function (_BaseTheme) {
9626 _inherits(SnowTheme, _BaseTheme);
9627
9628 function SnowTheme(quill, options) {
9629 _classCallCheck(this, SnowTheme);
9630
9631 if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
9632 options.modules.toolbar.container = TOOLBAR_CONFIG;
9633 }
9634
9635 var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
9636
9637 _this.quill.container.classList.add('ql-snow');
9638 return _this;
9639 }
9640
9641 _createClass(SnowTheme, [{
9642 key: 'extendToolbar',
9643 value: function extendToolbar(toolbar) {
9644 toolbar.container.classList.add('ql-snow');
9645 this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
9646 this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
9647 this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
9648 if (toolbar.container.querySelector('.ql-link')) {
9649 this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
9650 toolbar.handlers['link'].call(toolbar, !context.format.link);
9651 });
9652 }
9653 }
9654 }]);
9655
9656 return SnowTheme;
9657}(_base2.default);
9658
9659SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
9660 modules: {
9661 toolbar: {
9662 handlers: {
9663 link: function link(value) {
9664 if (value) {
9665 var range = this.quill.getSelection();
9666 if (range == null || range.length == 0) return;
9667 var preview = this.quill.getText(range);
9668 if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
9669 preview = 'mailto:' + preview;
9670 }
9671 var tooltip = this.quill.theme.tooltip;
9672 tooltip.edit('link', preview);
9673 } else {
9674 this.quill.format('link', false);
9675 }
9676 }
9677 }
9678 }
9679 }
9680});
9681
9682var SnowTooltip = function (_BaseTooltip) {
9683 _inherits(SnowTooltip, _BaseTooltip);
9684
9685 function SnowTooltip(quill, bounds) {
9686 _classCallCheck(this, SnowTooltip);
9687
9688 var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
9689
9690 _this2.preview = _this2.root.querySelector('a.ql-preview');
9691 return _this2;
9692 }
9693
9694 _createClass(SnowTooltip, [{
9695 key: 'listen',
9696 value: function listen() {
9697 var _this3 = this;
9698
9699 _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
9700 this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
9701 if (_this3.root.classList.contains('ql-editing')) {
9702 _this3.save();
9703 } else {
9704 _this3.edit('link', _this3.preview.textContent);
9705 }
9706 event.preventDefault();
9707 });
9708 this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
9709 if (_this3.linkRange != null) {
9710 var range = _this3.linkRange;
9711 _this3.restoreFocus();
9712 _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
9713 delete _this3.linkRange;
9714 }
9715 event.preventDefault();
9716 _this3.hide();
9717 });
9718 this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
9719 if (range == null) return;
9720 if (range.length === 0 && source === _emitter2.default.sources.USER) {
9721 var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
9722 _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
9723 link = _quill$scroll$descend2[0],
9724 offset = _quill$scroll$descend2[1];
9725
9726 if (link != null) {
9727 _this3.linkRange = new _selection.Range(range.index - offset, link.length());
9728 var preview = _link2.default.formats(link.domNode);
9729 _this3.preview.textContent = preview;
9730 _this3.preview.setAttribute('href', preview);
9731 _this3.show();
9732 _this3.position(_this3.quill.getBounds(_this3.linkRange));
9733 return;
9734 }
9735 } else {
9736 delete _this3.linkRange;
9737 }
9738 _this3.hide();
9739 });
9740 }
9741 }, {
9742 key: 'show',
9743 value: function show() {
9744 _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
9745 this.root.removeAttribute('data-mode');
9746 }
9747 }]);
9748
9749 return SnowTooltip;
9750}(_base.BaseTooltip);
9751
9752SnowTooltip.TEMPLATE = ['<a class="ql-preview" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
9753
9754exports.default = SnowTheme;
9755
9756/***/ }),
9757/* 63 */
9758/***/ (function(module, exports, __webpack_require__) {
9759
9760"use strict";
9761
9762
9763var _core = __webpack_require__(29);
9764
9765var _core2 = _interopRequireDefault(_core);
9766
9767var _align = __webpack_require__(36);
9768
9769var _direction = __webpack_require__(38);
9770
9771var _indent = __webpack_require__(64);
9772
9773var _blockquote = __webpack_require__(65);
9774
9775var _blockquote2 = _interopRequireDefault(_blockquote);
9776
9777var _header = __webpack_require__(66);
9778
9779var _header2 = _interopRequireDefault(_header);
9780
9781var _list = __webpack_require__(67);
9782
9783var _list2 = _interopRequireDefault(_list);
9784
9785var _background = __webpack_require__(37);
9786
9787var _color = __webpack_require__(26);
9788
9789var _font = __webpack_require__(39);
9790
9791var _size = __webpack_require__(40);
9792
9793var _bold = __webpack_require__(56);
9794
9795var _bold2 = _interopRequireDefault(_bold);
9796
9797var _italic = __webpack_require__(68);
9798
9799var _italic2 = _interopRequireDefault(_italic);
9800
9801var _link = __webpack_require__(27);
9802
9803var _link2 = _interopRequireDefault(_link);
9804
9805var _script = __webpack_require__(69);
9806
9807var _script2 = _interopRequireDefault(_script);
9808
9809var _strike = __webpack_require__(70);
9810
9811var _strike2 = _interopRequireDefault(_strike);
9812
9813var _underline = __webpack_require__(71);
9814
9815var _underline2 = _interopRequireDefault(_underline);
9816
9817var _image = __webpack_require__(72);
9818
9819var _image2 = _interopRequireDefault(_image);
9820
9821var _video = __webpack_require__(73);
9822
9823var _video2 = _interopRequireDefault(_video);
9824
9825var _code = __webpack_require__(13);
9826
9827var _code2 = _interopRequireDefault(_code);
9828
9829var _formula = __webpack_require__(74);
9830
9831var _formula2 = _interopRequireDefault(_formula);
9832
9833var _syntax = __webpack_require__(75);
9834
9835var _syntax2 = _interopRequireDefault(_syntax);
9836
9837var _toolbar = __webpack_require__(57);
9838
9839var _toolbar2 = _interopRequireDefault(_toolbar);
9840
9841var _icons = __webpack_require__(41);
9842
9843var _icons2 = _interopRequireDefault(_icons);
9844
9845var _picker = __webpack_require__(28);
9846
9847var _picker2 = _interopRequireDefault(_picker);
9848
9849var _colorPicker = __webpack_require__(59);
9850
9851var _colorPicker2 = _interopRequireDefault(_colorPicker);
9852
9853var _iconPicker = __webpack_require__(60);
9854
9855var _iconPicker2 = _interopRequireDefault(_iconPicker);
9856
9857var _tooltip = __webpack_require__(61);
9858
9859var _tooltip2 = _interopRequireDefault(_tooltip);
9860
9861var _bubble = __webpack_require__(108);
9862
9863var _bubble2 = _interopRequireDefault(_bubble);
9864
9865var _snow = __webpack_require__(62);
9866
9867var _snow2 = _interopRequireDefault(_snow);
9868
9869function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9870
9871_core2.default.register({
9872 'attributors/attribute/direction': _direction.DirectionAttribute,
9873
9874 'attributors/class/align': _align.AlignClass,
9875 'attributors/class/background': _background.BackgroundClass,
9876 'attributors/class/color': _color.ColorClass,
9877 'attributors/class/direction': _direction.DirectionClass,
9878 'attributors/class/font': _font.FontClass,
9879 'attributors/class/size': _size.SizeClass,
9880
9881 'attributors/style/align': _align.AlignStyle,
9882 'attributors/style/background': _background.BackgroundStyle,
9883 'attributors/style/color': _color.ColorStyle,
9884 'attributors/style/direction': _direction.DirectionStyle,
9885 'attributors/style/font': _font.FontStyle,
9886 'attributors/style/size': _size.SizeStyle
9887}, true);
9888
9889_core2.default.register({
9890 'formats/align': _align.AlignClass,
9891 'formats/direction': _direction.DirectionClass,
9892 'formats/indent': _indent.IndentClass,
9893
9894 'formats/background': _background.BackgroundStyle,
9895 'formats/color': _color.ColorStyle,
9896 'formats/font': _font.FontClass,
9897 'formats/size': _size.SizeClass,
9898
9899 'formats/blockquote': _blockquote2.default,
9900 'formats/code-block': _code2.default,
9901 'formats/header': _header2.default,
9902 'formats/list': _list2.default,
9903
9904 'formats/bold': _bold2.default,
9905 'formats/code': _code.Code,
9906 'formats/italic': _italic2.default,
9907 'formats/link': _link2.default,
9908 'formats/script': _script2.default,
9909 'formats/strike': _strike2.default,
9910 'formats/underline': _underline2.default,
9911
9912 'formats/image': _image2.default,
9913 'formats/video': _video2.default,
9914
9915 'formats/list/item': _list.ListItem,
9916
9917 'modules/formula': _formula2.default,
9918 'modules/syntax': _syntax2.default,
9919 'modules/toolbar': _toolbar2.default,
9920
9921 'themes/bubble': _bubble2.default,
9922 'themes/snow': _snow2.default,
9923
9924 'ui/icons': _icons2.default,
9925 'ui/picker': _picker2.default,
9926 'ui/icon-picker': _iconPicker2.default,
9927 'ui/color-picker': _colorPicker2.default,
9928 'ui/tooltip': _tooltip2.default
9929}, true);
9930
9931module.exports = _core2.default;
9932
9933/***/ }),
9934/* 64 */
9935/***/ (function(module, exports, __webpack_require__) {
9936
9937"use strict";
9938
9939
9940Object.defineProperty(exports, "__esModule", {
9941 value: true
9942});
9943exports.IndentClass = undefined;
9944
9945var _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; }; }();
9946
9947var _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); } };
9948
9949var _parchment = __webpack_require__(0);
9950
9951var _parchment2 = _interopRequireDefault(_parchment);
9952
9953function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9954
9955function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9956
9957function _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; }
9958
9959function _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; }
9960
9961var IdentAttributor = function (_Parchment$Attributor) {
9962 _inherits(IdentAttributor, _Parchment$Attributor);
9963
9964 function IdentAttributor() {
9965 _classCallCheck(this, IdentAttributor);
9966
9967 return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
9968 }
9969
9970 _createClass(IdentAttributor, [{
9971 key: 'add',
9972 value: function add(node, value) {
9973 if (value === '+1' || value === '-1') {
9974 var indent = this.value(node) || 0;
9975 value = value === '+1' ? indent + 1 : indent - 1;
9976 }
9977 if (value === 0) {
9978 this.remove(node);
9979 return true;
9980 } else {
9981 return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
9982 }
9983 }
9984 }, {
9985 key: 'canAdd',
9986 value: function canAdd(node, value) {
9987 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));
9988 }
9989 }, {
9990 key: 'value',
9991 value: function value(node) {
9992 return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
9993 }
9994 }]);
9995
9996 return IdentAttributor;
9997}(_parchment2.default.Attributor.Class);
9998
9999var IndentClass = new IdentAttributor('indent', 'ql-indent', {
10000 scope: _parchment2.default.Scope.BLOCK,
10001 whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
10002});
10003
10004exports.IndentClass = IndentClass;
10005
10006/***/ }),
10007/* 65 */
10008/***/ (function(module, exports, __webpack_require__) {
10009
10010"use strict";
10011
10012
10013Object.defineProperty(exports, "__esModule", {
10014 value: true
10015});
10016
10017var _block = __webpack_require__(4);
10018
10019var _block2 = _interopRequireDefault(_block);
10020
10021function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10022
10023function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10024
10025function _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; }
10026
10027function _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; }
10028
10029var Blockquote = function (_Block) {
10030 _inherits(Blockquote, _Block);
10031
10032 function Blockquote() {
10033 _classCallCheck(this, Blockquote);
10034
10035 return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
10036 }
10037
10038 return Blockquote;
10039}(_block2.default);
10040
10041Blockquote.blotName = 'blockquote';
10042Blockquote.tagName = 'blockquote';
10043
10044exports.default = Blockquote;
10045
10046/***/ }),
10047/* 66 */
10048/***/ (function(module, exports, __webpack_require__) {
10049
10050"use strict";
10051
10052
10053Object.defineProperty(exports, "__esModule", {
10054 value: true
10055});
10056
10057var _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; }; }();
10058
10059var _block = __webpack_require__(4);
10060
10061var _block2 = _interopRequireDefault(_block);
10062
10063function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10064
10065function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10066
10067function _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; }
10068
10069function _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; }
10070
10071var Header = function (_Block) {
10072 _inherits(Header, _Block);
10073
10074 function Header() {
10075 _classCallCheck(this, Header);
10076
10077 return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
10078 }
10079
10080 _createClass(Header, null, [{
10081 key: 'formats',
10082 value: function formats(domNode) {
10083 return this.tagName.indexOf(domNode.tagName) + 1;
10084 }
10085 }]);
10086
10087 return Header;
10088}(_block2.default);
10089
10090Header.blotName = 'header';
10091Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
10092
10093exports.default = Header;
10094
10095/***/ }),
10096/* 67 */
10097/***/ (function(module, exports, __webpack_require__) {
10098
10099"use strict";
10100
10101
10102Object.defineProperty(exports, "__esModule", {
10103 value: true
10104});
10105exports.default = exports.ListItem = undefined;
10106
10107var _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; }; }();
10108
10109var _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); } };
10110
10111var _parchment = __webpack_require__(0);
10112
10113var _parchment2 = _interopRequireDefault(_parchment);
10114
10115var _block = __webpack_require__(4);
10116
10117var _block2 = _interopRequireDefault(_block);
10118
10119var _container = __webpack_require__(24);
10120
10121var _container2 = _interopRequireDefault(_container);
10122
10123function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10124
10125function _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; }
10126
10127function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10128
10129function _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; }
10130
10131function _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; }
10132
10133var ListItem = function (_Block) {
10134 _inherits(ListItem, _Block);
10135
10136 function ListItem() {
10137 _classCallCheck(this, ListItem);
10138
10139 return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
10140 }
10141
10142 _createClass(ListItem, [{
10143 key: 'format',
10144 value: function format(name, value) {
10145 if (name === List.blotName && !value) {
10146 this.replaceWith(_parchment2.default.create(this.statics.scope));
10147 } else {
10148 _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
10149 }
10150 }
10151 }, {
10152 key: 'remove',
10153 value: function remove() {
10154 if (this.prev == null && this.next == null) {
10155 this.parent.remove();
10156 } else {
10157 _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
10158 }
10159 }
10160 }, {
10161 key: 'replaceWith',
10162 value: function replaceWith(name, value) {
10163 this.parent.isolate(this.offset(this.parent), this.length());
10164 if (name === this.parent.statics.blotName) {
10165 this.parent.replaceWith(name, value);
10166 return this;
10167 } else {
10168 this.parent.unwrap();
10169 return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
10170 }
10171 }
10172 }], [{
10173 key: 'formats',
10174 value: function formats(domNode) {
10175 return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
10176 }
10177 }]);
10178
10179 return ListItem;
10180}(_block2.default);
10181
10182ListItem.blotName = 'list-item';
10183ListItem.tagName = 'LI';
10184
10185var List = function (_Container) {
10186 _inherits(List, _Container);
10187
10188 _createClass(List, null, [{
10189 key: 'create',
10190 value: function create(value) {
10191 var tagName = value === 'ordered' ? 'OL' : 'UL';
10192 var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
10193 if (value === 'checked' || value === 'unchecked') {
10194 node.setAttribute('data-checked', value === 'checked');
10195 }
10196 return node;
10197 }
10198 }, {
10199 key: 'formats',
10200 value: function formats(domNode) {
10201 if (domNode.tagName === 'OL') return 'ordered';
10202 if (domNode.tagName === 'UL') {
10203 if (domNode.hasAttribute('data-checked')) {
10204 return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
10205 } else {
10206 return 'bullet';
10207 }
10208 }
10209 return undefined;
10210 }
10211 }]);
10212
10213 function List(domNode) {
10214 _classCallCheck(this, List);
10215
10216 var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
10217
10218 var listEventHandler = function listEventHandler(e) {
10219 if (e.target.parentNode !== domNode) return;
10220 var format = _this2.statics.formats(domNode);
10221 var blot = _parchment2.default.find(e.target);
10222 if (format === 'checked') {
10223 blot.format('list', 'unchecked');
10224 } else if (format === 'unchecked') {
10225 blot.format('list', 'checked');
10226 }
10227 };
10228
10229 domNode.addEventListener('touchstart', listEventHandler);
10230 domNode.addEventListener('mousedown', listEventHandler);
10231 return _this2;
10232 }
10233
10234 _createClass(List, [{
10235 key: 'format',
10236 value: function format(name, value) {
10237 if (this.children.length > 0) {
10238 this.children.tail.format(name, value);
10239 }
10240 }
10241 }, {
10242 key: 'formats',
10243 value: function formats() {
10244 // We don't inherit from FormatBlot
10245 return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
10246 }
10247 }, {
10248 key: 'insertBefore',
10249 value: function insertBefore(blot, ref) {
10250 if (blot instanceof ListItem) {
10251 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
10252 } else {
10253 var index = ref == null ? this.length() : ref.offset(this);
10254 var after = this.split(index);
10255 after.parent.insertBefore(blot, after);
10256 }
10257 }
10258 }, {
10259 key: 'optimize',
10260 value: function optimize(context) {
10261 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);
10262 var next = this.next;
10263 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')) {
10264 next.moveChildren(this);
10265 next.remove();
10266 }
10267 }
10268 }, {
10269 key: 'replace',
10270 value: function replace(target) {
10271 if (target.statics.blotName !== this.statics.blotName) {
10272 var item = _parchment2.default.create(this.statics.defaultChild);
10273 target.moveChildren(item);
10274 this.appendChild(item);
10275 }
10276 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
10277 }
10278 }]);
10279
10280 return List;
10281}(_container2.default);
10282
10283List.blotName = 'list';
10284List.scope = _parchment2.default.Scope.BLOCK_BLOT;
10285List.tagName = ['OL', 'UL'];
10286List.defaultChild = 'list-item';
10287List.allowedChildren = [ListItem];
10288
10289exports.ListItem = ListItem;
10290exports.default = List;
10291
10292/***/ }),
10293/* 68 */
10294/***/ (function(module, exports, __webpack_require__) {
10295
10296"use strict";
10297
10298
10299Object.defineProperty(exports, "__esModule", {
10300 value: true
10301});
10302
10303var _bold = __webpack_require__(56);
10304
10305var _bold2 = _interopRequireDefault(_bold);
10306
10307function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10308
10309function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10310
10311function _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; }
10312
10313function _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; }
10314
10315var Italic = function (_Bold) {
10316 _inherits(Italic, _Bold);
10317
10318 function Italic() {
10319 _classCallCheck(this, Italic);
10320
10321 return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
10322 }
10323
10324 return Italic;
10325}(_bold2.default);
10326
10327Italic.blotName = 'italic';
10328Italic.tagName = ['EM', 'I'];
10329
10330exports.default = Italic;
10331
10332/***/ }),
10333/* 69 */
10334/***/ (function(module, exports, __webpack_require__) {
10335
10336"use strict";
10337
10338
10339Object.defineProperty(exports, "__esModule", {
10340 value: true
10341});
10342
10343var _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; }; }();
10344
10345var _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); } };
10346
10347var _inline = __webpack_require__(6);
10348
10349var _inline2 = _interopRequireDefault(_inline);
10350
10351function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10352
10353function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10354
10355function _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; }
10356
10357function _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; }
10358
10359var Script = function (_Inline) {
10360 _inherits(Script, _Inline);
10361
10362 function Script() {
10363 _classCallCheck(this, Script);
10364
10365 return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
10366 }
10367
10368 _createClass(Script, null, [{
10369 key: 'create',
10370 value: function create(value) {
10371 if (value === 'super') {
10372 return document.createElement('sup');
10373 } else if (value === 'sub') {
10374 return document.createElement('sub');
10375 } else {
10376 return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
10377 }
10378 }
10379 }, {
10380 key: 'formats',
10381 value: function formats(domNode) {
10382 if (domNode.tagName === 'SUB') return 'sub';
10383 if (domNode.tagName === 'SUP') return 'super';
10384 return undefined;
10385 }
10386 }]);
10387
10388 return Script;
10389}(_inline2.default);
10390
10391Script.blotName = 'script';
10392Script.tagName = ['SUB', 'SUP'];
10393
10394exports.default = Script;
10395
10396/***/ }),
10397/* 70 */
10398/***/ (function(module, exports, __webpack_require__) {
10399
10400"use strict";
10401
10402
10403Object.defineProperty(exports, "__esModule", {
10404 value: true
10405});
10406
10407var _inline = __webpack_require__(6);
10408
10409var _inline2 = _interopRequireDefault(_inline);
10410
10411function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10412
10413function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10414
10415function _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; }
10416
10417function _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; }
10418
10419var Strike = function (_Inline) {
10420 _inherits(Strike, _Inline);
10421
10422 function Strike() {
10423 _classCallCheck(this, Strike);
10424
10425 return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
10426 }
10427
10428 return Strike;
10429}(_inline2.default);
10430
10431Strike.blotName = 'strike';
10432Strike.tagName = 'S';
10433
10434exports.default = Strike;
10435
10436/***/ }),
10437/* 71 */
10438/***/ (function(module, exports, __webpack_require__) {
10439
10440"use strict";
10441
10442
10443Object.defineProperty(exports, "__esModule", {
10444 value: true
10445});
10446
10447var _inline = __webpack_require__(6);
10448
10449var _inline2 = _interopRequireDefault(_inline);
10450
10451function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10452
10453function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10454
10455function _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; }
10456
10457function _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; }
10458
10459var Underline = function (_Inline) {
10460 _inherits(Underline, _Inline);
10461
10462 function Underline() {
10463 _classCallCheck(this, Underline);
10464
10465 return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
10466 }
10467
10468 return Underline;
10469}(_inline2.default);
10470
10471Underline.blotName = 'underline';
10472Underline.tagName = 'U';
10473
10474exports.default = Underline;
10475
10476/***/ }),
10477/* 72 */
10478/***/ (function(module, exports, __webpack_require__) {
10479
10480"use strict";
10481
10482
10483Object.defineProperty(exports, "__esModule", {
10484 value: true
10485});
10486
10487var _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; }; }();
10488
10489var _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); } };
10490
10491var _parchment = __webpack_require__(0);
10492
10493var _parchment2 = _interopRequireDefault(_parchment);
10494
10495var _link = __webpack_require__(27);
10496
10497function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10498
10499function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10500
10501function _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; }
10502
10503function _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; }
10504
10505var ATTRIBUTES = ['alt', 'height', 'width'];
10506
10507var Image = function (_Parchment$Embed) {
10508 _inherits(Image, _Parchment$Embed);
10509
10510 function Image() {
10511 _classCallCheck(this, Image);
10512
10513 return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
10514 }
10515
10516 _createClass(Image, [{
10517 key: 'format',
10518 value: function format(name, value) {
10519 if (ATTRIBUTES.indexOf(name) > -1) {
10520 if (value) {
10521 this.domNode.setAttribute(name, value);
10522 } else {
10523 this.domNode.removeAttribute(name);
10524 }
10525 } else {
10526 _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
10527 }
10528 }
10529 }], [{
10530 key: 'create',
10531 value: function create(value) {
10532 var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
10533 if (typeof value === 'string') {
10534 node.setAttribute('src', this.sanitize(value));
10535 }
10536 return node;
10537 }
10538 }, {
10539 key: 'formats',
10540 value: function formats(domNode) {
10541 return ATTRIBUTES.reduce(function (formats, attribute) {
10542 if (domNode.hasAttribute(attribute)) {
10543 formats[attribute] = domNode.getAttribute(attribute);
10544 }
10545 return formats;
10546 }, {});
10547 }
10548 }, {
10549 key: 'match',
10550 value: function match(url) {
10551 return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
10552 );
10553 }
10554 }, {
10555 key: 'sanitize',
10556 value: function sanitize(url) {
10557 return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
10558 }
10559 }, {
10560 key: 'value',
10561 value: function value(domNode) {
10562 return domNode.getAttribute('src');
10563 }
10564 }]);
10565
10566 return Image;
10567}(_parchment2.default.Embed);
10568
10569Image.blotName = 'image';
10570Image.tagName = 'IMG';
10571
10572exports.default = Image;
10573
10574/***/ }),
10575/* 73 */
10576/***/ (function(module, exports, __webpack_require__) {
10577
10578"use strict";
10579
10580
10581Object.defineProperty(exports, "__esModule", {
10582 value: true
10583});
10584
10585var _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; }; }();
10586
10587var _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); } };
10588
10589var _block = __webpack_require__(4);
10590
10591var _link = __webpack_require__(27);
10592
10593var _link2 = _interopRequireDefault(_link);
10594
10595function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10596
10597function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10598
10599function _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; }
10600
10601function _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; }
10602
10603var ATTRIBUTES = ['height', 'width'];
10604
10605var Video = function (_BlockEmbed) {
10606 _inherits(Video, _BlockEmbed);
10607
10608 function Video() {
10609 _classCallCheck(this, Video);
10610
10611 return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
10612 }
10613
10614 _createClass(Video, [{
10615 key: 'format',
10616 value: function format(name, value) {
10617 if (ATTRIBUTES.indexOf(name) > -1) {
10618 if (value) {
10619 this.domNode.setAttribute(name, value);
10620 } else {
10621 this.domNode.removeAttribute(name);
10622 }
10623 } else {
10624 _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
10625 }
10626 }
10627 }], [{
10628 key: 'create',
10629 value: function create(value) {
10630 var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
10631 node.setAttribute('frameborder', '0');
10632 node.setAttribute('allowfullscreen', true);
10633 node.setAttribute('src', this.sanitize(value));
10634 return node;
10635 }
10636 }, {
10637 key: 'formats',
10638 value: function formats(domNode) {
10639 return ATTRIBUTES.reduce(function (formats, attribute) {
10640 if (domNode.hasAttribute(attribute)) {
10641 formats[attribute] = domNode.getAttribute(attribute);
10642 }
10643 return formats;
10644 }, {});
10645 }
10646 }, {
10647 key: 'sanitize',
10648 value: function sanitize(url) {
10649 return _link2.default.sanitize(url);
10650 }
10651 }, {
10652 key: 'value',
10653 value: function value(domNode) {
10654 return domNode.getAttribute('src');
10655 }
10656 }]);
10657
10658 return Video;
10659}(_block.BlockEmbed);
10660
10661Video.blotName = 'video';
10662Video.className = 'ql-video';
10663Video.tagName = 'IFRAME';
10664
10665exports.default = Video;
10666
10667/***/ }),
10668/* 74 */
10669/***/ (function(module, exports, __webpack_require__) {
10670
10671"use strict";
10672
10673
10674Object.defineProperty(exports, "__esModule", {
10675 value: true
10676});
10677exports.default = exports.FormulaBlot = undefined;
10678
10679var _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; }; }();
10680
10681var _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); } };
10682
10683var _embed = __webpack_require__(25);
10684
10685var _embed2 = _interopRequireDefault(_embed);
10686
10687var _quill = __webpack_require__(5);
10688
10689var _quill2 = _interopRequireDefault(_quill);
10690
10691var _module = __webpack_require__(9);
10692
10693var _module2 = _interopRequireDefault(_module);
10694
10695function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10696
10697function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10698
10699function _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; }
10700
10701function _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; }
10702
10703var FormulaBlot = function (_Embed) {
10704 _inherits(FormulaBlot, _Embed);
10705
10706 function FormulaBlot() {
10707 _classCallCheck(this, FormulaBlot);
10708
10709 return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
10710 }
10711
10712 _createClass(FormulaBlot, null, [{
10713 key: 'create',
10714 value: function create(value) {
10715 var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
10716 if (typeof value === 'string') {
10717 window.katex.render(value, node, {
10718 throwOnError: false,
10719 errorColor: '#f00'
10720 });
10721 node.setAttribute('data-value', value);
10722 }
10723 return node;
10724 }
10725 }, {
10726 key: 'value',
10727 value: function value(domNode) {
10728 return domNode.getAttribute('data-value');
10729 }
10730 }]);
10731
10732 return FormulaBlot;
10733}(_embed2.default);
10734
10735FormulaBlot.blotName = 'formula';
10736FormulaBlot.className = 'ql-formula';
10737FormulaBlot.tagName = 'SPAN';
10738
10739var Formula = function (_Module) {
10740 _inherits(Formula, _Module);
10741
10742 _createClass(Formula, null, [{
10743 key: 'register',
10744 value: function register() {
10745 _quill2.default.register(FormulaBlot, true);
10746 }
10747 }]);
10748
10749 function Formula() {
10750 _classCallCheck(this, Formula);
10751
10752 var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
10753
10754 if (window.katex == null) {
10755 throw new Error('Formula module requires KaTeX.');
10756 }
10757 return _this2;
10758 }
10759
10760 return Formula;
10761}(_module2.default);
10762
10763exports.FormulaBlot = FormulaBlot;
10764exports.default = Formula;
10765
10766/***/ }),
10767/* 75 */
10768/***/ (function(module, exports, __webpack_require__) {
10769
10770"use strict";
10771
10772
10773Object.defineProperty(exports, "__esModule", {
10774 value: true
10775});
10776exports.default = exports.CodeToken = exports.CodeBlock = undefined;
10777
10778var _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; }; }();
10779
10780var _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); } };
10781
10782var _parchment = __webpack_require__(0);
10783
10784var _parchment2 = _interopRequireDefault(_parchment);
10785
10786var _quill = __webpack_require__(5);
10787
10788var _quill2 = _interopRequireDefault(_quill);
10789
10790var _module = __webpack_require__(9);
10791
10792var _module2 = _interopRequireDefault(_module);
10793
10794var _code = __webpack_require__(13);
10795
10796var _code2 = _interopRequireDefault(_code);
10797
10798function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10799
10800function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10801
10802function _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; }
10803
10804function _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; }
10805
10806var SyntaxCodeBlock = function (_CodeBlock) {
10807 _inherits(SyntaxCodeBlock, _CodeBlock);
10808
10809 function SyntaxCodeBlock() {
10810 _classCallCheck(this, SyntaxCodeBlock);
10811
10812 return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
10813 }
10814
10815 _createClass(SyntaxCodeBlock, [{
10816 key: 'replaceWith',
10817 value: function replaceWith(block) {
10818 this.domNode.textContent = this.domNode.textContent;
10819 this.attach();
10820 _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
10821 }
10822 }, {
10823 key: 'highlight',
10824 value: function highlight(_highlight) {
10825 var text = this.domNode.textContent;
10826 if (this.cachedText !== text) {
10827 if (text.trim().length > 0 || this.cachedText == null) {
10828 this.domNode.innerHTML = _highlight(text);
10829 this.domNode.normalize();
10830 this.attach();
10831 }
10832 this.cachedText = text;
10833 }
10834 }
10835 }]);
10836
10837 return SyntaxCodeBlock;
10838}(_code2.default);
10839
10840SyntaxCodeBlock.className = 'ql-syntax';
10841
10842var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
10843 scope: _parchment2.default.Scope.INLINE
10844});
10845
10846var Syntax = function (_Module) {
10847 _inherits(Syntax, _Module);
10848
10849 _createClass(Syntax, null, [{
10850 key: 'register',
10851 value: function register() {
10852 _quill2.default.register(CodeToken, true);
10853 _quill2.default.register(SyntaxCodeBlock, true);
10854 }
10855 }]);
10856
10857 function Syntax(quill, options) {
10858 _classCallCheck(this, Syntax);
10859
10860 var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
10861
10862 if (typeof _this2.options.highlight !== 'function') {
10863 throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
10864 }
10865 var timer = null;
10866 _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
10867 clearTimeout(timer);
10868 timer = setTimeout(function () {
10869 _this2.highlight();
10870 timer = null;
10871 }, _this2.options.interval);
10872 });
10873 _this2.highlight();
10874 return _this2;
10875 }
10876
10877 _createClass(Syntax, [{
10878 key: 'highlight',
10879 value: function highlight() {
10880 var _this3 = this;
10881
10882 if (this.quill.selection.composing) return;
10883 this.quill.update(_quill2.default.sources.USER);
10884 var range = this.quill.getSelection();
10885 this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
10886 code.highlight(_this3.options.highlight);
10887 });
10888 this.quill.update(_quill2.default.sources.SILENT);
10889 if (range != null) {
10890 this.quill.setSelection(range, _quill2.default.sources.SILENT);
10891 }
10892 }
10893 }]);
10894
10895 return Syntax;
10896}(_module2.default);
10897
10898Syntax.DEFAULTS = {
10899 highlight: function () {
10900 if (window.hljs == null) return null;
10901 return function (text) {
10902 var result = window.hljs.highlightAuto(text);
10903 return result.value;
10904 };
10905 }(),
10906 interval: 1000
10907};
10908
10909exports.CodeBlock = SyntaxCodeBlock;
10910exports.CodeToken = CodeToken;
10911exports.default = Syntax;
10912
10913/***/ }),
10914/* 76 */
10915/***/ (function(module, exports) {
10916
10917module.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>";
10918
10919/***/ }),
10920/* 77 */
10921/***/ (function(module, exports) {
10922
10923module.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>";
10924
10925/***/ }),
10926/* 78 */
10927/***/ (function(module, exports) {
10928
10929module.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>";
10930
10931/***/ }),
10932/* 79 */
10933/***/ (function(module, exports) {
10934
10935module.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>";
10936
10937/***/ }),
10938/* 80 */
10939/***/ (function(module, exports) {
10940
10941module.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>";
10942
10943/***/ }),
10944/* 81 */
10945/***/ (function(module, exports) {
10946
10947module.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>";
10948
10949/***/ }),
10950/* 82 */
10951/***/ (function(module, exports) {
10952
10953module.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>";
10954
10955/***/ }),
10956/* 83 */
10957/***/ (function(module, exports) {
10958
10959module.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>";
10960
10961/***/ }),
10962/* 84 */
10963/***/ (function(module, exports) {
10964
10965module.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>";
10966
10967/***/ }),
10968/* 85 */
10969/***/ (function(module, exports) {
10970
10971module.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>";
10972
10973/***/ }),
10974/* 86 */
10975/***/ (function(module, exports) {
10976
10977module.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>";
10978
10979/***/ }),
10980/* 87 */
10981/***/ (function(module, exports) {
10982
10983module.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>";
10984
10985/***/ }),
10986/* 88 */
10987/***/ (function(module, exports) {
10988
10989module.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>";
10990
10991/***/ }),
10992/* 89 */
10993/***/ (function(module, exports) {
10994
10995module.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>";
10996
10997/***/ }),
10998/* 90 */
10999/***/ (function(module, exports) {
11000
11001module.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>";
11002
11003/***/ }),
11004/* 91 */
11005/***/ (function(module, exports) {
11006
11007module.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>";
11008
11009/***/ }),
11010/* 92 */
11011/***/ (function(module, exports) {
11012
11013module.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>";
11014
11015/***/ }),
11016/* 93 */
11017/***/ (function(module, exports) {
11018
11019module.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>";
11020
11021/***/ }),
11022/* 94 */
11023/***/ (function(module, exports) {
11024
11025module.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>";
11026
11027/***/ }),
11028/* 95 */
11029/***/ (function(module, exports) {
11030
11031module.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>";
11032
11033/***/ }),
11034/* 96 */
11035/***/ (function(module, exports) {
11036
11037module.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>";
11038
11039/***/ }),
11040/* 97 */
11041/***/ (function(module, exports) {
11042
11043module.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>";
11044
11045/***/ }),
11046/* 98 */
11047/***/ (function(module, exports) {
11048
11049module.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>";
11050
11051/***/ }),
11052/* 99 */
11053/***/ (function(module, exports) {
11054
11055module.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>";
11056
11057/***/ }),
11058/* 100 */
11059/***/ (function(module, exports) {
11060
11061module.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>";
11062
11063/***/ }),
11064/* 101 */
11065/***/ (function(module, exports) {
11066
11067module.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>";
11068
11069/***/ }),
11070/* 102 */
11071/***/ (function(module, exports) {
11072
11073module.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>";
11074
11075/***/ }),
11076/* 103 */
11077/***/ (function(module, exports) {
11078
11079module.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>";
11080
11081/***/ }),
11082/* 104 */
11083/***/ (function(module, exports) {
11084
11085module.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>";
11086
11087/***/ }),
11088/* 105 */
11089/***/ (function(module, exports) {
11090
11091module.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>";
11092
11093/***/ }),
11094/* 106 */
11095/***/ (function(module, exports) {
11096
11097module.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>";
11098
11099/***/ }),
11100/* 107 */
11101/***/ (function(module, exports) {
11102
11103module.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>";
11104
11105/***/ }),
11106/* 108 */
11107/***/ (function(module, exports, __webpack_require__) {
11108
11109"use strict";
11110
11111
11112Object.defineProperty(exports, "__esModule", {
11113 value: true
11114});
11115exports.default = exports.BubbleTooltip = undefined;
11116
11117var _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); } };
11118
11119var _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; }; }();
11120
11121var _extend = __webpack_require__(3);
11122
11123var _extend2 = _interopRequireDefault(_extend);
11124
11125var _emitter = __webpack_require__(8);
11126
11127var _emitter2 = _interopRequireDefault(_emitter);
11128
11129var _base = __webpack_require__(43);
11130
11131var _base2 = _interopRequireDefault(_base);
11132
11133var _selection = __webpack_require__(15);
11134
11135var _icons = __webpack_require__(41);
11136
11137var _icons2 = _interopRequireDefault(_icons);
11138
11139function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11140
11141function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11142
11143function _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; }
11144
11145function _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; }
11146
11147var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
11148
11149var BubbleTheme = function (_BaseTheme) {
11150 _inherits(BubbleTheme, _BaseTheme);
11151
11152 function BubbleTheme(quill, options) {
11153 _classCallCheck(this, BubbleTheme);
11154
11155 if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
11156 options.modules.toolbar.container = TOOLBAR_CONFIG;
11157 }
11158
11159 var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
11160
11161 _this.quill.container.classList.add('ql-bubble');
11162 return _this;
11163 }
11164
11165 _createClass(BubbleTheme, [{
11166 key: 'extendToolbar',
11167 value: function extendToolbar(toolbar) {
11168 this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
11169 this.tooltip.root.appendChild(toolbar.container);
11170 this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
11171 this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
11172 }
11173 }]);
11174
11175 return BubbleTheme;
11176}(_base2.default);
11177
11178BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
11179 modules: {
11180 toolbar: {
11181 handlers: {
11182 link: function link(value) {
11183 if (!value) {
11184 this.quill.format('link', false);
11185 } else {
11186 this.quill.theme.tooltip.edit();
11187 }
11188 }
11189 }
11190 }
11191 }
11192});
11193
11194var BubbleTooltip = function (_BaseTooltip) {
11195 _inherits(BubbleTooltip, _BaseTooltip);
11196
11197 function BubbleTooltip(quill, bounds) {
11198 _classCallCheck(this, BubbleTooltip);
11199
11200 var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
11201
11202 _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
11203 if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
11204 if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
11205 _this2.show();
11206 // Lock our width so we will expand beyond our offsetParent boundaries
11207 _this2.root.style.left = '0px';
11208 _this2.root.style.width = '';
11209 _this2.root.style.width = _this2.root.offsetWidth + 'px';
11210 var lines = _this2.quill.getLines(range.index, range.length);
11211 if (lines.length === 1) {
11212 _this2.position(_this2.quill.getBounds(range));
11213 } else {
11214 var lastLine = lines[lines.length - 1];
11215 var index = _this2.quill.getIndex(lastLine);
11216 var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
11217 var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
11218 _this2.position(_bounds);
11219 }
11220 } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
11221 _this2.hide();
11222 }
11223 });
11224 return _this2;
11225 }
11226
11227 _createClass(BubbleTooltip, [{
11228 key: 'listen',
11229 value: function listen() {
11230 var _this3 = this;
11231
11232 _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
11233 this.root.querySelector('.ql-close').addEventListener('click', function () {
11234 _this3.root.classList.remove('ql-editing');
11235 });
11236 this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
11237 // Let selection be restored by toolbar handlers before repositioning
11238 setTimeout(function () {
11239 if (_this3.root.classList.contains('ql-hidden')) return;
11240 var range = _this3.quill.getSelection();
11241 if (range != null) {
11242 _this3.position(_this3.quill.getBounds(range));
11243 }
11244 }, 1);
11245 });
11246 }
11247 }, {
11248 key: 'cancel',
11249 value: function cancel() {
11250 this.show();
11251 }
11252 }, {
11253 key: 'position',
11254 value: function position(reference) {
11255 var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
11256 var arrow = this.root.querySelector('.ql-tooltip-arrow');
11257 arrow.style.marginLeft = '';
11258 if (shift === 0) return shift;
11259 arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
11260 }
11261 }]);
11262
11263 return BubbleTooltip;
11264}(_base.BaseTooltip);
11265
11266BubbleTooltip.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('');
11267
11268exports.BubbleTooltip = BubbleTooltip;
11269exports.default = BubbleTheme;
11270
11271/***/ }),
11272/* 109 */
11273/***/ (function(module, exports, __webpack_require__) {
11274
11275module.exports = __webpack_require__(63);
11276
11277
11278/***/ })
11279/******/ ]);
11280});
\No newline at end of file