PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / admin / resources / quill / quill.js

quill.js in VikBooking Hotel Booking Engine & PMS 1.8.16, at admin/resources/quill/quill.js

11,489 lines 427.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*!
2 * Quill Editor v1.3.6
3 * https://quilljs.com/
4 * Copyright (c) 2014, Jason Chen
5 * Copyright (c) 2013, salesforce.com
6 */
7 (function webpackUniversalModuleDefinition(root, factory) {
8 if(typeof exports === 'object' && typeof module === 'object')
9 module.exports = factory();
10 else if(typeof define === 'function' && define.amd)
11 define([], factory);
12 else if(typeof exports === 'object')
13 exports["Quill"] = factory();
14 else
15 root["Quill"] = factory();
16 })(typeof self !== 'undefined' ? self : this, function() {
17 return /******/ (function(modules) { // webpackBootstrap
18 /******/ // The module cache
19 /******/ var installedModules = {};
20 /******/
21 /******/ // The require function
22 /******/ function __webpack_require__(moduleId) {
23 /******/
24 /******/ // Check if module is in cache
25 /******/ if(installedModules[moduleId]) {
26 /******/ return installedModules[moduleId].exports;
27 /******/ }
28 /******/ // Create a new module (and put it into the cache)
29 /******/ var module = installedModules[moduleId] = {
30 /******/ i: moduleId,
31 /******/ l: false,
32 /******/ exports: {}
33 /******/ };
34 /******/
35 /******/ // Execute the module function
36 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
37 /******/
38 /******/ // Flag the module as loaded
39 /******/ module.l = true;
40 /******/
41 /******/ // Return the exports of the module
42 /******/ return module.exports;
43 /******/ }
44 /******/
45 /******/
46 /******/ // expose the modules object (__webpack_modules__)
47 /******/ __webpack_require__.m = modules;
48 /******/
49 /******/ // expose the module cache
50 /******/ __webpack_require__.c = installedModules;
51 /******/
52 /******/ // 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
88 Object.defineProperty(exports, "__esModule", { value: true });
89 var container_1 = __webpack_require__(17);
90 var format_1 = __webpack_require__(18);
91 var leaf_1 = __webpack_require__(19);
92 var scroll_1 = __webpack_require__(45);
93 var inline_1 = __webpack_require__(46);
94 var block_1 = __webpack_require__(47);
95 var embed_1 = __webpack_require__(48);
96 var text_1 = __webpack_require__(49);
97 var attributor_1 = __webpack_require__(12);
98 var class_1 = __webpack_require__(32);
99 var style_1 = __webpack_require__(33);
100 var store_1 = __webpack_require__(31);
101 var Registry = __webpack_require__(1);
102 var 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 };
123 exports.default = Parchment;
124
125
126 /***/ }),
127 /* 1 */
128 /***/ (function(module, exports, __webpack_require__) {
129
130 "use strict";
131
132 var __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 })();
142 Object.defineProperty(exports, "__esModule", { value: true });
143 var 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));
155 exports.ParchmentError = ParchmentError;
156 var attributes = {};
157 var classes = {};
158 var tags = {};
159 var types = {};
160 exports.DATA_KEY = '__blot';
161 var 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 function create(input, value) {
176 var match = query(input);
177 if (match == null) {
178 throw new ParchmentError("Unable to create " + input + " blot");
179 }
180 var BlotClass = match;
181 var node =
182 // @ts-ignore
183 input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);
184 return new BlotClass(node, value);
185 }
186 exports.create = create;
187 function find(node, bubble) {
188 if (bubble === void 0) { bubble = false; }
189 if (node == null)
190 return null;
191 // @ts-ignore
192 if (node[exports.DATA_KEY] != null)
193 return node[exports.DATA_KEY].blot;
194 if (bubble)
195 return find(node.parentNode, bubble);
196 return null;
197 }
198 exports.find = find;
199 function query(query, scope) {
200 if (scope === void 0) { scope = Scope.ANY; }
201 var match;
202 if (typeof query === 'string') {
203 match = types[query] || attributes[query];
204 // @ts-ignore
205 }
206 else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
207 match = types['text'];
208 }
209 else if (typeof query === 'number') {
210 if (query & Scope.LEVEL & Scope.BLOCK) {
211 match = types['block'];
212 }
213 else if (query & Scope.LEVEL & Scope.INLINE) {
214 match = types['inline'];
215 }
216 }
217 else if (query instanceof HTMLElement) {
218 var names = (query.getAttribute('class') || '').split(/\s+/);
219 for (var i in names) {
220 match = classes[names[i]];
221 if (match)
222 break;
223 }
224 match = match || tags[query.tagName];
225 }
226 if (match == null)
227 return null;
228 // @ts-ignore
229 if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)
230 return match;
231 return null;
232 }
233 exports.query = query;
234 function register() {
235 var Definitions = [];
236 for (var _i = 0; _i < arguments.length; _i++) {
237 Definitions[_i] = arguments[_i];
238 }
239 if (Definitions.length > 1) {
240 return Definitions.map(function (d) {
241 return register(d);
242 });
243 }
244 var Definition = Definitions[0];
245 if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
246 throw new ParchmentError('Invalid definition');
247 }
248 else if (Definition.blotName === 'abstract') {
249 throw new ParchmentError('Cannot register abstract class');
250 }
251 types[Definition.blotName || Definition.attrName] = Definition;
252 if (typeof Definition.keyName === 'string') {
253 attributes[Definition.keyName] = Definition;
254 }
255 else {
256 if (Definition.className != null) {
257 classes[Definition.className] = Definition;
258 }
259 if (Definition.tagName != null) {
260 if (Array.isArray(Definition.tagName)) {
261 Definition.tagName = Definition.tagName.map(function (tagName) {
262 return tagName.toUpperCase();
263 });
264 }
265 else {
266 Definition.tagName = Definition.tagName.toUpperCase();
267 }
268 var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
269 tagNames.forEach(function (tag) {
270 if (tags[tag] == null || Definition.className == null) {
271 tags[tag] = Definition;
272 }
273 });
274 }
275 }
276 return Definition;
277 }
278 exports.register = register;
279
280
281 /***/ }),
282 /* 2 */
283 /***/ (function(module, exports, __webpack_require__) {
284
285 var diff = __webpack_require__(51);
286 var equal = __webpack_require__(11);
287 var extend = __webpack_require__(3);
288 var op = __webpack_require__(20);
289
290
291 var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
292
293
294 var Delta = function (ops) {
295 // Assume we are given a well formed ops
296 if (Array.isArray(ops)) {
297 this.ops = ops;
298 } else if (ops != null && Array.isArray(ops.ops)) {
299 this.ops = ops.ops;
300 } else {
301 this.ops = [];
302 }
303 };
304
305
306 Delta.prototype.insert = function (text, attributes) {
307 var newOp = {};
308 if (text.length === 0) return this;
309 newOp.insert = text;
310 if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
311 newOp.attributes = attributes;
312 }
313 return this.push(newOp);
314 };
315
316 Delta.prototype['delete'] = function (length) {
317 if (length <= 0) return this;
318 return this.push({ 'delete': length });
319 };
320
321 Delta.prototype.retain = function (length, attributes) {
322 if (length <= 0) return this;
323 var newOp = { retain: length };
324 if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
325 newOp.attributes = attributes;
326 }
327 return this.push(newOp);
328 };
329
330 Delta.prototype.push = function (newOp) {
331 var index = this.ops.length;
332 var lastOp = this.ops[index - 1];
333 newOp = extend(true, {}, newOp);
334 if (typeof lastOp === 'object') {
335 if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
336 this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
337 return this;
338 }
339 // Since it does not matter if we insert before or after deleting at the same index,
340 // always prefer to insert first
341 if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
342 index -= 1;
343 lastOp = this.ops[index - 1];
344 if (typeof lastOp !== 'object') {
345 this.ops.unshift(newOp);
346 return this;
347 }
348 }
349 if (equal(newOp.attributes, lastOp.attributes)) {
350 if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
351 this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
352 if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
353 return this;
354 } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
355 this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
356 if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
357 return this;
358 }
359 }
360 }
361 if (index === this.ops.length) {
362 this.ops.push(newOp);
363 } else {
364 this.ops.splice(index, 0, newOp);
365 }
366 return this;
367 };
368
369 Delta.prototype.chop = function () {
370 var lastOp = this.ops[this.ops.length - 1];
371 if (lastOp && lastOp.retain && !lastOp.attributes) {
372 this.ops.pop();
373 }
374 return this;
375 };
376
377 Delta.prototype.filter = function (predicate) {
378 return this.ops.filter(predicate);
379 };
380
381 Delta.prototype.forEach = function (predicate) {
382 this.ops.forEach(predicate);
383 };
384
385 Delta.prototype.map = function (predicate) {
386 return this.ops.map(predicate);
387 };
388
389 Delta.prototype.partition = function (predicate) {
390 var passed = [], failed = [];
391 this.forEach(function(op) {
392 var target = predicate(op) ? passed : failed;
393 target.push(op);
394 });
395 return [passed, failed];
396 };
397
398 Delta.prototype.reduce = function (predicate, initial) {
399 return this.ops.reduce(predicate, initial);
400 };
401
402 Delta.prototype.changeLength = function () {
403 return this.reduce(function (length, elem) {
404 if (elem.insert) {
405 return length + op.length(elem);
406 } else if (elem.delete) {
407 return length - elem.delete;
408 }
409 return length;
410 }, 0);
411 };
412
413 Delta.prototype.length = function () {
414 return this.reduce(function (length, elem) {
415 return length + op.length(elem);
416 }, 0);
417 };
418
419 Delta.prototype.slice = function (start, end) {
420 start = start || 0;
421 if (typeof end !== 'number') end = Infinity;
422 var ops = [];
423 var iter = op.iterator(this.ops);
424 var index = 0;
425 while (index < end && iter.hasNext()) {
426 var nextOp;
427 if (index < start) {
428 nextOp = iter.next(start - index);
429 } else {
430 nextOp = iter.next(end - index);
431 ops.push(nextOp);
432 }
433 index += op.length(nextOp);
434 }
435 return new Delta(ops);
436 };
437
438
439 Delta.prototype.compose = function (other) {
440 var thisIter = op.iterator(this.ops);
441 var otherIter = op.iterator(other.ops);
442 var delta = new Delta();
443 while (thisIter.hasNext() || otherIter.hasNext()) {
444 if (otherIter.peekType() === 'insert') {
445 delta.push(otherIter.next());
446 } else if (thisIter.peekType() === 'delete') {
447 delta.push(thisIter.next());
448 } else {
449 var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
450 var thisOp = thisIter.next(length);
451 var otherOp = otherIter.next(length);
452 if (typeof otherOp.retain === 'number') {
453 var newOp = {};
454 if (typeof thisOp.retain === 'number') {
455 newOp.retain = length;
456 } else {
457 newOp.insert = thisOp.insert;
458 }
459 // Preserve null when composing with a retain, otherwise remove it for inserts
460 var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
461 if (attributes) newOp.attributes = attributes;
462 delta.push(newOp);
463 // Other op should be delete, we could be an insert or retain
464 // Insert + delete cancels out
465 } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
466 delta.push(otherOp);
467 }
468 }
469 }
470 return delta.chop();
471 };
472
473 Delta.prototype.concat = function (other) {
474 var delta = new Delta(this.ops.slice());
475 if (other.ops.length > 0) {
476 delta.push(other.ops[0]);
477 delta.ops = delta.ops.concat(other.ops.slice(1));
478 }
479 return delta;
480 };
481
482 Delta.prototype.diff = function (other, index) {
483 if (this.ops === other.ops) {
484 return new Delta();
485 }
486 var strings = [this, other].map(function (delta) {
487 return delta.map(function (op) {
488 if (op.insert != null) {
489 return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
490 }
491 var prep = (delta === other) ? 'on' : 'with';
492 throw new Error('diff() called ' + prep + ' non-document');
493 }).join('');
494 });
495 var delta = new Delta();
496 var diffResult = diff(strings[0], strings[1], index);
497 var thisIter = op.iterator(this.ops);
498 var otherIter = op.iterator(other.ops);
499 diffResult.forEach(function (component) {
500 var length = component[1].length;
501 while (length > 0) {
502 var opLength = 0;
503 switch (component[0]) {
504 case diff.INSERT:
505 opLength = Math.min(otherIter.peekLength(), length);
506 delta.push(otherIter.next(opLength));
507 break;
508 case diff.DELETE:
509 opLength = Math.min(length, thisIter.peekLength());
510 thisIter.next(opLength);
511 delta['delete'](opLength);
512 break;
513 case diff.EQUAL:
514 opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
515 var thisOp = thisIter.next(opLength);
516 var otherOp = otherIter.next(opLength);
517 if (equal(thisOp.insert, otherOp.insert)) {
518 delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
519 } else {
520 delta.push(otherOp)['delete'](opLength);
521 }
522 break;
523 }
524 length -= opLength;
525 }
526 });
527 return delta.chop();
528 };
529
530 Delta.prototype.eachLine = function (predicate, newline) {
531 newline = newline || '\n';
532 var iter = op.iterator(this.ops);
533 var line = new Delta();
534 var i = 0;
535 while (iter.hasNext()) {
536 if (iter.peekType() !== 'insert') return;
537 var thisOp = iter.peek();
538 var start = op.length(thisOp) - iter.peekLength();
539 var index = typeof thisOp.insert === 'string' ?
540 thisOp.insert.indexOf(newline, start) - start : -1;
541 if (index < 0) {
542 line.push(iter.next());
543 } else if (index > 0) {
544 line.push(iter.next(index));
545 } else {
546 if (predicate(line, iter.next(1).attributes || {}, i) === false) {
547 return;
548 }
549 i += 1;
550 line = new Delta();
551 }
552 }
553 if (line.length() > 0) {
554 predicate(line, {}, i);
555 }
556 };
557
558 Delta.prototype.transform = function (other, priority) {
559 priority = !!priority;
560 if (typeof other === 'number') {
561 return this.transformPosition(other, priority);
562 }
563 var thisIter = op.iterator(this.ops);
564 var otherIter = op.iterator(other.ops);
565 var delta = new Delta();
566 while (thisIter.hasNext() || otherIter.hasNext()) {
567 if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
568 delta.retain(op.length(thisIter.next()));
569 } else if (otherIter.peekType() === 'insert') {
570 delta.push(otherIter.next());
571 } else {
572 var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
573 var thisOp = thisIter.next(length);
574 var otherOp = otherIter.next(length);
575 if (thisOp['delete']) {
576 // Our delete either makes their delete redundant or removes their retain
577 continue;
578 } else if (otherOp['delete']) {
579 delta.push(otherOp);
580 } else {
581 // We retain either their retain or insert
582 delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
583 }
584 }
585 }
586 return delta.chop();
587 };
588
589 Delta.prototype.transformPosition = function (index, priority) {
590 priority = !!priority;
591 var thisIter = op.iterator(this.ops);
592 var offset = 0;
593 while (thisIter.hasNext() && offset <= index) {
594 var length = thisIter.peekLength();
595 var nextType = thisIter.peekType();
596 thisIter.next();
597 if (nextType === 'delete') {
598 index -= Math.min(length, index - offset);
599 continue;
600 } else if (nextType === 'insert' && (offset < index || !priority)) {
601 index += length;
602 }
603 offset += length;
604 }
605 return index;
606 };
607
608
609 module.exports = Delta;
610
611
612 /***/ }),
613 /* 3 */
614 /***/ (function(module, exports) {
615
616 'use strict';
617
618 var hasOwn = Object.prototype.hasOwnProperty;
619 var toStr = Object.prototype.toString;
620
621 var isArray = function isArray(arr) {
622 if (typeof Array.isArray === 'function') {
623 return Array.isArray(arr);
624 }
625
626 return toStr.call(arr) === '[object Array]';
627 };
628
629 var isPlainObject = function isPlainObject(obj) {
630 if (!obj || toStr.call(obj) !== '[object Object]') {
631 return false;
632 }
633
634 var hasOwnConstructor = hasOwn.call(obj, 'constructor');
635 var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
636 // Not own constructor property must be Object
637 if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
638 return false;
639 }
640
641 // Own properties are enumerated firstly, so to speed up,
642 // if last one is own, then all properties are own.
643 var key;
644 for (key in obj) { /**/ }
645
646 return typeof key === 'undefined' || hasOwn.call(obj, key);
647 };
648
649 module.exports = function extend() {
650 var options, name, src, copy, copyIsArray, clone;
651 var target = arguments[0];
652 var i = 1;
653 var length = arguments.length;
654 var deep = false;
655
656 // Handle a deep copy situation
657 if (typeof target === 'boolean') {
658 deep = target;
659 target = arguments[1] || {};
660 // skip the boolean and the target
661 i = 2;
662 }
663 if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
664 target = {};
665 }
666
667 for (; i < length; ++i) {
668 options = arguments[i];
669 // Only deal with non-null/undefined values
670 if (options != null) {
671 // Extend the base object
672 for (name in options) {
673 src = target[name];
674 copy = options[name];
675
676 // Prevent never-ending loop
677 if (target !== copy) {
678 // Recurse if we're merging plain objects or arrays
679 if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
680 if (copyIsArray) {
681 copyIsArray = false;
682 clone = src && isArray(src) ? src : [];
683 } else {
684 clone = src && isPlainObject(src) ? src : {};
685 }
686
687 // Never move original objects, clone them
688 target[name] = extend(deep, clone, copy);
689
690 // Don't bring in undefined values
691 } else if (typeof copy !== 'undefined') {
692 target[name] = copy;
693 }
694 }
695 }
696 }
697 }
698
699 // Return the modified object
700 return target;
701 };
702
703
704 /***/ }),
705 /* 4 */
706 /***/ (function(module, exports, __webpack_require__) {
707
708 "use strict";
709
710
711 Object.defineProperty(exports, "__esModule", {
712 value: true
713 });
714 exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
715
716 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
717
718 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
719
720 var _extend = __webpack_require__(3);
721
722 var _extend2 = _interopRequireDefault(_extend);
723
724 var _quillDelta = __webpack_require__(2);
725
726 var _quillDelta2 = _interopRequireDefault(_quillDelta);
727
728 var _parchment = __webpack_require__(0);
729
730 var _parchment2 = _interopRequireDefault(_parchment);
731
732 var _break = __webpack_require__(16);
733
734 var _break2 = _interopRequireDefault(_break);
735
736 var _inline = __webpack_require__(6);
737
738 var _inline2 = _interopRequireDefault(_inline);
739
740 var _text = __webpack_require__(7);
741
742 var _text2 = _interopRequireDefault(_text);
743
744 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
745
746 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
747
748 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
749
750 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
751
752 var NEWLINE_LENGTH = 1;
753
754 var BlockEmbed = function (_Parchment$Embed) {
755 _inherits(BlockEmbed, _Parchment$Embed);
756
757 function BlockEmbed() {
758 _classCallCheck(this, BlockEmbed);
759
760 return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
761 }
762
763 _createClass(BlockEmbed, [{
764 key: 'attach',
765 value: function attach() {
766 _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
767 this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
768 }
769 }, {
770 key: 'delta',
771 value: function delta() {
772 return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
773 }
774 }, {
775 key: 'format',
776 value: function format(name, value) {
777 var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
778 if (attribute != null) {
779 this.attributes.attribute(attribute, value);
780 }
781 }
782 }, {
783 key: 'formatAt',
784 value: function formatAt(index, length, name, value) {
785 this.format(name, value);
786 }
787 }, {
788 key: 'insertAt',
789 value: function insertAt(index, value, def) {
790 if (typeof value === 'string' && value.endsWith('\n')) {
791 var block = _parchment2.default.create(Block.blotName);
792 this.parent.insertBefore(block, index === 0 ? this : this.next);
793 block.insertAt(0, value.slice(0, -1));
794 } else {
795 _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
796 }
797 }
798 }]);
799
800 return BlockEmbed;
801 }(_parchment2.default.Embed);
802
803 BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
804 // It is important for cursor behavior BlockEmbeds use tags that are block level elements
805
806
807 var Block = function (_Parchment$Block) {
808 _inherits(Block, _Parchment$Block);
809
810 function Block(domNode) {
811 _classCallCheck(this, Block);
812
813 var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
814
815 _this2.cache = {};
816 return _this2;
817 }
818
819 _createClass(Block, [{
820 key: 'delta',
821 value: function delta() {
822 if (this.cache.delta == null) {
823 this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
824 if (leaf.length() === 0) {
825 return delta;
826 } else {
827 return delta.insert(leaf.value(), bubbleFormats(leaf));
828 }
829 }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
830 }
831 return this.cache.delta;
832 }
833 }, {
834 key: 'deleteAt',
835 value: function deleteAt(index, length) {
836 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
837 this.cache = {};
838 }
839 }, {
840 key: 'formatAt',
841 value: function formatAt(index, length, name, value) {
842 if (length <= 0) return;
843 if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
844 if (index + length === this.length()) {
845 this.format(name, value);
846 }
847 } else {
848 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
849 }
850 this.cache = {};
851 }
852 }, {
853 key: 'insertAt',
854 value: function insertAt(index, value, def) {
855 if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
856 if (value.length === 0) return;
857 var lines = value.split('\n');
858 var text = lines.shift();
859 if (text.length > 0) {
860 if (index < this.length() - 1 || this.children.tail == null) {
861 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
862 } else {
863 this.children.tail.insertAt(this.children.tail.length(), text);
864 }
865 this.cache = {};
866 }
867 var block = this;
868 lines.reduce(function (index, line) {
869 block = block.split(index, true);
870 block.insertAt(0, line);
871 return line.length;
872 }, index + text.length);
873 }
874 }, {
875 key: 'insertBefore',
876 value: function insertBefore(blot, ref) {
877 var head = this.children.head;
878 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
879 if (head instanceof _break2.default) {
880 head.remove();
881 }
882 this.cache = {};
883 }
884 }, {
885 key: 'length',
886 value: function length() {
887 if (this.cache.length == null) {
888 this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
889 }
890 return this.cache.length;
891 }
892 }, {
893 key: 'moveChildren',
894 value: function moveChildren(target, ref) {
895 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
896 this.cache = {};
897 }
898 }, {
899 key: 'optimize',
900 value: function optimize(context) {
901 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);
902 this.cache = {};
903 }
904 }, {
905 key: 'path',
906 value: function path(index) {
907 return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
908 }
909 }, {
910 key: 'removeChild',
911 value: function removeChild(child) {
912 _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
913 this.cache = {};
914 }
915 }, {
916 key: 'split',
917 value: function split(index) {
918 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
919
920 if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
921 var clone = this.clone();
922 if (index === 0) {
923 this.parent.insertBefore(clone, this);
924 return this;
925 } else {
926 this.parent.insertBefore(clone, this.next);
927 return clone;
928 }
929 } else {
930 var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
931 this.cache = {};
932 return next;
933 }
934 }
935 }]);
936
937 return Block;
938 }(_parchment2.default.Block);
939
940 Block.blotName = 'block';
941 Block.tagName = 'P';
942 Block.defaultChild = 'break';
943 Block.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];
944
945 function bubbleFormats(blot) {
946 var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
947
948 if (blot == null) return formats;
949 if (typeof blot.formats === 'function') {
950 formats = (0, _extend2.default)(formats, blot.formats());
951 }
952 if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
953 return formats;
954 }
955 return bubbleFormats(blot.parent, formats);
956 }
957
958 exports.bubbleFormats = bubbleFormats;
959 exports.BlockEmbed = BlockEmbed;
960 exports.default = Block;
961
962 /***/ }),
963 /* 5 */
964 /***/ (function(module, exports, __webpack_require__) {
965
966 "use strict";
967
968
969 Object.defineProperty(exports, "__esModule", {
970 value: true
971 });
972 exports.default = exports.overload = exports.expandConfig = undefined;
973
974 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
975
976 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
977
978 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
979
980 __webpack_require__(50);
981
982 var _quillDelta = __webpack_require__(2);
983
984 var _quillDelta2 = _interopRequireDefault(_quillDelta);
985
986 var _editor = __webpack_require__(14);
987
988 var _editor2 = _interopRequireDefault(_editor);
989
990 var _emitter3 = __webpack_require__(8);
991
992 var _emitter4 = _interopRequireDefault(_emitter3);
993
994 var _module = __webpack_require__(9);
995
996 var _module2 = _interopRequireDefault(_module);
997
998 var _parchment = __webpack_require__(0);
999
1000 var _parchment2 = _interopRequireDefault(_parchment);
1001
1002 var _selection = __webpack_require__(15);
1003
1004 var _selection2 = _interopRequireDefault(_selection);
1005
1006 var _extend = __webpack_require__(3);
1007
1008 var _extend2 = _interopRequireDefault(_extend);
1009
1010 var _logger = __webpack_require__(10);
1011
1012 var _logger2 = _interopRequireDefault(_logger);
1013
1014 var _theme = __webpack_require__(34);
1015
1016 var _theme2 = _interopRequireDefault(_theme);
1017
1018 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1019
1020 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1021
1022 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1023
1024 var debug = (0, _logger2.default)('quill');
1025
1026 var Quill = function () {
1027 _createClass(Quill, null, [{
1028 key: 'debug',
1029 value: function debug(limit) {
1030 if (limit === true) {
1031 limit = 'log';
1032 }
1033 _logger2.default.level(limit);
1034 }
1035 }, {
1036 key: 'find',
1037 value: function find(node) {
1038 return node.__quill || _parchment2.default.find(node);
1039 }
1040 }, {
1041 key: 'import',
1042 value: function _import(name) {
1043 if (this.imports[name] == null) {
1044 debug.error('Cannot import ' + name + '. Are you sure it was registered?');
1045 }
1046 return this.imports[name];
1047 }
1048 }, {
1049 key: 'register',
1050 value: function register(path, target) {
1051 var _this = this;
1052
1053 var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1054
1055 if (typeof path !== 'string') {
1056 var name = path.attrName || path.blotName;
1057 if (typeof name === 'string') {
1058 // register(Blot | Attributor, overwrite)
1059 this.register('formats/' + name, path, target);
1060 } else {
1061 Object.keys(path).forEach(function (key) {
1062 _this.register(key, path[key], target);
1063 });
1064 }
1065 } else {
1066 if (this.imports[path] != null && !overwrite) {
1067 debug.warn('Overwriting ' + path + ' with', target);
1068 }
1069 this.imports[path] = target;
1070 if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
1071 _parchment2.default.register(target);
1072 } else if (path.startsWith('modules') && typeof target.register === 'function') {
1073 target.register();
1074 }
1075 }
1076 }
1077 }]);
1078
1079 function Quill(container) {
1080 var _this2 = this;
1081
1082 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1083
1084 _classCallCheck(this, Quill);
1085
1086 this.options = expandConfig(container, options);
1087 this.container = this.options.container;
1088 if (this.container == null) {
1089 return debug.error('Invalid Quill container', container);
1090 }
1091 if (this.options.debug) {
1092 Quill.debug(this.options.debug);
1093 }
1094 var html = this.container.innerHTML.trim();
1095 this.container.classList.add('ql-container');
1096 this.container.innerHTML = '';
1097 this.container.__quill = this;
1098 this.root = this.addContainer('ql-editor');
1099 this.root.classList.add('ql-blank');
1100 this.root.setAttribute('data-gramm', false);
1101 this.scrollingContainer = this.options.scrollingContainer || this.root;
1102 this.emitter = new _emitter4.default();
1103 this.scroll = _parchment2.default.create(this.root, {
1104 emitter: this.emitter,
1105 whitelist: this.options.formats
1106 });
1107 this.editor = new _editor2.default(this.scroll);
1108 this.selection = new _selection2.default(this.scroll, this.emitter);
1109 this.theme = new this.options.theme(this, this.options);
1110 this.keyboard = this.theme.addModule('keyboard');
1111 this.clipboard = this.theme.addModule('clipboard');
1112 this.history = this.theme.addModule('history');
1113 this.theme.init();
1114 this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
1115 if (type === _emitter4.default.events.TEXT_CHANGE) {
1116 _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
1117 }
1118 });
1119 this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
1120 var range = _this2.selection.lastRange;
1121 var index = range && range.length === 0 ? range.index : undefined;
1122 modify.call(_this2, function () {
1123 return _this2.editor.update(null, mutations, index);
1124 }, source);
1125 });
1126 var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
1127 this.setContents(contents);
1128 this.history.clear();
1129 if (this.options.placeholder) {
1130 this.root.setAttribute('data-placeholder', this.options.placeholder);
1131 }
1132 if (this.options.readOnly) {
1133 this.disable();
1134 }
1135 }
1136
1137 _createClass(Quill, [{
1138 key: 'addContainer',
1139 value: function addContainer(container) {
1140 var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1141
1142 if (typeof container === 'string') {
1143 var className = container;
1144 container = document.createElement('div');
1145 container.classList.add(className);
1146 }
1147 this.container.insertBefore(container, refNode);
1148 return container;
1149 }
1150 }, {
1151 key: 'blur',
1152 value: function blur() {
1153 this.selection.setRange(null);
1154 }
1155 }, {
1156 key: 'deleteText',
1157 value: function deleteText(index, length, source) {
1158 var _this3 = this;
1159
1160 var _overload = overload(index, length, source);
1161
1162 var _overload2 = _slicedToArray(_overload, 4);
1163
1164 index = _overload2[0];
1165 length = _overload2[1];
1166 source = _overload2[3];
1167
1168 return modify.call(this, function () {
1169 return _this3.editor.deleteText(index, length);
1170 }, source, index, -1 * length);
1171 }
1172 }, {
1173 key: 'disable',
1174 value: function disable() {
1175 this.enable(false);
1176 }
1177 }, {
1178 key: 'enable',
1179 value: function enable() {
1180 var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1181
1182 this.scroll.enable(enabled);
1183 this.container.classList.toggle('ql-disabled', !enabled);
1184 }
1185 }, {
1186 key: 'focus',
1187 value: function focus() {
1188 var scrollTop = this.scrollingContainer.scrollTop;
1189 this.selection.focus();
1190 this.scrollingContainer.scrollTop = scrollTop;
1191 this.scrollIntoView();
1192 }
1193 }, {
1194 key: 'format',
1195 value: function format(name, value) {
1196 var _this4 = this;
1197
1198 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
1199
1200 return modify.call(this, function () {
1201 var range = _this4.getSelection(true);
1202 var change = new _quillDelta2.default();
1203 if (range == null) {
1204 return change;
1205 } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
1206 change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
1207 } else if (range.length === 0) {
1208 _this4.selection.format(name, value);
1209 return change;
1210 } else {
1211 change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
1212 }
1213 _this4.setSelection(range, _emitter4.default.sources.SILENT);
1214 return change;
1215 }, source);
1216 }
1217 }, {
1218 key: 'formatLine',
1219 value: function formatLine(index, length, name, value, source) {
1220 var _this5 = this;
1221
1222 var formats = void 0;
1223
1224 var _overload3 = overload(index, length, name, value, source);
1225
1226 var _overload4 = _slicedToArray(_overload3, 4);
1227
1228 index = _overload4[0];
1229 length = _overload4[1];
1230 formats = _overload4[2];
1231 source = _overload4[3];
1232
1233 return modify.call(this, function () {
1234 return _this5.editor.formatLine(index, length, formats);
1235 }, source, index, 0);
1236 }
1237 }, {
1238 key: 'formatText',
1239 value: function formatText(index, length, name, value, source) {
1240 var _this6 = this;
1241
1242 var formats = void 0;
1243
1244 var _overload5 = overload(index, length, name, value, source);
1245
1246 var _overload6 = _slicedToArray(_overload5, 4);
1247
1248 index = _overload6[0];
1249 length = _overload6[1];
1250 formats = _overload6[2];
1251 source = _overload6[3];
1252
1253 return modify.call(this, function () {
1254 return _this6.editor.formatText(index, length, formats);
1255 }, source, index, 0);
1256 }
1257 }, {
1258 key: 'getBounds',
1259 value: function getBounds(index) {
1260 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1261
1262 var bounds = void 0;
1263 if (typeof index === 'number') {
1264 bounds = this.selection.getBounds(index, length);
1265 } else {
1266 bounds = this.selection.getBounds(index.index, index.length);
1267 }
1268 var containerBounds = this.container.getBoundingClientRect();
1269 return {
1270 bottom: bounds.bottom - containerBounds.top,
1271 height: bounds.height,
1272 left: bounds.left - containerBounds.left,
1273 right: bounds.right - containerBounds.left,
1274 top: bounds.top - containerBounds.top,
1275 width: bounds.width
1276 };
1277 }
1278 }, {
1279 key: 'getContents',
1280 value: function getContents() {
1281 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1282 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
1283
1284 var _overload7 = overload(index, length);
1285
1286 var _overload8 = _slicedToArray(_overload7, 2);
1287
1288 index = _overload8[0];
1289 length = _overload8[1];
1290
1291 return this.editor.getContents(index, length);
1292 }
1293 }, {
1294 key: 'getFormat',
1295 value: function getFormat() {
1296 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);
1297 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1298
1299 if (typeof index === 'number') {
1300 return this.editor.getFormat(index, length);
1301 } else {
1302 return this.editor.getFormat(index.index, index.length);
1303 }
1304 }
1305 }, {
1306 key: 'getIndex',
1307 value: function getIndex(blot) {
1308 return blot.offset(this.scroll);
1309 }
1310 }, {
1311 key: 'getLength',
1312 value: function getLength() {
1313 return this.scroll.length();
1314 }
1315 }, {
1316 key: 'getLeaf',
1317 value: function getLeaf(index) {
1318 return this.scroll.leaf(index);
1319 }
1320 }, {
1321 key: 'getLine',
1322 value: function getLine(index) {
1323 return this.scroll.line(index);
1324 }
1325 }, {
1326 key: 'getLines',
1327 value: function getLines() {
1328 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1329 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
1330
1331 if (typeof index !== 'number') {
1332 return this.scroll.lines(index.index, index.length);
1333 } else {
1334 return this.scroll.lines(index, length);
1335 }
1336 }
1337 }, {
1338 key: 'getModule',
1339 value: function getModule(name) {
1340 return this.theme.modules[name];
1341 }
1342 }, {
1343 key: 'getSelection',
1344 value: function getSelection() {
1345 var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1346
1347 if (focus) this.focus();
1348 this.update(); // Make sure we access getRange with editor in consistent state
1349 return this.selection.getRange()[0];
1350 }
1351 }, {
1352 key: 'getText',
1353 value: function getText() {
1354 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1355 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
1356
1357 var _overload9 = overload(index, length);
1358
1359 var _overload10 = _slicedToArray(_overload9, 2);
1360
1361 index = _overload10[0];
1362 length = _overload10[1];
1363
1364 return this.editor.getText(index, length);
1365 }
1366 }, {
1367 key: 'hasFocus',
1368 value: function hasFocus() {
1369 return this.selection.hasFocus();
1370 }
1371 }, {
1372 key: 'insertEmbed',
1373 value: function insertEmbed(index, embed, value) {
1374 var _this7 = this;
1375
1376 var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
1377
1378 return modify.call(this, function () {
1379 return _this7.editor.insertEmbed(index, embed, value);
1380 }, source, index);
1381 }
1382 }, {
1383 key: 'insertText',
1384 value: function insertText(index, text, name, value, source) {
1385 var _this8 = this;
1386
1387 var formats = void 0;
1388
1389 var _overload11 = overload(index, 0, name, value, source);
1390
1391 var _overload12 = _slicedToArray(_overload11, 4);
1392
1393 index = _overload12[0];
1394 formats = _overload12[2];
1395 source = _overload12[3];
1396
1397 return modify.call(this, function () {
1398 return _this8.editor.insertText(index, text, formats);
1399 }, source, index, text.length);
1400 }
1401 }, {
1402 key: 'isEnabled',
1403 value: function isEnabled() {
1404 return !this.container.classList.contains('ql-disabled');
1405 }
1406 }, {
1407 key: 'off',
1408 value: function off() {
1409 return this.emitter.off.apply(this.emitter, arguments);
1410 }
1411 }, {
1412 key: 'on',
1413 value: function on() {
1414 return this.emitter.on.apply(this.emitter, arguments);
1415 }
1416 }, {
1417 key: 'once',
1418 value: function once() {
1419 return this.emitter.once.apply(this.emitter, arguments);
1420 }
1421 }, {
1422 key: 'pasteHTML',
1423 value: function pasteHTML(index, html, source) {
1424 this.clipboard.dangerouslyPasteHTML(index, html, source);
1425 }
1426 }, {
1427 key: 'removeFormat',
1428 value: function removeFormat(index, length, source) {
1429 var _this9 = this;
1430
1431 var _overload13 = overload(index, length, source);
1432
1433 var _overload14 = _slicedToArray(_overload13, 4);
1434
1435 index = _overload14[0];
1436 length = _overload14[1];
1437 source = _overload14[3];
1438
1439 return modify.call(this, function () {
1440 return _this9.editor.removeFormat(index, length);
1441 }, source, index);
1442 }
1443 }, {
1444 key: 'scrollIntoView',
1445 value: function scrollIntoView() {
1446 this.selection.scrollIntoView(this.scrollingContainer);
1447 }
1448 }, {
1449 key: 'setContents',
1450 value: function setContents(delta) {
1451 var _this10 = this;
1452
1453 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1454
1455 return modify.call(this, function () {
1456 delta = new _quillDelta2.default(delta);
1457 var length = _this10.getLength();
1458 var deleted = _this10.editor.deleteText(0, length);
1459 var applied = _this10.editor.applyDelta(delta);
1460 var lastOp = applied.ops[applied.ops.length - 1];
1461 if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
1462 _this10.editor.deleteText(_this10.getLength() - 1, 1);
1463 applied.delete(1);
1464 }
1465 var ret = deleted.compose(applied);
1466 return ret;
1467 }, source);
1468 }
1469 }, {
1470 key: 'setSelection',
1471 value: function setSelection(index, length, source) {
1472 if (index == null) {
1473 this.selection.setRange(null, length || Quill.sources.API);
1474 } else {
1475 var _overload15 = overload(index, length, source);
1476
1477 var _overload16 = _slicedToArray(_overload15, 4);
1478
1479 index = _overload16[0];
1480 length = _overload16[1];
1481 source = _overload16[3];
1482
1483 this.selection.setRange(new _selection.Range(index, length), source);
1484 if (source !== _emitter4.default.sources.SILENT) {
1485 this.selection.scrollIntoView(this.scrollingContainer);
1486 }
1487 }
1488 }
1489 }, {
1490 key: 'setText',
1491 value: function setText(text) {
1492 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1493
1494 var delta = new _quillDelta2.default().insert(text);
1495 return this.setContents(delta, source);
1496 }
1497 }, {
1498 key: 'update',
1499 value: function update() {
1500 var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
1501
1502 var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
1503 this.selection.update(source);
1504 return change;
1505 }
1506 }, {
1507 key: 'updateContents',
1508 value: function updateContents(delta) {
1509 var _this11 = this;
1510
1511 var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
1512
1513 return modify.call(this, function () {
1514 delta = new _quillDelta2.default(delta);
1515 return _this11.editor.applyDelta(delta, source);
1516 }, source, true);
1517 }
1518 }]);
1519
1520 return Quill;
1521 }();
1522
1523 Quill.DEFAULTS = {
1524 bounds: null,
1525 formats: null,
1526 modules: {},
1527 placeholder: '',
1528 readOnly: false,
1529 scrollingContainer: null,
1530 strict: true,
1531 theme: 'default'
1532 };
1533 Quill.events = _emitter4.default.events;
1534 Quill.sources = _emitter4.default.sources;
1535 // eslint-disable-next-line no-undef
1536 Quill.version = false ? 'dev' : "1.3.6";
1537
1538 Quill.imports = {
1539 'delta': _quillDelta2.default,
1540 'parchment': _parchment2.default,
1541 'core/module': _module2.default,
1542 'core/theme': _theme2.default
1543 };
1544
1545 function expandConfig(container, userConfig) {
1546 userConfig = (0, _extend2.default)(true, {
1547 container: container,
1548 modules: {
1549 clipboard: true,
1550 keyboard: true,
1551 history: true
1552 }
1553 }, userConfig);
1554 if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
1555 userConfig.theme = _theme2.default;
1556 } else {
1557 userConfig.theme = Quill.import('themes/' + userConfig.theme);
1558 if (userConfig.theme == null) {
1559 throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
1560 }
1561 }
1562 var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
1563 [themeConfig, userConfig].forEach(function (config) {
1564 config.modules = config.modules || {};
1565 Object.keys(config.modules).forEach(function (module) {
1566 if (config.modules[module] === true) {
1567 config.modules[module] = {};
1568 }
1569 });
1570 });
1571 var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
1572 var moduleConfig = moduleNames.reduce(function (config, name) {
1573 var moduleClass = Quill.import('modules/' + name);
1574 if (moduleClass == null) {
1575 debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
1576 } else {
1577 config[name] = moduleClass.DEFAULTS || {};
1578 }
1579 return config;
1580 }, {});
1581 // Special case toolbar shorthand
1582 if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
1583 userConfig.modules.toolbar = {
1584 container: userConfig.modules.toolbar
1585 };
1586 }
1587 userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
1588 ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
1589 if (typeof userConfig[key] === 'string') {
1590 userConfig[key] = document.querySelector(userConfig[key]);
1591 }
1592 });
1593 userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
1594 if (userConfig.modules[name]) {
1595 config[name] = userConfig.modules[name];
1596 }
1597 return config;
1598 }, {});
1599 return userConfig;
1600 }
1601
1602 // Handle selection preservation and TEXT_CHANGE emission
1603 // common to modification APIs
1604 function modify(modifier, source, index, shift) {
1605 if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
1606 return new _quillDelta2.default();
1607 }
1608 var range = index == null ? null : this.getSelection();
1609 var oldDelta = this.editor.delta;
1610 var change = modifier();
1611 if (range != null) {
1612 if (index === true) index = range.index;
1613 if (shift == null) {
1614 range = shiftRange(range, change, source);
1615 } else if (shift !== 0) {
1616 range = shiftRange(range, index, shift, source);
1617 }
1618 this.setSelection(range, _emitter4.default.sources.SILENT);
1619 }
1620 if (change.length() > 0) {
1621 var _emitter;
1622
1623 var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
1624 (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
1625 if (source !== _emitter4.default.sources.SILENT) {
1626 var _emitter2;
1627
1628 (_emitter2 = this.emitter).emit.apply(_emitter2, args);
1629 }
1630 }
1631 return change;
1632 }
1633
1634 function overload(index, length, name, value, source) {
1635 var formats = {};
1636 if (typeof index.index === 'number' && typeof index.length === 'number') {
1637 // Allow for throwaway end (used by insertText/insertEmbed)
1638 if (typeof length !== 'number') {
1639 source = value, value = name, name = length, length = index.length, index = index.index;
1640 } else {
1641 length = index.length, index = index.index;
1642 }
1643 } else if (typeof length !== 'number') {
1644 source = value, value = name, name = length, length = 0;
1645 }
1646 // Handle format being object, two format name/value strings or excluded
1647 if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
1648 formats = name;
1649 source = value;
1650 } else if (typeof name === 'string') {
1651 if (value != null) {
1652 formats[name] = value;
1653 } else {
1654 source = name;
1655 }
1656 }
1657 // Handle optional source
1658 source = source || _emitter4.default.sources.API;
1659 return [index, length, formats, source];
1660 }
1661
1662 function shiftRange(range, index, length, source) {
1663 if (range == null) return null;
1664 var start = void 0,
1665 end = void 0;
1666 if (index instanceof _quillDelta2.default) {
1667 var _map = [range.index, range.index + range.length].map(function (pos) {
1668 return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
1669 });
1670
1671 var _map2 = _slicedToArray(_map, 2);
1672
1673 start = _map2[0];
1674 end = _map2[1];
1675 } else {
1676 var _map3 = [range.index, range.index + range.length].map(function (pos) {
1677 if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
1678 if (length >= 0) {
1679 return pos + length;
1680 } else {
1681 return Math.max(index, pos + length);
1682 }
1683 });
1684
1685 var _map4 = _slicedToArray(_map3, 2);
1686
1687 start = _map4[0];
1688 end = _map4[1];
1689 }
1690 return new _selection.Range(start, end - start);
1691 }
1692
1693 exports.expandConfig = expandConfig;
1694 exports.overload = overload;
1695 exports.default = Quill;
1696
1697 /***/ }),
1698 /* 6 */
1699 /***/ (function(module, exports, __webpack_require__) {
1700
1701 "use strict";
1702
1703
1704 Object.defineProperty(exports, "__esModule", {
1705 value: true
1706 });
1707
1708 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1709
1710 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
1711
1712 var _text = __webpack_require__(7);
1713
1714 var _text2 = _interopRequireDefault(_text);
1715
1716 var _parchment = __webpack_require__(0);
1717
1718 var _parchment2 = _interopRequireDefault(_parchment);
1719
1720 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1721
1722 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1723
1724 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1725
1726 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1727
1728 var Inline = function (_Parchment$Inline) {
1729 _inherits(Inline, _Parchment$Inline);
1730
1731 function Inline() {
1732 _classCallCheck(this, Inline);
1733
1734 return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
1735 }
1736
1737 _createClass(Inline, [{
1738 key: 'formatAt',
1739 value: function formatAt(index, length, name, value) {
1740 if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
1741 var blot = this.isolate(index, length);
1742 if (value) {
1743 blot.wrap(name, value);
1744 }
1745 } else {
1746 _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
1747 }
1748 }
1749 }, {
1750 key: 'optimize',
1751 value: function optimize(context) {
1752 _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);
1753 if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
1754 var parent = this.parent.isolate(this.offset(), this.length());
1755 this.moveChildren(parent);
1756 parent.wrap(this);
1757 }
1758 }
1759 }], [{
1760 key: 'compare',
1761 value: function compare(self, other) {
1762 var selfIndex = Inline.order.indexOf(self);
1763 var otherIndex = Inline.order.indexOf(other);
1764 if (selfIndex >= 0 || otherIndex >= 0) {
1765 return selfIndex - otherIndex;
1766 } else if (self === other) {
1767 return 0;
1768 } else if (self < other) {
1769 return -1;
1770 } else {
1771 return 1;
1772 }
1773 }
1774 }]);
1775
1776 return Inline;
1777 }(_parchment2.default.Inline);
1778
1779 Inline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];
1780 // Lower index means deeper in the DOM tree, since not found (-1) is for embeds
1781 Inline.order = ['cursor', 'inline', // Must be lower
1782 'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher
1783 ];
1784
1785 exports.default = Inline;
1786
1787 /***/ }),
1788 /* 7 */
1789 /***/ (function(module, exports, __webpack_require__) {
1790
1791 "use strict";
1792
1793
1794 Object.defineProperty(exports, "__esModule", {
1795 value: true
1796 });
1797
1798 var _parchment = __webpack_require__(0);
1799
1800 var _parchment2 = _interopRequireDefault(_parchment);
1801
1802 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1803
1804 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1805
1806 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1807
1808 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1809
1810 var TextBlot = function (_Parchment$Text) {
1811 _inherits(TextBlot, _Parchment$Text);
1812
1813 function TextBlot() {
1814 _classCallCheck(this, TextBlot);
1815
1816 return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
1817 }
1818
1819 return TextBlot;
1820 }(_parchment2.default.Text);
1821
1822 exports.default = TextBlot;
1823
1824 /***/ }),
1825 /* 8 */
1826 /***/ (function(module, exports, __webpack_require__) {
1827
1828 "use strict";
1829
1830
1831 Object.defineProperty(exports, "__esModule", {
1832 value: true
1833 });
1834
1835 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1836
1837 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
1838
1839 var _eventemitter = __webpack_require__(54);
1840
1841 var _eventemitter2 = _interopRequireDefault(_eventemitter);
1842
1843 var _logger = __webpack_require__(10);
1844
1845 var _logger2 = _interopRequireDefault(_logger);
1846
1847 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1848
1849 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1850
1851 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1852
1853 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1854
1855 var debug = (0, _logger2.default)('quill:events');
1856
1857 var EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];
1858
1859 EVENTS.forEach(function (eventName) {
1860 document.addEventListener(eventName, function () {
1861 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1862 args[_key] = arguments[_key];
1863 }
1864
1865 [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {
1866 // TODO use WeakMap
1867 if (node.__quill && node.__quill.emitter) {
1868 var _node$__quill$emitter;
1869
1870 (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);
1871 }
1872 });
1873 });
1874 });
1875
1876 var Emitter = function (_EventEmitter) {
1877 _inherits(Emitter, _EventEmitter);
1878
1879 function Emitter() {
1880 _classCallCheck(this, Emitter);
1881
1882 var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
1883
1884 _this.listeners = {};
1885 _this.on('error', debug.error);
1886 return _this;
1887 }
1888
1889 _createClass(Emitter, [{
1890 key: 'emit',
1891 value: function emit() {
1892 debug.log.apply(debug, arguments);
1893 _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
1894 }
1895 }, {
1896 key: 'handleDOM',
1897 value: function handleDOM(event) {
1898 for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1899 args[_key2 - 1] = arguments[_key2];
1900 }
1901
1902 (this.listeners[event.type] || []).forEach(function (_ref) {
1903 var node = _ref.node,
1904 handler = _ref.handler;
1905
1906 if (event.target === node || node.contains(event.target)) {
1907 handler.apply(undefined, [event].concat(args));
1908 }
1909 });
1910 }
1911 }, {
1912 key: 'listenDOM',
1913 value: function listenDOM(eventName, node, handler) {
1914 if (!this.listeners[eventName]) {
1915 this.listeners[eventName] = [];
1916 }
1917 this.listeners[eventName].push({ node: node, handler: handler });
1918 }
1919 }]);
1920
1921 return Emitter;
1922 }(_eventemitter2.default);
1923
1924 Emitter.events = {
1925 EDITOR_CHANGE: 'editor-change',
1926 SCROLL_BEFORE_UPDATE: 'scroll-before-update',
1927 SCROLL_OPTIMIZE: 'scroll-optimize',
1928 SCROLL_UPDATE: 'scroll-update',
1929 SELECTION_CHANGE: 'selection-change',
1930 TEXT_CHANGE: 'text-change'
1931 };
1932 Emitter.sources = {
1933 API: 'api',
1934 SILENT: 'silent',
1935 USER: 'user'
1936 };
1937
1938 exports.default = Emitter;
1939
1940 /***/ }),
1941 /* 9 */
1942 /***/ (function(module, exports, __webpack_require__) {
1943
1944 "use strict";
1945
1946
1947 Object.defineProperty(exports, "__esModule", {
1948 value: true
1949 });
1950
1951 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1952
1953 var Module = function Module(quill) {
1954 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1955
1956 _classCallCheck(this, Module);
1957
1958 this.quill = quill;
1959 this.options = options;
1960 };
1961
1962 Module.DEFAULTS = {};
1963
1964 exports.default = Module;
1965
1966 /***/ }),
1967 /* 10 */
1968 /***/ (function(module, exports, __webpack_require__) {
1969
1970 "use strict";
1971
1972
1973 Object.defineProperty(exports, "__esModule", {
1974 value: true
1975 });
1976 var levels = ['error', 'warn', 'log', 'info'];
1977 var level = 'warn';
1978
1979 function debug(method) {
1980 if (levels.indexOf(method) <= levels.indexOf(level)) {
1981 var _console;
1982
1983 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1984 args[_key - 1] = arguments[_key];
1985 }
1986
1987 (_console = console)[method].apply(_console, args); // eslint-disable-line no-console
1988 }
1989 }
1990
1991 function namespace(ns) {
1992 return levels.reduce(function (logger, method) {
1993 logger[method] = debug.bind(console, method, ns);
1994 return logger;
1995 }, {});
1996 }
1997
1998 debug.level = namespace.level = function (newLevel) {
1999 level = newLevel;
2000 };
2001
2002 exports.default = namespace;
2003
2004 /***/ }),
2005 /* 11 */
2006 /***/ (function(module, exports, __webpack_require__) {
2007
2008 var pSlice = Array.prototype.slice;
2009 var objectKeys = __webpack_require__(52);
2010 var isArguments = __webpack_require__(53);
2011
2012 var deepEqual = module.exports = function (actual, expected, opts) {
2013 if (!opts) opts = {};
2014 // 7.1. All identical values are equivalent, as determined by ===.
2015 if (actual === expected) {
2016 return true;
2017
2018 } else if (actual instanceof Date && expected instanceof Date) {
2019 return actual.getTime() === expected.getTime();
2020
2021 // 7.3. Other pairs that do not both pass typeof value == 'object',
2022 // equivalence is determined by ==.
2023 } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
2024 return opts.strict ? actual === expected : actual == expected;
2025
2026 // 7.4. For all other Object pairs, including Array objects, equivalence is
2027 // determined by having the same number of owned properties (as verified
2028 // with Object.prototype.hasOwnProperty.call), the same set of keys
2029 // (although not necessarily the same order), equivalent values for every
2030 // corresponding key, and an identical 'prototype' property. Note: this
2031 // accounts for both named and indexed properties on Arrays.
2032 } else {
2033 return objEquiv(actual, expected, opts);
2034 }
2035 }
2036
2037 function isUndefinedOrNull(value) {
2038 return value === null || value === undefined;
2039 }
2040
2041 function isBuffer (x) {
2042 if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
2043 if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
2044 return false;
2045 }
2046 if (x.length > 0 && typeof x[0] !== 'number') return false;
2047 return true;
2048 }
2049
2050 function objEquiv(a, b, opts) {
2051 var i, key;
2052 if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
2053 return false;
2054 // an identical 'prototype' property.
2055 if (a.prototype !== b.prototype) return false;
2056 //~~~I've managed to break Object.keys through screwy arguments passing.
2057 // Converting to array solves the problem.
2058 if (isArguments(a)) {
2059 if (!isArguments(b)) {
2060 return false;
2061 }
2062 a = pSlice.call(a);
2063 b = pSlice.call(b);
2064 return deepEqual(a, b, opts);
2065 }
2066 if (isBuffer(a)) {
2067 if (!isBuffer(b)) {
2068 return false;
2069 }
2070 if (a.length !== b.length) return false;
2071 for (i = 0; i < a.length; i++) {
2072 if (a[i] !== b[i]) return false;
2073 }
2074 return true;
2075 }
2076 try {
2077 var ka = objectKeys(a),
2078 kb = objectKeys(b);
2079 } catch (e) {//happens when one is a string literal and the other isn't
2080 return false;
2081 }
2082 // having the same number of owned properties (keys incorporates
2083 // hasOwnProperty)
2084 if (ka.length != kb.length)
2085 return false;
2086 //the same set of keys (although not necessarily the same order),
2087 ka.sort();
2088 kb.sort();
2089 //~~~cheap key test
2090 for (i = ka.length - 1; i >= 0; i--) {
2091 if (ka[i] != kb[i])
2092 return false;
2093 }
2094 //equivalent values for every corresponding key, and
2095 //~~~possibly expensive deep test
2096 for (i = ka.length - 1; i >= 0; i--) {
2097 key = ka[i];
2098 if (!deepEqual(a[key], b[key], opts)) return false;
2099 }
2100 return typeof a === typeof b;
2101 }
2102
2103
2104 /***/ }),
2105 /* 12 */
2106 /***/ (function(module, exports, __webpack_require__) {
2107
2108 "use strict";
2109
2110 Object.defineProperty(exports, "__esModule", { value: true });
2111 var Registry = __webpack_require__(1);
2112 var Attributor = /** @class */ (function () {
2113 function Attributor(attrName, keyName, options) {
2114 if (options === void 0) { options = {}; }
2115 this.attrName = attrName;
2116 this.keyName = keyName;
2117 var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
2118 if (options.scope != null) {
2119 // Ignore type bits, force attribute bit
2120 this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
2121 }
2122 else {
2123 this.scope = Registry.Scope.ATTRIBUTE;
2124 }
2125 if (options.whitelist != null)
2126 this.whitelist = options.whitelist;
2127 }
2128 Attributor.keys = function (node) {
2129 return [].map.call(node.attributes, function (item) {
2130 return item.name;
2131 });
2132 };
2133 Attributor.prototype.add = function (node, value) {
2134 if (!this.canAdd(node, value))
2135 return false;
2136 node.setAttribute(this.keyName, value);
2137 return true;
2138 };
2139 Attributor.prototype.canAdd = function (node, value) {
2140 var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
2141 if (match == null)
2142 return false;
2143 if (this.whitelist == null)
2144 return true;
2145 if (typeof value === 'string') {
2146 return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1;
2147 }
2148 else {
2149 return this.whitelist.indexOf(value) > -1;
2150 }
2151 };
2152 Attributor.prototype.remove = function (node) {
2153 node.removeAttribute(this.keyName);
2154 };
2155 Attributor.prototype.value = function (node) {
2156 var value = node.getAttribute(this.keyName);
2157 if (this.canAdd(node, value) && value) {
2158 return value;
2159 }
2160 return '';
2161 };
2162 return Attributor;
2163 }());
2164 exports.default = Attributor;
2165
2166
2167 /***/ }),
2168 /* 13 */
2169 /***/ (function(module, exports, __webpack_require__) {
2170
2171 "use strict";
2172
2173
2174 Object.defineProperty(exports, "__esModule", {
2175 value: true
2176 });
2177 exports.default = exports.Code = undefined;
2178
2179 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
2180
2181 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2182
2183 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
2184
2185 var _quillDelta = __webpack_require__(2);
2186
2187 var _quillDelta2 = _interopRequireDefault(_quillDelta);
2188
2189 var _parchment = __webpack_require__(0);
2190
2191 var _parchment2 = _interopRequireDefault(_parchment);
2192
2193 var _block = __webpack_require__(4);
2194
2195 var _block2 = _interopRequireDefault(_block);
2196
2197 var _inline = __webpack_require__(6);
2198
2199 var _inline2 = _interopRequireDefault(_inline);
2200
2201 var _text = __webpack_require__(7);
2202
2203 var _text2 = _interopRequireDefault(_text);
2204
2205 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2206
2207 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2208
2209 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2210
2211 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2212
2213 var Code = function (_Inline) {
2214 _inherits(Code, _Inline);
2215
2216 function Code() {
2217 _classCallCheck(this, Code);
2218
2219 return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
2220 }
2221
2222 return Code;
2223 }(_inline2.default);
2224
2225 Code.blotName = 'code';
2226 Code.tagName = 'CODE';
2227
2228 var CodeBlock = function (_Block) {
2229 _inherits(CodeBlock, _Block);
2230
2231 function CodeBlock() {
2232 _classCallCheck(this, CodeBlock);
2233
2234 return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
2235 }
2236
2237 _createClass(CodeBlock, [{
2238 key: 'delta',
2239 value: function delta() {
2240 var _this3 = this;
2241
2242 var text = this.domNode.textContent;
2243 if (text.endsWith('\n')) {
2244 // Should always be true
2245 text = text.slice(0, -1);
2246 }
2247 return text.split('\n').reduce(function (delta, frag) {
2248 return delta.insert(frag).insert('\n', _this3.formats());
2249 }, new _quillDelta2.default());
2250 }
2251 }, {
2252 key: 'format',
2253 value: function format(name, value) {
2254 if (name === this.statics.blotName && value) return;
2255
2256 var _descendant = this.descendant(_text2.default, this.length() - 1),
2257 _descendant2 = _slicedToArray(_descendant, 1),
2258 text = _descendant2[0];
2259
2260 if (text != null) {
2261 text.deleteAt(text.length() - 1, 1);
2262 }
2263 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
2264 }
2265 }, {
2266 key: 'formatAt',
2267 value: function formatAt(index, length, name, value) {
2268 if (length === 0) return;
2269 if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
2270 return;
2271 }
2272 var nextNewline = this.newlineIndex(index);
2273 if (nextNewline < 0 || nextNewline >= index + length) return;
2274 var prevNewline = this.newlineIndex(index, true) + 1;
2275 var isolateLength = nextNewline - prevNewline + 1;
2276 var blot = this.isolate(prevNewline, isolateLength);
2277 var next = blot.next;
2278 blot.format(name, value);
2279 if (next instanceof CodeBlock) {
2280 next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
2281 }
2282 }
2283 }, {
2284 key: 'insertAt',
2285 value: function insertAt(index, value, def) {
2286 if (def != null) return;
2287
2288 var _descendant3 = this.descendant(_text2.default, index),
2289 _descendant4 = _slicedToArray(_descendant3, 2),
2290 text = _descendant4[0],
2291 offset = _descendant4[1];
2292
2293 text.insertAt(offset, value);
2294 }
2295 }, {
2296 key: 'length',
2297 value: function length() {
2298 var length = this.domNode.textContent.length;
2299 if (!this.domNode.textContent.endsWith('\n')) {
2300 return length + 1;
2301 }
2302 return length;
2303 }
2304 }, {
2305 key: 'newlineIndex',
2306 value: function newlineIndex(searchIndex) {
2307 var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2308
2309 if (!reverse) {
2310 var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
2311 return offset > -1 ? searchIndex + offset : -1;
2312 } else {
2313 return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
2314 }
2315 }
2316 }, {
2317 key: 'optimize',
2318 value: function optimize(context) {
2319 if (!this.domNode.textContent.endsWith('\n')) {
2320 this.appendChild(_parchment2.default.create('text', '\n'));
2321 }
2322 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);
2323 var next = this.next;
2324 if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
2325 next.optimize(context);
2326 next.moveChildren(this);
2327 next.remove();
2328 }
2329 }
2330 }, {
2331 key: 'replace',
2332 value: function replace(target) {
2333 _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
2334 [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
2335 var blot = _parchment2.default.find(node);
2336 if (blot == null) {
2337 node.parentNode.removeChild(node);
2338 } else if (blot instanceof _parchment2.default.Embed) {
2339 blot.remove();
2340 } else {
2341 blot.unwrap();
2342 }
2343 });
2344 }
2345 }], [{
2346 key: 'create',
2347 value: function create(value) {
2348 var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
2349 domNode.setAttribute('spellcheck', false);
2350 return domNode;
2351 }
2352 }, {
2353 key: 'formats',
2354 value: function formats() {
2355 return true;
2356 }
2357 }]);
2358
2359 return CodeBlock;
2360 }(_block2.default);
2361
2362 CodeBlock.blotName = 'code-block';
2363 CodeBlock.tagName = 'PRE';
2364 CodeBlock.TAB = ' ';
2365
2366 exports.Code = Code;
2367 exports.default = CodeBlock;
2368
2369 /***/ }),
2370 /* 14 */
2371 /***/ (function(module, exports, __webpack_require__) {
2372
2373 "use strict";
2374
2375
2376 Object.defineProperty(exports, "__esModule", {
2377 value: true
2378 });
2379
2380 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2381
2382 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
2383
2384 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2385
2386 var _quillDelta = __webpack_require__(2);
2387
2388 var _quillDelta2 = _interopRequireDefault(_quillDelta);
2389
2390 var _op = __webpack_require__(20);
2391
2392 var _op2 = _interopRequireDefault(_op);
2393
2394 var _parchment = __webpack_require__(0);
2395
2396 var _parchment2 = _interopRequireDefault(_parchment);
2397
2398 var _code = __webpack_require__(13);
2399
2400 var _code2 = _interopRequireDefault(_code);
2401
2402 var _cursor = __webpack_require__(24);
2403
2404 var _cursor2 = _interopRequireDefault(_cursor);
2405
2406 var _block = __webpack_require__(4);
2407
2408 var _block2 = _interopRequireDefault(_block);
2409
2410 var _break = __webpack_require__(16);
2411
2412 var _break2 = _interopRequireDefault(_break);
2413
2414 var _clone = __webpack_require__(21);
2415
2416 var _clone2 = _interopRequireDefault(_clone);
2417
2418 var _deepEqual = __webpack_require__(11);
2419
2420 var _deepEqual2 = _interopRequireDefault(_deepEqual);
2421
2422 var _extend = __webpack_require__(3);
2423
2424 var _extend2 = _interopRequireDefault(_extend);
2425
2426 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2427
2428 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2429
2430 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2431
2432 var ASCII = /^[ -~]*$/;
2433
2434 var Editor = function () {
2435 function Editor(scroll) {
2436 _classCallCheck(this, Editor);
2437
2438 this.scroll = scroll;
2439 this.delta = this.getDelta();
2440 }
2441
2442 _createClass(Editor, [{
2443 key: 'applyDelta',
2444 value: function applyDelta(delta) {
2445 var _this = this;
2446
2447 var consumeNextNewline = false;
2448 this.scroll.update();
2449 var scrollLength = this.scroll.length();
2450 this.scroll.batchStart();
2451 delta = normalizeDelta(delta);
2452 delta.reduce(function (index, op) {
2453 var length = op.retain || op.delete || op.insert.length || 1;
2454 var attributes = op.attributes || {};
2455 if (op.insert != null) {
2456 if (typeof op.insert === 'string') {
2457 var text = op.insert;
2458 if (text.endsWith('\n') && consumeNextNewline) {
2459 consumeNextNewline = false;
2460 text = text.slice(0, -1);
2461 }
2462 if (index >= scrollLength && !text.endsWith('\n')) {
2463 consumeNextNewline = true;
2464 }
2465 _this.scroll.insertAt(index, text);
2466
2467 var _scroll$line = _this.scroll.line(index),
2468 _scroll$line2 = _slicedToArray(_scroll$line, 2),
2469 line = _scroll$line2[0],
2470 offset = _scroll$line2[1];
2471
2472 var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
2473 if (line instanceof _block2.default) {
2474 var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
2475 _line$descendant2 = _slicedToArray(_line$descendant, 1),
2476 leaf = _line$descendant2[0];
2477
2478 formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
2479 }
2480 attributes = _op2.default.attributes.diff(formats, attributes) || {};
2481 } else if (_typeof(op.insert) === 'object') {
2482 var key = Object.keys(op.insert)[0]; // There should only be one key
2483 if (key == null) return index;
2484 _this.scroll.insertAt(index, key, op.insert[key]);
2485 }
2486 scrollLength += length;
2487 }
2488 Object.keys(attributes).forEach(function (name) {
2489 _this.scroll.formatAt(index, length, name, attributes[name]);
2490 });
2491 return index + length;
2492 }, 0);
2493 delta.reduce(function (index, op) {
2494 if (typeof op.delete === 'number') {
2495 _this.scroll.deleteAt(index, op.delete);
2496 return index;
2497 }
2498 return index + (op.retain || op.insert.length || 1);
2499 }, 0);
2500 this.scroll.batchEnd();
2501 return this.update(delta);
2502 }
2503 }, {
2504 key: 'deleteText',
2505 value: function deleteText(index, length) {
2506 this.scroll.deleteAt(index, length);
2507 return this.update(new _quillDelta2.default().retain(index).delete(length));
2508 }
2509 }, {
2510 key: 'formatLine',
2511 value: function formatLine(index, length) {
2512 var _this2 = this;
2513
2514 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2515
2516 this.scroll.update();
2517 Object.keys(formats).forEach(function (format) {
2518 if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
2519 var lines = _this2.scroll.lines(index, Math.max(length, 1));
2520 var lengthRemaining = length;
2521 lines.forEach(function (line) {
2522 var lineLength = line.length();
2523 if (!(line instanceof _code2.default)) {
2524 line.format(format, formats[format]);
2525 } else {
2526 var codeIndex = index - line.offset(_this2.scroll);
2527 var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
2528 line.formatAt(codeIndex, codeLength, format, formats[format]);
2529 }
2530 lengthRemaining -= lineLength;
2531 });
2532 });
2533 this.scroll.optimize();
2534 return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
2535 }
2536 }, {
2537 key: 'formatText',
2538 value: function formatText(index, length) {
2539 var _this3 = this;
2540
2541 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2542
2543 Object.keys(formats).forEach(function (format) {
2544 _this3.scroll.formatAt(index, length, format, formats[format]);
2545 });
2546 return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
2547 }
2548 }, {
2549 key: 'getContents',
2550 value: function getContents(index, length) {
2551 return this.delta.slice(index, index + length);
2552 }
2553 }, {
2554 key: 'getDelta',
2555 value: function getDelta() {
2556 return this.scroll.lines().reduce(function (delta, line) {
2557 return delta.concat(line.delta());
2558 }, new _quillDelta2.default());
2559 }
2560 }, {
2561 key: 'getFormat',
2562 value: function getFormat(index) {
2563 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2564
2565 var lines = [],
2566 leaves = [];
2567 if (length === 0) {
2568 this.scroll.path(index).forEach(function (path) {
2569 var _path = _slicedToArray(path, 1),
2570 blot = _path[0];
2571
2572 if (blot instanceof _block2.default) {
2573 lines.push(blot);
2574 } else if (blot instanceof _parchment2.default.Leaf) {
2575 leaves.push(blot);
2576 }
2577 });
2578 } else {
2579 lines = this.scroll.lines(index, length);
2580 leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
2581 }
2582 var formatsArr = [lines, leaves].map(function (blots) {
2583 if (blots.length === 0) return {};
2584 var formats = (0, _block.bubbleFormats)(blots.shift());
2585 while (Object.keys(formats).length > 0) {
2586 var blot = blots.shift();
2587 if (blot == null) return formats;
2588 formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
2589 }
2590 return formats;
2591 });
2592 return _extend2.default.apply(_extend2.default, formatsArr);
2593 }
2594 }, {
2595 key: 'getText',
2596 value: function getText(index, length) {
2597 return this.getContents(index, length).filter(function (op) {
2598 return typeof op.insert === 'string';
2599 }).map(function (op) {
2600 return op.insert;
2601 }).join('');
2602 }
2603 }, {
2604 key: 'insertEmbed',
2605 value: function insertEmbed(index, embed, value) {
2606 this.scroll.insertAt(index, embed, value);
2607 return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
2608 }
2609 }, {
2610 key: 'insertText',
2611 value: function insertText(index, text) {
2612 var _this4 = this;
2613
2614 var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2615
2616 text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2617 this.scroll.insertAt(index, text);
2618 Object.keys(formats).forEach(function (format) {
2619 _this4.scroll.formatAt(index, text.length, format, formats[format]);
2620 });
2621 return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
2622 }
2623 }, {
2624 key: 'isBlank',
2625 value: function isBlank() {
2626 if (this.scroll.children.length == 0) return true;
2627 if (this.scroll.children.length > 1) return false;
2628 var block = this.scroll.children.head;
2629 if (block.statics.blotName !== _block2.default.blotName) return false;
2630 if (block.children.length > 1) return false;
2631 return block.children.head instanceof _break2.default;
2632 }
2633 }, {
2634 key: 'removeFormat',
2635 value: function removeFormat(index, length) {
2636 var text = this.getText(index, length);
2637
2638 var _scroll$line3 = this.scroll.line(index + length),
2639 _scroll$line4 = _slicedToArray(_scroll$line3, 2),
2640 line = _scroll$line4[0],
2641 offset = _scroll$line4[1];
2642
2643 var suffixLength = 0,
2644 suffix = new _quillDelta2.default();
2645 if (line != null) {
2646 if (!(line instanceof _code2.default)) {
2647 suffixLength = line.length() - offset;
2648 } else {
2649 suffixLength = line.newlineIndex(offset) - offset + 1;
2650 }
2651 suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
2652 }
2653 var contents = this.getContents(index, length + suffixLength);
2654 var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
2655 var delta = new _quillDelta2.default().retain(index).concat(diff);
2656 return this.applyDelta(delta);
2657 }
2658 }, {
2659 key: 'update',
2660 value: function update(change) {
2661 var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
2662 var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
2663
2664 var oldDelta = this.delta;
2665 if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
2666 // Optimization for character changes
2667 var textBlot = _parchment2.default.find(mutations[0].target);
2668 var formats = (0, _block.bubbleFormats)(textBlot);
2669 var index = textBlot.offset(this.scroll);
2670 var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
2671 var oldText = new _quillDelta2.default().insert(oldValue);
2672 var newText = new _quillDelta2.default().insert(textBlot.value());
2673 var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
2674 change = diffDelta.reduce(function (delta, op) {
2675 if (op.insert) {
2676 return delta.insert(op.insert, formats);
2677 } else {
2678 return delta.push(op);
2679 }
2680 }, new _quillDelta2.default());
2681 this.delta = oldDelta.compose(change);
2682 } else {
2683 this.delta = this.getDelta();
2684 if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
2685 change = oldDelta.diff(this.delta, cursorIndex);
2686 }
2687 }
2688 return change;
2689 }
2690 }]);
2691
2692 return Editor;
2693 }();
2694
2695 function combineFormats(formats, combined) {
2696 return Object.keys(combined).reduce(function (merged, name) {
2697 if (formats[name] == null) return merged;
2698 if (combined[name] === formats[name]) {
2699 merged[name] = combined[name];
2700 } else if (Array.isArray(combined[name])) {
2701 if (combined[name].indexOf(formats[name]) < 0) {
2702 merged[name] = combined[name].concat([formats[name]]);
2703 }
2704 } else {
2705 merged[name] = [combined[name], formats[name]];
2706 }
2707 return merged;
2708 }, {});
2709 }
2710
2711 function normalizeDelta(delta) {
2712 return delta.reduce(function (delta, op) {
2713 if (op.insert === 1) {
2714 var attributes = (0, _clone2.default)(op.attributes);
2715 delete attributes['image'];
2716 return delta.insert({ image: op.attributes.image }, attributes);
2717 }
2718 if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
2719 op = (0, _clone2.default)(op);
2720 if (op.attributes.list) {
2721 op.attributes.list = 'ordered';
2722 } else {
2723 op.attributes.list = 'bullet';
2724 delete op.attributes.bullet;
2725 }
2726 }
2727 if (typeof op.insert === 'string') {
2728 var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
2729 return delta.insert(text, op.attributes);
2730 }
2731 return delta.push(op);
2732 }, new _quillDelta2.default());
2733 }
2734
2735 exports.default = Editor;
2736
2737 /***/ }),
2738 /* 15 */
2739 /***/ (function(module, exports, __webpack_require__) {
2740
2741 "use strict";
2742
2743
2744 Object.defineProperty(exports, "__esModule", {
2745 value: true
2746 });
2747 exports.default = exports.Range = undefined;
2748
2749 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
2750
2751 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2752
2753 var _parchment = __webpack_require__(0);
2754
2755 var _parchment2 = _interopRequireDefault(_parchment);
2756
2757 var _clone = __webpack_require__(21);
2758
2759 var _clone2 = _interopRequireDefault(_clone);
2760
2761 var _deepEqual = __webpack_require__(11);
2762
2763 var _deepEqual2 = _interopRequireDefault(_deepEqual);
2764
2765 var _emitter3 = __webpack_require__(8);
2766
2767 var _emitter4 = _interopRequireDefault(_emitter3);
2768
2769 var _logger = __webpack_require__(10);
2770
2771 var _logger2 = _interopRequireDefault(_logger);
2772
2773 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2774
2775 function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
2776
2777 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2778
2779 var debug = (0, _logger2.default)('quill:selection');
2780
2781 var Range = function Range(index) {
2782 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2783
2784 _classCallCheck(this, Range);
2785
2786 this.index = index;
2787 this.length = length;
2788 };
2789
2790 var Selection = function () {
2791 function Selection(scroll, emitter) {
2792 var _this = this;
2793
2794 _classCallCheck(this, Selection);
2795
2796 this.emitter = emitter;
2797 this.scroll = scroll;
2798 this.composing = false;
2799 this.mouseDown = false;
2800 this.root = this.scroll.domNode;
2801 this.cursor = _parchment2.default.create('cursor', this);
2802 // savedRange is last non-null range
2803 this.lastRange = this.savedRange = new Range(0, 0);
2804 this.handleComposition();
2805 this.handleDragging();
2806 this.emitter.listenDOM('selectionchange', document, function () {
2807 if (!_this.mouseDown) {
2808 setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
2809 }
2810 });
2811 this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
2812 if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
2813 _this.update(_emitter4.default.sources.SILENT);
2814 }
2815 });
2816 this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
2817 if (!_this.hasFocus()) return;
2818 var native = _this.getNativeRange();
2819 if (native == null) return;
2820 if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
2821 // TODO unclear if this has negative side effects
2822 _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
2823 try {
2824 _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
2825 } catch (ignored) {}
2826 });
2827 });
2828 this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {
2829 if (context.range) {
2830 var _context$range = context.range,
2831 startNode = _context$range.startNode,
2832 startOffset = _context$range.startOffset,
2833 endNode = _context$range.endNode,
2834 endOffset = _context$range.endOffset;
2835
2836 _this.setNativeRange(startNode, startOffset, endNode, endOffset);
2837 }
2838 });
2839 this.update(_emitter4.default.sources.SILENT);
2840 }
2841
2842 _createClass(Selection, [{
2843 key: 'handleComposition',
2844 value: function handleComposition() {
2845 var _this2 = this;
2846
2847 this.root.addEventListener('compositionstart', function () {
2848 _this2.composing = true;
2849 });
2850 this.root.addEventListener('compositionend', function () {
2851 _this2.composing = false;
2852 if (_this2.cursor.parent) {
2853 var range = _this2.cursor.restore();
2854 if (!range) return;
2855 setTimeout(function () {
2856 _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);
2857 }, 1);
2858 }
2859 });
2860 }
2861 }, {
2862 key: 'handleDragging',
2863 value: function handleDragging() {
2864 var _this3 = this;
2865
2866 this.emitter.listenDOM('mousedown', document.body, function () {
2867 _this3.mouseDown = true;
2868 });
2869 this.emitter.listenDOM('mouseup', document.body, function () {
2870 _this3.mouseDown = false;
2871 _this3.update(_emitter4.default.sources.USER);
2872 });
2873 }
2874 }, {
2875 key: 'focus',
2876 value: function focus() {
2877 if (this.hasFocus()) return;
2878 this.root.focus();
2879 this.setRange(this.savedRange);
2880 }
2881 }, {
2882 key: 'format',
2883 value: function format(_format, value) {
2884 if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
2885 this.scroll.update();
2886 var nativeRange = this.getNativeRange();
2887 if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
2888 if (nativeRange.start.node !== this.cursor.textNode) {
2889 var blot = _parchment2.default.find(nativeRange.start.node, false);
2890 if (blot == null) return;
2891 // TODO Give blot ability to not split
2892 if (blot instanceof _parchment2.default.Leaf) {
2893 var after = blot.split(nativeRange.start.offset);
2894 blot.parent.insertBefore(this.cursor, after);
2895 } else {
2896 blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
2897 }
2898 this.cursor.attach();
2899 }
2900 this.cursor.format(_format, value);
2901 this.scroll.optimize();
2902 this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
2903 this.update();
2904 }
2905 }, {
2906 key: 'getBounds',
2907 value: function getBounds(index) {
2908 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2909
2910 var scrollLength = this.scroll.length();
2911 index = Math.min(index, scrollLength - 1);
2912 length = Math.min(index + length, scrollLength - 1) - index;
2913 var node = void 0,
2914 _scroll$leaf = this.scroll.leaf(index),
2915 _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
2916 leaf = _scroll$leaf2[0],
2917 offset = _scroll$leaf2[1];
2918 if (leaf == null) return null;
2919
2920 var _leaf$position = leaf.position(offset, true);
2921
2922 var _leaf$position2 = _slicedToArray(_leaf$position, 2);
2923
2924 node = _leaf$position2[0];
2925 offset = _leaf$position2[1];
2926
2927 var range = document.createRange();
2928 if (length > 0) {
2929 range.setStart(node, offset);
2930
2931 var _scroll$leaf3 = this.scroll.leaf(index + length);
2932
2933 var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
2934
2935 leaf = _scroll$leaf4[0];
2936 offset = _scroll$leaf4[1];
2937
2938 if (leaf == null) return null;
2939
2940 var _leaf$position3 = leaf.position(offset, true);
2941
2942 var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
2943
2944 node = _leaf$position4[0];
2945 offset = _leaf$position4[1];
2946
2947 range.setEnd(node, offset);
2948 return range.getBoundingClientRect();
2949 } else {
2950 var side = 'left';
2951 var rect = void 0;
2952 if (node instanceof Text) {
2953 if (offset < node.data.length) {
2954 range.setStart(node, offset);
2955 range.setEnd(node, offset + 1);
2956 } else {
2957 range.setStart(node, offset - 1);
2958 range.setEnd(node, offset);
2959 side = 'right';
2960 }
2961 rect = range.getBoundingClientRect();
2962 } else {
2963 rect = leaf.domNode.getBoundingClientRect();
2964 if (offset > 0) side = 'right';
2965 }
2966 return {
2967 bottom: rect.top + rect.height,
2968 height: rect.height,
2969 left: rect[side],
2970 right: rect[side],
2971 top: rect.top,
2972 width: 0
2973 };
2974 }
2975 }
2976 }, {
2977 key: 'getNativeRange',
2978 value: function getNativeRange() {
2979 var selection = document.getSelection();
2980 if (selection == null || selection.rangeCount <= 0) return null;
2981 var nativeRange = selection.getRangeAt(0);
2982 if (nativeRange == null) return null;
2983 var range = this.normalizeNative(nativeRange);
2984 debug.info('getNativeRange', range);
2985 return range;
2986 }
2987 }, {
2988 key: 'getRange',
2989 value: function getRange() {
2990 var normalized = this.getNativeRange();
2991 if (normalized == null) return [null, null];
2992 var range = this.normalizedToRange(normalized);
2993 return [range, normalized];
2994 }
2995 }, {
2996 key: 'hasFocus',
2997 value: function hasFocus() {
2998 return document.activeElement === this.root;
2999 }
3000 }, {
3001 key: 'normalizedToRange',
3002 value: function normalizedToRange(range) {
3003 var _this4 = this;
3004
3005 var positions = [[range.start.node, range.start.offset]];
3006 if (!range.native.collapsed) {
3007 positions.push([range.end.node, range.end.offset]);
3008 }
3009 var indexes = positions.map(function (position) {
3010 var _position = _slicedToArray(position, 2),
3011 node = _position[0],
3012 offset = _position[1];
3013
3014 var blot = _parchment2.default.find(node, true);
3015 var index = blot.offset(_this4.scroll);
3016 if (offset === 0) {
3017 return index;
3018 } else if (blot instanceof _parchment2.default.Container) {
3019 return index + blot.length();
3020 } else {
3021 return index + blot.index(node, offset);
3022 }
3023 });
3024 var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
3025 var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
3026 return new Range(start, end - start);
3027 }
3028 }, {
3029 key: 'normalizeNative',
3030 value: function normalizeNative(nativeRange) {
3031 if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
3032 return null;
3033 }
3034 var range = {
3035 start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
3036 end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
3037 native: nativeRange
3038 };
3039 [range.start, range.end].forEach(function (position) {
3040 var node = position.node,
3041 offset = position.offset;
3042 while (!(node instanceof Text) && node.childNodes.length > 0) {
3043 if (node.childNodes.length > offset) {
3044 node = node.childNodes[offset];
3045 offset = 0;
3046 } else if (node.childNodes.length === offset) {
3047 node = node.lastChild;
3048 offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
3049 } else {
3050 break;
3051 }
3052 }
3053 position.node = node, position.offset = offset;
3054 });
3055 return range;
3056 }
3057 }, {
3058 key: 'rangeToNative',
3059 value: function rangeToNative(range) {
3060 var _this5 = this;
3061
3062 var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
3063 var args = [];
3064 var scrollLength = this.scroll.length();
3065 indexes.forEach(function (index, i) {
3066 index = Math.min(scrollLength - 1, index);
3067 var node = void 0,
3068 _scroll$leaf5 = _this5.scroll.leaf(index),
3069 _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
3070 leaf = _scroll$leaf6[0],
3071 offset = _scroll$leaf6[1];
3072 var _leaf$position5 = leaf.position(offset, i !== 0);
3073
3074 var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
3075
3076 node = _leaf$position6[0];
3077 offset = _leaf$position6[1];
3078
3079 args.push(node, offset);
3080 });
3081 if (args.length < 2) {
3082 args = args.concat(args);
3083 }
3084 return args;
3085 }
3086 }, {
3087 key: 'scrollIntoView',
3088 value: function scrollIntoView(scrollingContainer) {
3089 var range = this.lastRange;
3090 if (range == null) return;
3091 var bounds = this.getBounds(range.index, range.length);
3092 if (bounds == null) return;
3093 var limit = this.scroll.length() - 1;
3094
3095 var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
3096 _scroll$line2 = _slicedToArray(_scroll$line, 1),
3097 first = _scroll$line2[0];
3098
3099 var last = first;
3100 if (range.length > 0) {
3101 var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
3102
3103 var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
3104
3105 last = _scroll$line4[0];
3106 }
3107 if (first == null || last == null) return;
3108 var scrollBounds = scrollingContainer.getBoundingClientRect();
3109 if (bounds.top < scrollBounds.top) {
3110 scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;
3111 } else if (bounds.bottom > scrollBounds.bottom) {
3112 scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;
3113 }
3114 }
3115 }, {
3116 key: 'setNativeRange',
3117 value: function setNativeRange(startNode, startOffset) {
3118 var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
3119 var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
3120 var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
3121
3122 debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
3123 if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
3124 return;
3125 }
3126 var selection = document.getSelection();
3127 if (selection == null) return;
3128 if (startNode != null) {
3129 if (!this.hasFocus()) this.root.focus();
3130 var native = (this.getNativeRange() || {}).native;
3131 if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
3132
3133 if (startNode.tagName == "BR") {
3134 startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
3135 startNode = startNode.parentNode;
3136 }
3137 if (endNode.tagName == "BR") {
3138 endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
3139 endNode = endNode.parentNode;
3140 }
3141 var range = document.createRange();
3142 range.setStart(startNode, startOffset);
3143 range.setEnd(endNode, endOffset);
3144 selection.removeAllRanges();
3145 selection.addRange(range);
3146 }
3147 } else {
3148 selection.removeAllRanges();
3149 this.root.blur();
3150 document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
3151 }
3152 }
3153 }, {
3154 key: 'setRange',
3155 value: function setRange(range) {
3156 var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3157 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
3158
3159 if (typeof force === 'string') {
3160 source = force;
3161 force = false;
3162 }
3163 debug.info('setRange', range);
3164 if (range != null) {
3165 var args = this.rangeToNative(range);
3166 this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
3167 } else {
3168 this.setNativeRange(null);
3169 }
3170 this.update(source);
3171 }
3172 }, {
3173 key: 'update',
3174 value: function update() {
3175 var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
3176
3177 var oldRange = this.lastRange;
3178
3179 var _getRange = this.getRange(),
3180 _getRange2 = _slicedToArray(_getRange, 2),
3181 lastRange = _getRange2[0],
3182 nativeRange = _getRange2[1];
3183
3184 this.lastRange = lastRange;
3185 if (this.lastRange != null) {
3186 this.savedRange = this.lastRange;
3187 }
3188 if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
3189 var _emitter;
3190
3191 if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
3192 this.cursor.restore();
3193 }
3194 var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
3195 (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
3196 if (source !== _emitter4.default.sources.SILENT) {
3197 var _emitter2;
3198
3199 (_emitter2 = this.emitter).emit.apply(_emitter2, args);
3200 }
3201 }
3202 }
3203 }]);
3204
3205 return Selection;
3206 }();
3207
3208 function contains(parent, descendant) {
3209 try {
3210 // Firefox inserts inaccessible nodes around video elements
3211 descendant.parentNode;
3212 } catch (e) {
3213 return false;
3214 }
3215 // IE11 has bug with Text nodes
3216 // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
3217 if (descendant instanceof Text) {
3218 descendant = descendant.parentNode;
3219 }
3220 return parent.contains(descendant);
3221 }
3222
3223 exports.Range = Range;
3224 exports.default = Selection;
3225
3226 /***/ }),
3227 /* 16 */
3228 /***/ (function(module, exports, __webpack_require__) {
3229
3230 "use strict";
3231
3232
3233 Object.defineProperty(exports, "__esModule", {
3234 value: true
3235 });
3236
3237 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
3238
3239 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
3240
3241 var _parchment = __webpack_require__(0);
3242
3243 var _parchment2 = _interopRequireDefault(_parchment);
3244
3245 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3246
3247 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3248
3249 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
3250
3251 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3252
3253 var Break = function (_Parchment$Embed) {
3254 _inherits(Break, _Parchment$Embed);
3255
3256 function Break() {
3257 _classCallCheck(this, Break);
3258
3259 return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
3260 }
3261
3262 _createClass(Break, [{
3263 key: 'insertInto',
3264 value: function insertInto(parent, ref) {
3265 if (parent.children.length === 0) {
3266 _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
3267 } else {
3268 this.remove();
3269 }
3270 }
3271 }, {
3272 key: 'length',
3273 value: function length() {
3274 return 0;
3275 }
3276 }, {
3277 key: 'value',
3278 value: function value() {
3279 return '';
3280 }
3281 }], [{
3282 key: 'value',
3283 value: function value() {
3284 return undefined;
3285 }
3286 }]);
3287
3288 return Break;
3289 }(_parchment2.default.Embed);
3290
3291 Break.blotName = 'break';
3292 Break.tagName = 'BR';
3293
3294 exports.default = Break;
3295
3296 /***/ }),
3297 /* 17 */
3298 /***/ (function(module, exports, __webpack_require__) {
3299
3300 "use strict";
3301
3302 var __extends = (this && this.__extends) || (function () {
3303 var extendStatics = Object.setPrototypeOf ||
3304 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3305 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3306 return function (d, b) {
3307 extendStatics(d, b);
3308 function __() { this.constructor = d; }
3309 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3310 };
3311 })();
3312 Object.defineProperty(exports, "__esModule", { value: true });
3313 var linked_list_1 = __webpack_require__(44);
3314 var shadow_1 = __webpack_require__(30);
3315 var Registry = __webpack_require__(1);
3316 var ContainerBlot = /** @class */ (function (_super) {
3317 __extends(ContainerBlot, _super);
3318 function ContainerBlot(domNode) {
3319 var _this = _super.call(this, domNode) || this;
3320 _this.build();
3321 return _this;
3322 }
3323 ContainerBlot.prototype.appendChild = function (other) {
3324 this.insertBefore(other);
3325 };
3326 ContainerBlot.prototype.attach = function () {
3327 _super.prototype.attach.call(this);
3328 this.children.forEach(function (child) {
3329 child.attach();
3330 });
3331 };
3332 ContainerBlot.prototype.build = function () {
3333 var _this = this;
3334 this.children = new linked_list_1.default();
3335 // Need to be reversed for if DOM nodes already in order
3336 [].slice
3337 .call(this.domNode.childNodes)
3338 .reverse()
3339 .forEach(function (node) {
3340 try {
3341 var child = makeBlot(node);
3342 _this.insertBefore(child, _this.children.head || undefined);
3343 }
3344 catch (err) {
3345 if (err instanceof Registry.ParchmentError)
3346 return;
3347 else
3348 throw err;
3349 }
3350 });
3351 };
3352 ContainerBlot.prototype.deleteAt = function (index, length) {
3353 if (index === 0 && length === this.length()) {
3354 return this.remove();
3355 }
3356 this.children.forEachAt(index, length, function (child, offset, length) {
3357 child.deleteAt(offset, length);
3358 });
3359 };
3360 ContainerBlot.prototype.descendant = function (criteria, index) {
3361 var _a = this.children.find(index), child = _a[0], offset = _a[1];
3362 if ((criteria.blotName == null && criteria(child)) ||
3363 (criteria.blotName != null && child instanceof criteria)) {
3364 return [child, offset];
3365 }
3366 else if (child instanceof ContainerBlot) {
3367 return child.descendant(criteria, offset);
3368 }
3369 else {
3370 return [null, -1];
3371 }
3372 };
3373 ContainerBlot.prototype.descendants = function (criteria, index, length) {
3374 if (index === void 0) { index = 0; }
3375 if (length === void 0) { length = Number.MAX_VALUE; }
3376 var descendants = [];
3377 var lengthLeft = length;
3378 this.children.forEachAt(index, length, function (child, index, length) {
3379 if ((criteria.blotName == null && criteria(child)) ||
3380 (criteria.blotName != null && child instanceof criteria)) {
3381 descendants.push(child);
3382 }
3383 if (child instanceof ContainerBlot) {
3384 descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
3385 }
3386 lengthLeft -= length;
3387 });
3388 return descendants;
3389 };
3390 ContainerBlot.prototype.detach = function () {
3391 this.children.forEach(function (child) {
3392 child.detach();
3393 });
3394 _super.prototype.detach.call(this);
3395 };
3396 ContainerBlot.prototype.formatAt = function (index, length, name, value) {
3397 this.children.forEachAt(index, length, function (child, offset, length) {
3398 child.formatAt(offset, length, name, value);
3399 });
3400 };
3401 ContainerBlot.prototype.insertAt = function (index, value, def) {
3402 var _a = this.children.find(index), child = _a[0], offset = _a[1];
3403 if (child) {
3404 child.insertAt(offset, value, def);
3405 }
3406 else {
3407 var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
3408 this.appendChild(blot);
3409 }
3410 };
3411 ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
3412 if (this.statics.allowedChildren != null &&
3413 !this.statics.allowedChildren.some(function (child) {
3414 return childBlot instanceof child;
3415 })) {
3416 throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
3417 }
3418 childBlot.insertInto(this, refBlot);
3419 };
3420 ContainerBlot.prototype.length = function () {
3421 return this.children.reduce(function (memo, child) {
3422 return memo + child.length();
3423 }, 0);
3424 };
3425 ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
3426 this.children.forEach(function (child) {
3427 targetParent.insertBefore(child, refNode);
3428 });
3429 };
3430 ContainerBlot.prototype.optimize = function (context) {
3431 _super.prototype.optimize.call(this, context);
3432 if (this.children.length === 0) {
3433 if (this.statics.defaultChild != null) {
3434 var child = Registry.create(this.statics.defaultChild);
3435 this.appendChild(child);
3436 child.optimize(context);
3437 }
3438 else {
3439 this.remove();
3440 }
3441 }
3442 };
3443 ContainerBlot.prototype.path = function (index, inclusive) {
3444 if (inclusive === void 0) { inclusive = false; }
3445 var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
3446 var position = [[this, index]];
3447 if (child instanceof ContainerBlot) {
3448 return position.concat(child.path(offset, inclusive));
3449 }
3450 else if (child != null) {
3451 position.push([child, offset]);
3452 }
3453 return position;
3454 };
3455 ContainerBlot.prototype.removeChild = function (child) {
3456 this.children.remove(child);
3457 };
3458 ContainerBlot.prototype.replace = function (target) {
3459 if (target instanceof ContainerBlot) {
3460 target.moveChildren(this);
3461 }
3462 _super.prototype.replace.call(this, target);
3463 };
3464 ContainerBlot.prototype.split = function (index, force) {
3465 if (force === void 0) { force = false; }
3466 if (!force) {
3467 if (index === 0)
3468 return this;
3469 if (index === this.length())
3470 return this.next;
3471 }
3472 var after = this.clone();
3473 this.parent.insertBefore(after, this.next);
3474 this.children.forEachAt(index, this.length(), function (child, offset, length) {
3475 child = child.split(offset, force);
3476 after.appendChild(child);
3477 });
3478 return after;
3479 };
3480 ContainerBlot.prototype.unwrap = function () {
3481 this.moveChildren(this.parent, this.next);
3482 this.remove();
3483 };
3484 ContainerBlot.prototype.update = function (mutations, context) {
3485 var _this = this;
3486 var addedNodes = [];
3487 var removedNodes = [];
3488 mutations.forEach(function (mutation) {
3489 if (mutation.target === _this.domNode && mutation.type === 'childList') {
3490 addedNodes.push.apply(addedNodes, mutation.addedNodes);
3491 removedNodes.push.apply(removedNodes, mutation.removedNodes);
3492 }
3493 });
3494 removedNodes.forEach(function (node) {
3495 // Check node has actually been removed
3496 // One exception is Chrome does not immediately remove IFRAMEs
3497 // from DOM but MutationRecord is correct in its reported removal
3498 if (node.parentNode != null &&
3499 // @ts-ignore
3500 node.tagName !== 'IFRAME' &&
3501 document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
3502 return;
3503 }
3504 var blot = Registry.find(node);
3505 if (blot == null)
3506 return;
3507 if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
3508 blot.detach();
3509 }
3510 });
3511 addedNodes
3512 .filter(function (node) {
3513 return node.parentNode == _this.domNode;
3514 })
3515 .sort(function (a, b) {
3516 if (a === b)
3517 return 0;
3518 if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
3519 return 1;
3520 }
3521 return -1;
3522 })
3523 .forEach(function (node) {
3524 var refBlot = null;
3525 if (node.nextSibling != null) {
3526 refBlot = Registry.find(node.nextSibling);
3527 }
3528 var blot = makeBlot(node);
3529 if (blot.next != refBlot || blot.next == null) {
3530 if (blot.parent != null) {
3531 blot.parent.removeChild(_this);
3532 }
3533 _this.insertBefore(blot, refBlot || undefined);
3534 }
3535 });
3536 };
3537 return ContainerBlot;
3538 }(shadow_1.default));
3539 function makeBlot(node) {
3540 var blot = Registry.find(node);
3541 if (blot == null) {
3542 try {
3543 blot = Registry.create(node);
3544 }
3545 catch (e) {
3546 blot = Registry.create(Registry.Scope.INLINE);
3547 [].slice.call(node.childNodes).forEach(function (child) {
3548 // @ts-ignore
3549 blot.domNode.appendChild(child);
3550 });
3551 if (node.parentNode) {
3552 node.parentNode.replaceChild(blot.domNode, node);
3553 }
3554 blot.attach();
3555 }
3556 }
3557 return blot;
3558 }
3559 exports.default = ContainerBlot;
3560
3561
3562 /***/ }),
3563 /* 18 */
3564 /***/ (function(module, exports, __webpack_require__) {
3565
3566 "use strict";
3567
3568 var __extends = (this && this.__extends) || (function () {
3569 var extendStatics = Object.setPrototypeOf ||
3570 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3571 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3572 return function (d, b) {
3573 extendStatics(d, b);
3574 function __() { this.constructor = d; }
3575 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3576 };
3577 })();
3578 Object.defineProperty(exports, "__esModule", { value: true });
3579 var attributor_1 = __webpack_require__(12);
3580 var store_1 = __webpack_require__(31);
3581 var container_1 = __webpack_require__(17);
3582 var Registry = __webpack_require__(1);
3583 var FormatBlot = /** @class */ (function (_super) {
3584 __extends(FormatBlot, _super);
3585 function FormatBlot(domNode) {
3586 var _this = _super.call(this, domNode) || this;
3587 _this.attributes = new store_1.default(_this.domNode);
3588 return _this;
3589 }
3590 FormatBlot.formats = function (domNode) {
3591 if (typeof this.tagName === 'string') {
3592 return true;
3593 }
3594 else if (Array.isArray(this.tagName)) {
3595 return domNode.tagName.toLowerCase();
3596 }
3597 return undefined;
3598 };
3599 FormatBlot.prototype.format = function (name, value) {
3600 var format = Registry.query(name);
3601 if (format instanceof attributor_1.default) {
3602 this.attributes.attribute(format, value);
3603 }
3604 else if (value) {
3605 if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
3606 this.replaceWith(name, value);
3607 }
3608 }
3609 };
3610 FormatBlot.prototype.formats = function () {
3611 var formats = this.attributes.values();
3612 var format = this.statics.formats(this.domNode);
3613 if (format != null) {
3614 formats[this.statics.blotName] = format;
3615 }
3616 return formats;
3617 };
3618 FormatBlot.prototype.replaceWith = function (name, value) {
3619 var replacement = _super.prototype.replaceWith.call(this, name, value);
3620 this.attributes.copy(replacement);
3621 return replacement;
3622 };
3623 FormatBlot.prototype.update = function (mutations, context) {
3624 var _this = this;
3625 _super.prototype.update.call(this, mutations, context);
3626 if (mutations.some(function (mutation) {
3627 return mutation.target === _this.domNode && mutation.type === 'attributes';
3628 })) {
3629 this.attributes.build();
3630 }
3631 };
3632 FormatBlot.prototype.wrap = function (name, value) {
3633 var wrapper = _super.prototype.wrap.call(this, name, value);
3634 if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
3635 this.attributes.move(wrapper);
3636 }
3637 return wrapper;
3638 };
3639 return FormatBlot;
3640 }(container_1.default));
3641 exports.default = FormatBlot;
3642
3643
3644 /***/ }),
3645 /* 19 */
3646 /***/ (function(module, exports, __webpack_require__) {
3647
3648 "use strict";
3649
3650 var __extends = (this && this.__extends) || (function () {
3651 var extendStatics = Object.setPrototypeOf ||
3652 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3653 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
3654 return function (d, b) {
3655 extendStatics(d, b);
3656 function __() { this.constructor = d; }
3657 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3658 };
3659 })();
3660 Object.defineProperty(exports, "__esModule", { value: true });
3661 var shadow_1 = __webpack_require__(30);
3662 var Registry = __webpack_require__(1);
3663 var LeafBlot = /** @class */ (function (_super) {
3664 __extends(LeafBlot, _super);
3665 function LeafBlot() {
3666 return _super !== null && _super.apply(this, arguments) || this;
3667 }
3668 LeafBlot.value = function (domNode) {
3669 return true;
3670 };
3671 LeafBlot.prototype.index = function (node, offset) {
3672 if (this.domNode === node ||
3673 this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
3674 return Math.min(offset, 1);
3675 }
3676 return -1;
3677 };
3678 LeafBlot.prototype.position = function (index, inclusive) {
3679 var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
3680 if (index > 0)
3681 offset += 1;
3682 return [this.parent.domNode, offset];
3683 };
3684 LeafBlot.prototype.value = function () {
3685 return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
3686 var _a;
3687 };
3688 LeafBlot.scope = Registry.Scope.INLINE_BLOT;
3689 return LeafBlot;
3690 }(shadow_1.default));
3691 exports.default = LeafBlot;
3692
3693
3694 /***/ }),
3695 /* 20 */
3696 /***/ (function(module, exports, __webpack_require__) {
3697
3698 var equal = __webpack_require__(11);
3699 var extend = __webpack_require__(3);
3700
3701
3702 var lib = {
3703 attributes: {
3704 compose: function (a, b, keepNull) {
3705 if (typeof a !== 'object') a = {};
3706 if (typeof b !== 'object') b = {};
3707 var attributes = extend(true, {}, b);
3708 if (!keepNull) {
3709 attributes = Object.keys(attributes).reduce(function (copy, key) {
3710 if (attributes[key] != null) {
3711 copy[key] = attributes[key];
3712 }
3713 return copy;
3714 }, {});
3715 }
3716 for (var key in a) {
3717 if (a[key] !== undefined && b[key] === undefined) {
3718 attributes[key] = a[key];
3719 }
3720 }
3721 return Object.keys(attributes).length > 0 ? attributes : undefined;
3722 },
3723
3724 diff: function(a, b) {
3725 if (typeof a !== 'object') a = {};
3726 if (typeof b !== 'object') b = {};
3727 var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
3728 if (!equal(a[key], b[key])) {
3729 attributes[key] = b[key] === undefined ? null : b[key];
3730 }
3731 return attributes;
3732 }, {});
3733 return Object.keys(attributes).length > 0 ? attributes : undefined;
3734 },
3735
3736 transform: function (a, b, priority) {
3737 if (typeof a !== 'object') return b;
3738 if (typeof b !== 'object') return undefined;
3739 if (!priority) return b; // b simply overwrites us without priority
3740 var attributes = Object.keys(b).reduce(function (attributes, key) {
3741 if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
3742 return attributes;
3743 }, {});
3744 return Object.keys(attributes).length > 0 ? attributes : undefined;
3745 }
3746 },
3747
3748 iterator: function (ops) {
3749 return new Iterator(ops);
3750 },
3751
3752 length: function (op) {
3753 if (typeof op['delete'] === 'number') {
3754 return op['delete'];
3755 } else if (typeof op.retain === 'number') {
3756 return op.retain;
3757 } else {
3758 return typeof op.insert === 'string' ? op.insert.length : 1;
3759 }
3760 }
3761 };
3762
3763
3764 function Iterator(ops) {
3765 this.ops = ops;
3766 this.index = 0;
3767 this.offset = 0;
3768 };
3769
3770 Iterator.prototype.hasNext = function () {
3771 return this.peekLength() < Infinity;
3772 };
3773
3774 Iterator.prototype.next = function (length) {
3775 if (!length) length = Infinity;
3776 var nextOp = this.ops[this.index];
3777 if (nextOp) {
3778 var offset = this.offset;
3779 var opLength = lib.length(nextOp)
3780 if (length >= opLength - offset) {
3781 length = opLength - offset;
3782 this.index += 1;
3783 this.offset = 0;
3784 } else {
3785 this.offset += length;
3786 }
3787 if (typeof nextOp['delete'] === 'number') {
3788 return { 'delete': length };
3789 } else {
3790 var retOp = {};
3791 if (nextOp.attributes) {
3792 retOp.attributes = nextOp.attributes;
3793 }
3794 if (typeof nextOp.retain === 'number') {
3795 retOp.retain = length;
3796 } else if (typeof nextOp.insert === 'string') {
3797 retOp.insert = nextOp.insert.substr(offset, length);
3798 } else {
3799 // offset should === 0, length should === 1
3800 retOp.insert = nextOp.insert;
3801 }
3802 return retOp;
3803 }
3804 } else {
3805 return { retain: Infinity };
3806 }
3807 };
3808
3809 Iterator.prototype.peek = function () {
3810 return this.ops[this.index];
3811 };
3812
3813 Iterator.prototype.peekLength = function () {
3814 if (this.ops[this.index]) {
3815 // Should never return 0 if our index is being managed correctly
3816 return lib.length(this.ops[this.index]) - this.offset;
3817 } else {
3818 return Infinity;
3819 }
3820 };
3821
3822 Iterator.prototype.peekType = function () {
3823 if (this.ops[this.index]) {
3824 if (typeof this.ops[this.index]['delete'] === 'number') {
3825 return 'delete';
3826 } else if (typeof this.ops[this.index].retain === 'number') {
3827 return 'retain';
3828 } else {
3829 return 'insert';
3830 }
3831 }
3832 return 'retain';
3833 };
3834
3835
3836 module.exports = lib;
3837
3838
3839 /***/ }),
3840 /* 21 */
3841 /***/ (function(module, exports) {
3842
3843 var clone = (function() {
3844 'use strict';
3845
3846 function _instanceof(obj, type) {
3847 return type != null && obj instanceof type;
3848 }
3849
3850 var nativeMap;
3851 try {
3852 nativeMap = Map;
3853 } catch(_) {
3854 // maybe a reference error because no `Map`. Give it a dummy value that no
3855 // value will ever be an instanceof.
3856 nativeMap = function() {};
3857 }
3858
3859 var nativeSet;
3860 try {
3861 nativeSet = Set;
3862 } catch(_) {
3863 nativeSet = function() {};
3864 }
3865
3866 var nativePromise;
3867 try {
3868 nativePromise = Promise;
3869 } catch(_) {
3870 nativePromise = function() {};
3871 }
3872
3873 /**
3874 * Clones (copies) an Object using deep copying.
3875 *
3876 * This function supports circular references by default, but if you are certain
3877 * there are no circular references in your object, you can save some CPU time
3878 * by calling clone(obj, false).
3879 *
3880 * Caution: if `circular` is false and `parent` contains circular references,
3881 * your program may enter an infinite loop and crash.
3882 *
3883 * @param `parent` - the object to be cloned
3884 * @param `circular` - set to true if the object to be cloned may contain
3885 * circular references. (optional - true by default)
3886 * @param `depth` - set to a number if the object is only to be cloned to
3887 * a particular depth. (optional - defaults to Infinity)
3888 * @param `prototype` - sets the prototype to be used when cloning an object.
3889 * (optional - defaults to parent prototype).
3890 * @param `includeNonEnumerable` - set to true if the non-enumerable properties
3891 * should be cloned as well. Non-enumerable properties on the prototype
3892 * chain will be ignored. (optional - false by default)
3893 */
3894 function clone(parent, circular, depth, prototype, includeNonEnumerable) {
3895 if (typeof circular === 'object') {
3896 depth = circular.depth;
3897 prototype = circular.prototype;
3898 includeNonEnumerable = circular.includeNonEnumerable;
3899 circular = circular.circular;
3900 }
3901 // maintain two arrays for circular references, where corresponding parents
3902 // and children have the same index
3903 var allParents = [];
3904 var allChildren = [];
3905
3906 var useBuffer = typeof Buffer != 'undefined';
3907
3908 if (typeof circular == 'undefined')
3909 circular = true;
3910
3911 if (typeof depth == 'undefined')
3912 depth = Infinity;
3913
3914 // recurse this function so we don't reset allParents and allChildren
3915 function _clone(parent, depth) {
3916 // cloning null always returns null
3917 if (parent === null)
3918 return null;
3919
3920 if (depth === 0)
3921 return parent;
3922
3923 var child;
3924 var proto;
3925 if (typeof parent != 'object') {
3926 return parent;
3927 }
3928
3929 if (_instanceof(parent, nativeMap)) {
3930 child = new nativeMap();
3931 } else if (_instanceof(parent, nativeSet)) {
3932 child = new nativeSet();
3933 } else if (_instanceof(parent, nativePromise)) {
3934 child = new nativePromise(function (resolve, reject) {
3935 parent.then(function(value) {
3936 resolve(_clone(value, depth - 1));
3937 }, function(err) {
3938 reject(_clone(err, depth - 1));
3939 });
3940 });
3941 } else if (clone.__isArray(parent)) {
3942 child = [];
3943 } else if (clone.__isRegExp(parent)) {
3944 child = new RegExp(parent.source, __getRegExpFlags(parent));
3945 if (parent.lastIndex) child.lastIndex = parent.lastIndex;
3946 } else if (clone.__isDate(parent)) {
3947 child = new Date(parent.getTime());
3948 } else if (useBuffer && Buffer.isBuffer(parent)) {
3949 child = new Buffer(parent.length);
3950 parent.copy(child);
3951 return child;
3952 } else if (_instanceof(parent, Error)) {
3953 child = Object.create(parent);
3954 } else {
3955 if (typeof prototype == 'undefined') {
3956 proto = Object.getPrototypeOf(parent);
3957 child = Object.create(proto);
3958 }
3959 else {
3960 child = Object.create(prototype);
3961 proto = prototype;
3962 }
3963 }
3964
3965 if (circular) {
3966 var index = allParents.indexOf(parent);
3967
3968 if (index != -1) {
3969 return allChildren[index];
3970 }
3971 allParents.push(parent);
3972 allChildren.push(child);
3973 }
3974
3975 if (_instanceof(parent, nativeMap)) {
3976 parent.forEach(function(value, key) {
3977 var keyChild = _clone(key, depth - 1);
3978 var valueChild = _clone(value, depth - 1);
3979 child.set(keyChild, valueChild);
3980 });
3981 }
3982 if (_instanceof(parent, nativeSet)) {
3983 parent.forEach(function(value) {
3984 var entryChild = _clone(value, depth - 1);
3985 child.add(entryChild);
3986 });
3987 }
3988
3989 for (var i in parent) {
3990 var attrs;
3991 if (proto) {
3992 attrs = Object.getOwnPropertyDescriptor(proto, i);
3993 }
3994
3995 if (attrs && attrs.set == null) {
3996 continue;
3997 }
3998 child[i] = _clone(parent[i], depth - 1);
3999 }
4000
4001 if (Object.getOwnPropertySymbols) {
4002 var symbols = Object.getOwnPropertySymbols(parent);
4003 for (var i = 0; i < symbols.length; i++) {
4004 // Don't need to worry about cloning a symbol because it is a primitive,
4005 // like a number or string.
4006 var symbol = symbols[i];
4007 var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
4008 if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
4009 continue;
4010 }
4011 child[symbol] = _clone(parent[symbol], depth - 1);
4012 if (!descriptor.enumerable) {
4013 Object.defineProperty(child, symbol, {
4014 enumerable: false
4015 });
4016 }
4017 }
4018 }
4019
4020 if (includeNonEnumerable) {
4021 var allPropertyNames = Object.getOwnPropertyNames(parent);
4022 for (var i = 0; i < allPropertyNames.length; i++) {
4023 var propertyName = allPropertyNames[i];
4024 var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
4025 if (descriptor && descriptor.enumerable) {
4026 continue;
4027 }
4028 child[propertyName] = _clone(parent[propertyName], depth - 1);
4029 Object.defineProperty(child, propertyName, {
4030 enumerable: false
4031 });
4032 }
4033 }
4034
4035 return child;
4036 }
4037
4038 return _clone(parent, depth);
4039 }
4040
4041 /**
4042 * Simple flat clone using prototype, accepts only objects, usefull for property
4043 * override on FLAT configuration object (no nested props).
4044 *
4045 * USE WITH CAUTION! This may not behave as you wish if you do not know how this
4046 * works.
4047 */
4048 clone.clonePrototype = function clonePrototype(parent) {
4049 if (parent === null)
4050 return null;
4051
4052 var c = function () {};
4053 c.prototype = parent;
4054 return new c();
4055 };
4056
4057 // private utility functions
4058
4059 function __objToStr(o) {
4060 return Object.prototype.toString.call(o);
4061 }
4062 clone.__objToStr = __objToStr;
4063
4064 function __isDate(o) {
4065 return typeof o === 'object' && __objToStr(o) === '[object Date]';
4066 }
4067 clone.__isDate = __isDate;
4068
4069 function __isArray(o) {
4070 return typeof o === 'object' && __objToStr(o) === '[object Array]';
4071 }
4072 clone.__isArray = __isArray;
4073
4074 function __isRegExp(o) {
4075 return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
4076 }
4077 clone.__isRegExp = __isRegExp;
4078
4079 function __getRegExpFlags(re) {
4080 var flags = '';
4081 if (re.global) flags += 'g';
4082 if (re.ignoreCase) flags += 'i';
4083 if (re.multiline) flags += 'm';
4084 return flags;
4085 }
4086 clone.__getRegExpFlags = __getRegExpFlags;
4087
4088 return clone;
4089 })();
4090
4091 if (typeof module === 'object' && module.exports) {
4092 module.exports = clone;
4093 }
4094
4095
4096 /***/ }),
4097 /* 22 */
4098 /***/ (function(module, exports, __webpack_require__) {
4099
4100 "use strict";
4101
4102
4103 Object.defineProperty(exports, "__esModule", {
4104 value: true
4105 });
4106
4107 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
4108
4109 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4110
4111 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4112
4113 var _parchment = __webpack_require__(0);
4114
4115 var _parchment2 = _interopRequireDefault(_parchment);
4116
4117 var _emitter = __webpack_require__(8);
4118
4119 var _emitter2 = _interopRequireDefault(_emitter);
4120
4121 var _block = __webpack_require__(4);
4122
4123 var _block2 = _interopRequireDefault(_block);
4124
4125 var _break = __webpack_require__(16);
4126
4127 var _break2 = _interopRequireDefault(_break);
4128
4129 var _code = __webpack_require__(13);
4130
4131 var _code2 = _interopRequireDefault(_code);
4132
4133 var _container = __webpack_require__(25);
4134
4135 var _container2 = _interopRequireDefault(_container);
4136
4137 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4138
4139 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4140
4141 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4142
4143 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4144
4145 function isLine(blot) {
4146 return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
4147 }
4148
4149 var Scroll = function (_Parchment$Scroll) {
4150 _inherits(Scroll, _Parchment$Scroll);
4151
4152 function Scroll(domNode, config) {
4153 _classCallCheck(this, Scroll);
4154
4155 var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
4156
4157 _this.emitter = config.emitter;
4158 if (Array.isArray(config.whitelist)) {
4159 _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
4160 whitelist[format] = true;
4161 return whitelist;
4162 }, {});
4163 }
4164 // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
4165 _this.domNode.addEventListener('DOMNodeInserted', function () {});
4166 _this.optimize();
4167 _this.enable();
4168 return _this;
4169 }
4170
4171 _createClass(Scroll, [{
4172 key: 'batchStart',
4173 value: function batchStart() {
4174 this.batch = true;
4175 }
4176 }, {
4177 key: 'batchEnd',
4178 value: function batchEnd() {
4179 this.batch = false;
4180 this.optimize();
4181 }
4182 }, {
4183 key: 'deleteAt',
4184 value: function deleteAt(index, length) {
4185 var _line = this.line(index),
4186 _line2 = _slicedToArray(_line, 2),
4187 first = _line2[0],
4188 offset = _line2[1];
4189
4190 var _line3 = this.line(index + length),
4191 _line4 = _slicedToArray(_line3, 1),
4192 last = _line4[0];
4193
4194 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
4195 if (last != null && first !== last && offset > 0) {
4196 if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {
4197 this.optimize();
4198 return;
4199 }
4200 if (first instanceof _code2.default) {
4201 var newlineIndex = first.newlineIndex(first.length(), true);
4202 if (newlineIndex > -1) {
4203 first = first.split(newlineIndex + 1);
4204 if (first === last) {
4205 this.optimize();
4206 return;
4207 }
4208 }
4209 } else if (last instanceof _code2.default) {
4210 var _newlineIndex = last.newlineIndex(0);
4211 if (_newlineIndex > -1) {
4212 last.split(_newlineIndex + 1);
4213 }
4214 }
4215 var ref = last.children.head instanceof _break2.default ? null : last.children.head;
4216 first.moveChildren(last, ref);
4217 first.remove();
4218 }
4219 this.optimize();
4220 }
4221 }, {
4222 key: 'enable',
4223 value: function enable() {
4224 var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4225
4226 this.domNode.setAttribute('contenteditable', enabled);
4227 }
4228 }, {
4229 key: 'formatAt',
4230 value: function formatAt(index, length, format, value) {
4231 if (this.whitelist != null && !this.whitelist[format]) return;
4232 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
4233 this.optimize();
4234 }
4235 }, {
4236 key: 'insertAt',
4237 value: function insertAt(index, value, def) {
4238 if (def != null && this.whitelist != null && !this.whitelist[value]) return;
4239 if (index >= this.length()) {
4240 if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
4241 var blot = _parchment2.default.create(this.statics.defaultChild);
4242 this.appendChild(blot);
4243 if (def == null && value.endsWith('\n')) {
4244 value = value.slice(0, -1);
4245 }
4246 blot.insertAt(0, value, def);
4247 } else {
4248 var embed = _parchment2.default.create(value, def);
4249 this.appendChild(embed);
4250 }
4251 } else {
4252 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
4253 }
4254 this.optimize();
4255 }
4256 }, {
4257 key: 'insertBefore',
4258 value: function insertBefore(blot, ref) {
4259 if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
4260 var wrapper = _parchment2.default.create(this.statics.defaultChild);
4261 wrapper.appendChild(blot);
4262 blot = wrapper;
4263 }
4264 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
4265 }
4266 }, {
4267 key: 'leaf',
4268 value: function leaf(index) {
4269 return this.path(index).pop() || [null, -1];
4270 }
4271 }, {
4272 key: 'line',
4273 value: function line(index) {
4274 if (index === this.length()) {
4275 return this.line(index - 1);
4276 }
4277 return this.descendant(isLine, index);
4278 }
4279 }, {
4280 key: 'lines',
4281 value: function lines() {
4282 var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
4283 var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
4284
4285 var getLines = function getLines(blot, index, length) {
4286 var lines = [],
4287 lengthLeft = length;
4288 blot.children.forEachAt(index, length, function (child, index, length) {
4289 if (isLine(child)) {
4290 lines.push(child);
4291 } else if (child instanceof _parchment2.default.Container) {
4292 lines = lines.concat(getLines(child, index, lengthLeft));
4293 }
4294 lengthLeft -= length;
4295 });
4296 return lines;
4297 };
4298 return getLines(this, index, length);
4299 }
4300 }, {
4301 key: 'optimize',
4302 value: function optimize() {
4303 var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4304 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4305
4306 if (this.batch === true) return;
4307 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);
4308 if (mutations.length > 0) {
4309 this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);
4310 }
4311 }
4312 }, {
4313 key: 'path',
4314 value: function path(index) {
4315 return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
4316 }
4317 }, {
4318 key: 'update',
4319 value: function update(mutations) {
4320 if (this.batch === true) return;
4321 var source = _emitter2.default.sources.USER;
4322 if (typeof mutations === 'string') {
4323 source = mutations;
4324 }
4325 if (!Array.isArray(mutations)) {
4326 mutations = this.observer.takeRecords();
4327 }
4328 if (mutations.length > 0) {
4329 this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
4330 }
4331 _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
4332 if (mutations.length > 0) {
4333 this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
4334 }
4335 }
4336 }]);
4337
4338 return Scroll;
4339 }(_parchment2.default.Scroll);
4340
4341 Scroll.blotName = 'scroll';
4342 Scroll.className = 'ql-editor';
4343 Scroll.tagName = 'DIV';
4344 Scroll.defaultChild = 'block';
4345 Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
4346
4347 exports.default = Scroll;
4348
4349 /***/ }),
4350 /* 23 */
4351 /***/ (function(module, exports, __webpack_require__) {
4352
4353 "use strict";
4354
4355
4356 Object.defineProperty(exports, "__esModule", {
4357 value: true
4358 });
4359 exports.SHORTKEY = exports.default = undefined;
4360
4361 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4362
4363 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
4364
4365 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4366
4367 var _clone = __webpack_require__(21);
4368
4369 var _clone2 = _interopRequireDefault(_clone);
4370
4371 var _deepEqual = __webpack_require__(11);
4372
4373 var _deepEqual2 = _interopRequireDefault(_deepEqual);
4374
4375 var _extend = __webpack_require__(3);
4376
4377 var _extend2 = _interopRequireDefault(_extend);
4378
4379 var _quillDelta = __webpack_require__(2);
4380
4381 var _quillDelta2 = _interopRequireDefault(_quillDelta);
4382
4383 var _op = __webpack_require__(20);
4384
4385 var _op2 = _interopRequireDefault(_op);
4386
4387 var _parchment = __webpack_require__(0);
4388
4389 var _parchment2 = _interopRequireDefault(_parchment);
4390
4391 var _quill = __webpack_require__(5);
4392
4393 var _quill2 = _interopRequireDefault(_quill);
4394
4395 var _logger = __webpack_require__(10);
4396
4397 var _logger2 = _interopRequireDefault(_logger);
4398
4399 var _module = __webpack_require__(9);
4400
4401 var _module2 = _interopRequireDefault(_module);
4402
4403 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4404
4405 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4406
4407 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4408
4409 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4410
4411 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4412
4413 var debug = (0, _logger2.default)('quill:keyboard');
4414
4415 var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
4416
4417 var Keyboard = function (_Module) {
4418 _inherits(Keyboard, _Module);
4419
4420 _createClass(Keyboard, null, [{
4421 key: 'match',
4422 value: function match(evt, binding) {
4423 binding = normalize(binding);
4424 if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
4425 return !!binding[key] !== evt[key] && binding[key] !== null;
4426 })) {
4427 return false;
4428 }
4429 return binding.key === (evt.which || evt.keyCode);
4430 }
4431 }]);
4432
4433 function Keyboard(quill, options) {
4434 _classCallCheck(this, Keyboard);
4435
4436 var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
4437
4438 _this.bindings = {};
4439 Object.keys(_this.options.bindings).forEach(function (name) {
4440 if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {
4441 return;
4442 }
4443 if (_this.options.bindings[name]) {
4444 _this.addBinding(_this.options.bindings[name]);
4445 }
4446 });
4447 _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
4448 _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
4449 if (/Firefox/i.test(navigator.userAgent)) {
4450 // Need to handle delete and backspace for Firefox in the general case #1171
4451 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
4452 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
4453 } else {
4454 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
4455 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
4456 }
4457 _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
4458 _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
4459 _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
4460 _this.listen();
4461 return _this;
4462 }
4463
4464 _createClass(Keyboard, [{
4465 key: 'addBinding',
4466 value: function addBinding(key) {
4467 var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4468 var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4469
4470 var binding = normalize(key);
4471 if (binding == null || binding.key == null) {
4472 return debug.warn('Attempted to add invalid keyboard binding', binding);
4473 }
4474 if (typeof context === 'function') {
4475 context = { handler: context };
4476 }
4477 if (typeof handler === 'function') {
4478 handler = { handler: handler };
4479 }
4480 binding = (0, _extend2.default)(binding, context, handler);
4481 this.bindings[binding.key] = this.bindings[binding.key] || [];
4482 this.bindings[binding.key].push(binding);
4483 }
4484 }, {
4485 key: 'listen',
4486 value: function listen() {
4487 var _this2 = this;
4488
4489 this.quill.root.addEventListener('keydown', function (evt) {
4490 if (evt.defaultPrevented) return;
4491 var which = evt.which || evt.keyCode;
4492 var bindings = (_this2.bindings[which] || []).filter(function (binding) {
4493 return Keyboard.match(evt, binding);
4494 });
4495 if (bindings.length === 0) return;
4496 var range = _this2.quill.getSelection();
4497 if (range == null || !_this2.quill.hasFocus()) return;
4498
4499 var _quill$getLine = _this2.quill.getLine(range.index),
4500 _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
4501 line = _quill$getLine2[0],
4502 offset = _quill$getLine2[1];
4503
4504 var _quill$getLeaf = _this2.quill.getLeaf(range.index),
4505 _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
4506 leafStart = _quill$getLeaf2[0],
4507 offsetStart = _quill$getLeaf2[1];
4508
4509 var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
4510 _ref2 = _slicedToArray(_ref, 2),
4511 leafEnd = _ref2[0],
4512 offsetEnd = _ref2[1];
4513
4514 var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
4515 var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
4516 var curContext = {
4517 collapsed: range.length === 0,
4518 empty: range.length === 0 && line.length() <= 1,
4519 format: _this2.quill.getFormat(range),
4520 offset: offset,
4521 prefix: prefixText,
4522 suffix: suffixText
4523 };
4524 var prevented = bindings.some(function (binding) {
4525 if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
4526 if (binding.empty != null && binding.empty !== curContext.empty) return false;
4527 if (binding.offset != null && binding.offset !== curContext.offset) return false;
4528 if (Array.isArray(binding.format)) {
4529 // any format is present
4530 if (binding.format.every(function (name) {
4531 return curContext.format[name] == null;
4532 })) {
4533 return false;
4534 }
4535 } else if (_typeof(binding.format) === 'object') {
4536 // all formats must match
4537 if (!Object.keys(binding.format).every(function (name) {
4538 if (binding.format[name] === true) return curContext.format[name] != null;
4539 if (binding.format[name] === false) return curContext.format[name] == null;
4540 return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
4541 })) {
4542 return false;
4543 }
4544 }
4545 if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
4546 if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
4547 return binding.handler.call(_this2, range, curContext) !== true;
4548 });
4549 if (prevented) {
4550 evt.preventDefault();
4551 }
4552 });
4553 }
4554 }]);
4555
4556 return Keyboard;
4557 }(_module2.default);
4558
4559 Keyboard.keys = {
4560 BACKSPACE: 8,
4561 TAB: 9,
4562 ENTER: 13,
4563 ESCAPE: 27,
4564 LEFT: 37,
4565 UP: 38,
4566 RIGHT: 39,
4567 DOWN: 40,
4568 DELETE: 46
4569 };
4570
4571 Keyboard.DEFAULTS = {
4572 bindings: {
4573 'bold': makeFormatHandler('bold'),
4574 'italic': makeFormatHandler('italic'),
4575 'underline': makeFormatHandler('underline'),
4576 'indent': {
4577 // highlight tab or tab at beginning of list, indent or blockquote
4578 key: Keyboard.keys.TAB,
4579 format: ['blockquote', 'indent', 'list'],
4580 handler: function handler(range, context) {
4581 if (context.collapsed && context.offset !== 0) return true;
4582 this.quill.format('indent', '+1', _quill2.default.sources.USER);
4583 }
4584 },
4585 'outdent': {
4586 key: Keyboard.keys.TAB,
4587 shiftKey: true,
4588 format: ['blockquote', 'indent', 'list'],
4589 // highlight tab or tab at beginning of list, indent or blockquote
4590 handler: function handler(range, context) {
4591 if (context.collapsed && context.offset !== 0) return true;
4592 this.quill.format('indent', '-1', _quill2.default.sources.USER);
4593 }
4594 },
4595 'outdent backspace': {
4596 key: Keyboard.keys.BACKSPACE,
4597 collapsed: true,
4598 shiftKey: null,
4599 metaKey: null,
4600 ctrlKey: null,
4601 altKey: null,
4602 format: ['indent', 'list'],
4603 offset: 0,
4604 handler: function handler(range, context) {
4605 if (context.format.indent != null) {
4606 this.quill.format('indent', '-1', _quill2.default.sources.USER);
4607 } else if (context.format.list != null) {
4608 this.quill.format('list', false, _quill2.default.sources.USER);
4609 }
4610 }
4611 },
4612 'indent code-block': makeCodeBlockHandler(true),
4613 'outdent code-block': makeCodeBlockHandler(false),
4614 'remove tab': {
4615 key: Keyboard.keys.TAB,
4616 shiftKey: true,
4617 collapsed: true,
4618 prefix: /\t$/,
4619 handler: function handler(range) {
4620 this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
4621 }
4622 },
4623 'tab': {
4624 key: Keyboard.keys.TAB,
4625 handler: function handler(range) {
4626 this.quill.history.cutoff();
4627 var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\t');
4628 this.quill.updateContents(delta, _quill2.default.sources.USER);
4629 this.quill.history.cutoff();
4630 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4631 }
4632 },
4633 'list empty enter': {
4634 key: Keyboard.keys.ENTER,
4635 collapsed: true,
4636 format: ['list'],
4637 empty: true,
4638 handler: function handler(range, context) {
4639 this.quill.format('list', false, _quill2.default.sources.USER);
4640 if (context.format.indent) {
4641 this.quill.format('indent', false, _quill2.default.sources.USER);
4642 }
4643 }
4644 },
4645 'checklist enter': {
4646 key: Keyboard.keys.ENTER,
4647 collapsed: true,
4648 format: { list: 'checked' },
4649 handler: function handler(range) {
4650 var _quill$getLine3 = this.quill.getLine(range.index),
4651 _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),
4652 line = _quill$getLine4[0],
4653 offset = _quill$getLine4[1];
4654
4655 var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });
4656 var delta = new _quillDelta2.default().retain(range.index).insert('\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });
4657 this.quill.updateContents(delta, _quill2.default.sources.USER);
4658 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4659 this.quill.scrollIntoView();
4660 }
4661 },
4662 'header enter': {
4663 key: Keyboard.keys.ENTER,
4664 collapsed: true,
4665 format: ['header'],
4666 suffix: /^$/,
4667 handler: function handler(range, context) {
4668 var _quill$getLine5 = this.quill.getLine(range.index),
4669 _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),
4670 line = _quill$getLine6[0],
4671 offset = _quill$getLine6[1];
4672
4673 var delta = new _quillDelta2.default().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });
4674 this.quill.updateContents(delta, _quill2.default.sources.USER);
4675 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4676 this.quill.scrollIntoView();
4677 }
4678 },
4679 'list autofill': {
4680 key: ' ',
4681 collapsed: true,
4682 format: { list: false },
4683 prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
4684 handler: function handler(range, context) {
4685 var length = context.prefix.length;
4686
4687 var _quill$getLine7 = this.quill.getLine(range.index),
4688 _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),
4689 line = _quill$getLine8[0],
4690 offset = _quill$getLine8[1];
4691
4692 if (offset > length) return true;
4693 var value = void 0;
4694 switch (context.prefix.trim()) {
4695 case '[]':case '[ ]':
4696 value = 'unchecked';
4697 break;
4698 case '[x]':
4699 value = 'checked';
4700 break;
4701 case '-':case '*':
4702 value = 'bullet';
4703 break;
4704 default:
4705 value = 'ordered';
4706 }
4707 this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);
4708 this.quill.history.cutoff();
4709 var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });
4710 this.quill.updateContents(delta, _quill2.default.sources.USER);
4711 this.quill.history.cutoff();
4712 this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
4713 }
4714 },
4715 'code exit': {
4716 key: Keyboard.keys.ENTER,
4717 collapsed: true,
4718 format: ['code-block'],
4719 prefix: /\n\n$/,
4720 suffix: /^\s+$/,
4721 handler: function handler(range) {
4722 var _quill$getLine9 = this.quill.getLine(range.index),
4723 _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),
4724 line = _quill$getLine10[0],
4725 offset = _quill$getLine10[1];
4726
4727 var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);
4728 this.quill.updateContents(delta, _quill2.default.sources.USER);
4729 }
4730 },
4731 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),
4732 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),
4733 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),
4734 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)
4735 }
4736 };
4737
4738 function makeEmbedArrowHandler(key, shiftKey) {
4739 var _ref3;
4740
4741 var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';
4742 return _ref3 = {
4743 key: key,
4744 shiftKey: shiftKey,
4745 altKey: null
4746 }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {
4747 var index = range.index;
4748 if (key === Keyboard.keys.RIGHT) {
4749 index += range.length + 1;
4750 }
4751
4752 var _quill$getLeaf3 = this.quill.getLeaf(index),
4753 _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),
4754 leaf = _quill$getLeaf4[0];
4755
4756 if (!(leaf instanceof _parchment2.default.Embed)) return true;
4757 if (key === Keyboard.keys.LEFT) {
4758 if (shiftKey) {
4759 this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);
4760 } else {
4761 this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);
4762 }
4763 } else {
4764 if (shiftKey) {
4765 this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);
4766 } else {
4767 this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);
4768 }
4769 }
4770 return false;
4771 }), _ref3;
4772 }
4773
4774 function handleBackspace(range, context) {
4775 if (range.index === 0 || this.quill.getLength() <= 1) return;
4776
4777 var _quill$getLine11 = this.quill.getLine(range.index),
4778 _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
4779 line = _quill$getLine12[0];
4780
4781 var formats = {};
4782 if (context.offset === 0) {
4783 var _quill$getLine13 = this.quill.getLine(range.index - 1),
4784 _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),
4785 prev = _quill$getLine14[0];
4786
4787 if (prev != null && prev.length() > 1) {
4788 var curFormats = line.formats();
4789 var prevFormats = this.quill.getFormat(range.index - 1, 1);
4790 formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
4791 }
4792 }
4793 // Check for astral symbols
4794 var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
4795 this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
4796 if (Object.keys(formats).length > 0) {
4797 this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
4798 }
4799 this.quill.focus();
4800 }
4801
4802 function handleDelete(range, context) {
4803 // Check for astral symbols
4804 var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
4805 if (range.index >= this.quill.getLength() - length) return;
4806 var formats = {},
4807 nextLength = 0;
4808
4809 var _quill$getLine15 = this.quill.getLine(range.index),
4810 _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),
4811 line = _quill$getLine16[0];
4812
4813 if (context.offset >= line.length() - 1) {
4814 var _quill$getLine17 = this.quill.getLine(range.index + 1),
4815 _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),
4816 next = _quill$getLine18[0];
4817
4818 if (next) {
4819 var curFormats = line.formats();
4820 var nextFormats = this.quill.getFormat(range.index, 1);
4821 formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
4822 nextLength = next.length();
4823 }
4824 }
4825 this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
4826 if (Object.keys(formats).length > 0) {
4827 this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
4828 }
4829 }
4830
4831 function handleDeleteRange(range) {
4832 var lines = this.quill.getLines(range);
4833 var formats = {};
4834 if (lines.length > 1) {
4835 var firstFormats = lines[0].formats();
4836 var lastFormats = lines[lines.length - 1].formats();
4837 formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};
4838 }
4839 this.quill.deleteText(range, _quill2.default.sources.USER);
4840 if (Object.keys(formats).length > 0) {
4841 this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);
4842 }
4843 this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
4844 this.quill.focus();
4845 }
4846
4847 function handleEnter(range, context) {
4848 var _this3 = this;
4849
4850 if (range.length > 0) {
4851 this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
4852 }
4853 var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
4854 if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
4855 lineFormats[format] = context.format[format];
4856 }
4857 return lineFormats;
4858 }, {});
4859 this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
4860 // Earlier scroll.deleteAt might have messed up our selection,
4861 // so insertText's built in selection preservation is not reliable
4862 this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
4863 this.quill.focus();
4864 Object.keys(context.format).forEach(function (name) {
4865 if (lineFormats[name] != null) return;
4866 if (Array.isArray(context.format[name])) return;
4867 if (name === 'link') return;
4868 _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
4869 });
4870 }
4871
4872 function makeCodeBlockHandler(indent) {
4873 return {
4874 key: Keyboard.keys.TAB,
4875 shiftKey: !indent,
4876 format: { 'code-block': true },
4877 handler: function handler(range) {
4878 var CodeBlock = _parchment2.default.query('code-block');
4879 var index = range.index,
4880 length = range.length;
4881
4882 var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
4883 _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
4884 block = _quill$scroll$descend2[0],
4885 offset = _quill$scroll$descend2[1];
4886
4887 if (block == null) return;
4888 var scrollIndex = this.quill.getIndex(block);
4889 var start = block.newlineIndex(offset, true) + 1;
4890 var end = block.newlineIndex(scrollIndex + offset + length);
4891 var lines = block.domNode.textContent.slice(start, end).split('\n');
4892 offset = 0;
4893 lines.forEach(function (line, i) {
4894 if (indent) {
4895 block.insertAt(start + offset, CodeBlock.TAB);
4896 offset += CodeBlock.TAB.length;
4897 if (i === 0) {
4898 index += CodeBlock.TAB.length;
4899 } else {
4900 length += CodeBlock.TAB.length;
4901 }
4902 } else if (line.startsWith(CodeBlock.TAB)) {
4903 block.deleteAt(start + offset, CodeBlock.TAB.length);
4904 offset -= CodeBlock.TAB.length;
4905 if (i === 0) {
4906 index -= CodeBlock.TAB.length;
4907 } else {
4908 length -= CodeBlock.TAB.length;
4909 }
4910 }
4911 offset += line.length + 1;
4912 });
4913 this.quill.update(_quill2.default.sources.USER);
4914 this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
4915 }
4916 };
4917 }
4918
4919 function makeFormatHandler(format) {
4920 return {
4921 key: format[0].toUpperCase(),
4922 shortKey: true,
4923 handler: function handler(range, context) {
4924 this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
4925 }
4926 };
4927 }
4928
4929 function normalize(binding) {
4930 if (typeof binding === 'string' || typeof binding === 'number') {
4931 return normalize({ key: binding });
4932 }
4933 if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
4934 binding = (0, _clone2.default)(binding, false);
4935 }
4936 if (typeof binding.key === 'string') {
4937 if (Keyboard.keys[binding.key.toUpperCase()] != null) {
4938 binding.key = Keyboard.keys[binding.key.toUpperCase()];
4939 } else if (binding.key.length === 1) {
4940 binding.key = binding.key.toUpperCase().charCodeAt(0);
4941 } else {
4942 return null;
4943 }
4944 }
4945 if (binding.shortKey) {
4946 binding[SHORTKEY] = binding.shortKey;
4947 delete binding.shortKey;
4948 }
4949 return binding;
4950 }
4951
4952 exports.default = Keyboard;
4953 exports.SHORTKEY = SHORTKEY;
4954
4955 /***/ }),
4956 /* 24 */
4957 /***/ (function(module, exports, __webpack_require__) {
4958
4959 "use strict";
4960
4961
4962 Object.defineProperty(exports, "__esModule", {
4963 value: true
4964 });
4965
4966 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
4967
4968 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
4969
4970 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4971
4972 var _parchment = __webpack_require__(0);
4973
4974 var _parchment2 = _interopRequireDefault(_parchment);
4975
4976 var _text = __webpack_require__(7);
4977
4978 var _text2 = _interopRequireDefault(_text);
4979
4980 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4981
4982 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4983
4984 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
4985
4986 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
4987
4988 var Cursor = function (_Parchment$Embed) {
4989 _inherits(Cursor, _Parchment$Embed);
4990
4991 _createClass(Cursor, null, [{
4992 key: 'value',
4993 value: function value() {
4994 return undefined;
4995 }
4996 }]);
4997
4998 function Cursor(domNode, selection) {
4999 _classCallCheck(this, Cursor);
5000
5001 var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
5002
5003 _this.selection = selection;
5004 _this.textNode = document.createTextNode(Cursor.CONTENTS);
5005 _this.domNode.appendChild(_this.textNode);
5006 _this._length = 0;
5007 return _this;
5008 }
5009
5010 _createClass(Cursor, [{
5011 key: 'detach',
5012 value: function detach() {
5013 // super.detach() will also clear domNode.__blot
5014 if (this.parent != null) this.parent.removeChild(this);
5015 }
5016 }, {
5017 key: 'format',
5018 value: function format(name, value) {
5019 if (this._length !== 0) {
5020 return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
5021 }
5022 var target = this,
5023 index = 0;
5024 while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
5025 index += target.offset(target.parent);
5026 target = target.parent;
5027 }
5028 if (target != null) {
5029 this._length = Cursor.CONTENTS.length;
5030 target.optimize();
5031 target.formatAt(index, Cursor.CONTENTS.length, name, value);
5032 this._length = 0;
5033 }
5034 }
5035 }, {
5036 key: 'index',
5037 value: function index(node, offset) {
5038 if (node === this.textNode) return 0;
5039 return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
5040 }
5041 }, {
5042 key: 'length',
5043 value: function length() {
5044 return this._length;
5045 }
5046 }, {
5047 key: 'position',
5048 value: function position() {
5049 return [this.textNode, this.textNode.data.length];
5050 }
5051 }, {
5052 key: 'remove',
5053 value: function remove() {
5054 _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
5055 this.parent = null;
5056 }
5057 }, {
5058 key: 'restore',
5059 value: function restore() {
5060 if (this.selection.composing || this.parent == null) return;
5061 var textNode = this.textNode;
5062 var range = this.selection.getNativeRange();
5063 var restoreText = void 0,
5064 start = void 0,
5065 end = void 0;
5066 if (range != null && range.start.node === textNode && range.end.node === textNode) {
5067 var _ref = [textNode, range.start.offset, range.end.offset];
5068 restoreText = _ref[0];
5069 start = _ref[1];
5070 end = _ref[2];
5071 }
5072 // Link format will insert text outside of anchor tag
5073 while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
5074 this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
5075 }
5076 if (this.textNode.data !== Cursor.CONTENTS) {
5077 var text = this.textNode.data.split(Cursor.CONTENTS).join('');
5078 if (this.next instanceof _text2.default) {
5079 restoreText = this.next.domNode;
5080 this.next.insertAt(0, text);
5081 this.textNode.data = Cursor.CONTENTS;
5082 } else {
5083 this.textNode.data = text;
5084 this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
5085 this.textNode = document.createTextNode(Cursor.CONTENTS);
5086 this.domNode.appendChild(this.textNode);
5087 }
5088 }
5089 this.remove();
5090 if (start != null) {
5091 var _map = [start, end].map(function (offset) {
5092 return Math.max(0, Math.min(restoreText.data.length, offset - 1));
5093 });
5094
5095 var _map2 = _slicedToArray(_map, 2);
5096
5097 start = _map2[0];
5098 end = _map2[1];
5099
5100 return {
5101 startNode: restoreText,
5102 startOffset: start,
5103 endNode: restoreText,
5104 endOffset: end
5105 };
5106 }
5107 }
5108 }, {
5109 key: 'update',
5110 value: function update(mutations, context) {
5111 var _this2 = this;
5112
5113 if (mutations.some(function (mutation) {
5114 return mutation.type === 'characterData' && mutation.target === _this2.textNode;
5115 })) {
5116 var range = this.restore();
5117 if (range) context.range = range;
5118 }
5119 }
5120 }, {
5121 key: 'value',
5122 value: function value() {
5123 return '';
5124 }
5125 }]);
5126
5127 return Cursor;
5128 }(_parchment2.default.Embed);
5129
5130 Cursor.blotName = 'cursor';
5131 Cursor.className = 'ql-cursor';
5132 Cursor.tagName = 'span';
5133 Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
5134
5135
5136 exports.default = Cursor;
5137
5138 /***/ }),
5139 /* 25 */
5140 /***/ (function(module, exports, __webpack_require__) {
5141
5142 "use strict";
5143
5144
5145 Object.defineProperty(exports, "__esModule", {
5146 value: true
5147 });
5148
5149 var _parchment = __webpack_require__(0);
5150
5151 var _parchment2 = _interopRequireDefault(_parchment);
5152
5153 var _block = __webpack_require__(4);
5154
5155 var _block2 = _interopRequireDefault(_block);
5156
5157 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5158
5159 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5160
5161 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5162
5163 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5164
5165 var Container = function (_Parchment$Container) {
5166 _inherits(Container, _Parchment$Container);
5167
5168 function Container() {
5169 _classCallCheck(this, Container);
5170
5171 return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
5172 }
5173
5174 return Container;
5175 }(_parchment2.default.Container);
5176
5177 Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
5178
5179 exports.default = Container;
5180
5181 /***/ }),
5182 /* 26 */
5183 /***/ (function(module, exports, __webpack_require__) {
5184
5185 "use strict";
5186
5187
5188 Object.defineProperty(exports, "__esModule", {
5189 value: true
5190 });
5191 exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
5192
5193 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
5194
5195 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
5196
5197 var _parchment = __webpack_require__(0);
5198
5199 var _parchment2 = _interopRequireDefault(_parchment);
5200
5201 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5202
5203 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5204
5205 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5206
5207 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5208
5209 var ColorAttributor = function (_Parchment$Attributor) {
5210 _inherits(ColorAttributor, _Parchment$Attributor);
5211
5212 function ColorAttributor() {
5213 _classCallCheck(this, ColorAttributor);
5214
5215 return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
5216 }
5217
5218 _createClass(ColorAttributor, [{
5219 key: 'value',
5220 value: function value(domNode) {
5221 var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
5222 if (!value.startsWith('rgb(')) return value;
5223 value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
5224 return '#' + value.split(',').map(function (component) {
5225 return ('00' + parseInt(component).toString(16)).slice(-2);
5226 }).join('');
5227 }
5228 }]);
5229
5230 return ColorAttributor;
5231 }(_parchment2.default.Attributor.Style);
5232
5233 var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
5234 scope: _parchment2.default.Scope.INLINE
5235 });
5236 var ColorStyle = new ColorAttributor('color', 'color', {
5237 scope: _parchment2.default.Scope.INLINE
5238 });
5239
5240 exports.ColorAttributor = ColorAttributor;
5241 exports.ColorClass = ColorClass;
5242 exports.ColorStyle = ColorStyle;
5243
5244 /***/ }),
5245 /* 27 */
5246 /***/ (function(module, exports, __webpack_require__) {
5247
5248 "use strict";
5249
5250
5251 Object.defineProperty(exports, "__esModule", {
5252 value: true
5253 });
5254 exports.sanitize = exports.default = undefined;
5255
5256 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
5257
5258 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
5259
5260 var _inline = __webpack_require__(6);
5261
5262 var _inline2 = _interopRequireDefault(_inline);
5263
5264 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5265
5266 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5267
5268 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
5269
5270 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
5271
5272 var Link = function (_Inline) {
5273 _inherits(Link, _Inline);
5274
5275 function Link() {
5276 _classCallCheck(this, Link);
5277
5278 return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
5279 }
5280
5281 _createClass(Link, [{
5282 key: 'format',
5283 value: function format(name, value) {
5284 if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
5285 value = this.constructor.sanitize(value);
5286 this.domNode.setAttribute('href', value);
5287 }
5288 }], [{
5289 key: 'create',
5290 value: function create(value) {
5291 var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
5292 value = this.sanitize(value);
5293 node.setAttribute('href', value);
5294 node.setAttribute('target', '_blank');
5295 return node;
5296 }
5297 }, {
5298 key: 'formats',
5299 value: function formats(domNode) {
5300 return domNode.getAttribute('href');
5301 }
5302 }, {
5303 key: 'sanitize',
5304 value: function sanitize(url) {
5305 return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
5306 }
5307 }]);
5308
5309 return Link;
5310 }(_inline2.default);
5311
5312 Link.blotName = 'link';
5313 Link.tagName = 'A';
5314 Link.SANITIZED_URL = 'about:blank';
5315 Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];
5316
5317 function _sanitize(url, protocols) {
5318 var anchor = document.createElement('a');
5319 anchor.href = url;
5320 var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
5321 return protocols.indexOf(protocol) > -1;
5322 }
5323
5324 exports.default = Link;
5325 exports.sanitize = _sanitize;
5326
5327 /***/ }),
5328 /* 28 */
5329 /***/ (function(module, exports, __webpack_require__) {
5330
5331 "use strict";
5332
5333
5334 Object.defineProperty(exports, "__esModule", {
5335 value: true
5336 });
5337
5338 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
5339
5340 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
5341
5342 var _keyboard = __webpack_require__(23);
5343
5344 var _keyboard2 = _interopRequireDefault(_keyboard);
5345
5346 var _dropdown = __webpack_require__(107);
5347
5348 var _dropdown2 = _interopRequireDefault(_dropdown);
5349
5350 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5351
5352 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5353
5354 var optionsCounter = 0;
5355
5356 function toggleAriaAttribute(element, attribute) {
5357 element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));
5358 }
5359
5360 var Picker = function () {
5361 function Picker(select) {
5362 var _this = this;
5363
5364 _classCallCheck(this, Picker);
5365
5366 this.select = select;
5367 this.container = document.createElement('span');
5368 this.buildPicker();
5369 this.select.style.display = 'none';
5370 this.select.parentNode.insertBefore(this.container, this.select);
5371
5372 this.label.addEventListener('mousedown', function () {
5373 _this.togglePicker();
5374 });
5375 this.label.addEventListener('keydown', function (event) {
5376 switch (event.keyCode) {
5377 // Allows the "Enter" key to open the picker
5378 case _keyboard2.default.keys.ENTER:
5379 _this.togglePicker();
5380 break;
5381
5382 // Allows the "Escape" key to close the picker
5383 case _keyboard2.default.keys.ESCAPE:
5384 _this.escape();
5385 event.preventDefault();
5386 break;
5387 default:
5388 }
5389 });
5390 this.select.addEventListener('change', this.update.bind(this));
5391 }
5392
5393 _createClass(Picker, [{
5394 key: 'togglePicker',
5395 value: function togglePicker() {
5396 this.container.classList.toggle('ql-expanded');
5397 // Toggle aria-expanded and aria-hidden to make the picker accessible
5398 toggleAriaAttribute(this.label, 'aria-expanded');
5399 toggleAriaAttribute(this.options, 'aria-hidden');
5400 }
5401 }, {
5402 key: 'buildItem',
5403 value: function buildItem(option) {
5404 var _this2 = this;
5405
5406 var item = document.createElement('span');
5407 item.tabIndex = '0';
5408 item.setAttribute('role', 'button');
5409
5410 item.classList.add('ql-picker-item');
5411 if (option.hasAttribute('value')) {
5412 item.setAttribute('data-value', option.getAttribute('value'));
5413 }
5414 if (option.textContent) {
5415 item.setAttribute('data-label', option.textContent);
5416 }
5417 item.addEventListener('click', function () {
5418 _this2.selectItem(item, true);
5419 });
5420 item.addEventListener('keydown', function (event) {
5421 switch (event.keyCode) {
5422 // Allows the "Enter" key to select an item
5423 case _keyboard2.default.keys.ENTER:
5424 _this2.selectItem(item, true);
5425 event.preventDefault();
5426 break;
5427
5428 // Allows the "Escape" key to close the picker
5429 case _keyboard2.default.keys.ESCAPE:
5430 _this2.escape();
5431 event.preventDefault();
5432 break;
5433 default:
5434 }
5435 });
5436
5437 return item;
5438 }
5439 }, {
5440 key: 'buildLabel',
5441 value: function buildLabel() {
5442 var label = document.createElement('span');
5443 label.classList.add('ql-picker-label');
5444 label.innerHTML = _dropdown2.default;
5445 label.tabIndex = '0';
5446 label.setAttribute('role', 'button');
5447 label.setAttribute('aria-expanded', 'false');
5448 this.container.appendChild(label);
5449 return label;
5450 }
5451 }, {
5452 key: 'buildOptions',
5453 value: function buildOptions() {
5454 var _this3 = this;
5455
5456 var options = document.createElement('span');
5457 options.classList.add('ql-picker-options');
5458
5459 // Don't want screen readers to read this until options are visible
5460 options.setAttribute('aria-hidden', 'true');
5461 options.tabIndex = '-1';
5462
5463 // Need a unique id for aria-controls
5464 options.id = 'ql-picker-options-' + optionsCounter;
5465 optionsCounter += 1;
5466 this.label.setAttribute('aria-controls', options.id);
5467
5468 this.options = options;
5469
5470 [].slice.call(this.select.options).forEach(function (option) {
5471 var item = _this3.buildItem(option);
5472 options.appendChild(item);
5473 if (option.selected === true) {
5474 _this3.selectItem(item);
5475 }
5476 });
5477 this.container.appendChild(options);
5478 }
5479 }, {
5480 key: 'buildPicker',
5481 value: function buildPicker() {
5482 var _this4 = this;
5483
5484 [].slice.call(this.select.attributes).forEach(function (item) {
5485 _this4.container.setAttribute(item.name, item.value);
5486 });
5487 this.container.classList.add('ql-picker');
5488 this.label = this.buildLabel();
5489 this.buildOptions();
5490 }
5491 }, {
5492 key: 'escape',
5493 value: function escape() {
5494 var _this5 = this;
5495
5496 // Close menu and return focus to trigger label
5497 this.close();
5498 // Need setTimeout for accessibility to ensure that the browser executes
5499 // focus on the next process thread and after any DOM content changes
5500 setTimeout(function () {
5501 return _this5.label.focus();
5502 }, 1);
5503 }
5504 }, {
5505 key: 'close',
5506 value: function close() {
5507 this.container.classList.remove('ql-expanded');
5508 this.label.setAttribute('aria-expanded', 'false');
5509 this.options.setAttribute('aria-hidden', 'true');
5510 }
5511 }, {
5512 key: 'selectItem',
5513 value: function selectItem(item) {
5514 var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5515
5516 var selected = this.container.querySelector('.ql-selected');
5517 if (item === selected) return;
5518 if (selected != null) {
5519 selected.classList.remove('ql-selected');
5520 }
5521 if (item == null) return;
5522 item.classList.add('ql-selected');
5523 this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
5524 if (item.hasAttribute('data-value')) {
5525 this.label.setAttribute('data-value', item.getAttribute('data-value'));
5526 } else {
5527 this.label.removeAttribute('data-value');
5528 }
5529 if (item.hasAttribute('data-label')) {
5530 this.label.setAttribute('data-label', item.getAttribute('data-label'));
5531 } else {
5532 this.label.removeAttribute('data-label');
5533 }
5534 if (trigger) {
5535 if (typeof Event === 'function') {
5536 this.select.dispatchEvent(new Event('change'));
5537 } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
5538 // IE11
5539 var event = document.createEvent('Event');
5540 event.initEvent('change', true, true);
5541 this.select.dispatchEvent(event);
5542 }
5543 this.close();
5544 }
5545 }
5546 }, {
5547 key: 'update',
5548 value: function update() {
5549 var option = void 0;
5550 if (this.select.selectedIndex > -1) {
5551 var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
5552 option = this.select.options[this.select.selectedIndex];
5553 this.selectItem(item);
5554 } else {
5555 this.selectItem(null);
5556 }
5557 var isActive = option != null && option !== this.select.querySelector('option[selected]');
5558 this.label.classList.toggle('ql-active', isActive);
5559 }
5560 }]);
5561
5562 return Picker;
5563 }();
5564
5565 exports.default = Picker;
5566
5567 /***/ }),
5568 /* 29 */
5569 /***/ (function(module, exports, __webpack_require__) {
5570
5571 "use strict";
5572
5573
5574 Object.defineProperty(exports, "__esModule", {
5575 value: true
5576 });
5577
5578 var _parchment = __webpack_require__(0);
5579
5580 var _parchment2 = _interopRequireDefault(_parchment);
5581
5582 var _quill = __webpack_require__(5);
5583
5584 var _quill2 = _interopRequireDefault(_quill);
5585
5586 var _block = __webpack_require__(4);
5587
5588 var _block2 = _interopRequireDefault(_block);
5589
5590 var _break = __webpack_require__(16);
5591
5592 var _break2 = _interopRequireDefault(_break);
5593
5594 var _container = __webpack_require__(25);
5595
5596 var _container2 = _interopRequireDefault(_container);
5597
5598 var _cursor = __webpack_require__(24);
5599
5600 var _cursor2 = _interopRequireDefault(_cursor);
5601
5602 var _embed = __webpack_require__(35);
5603
5604 var _embed2 = _interopRequireDefault(_embed);
5605
5606 var _inline = __webpack_require__(6);
5607
5608 var _inline2 = _interopRequireDefault(_inline);
5609
5610 var _scroll = __webpack_require__(22);
5611
5612 var _scroll2 = _interopRequireDefault(_scroll);
5613
5614 var _text = __webpack_require__(7);
5615
5616 var _text2 = _interopRequireDefault(_text);
5617
5618 var _clipboard = __webpack_require__(55);
5619
5620 var _clipboard2 = _interopRequireDefault(_clipboard);
5621
5622 var _history = __webpack_require__(42);
5623
5624 var _history2 = _interopRequireDefault(_history);
5625
5626 var _keyboard = __webpack_require__(23);
5627
5628 var _keyboard2 = _interopRequireDefault(_keyboard);
5629
5630 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5631
5632 _quill2.default.register({
5633 'blots/block': _block2.default,
5634 'blots/block/embed': _block.BlockEmbed,
5635 'blots/break': _break2.default,
5636 'blots/container': _container2.default,
5637 'blots/cursor': _cursor2.default,
5638 'blots/embed': _embed2.default,
5639 'blots/inline': _inline2.default,
5640 'blots/scroll': _scroll2.default,
5641 'blots/text': _text2.default,
5642
5643 'modules/clipboard': _clipboard2.default,
5644 'modules/history': _history2.default,
5645 'modules/keyboard': _keyboard2.default
5646 });
5647
5648 _parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
5649
5650 exports.default = _quill2.default;
5651
5652 /***/ }),
5653 /* 30 */
5654 /***/ (function(module, exports, __webpack_require__) {
5655
5656 "use strict";
5657
5658 Object.defineProperty(exports, "__esModule", { value: true });
5659 var Registry = __webpack_require__(1);
5660 var ShadowBlot = /** @class */ (function () {
5661 function ShadowBlot(domNode) {
5662 this.domNode = domNode;
5663 // @ts-ignore
5664 this.domNode[Registry.DATA_KEY] = { blot: this };
5665 }
5666 Object.defineProperty(ShadowBlot.prototype, "statics", {
5667 // Hack for accessing inherited static methods
5668 get: function () {
5669 return this.constructor;
5670 },
5671 enumerable: true,
5672 configurable: true
5673 });
5674 ShadowBlot.create = function (value) {
5675 if (this.tagName == null) {
5676 throw new Registry.ParchmentError('Blot definition missing tagName');
5677 }
5678 var node;
5679 if (Array.isArray(this.tagName)) {
5680 if (typeof value === 'string') {
5681 value = value.toUpperCase();
5682 if (parseInt(value).toString() === value) {
5683 value = parseInt(value);
5684 }
5685 }
5686 if (typeof value === 'number') {
5687 node = document.createElement(this.tagName[value - 1]);
5688 }
5689 else if (this.tagName.indexOf(value) > -1) {
5690 node = document.createElement(value);
5691 }
5692 else {
5693 node = document.createElement(this.tagName[0]);
5694 }
5695 }
5696 else {
5697 node = document.createElement(this.tagName);
5698 }
5699 if (this.className) {
5700 node.classList.add(this.className);
5701 }
5702 return node;
5703 };
5704 ShadowBlot.prototype.attach = function () {
5705 if (this.parent != null) {
5706 this.scroll = this.parent.scroll;
5707 }
5708 };
5709 ShadowBlot.prototype.clone = function () {
5710 var domNode = this.domNode.cloneNode(false);
5711 return Registry.create(domNode);
5712 };
5713 ShadowBlot.prototype.detach = function () {
5714 if (this.parent != null)
5715 this.parent.removeChild(this);
5716 // @ts-ignore
5717 delete this.domNode[Registry.DATA_KEY];
5718 };
5719 ShadowBlot.prototype.deleteAt = function (index, length) {
5720 var blot = this.isolate(index, length);
5721 blot.remove();
5722 };
5723 ShadowBlot.prototype.formatAt = function (index, length, name, value) {
5724 var blot = this.isolate(index, length);
5725 if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
5726 blot.wrap(name, value);
5727 }
5728 else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
5729 var parent = Registry.create(this.statics.scope);
5730 blot.wrap(parent);
5731 parent.format(name, value);
5732 }
5733 };
5734 ShadowBlot.prototype.insertAt = function (index, value, def) {
5735 var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
5736 var ref = this.split(index);
5737 this.parent.insertBefore(blot, ref);
5738 };
5739 ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
5740 if (refBlot === void 0) { refBlot = null; }
5741 if (this.parent != null) {
5742 this.parent.children.remove(this);
5743 }
5744 var refDomNode = null;
5745 parentBlot.children.insertBefore(this, refBlot);
5746 if (refBlot != null) {
5747 refDomNode = refBlot.domNode;
5748 }
5749 if (this.domNode.parentNode != parentBlot.domNode ||
5750 this.domNode.nextSibling != refDomNode) {
5751 parentBlot.domNode.insertBefore(this.domNode, refDomNode);
5752 }
5753 this.parent = parentBlot;
5754 this.attach();
5755 };
5756 ShadowBlot.prototype.isolate = function (index, length) {
5757 var target = this.split(index);
5758 target.split(length);
5759 return target;
5760 };
5761 ShadowBlot.prototype.length = function () {
5762 return 1;
5763 };
5764 ShadowBlot.prototype.offset = function (root) {
5765 if (root === void 0) { root = this.parent; }
5766 if (this.parent == null || this == root)
5767 return 0;
5768 return this.parent.children.offset(this) + this.parent.offset(root);
5769 };
5770 ShadowBlot.prototype.optimize = function (context) {
5771 // TODO clean up once we use WeakMap
5772 // @ts-ignore
5773 if (this.domNode[Registry.DATA_KEY] != null) {
5774 // @ts-ignore
5775 delete this.domNode[Registry.DATA_KEY].mutations;
5776 }
5777 };
5778 ShadowBlot.prototype.remove = function () {
5779 if (this.domNode.parentNode != null) {
5780 this.domNode.parentNode.removeChild(this.domNode);
5781 }
5782 this.detach();
5783 };
5784 ShadowBlot.prototype.replace = function (target) {
5785 if (target.parent == null)
5786 return;
5787 target.parent.insertBefore(this, target.next);
5788 target.remove();
5789 };
5790 ShadowBlot.prototype.replaceWith = function (name, value) {
5791 var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
5792 replacement.replace(this);
5793 return replacement;
5794 };
5795 ShadowBlot.prototype.split = function (index, force) {
5796 return index === 0 ? this : this.next;
5797 };
5798 ShadowBlot.prototype.update = function (mutations, context) {
5799 // Nothing to do by default
5800 };
5801 ShadowBlot.prototype.wrap = function (name, value) {
5802 var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
5803 if (this.parent != null) {
5804 this.parent.insertBefore(wrapper, this.next);
5805 }
5806 wrapper.appendChild(this);
5807 return wrapper;
5808 };
5809 ShadowBlot.blotName = 'abstract';
5810 return ShadowBlot;
5811 }());
5812 exports.default = ShadowBlot;
5813
5814
5815 /***/ }),
5816 /* 31 */
5817 /***/ (function(module, exports, __webpack_require__) {
5818
5819 "use strict";
5820
5821 Object.defineProperty(exports, "__esModule", { value: true });
5822 var attributor_1 = __webpack_require__(12);
5823 var class_1 = __webpack_require__(32);
5824 var style_1 = __webpack_require__(33);
5825 var Registry = __webpack_require__(1);
5826 var AttributorStore = /** @class */ (function () {
5827 function AttributorStore(domNode) {
5828 this.attributes = {};
5829 this.domNode = domNode;
5830 this.build();
5831 }
5832 AttributorStore.prototype.attribute = function (attribute, value) {
5833 // verb
5834 if (value) {
5835 if (attribute.add(this.domNode, value)) {
5836 if (attribute.value(this.domNode) != null) {
5837 this.attributes[attribute.attrName] = attribute;
5838 }
5839 else {
5840 delete this.attributes[attribute.attrName];
5841 }
5842 }
5843 }
5844 else {
5845 attribute.remove(this.domNode);
5846 delete this.attributes[attribute.attrName];
5847 }
5848 };
5849 AttributorStore.prototype.build = function () {
5850 var _this = this;
5851 this.attributes = {};
5852 var attributes = attributor_1.default.keys(this.domNode);
5853 var classes = class_1.default.keys(this.domNode);
5854 var styles = style_1.default.keys(this.domNode);
5855 attributes
5856 .concat(classes)
5857 .concat(styles)
5858 .forEach(function (name) {
5859 var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
5860 if (attr instanceof attributor_1.default) {
5861 _this.attributes[attr.attrName] = attr;
5862 }
5863 });
5864 };
5865 AttributorStore.prototype.copy = function (target) {
5866 var _this = this;
5867 Object.keys(this.attributes).forEach(function (key) {
5868 var value = _this.attributes[key].value(_this.domNode);
5869 target.format(key, value);
5870 });
5871 };
5872 AttributorStore.prototype.move = function (target) {
5873 var _this = this;
5874 this.copy(target);
5875 Object.keys(this.attributes).forEach(function (key) {
5876 _this.attributes[key].remove(_this.domNode);
5877 });
5878 this.attributes = {};
5879 };
5880 AttributorStore.prototype.values = function () {
5881 var _this = this;
5882 return Object.keys(this.attributes).reduce(function (attributes, name) {
5883 attributes[name] = _this.attributes[name].value(_this.domNode);
5884 return attributes;
5885 }, {});
5886 };
5887 return AttributorStore;
5888 }());
5889 exports.default = AttributorStore;
5890
5891
5892 /***/ }),
5893 /* 32 */
5894 /***/ (function(module, exports, __webpack_require__) {
5895
5896 "use strict";
5897
5898 var __extends = (this && this.__extends) || (function () {
5899 var extendStatics = Object.setPrototypeOf ||
5900 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5901 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5902 return function (d, b) {
5903 extendStatics(d, b);
5904 function __() { this.constructor = d; }
5905 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5906 };
5907 })();
5908 Object.defineProperty(exports, "__esModule", { value: true });
5909 var attributor_1 = __webpack_require__(12);
5910 function match(node, prefix) {
5911 var className = node.getAttribute('class') || '';
5912 return className.split(/\s+/).filter(function (name) {
5913 return name.indexOf(prefix + "-") === 0;
5914 });
5915 }
5916 var ClassAttributor = /** @class */ (function (_super) {
5917 __extends(ClassAttributor, _super);
5918 function ClassAttributor() {
5919 return _super !== null && _super.apply(this, arguments) || this;
5920 }
5921 ClassAttributor.keys = function (node) {
5922 return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
5923 return name
5924 .split('-')
5925 .slice(0, -1)
5926 .join('-');
5927 });
5928 };
5929 ClassAttributor.prototype.add = function (node, value) {
5930 if (!this.canAdd(node, value))
5931 return false;
5932 this.remove(node);
5933 node.classList.add(this.keyName + "-" + value);
5934 return true;
5935 };
5936 ClassAttributor.prototype.remove = function (node) {
5937 var matches = match(node, this.keyName);
5938 matches.forEach(function (name) {
5939 node.classList.remove(name);
5940 });
5941 if (node.classList.length === 0) {
5942 node.removeAttribute('class');
5943 }
5944 };
5945 ClassAttributor.prototype.value = function (node) {
5946 var result = match(node, this.keyName)[0] || '';
5947 var value = result.slice(this.keyName.length + 1); // +1 for hyphen
5948 return this.canAdd(node, value) ? value : '';
5949 };
5950 return ClassAttributor;
5951 }(attributor_1.default));
5952 exports.default = ClassAttributor;
5953
5954
5955 /***/ }),
5956 /* 33 */
5957 /***/ (function(module, exports, __webpack_require__) {
5958
5959 "use strict";
5960
5961 var __extends = (this && this.__extends) || (function () {
5962 var extendStatics = Object.setPrototypeOf ||
5963 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5964 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5965 return function (d, b) {
5966 extendStatics(d, b);
5967 function __() { this.constructor = d; }
5968 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5969 };
5970 })();
5971 Object.defineProperty(exports, "__esModule", { value: true });
5972 var attributor_1 = __webpack_require__(12);
5973 function camelize(name) {
5974 var parts = name.split('-');
5975 var rest = parts
5976 .slice(1)
5977 .map(function (part) {
5978 return part[0].toUpperCase() + part.slice(1);
5979 })
5980 .join('');
5981 return parts[0] + rest;
5982 }
5983 var StyleAttributor = /** @class */ (function (_super) {
5984 __extends(StyleAttributor, _super);
5985 function StyleAttributor() {
5986 return _super !== null && _super.apply(this, arguments) || this;
5987 }
5988 StyleAttributor.keys = function (node) {
5989 return (node.getAttribute('style') || '').split(';').map(function (value) {
5990 var arr = value.split(':');
5991 return arr[0].trim();
5992 });
5993 };
5994 StyleAttributor.prototype.add = function (node, value) {
5995 if (!this.canAdd(node, value))
5996 return false;
5997 // @ts-ignore
5998 node.style[camelize(this.keyName)] = value;
5999 return true;
6000 };
6001 StyleAttributor.prototype.remove = function (node) {
6002 // @ts-ignore
6003 node.style[camelize(this.keyName)] = '';
6004 if (!node.getAttribute('style')) {
6005 node.removeAttribute('style');
6006 }
6007 };
6008 StyleAttributor.prototype.value = function (node) {
6009 // @ts-ignore
6010 var value = node.style[camelize(this.keyName)];
6011 return this.canAdd(node, value) ? value : '';
6012 };
6013 return StyleAttributor;
6014 }(attributor_1.default));
6015 exports.default = StyleAttributor;
6016
6017
6018 /***/ }),
6019 /* 34 */
6020 /***/ (function(module, exports, __webpack_require__) {
6021
6022 "use strict";
6023
6024
6025 Object.defineProperty(exports, "__esModule", {
6026 value: true
6027 });
6028
6029 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6030
6031 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6032
6033 var Theme = function () {
6034 function Theme(quill, options) {
6035 _classCallCheck(this, Theme);
6036
6037 this.quill = quill;
6038 this.options = options;
6039 this.modules = {};
6040 }
6041
6042 _createClass(Theme, [{
6043 key: 'init',
6044 value: function init() {
6045 var _this = this;
6046
6047 Object.keys(this.options.modules).forEach(function (name) {
6048 if (_this.modules[name] == null) {
6049 _this.addModule(name);
6050 }
6051 });
6052 }
6053 }, {
6054 key: 'addModule',
6055 value: function addModule(name) {
6056 var moduleClass = this.quill.constructor.import('modules/' + name);
6057 this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
6058 return this.modules[name];
6059 }
6060 }]);
6061
6062 return Theme;
6063 }();
6064
6065 Theme.DEFAULTS = {
6066 modules: {}
6067 };
6068 Theme.themes = {
6069 'default': Theme
6070 };
6071
6072 exports.default = Theme;
6073
6074 /***/ }),
6075 /* 35 */
6076 /***/ (function(module, exports, __webpack_require__) {
6077
6078 "use strict";
6079
6080
6081 Object.defineProperty(exports, "__esModule", {
6082 value: true
6083 });
6084
6085 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6086
6087 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
6088
6089 var _parchment = __webpack_require__(0);
6090
6091 var _parchment2 = _interopRequireDefault(_parchment);
6092
6093 var _text = __webpack_require__(7);
6094
6095 var _text2 = _interopRequireDefault(_text);
6096
6097 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6098
6099 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6100
6101 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6102
6103 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6104
6105 var GUARD_TEXT = '\uFEFF';
6106
6107 var Embed = function (_Parchment$Embed) {
6108 _inherits(Embed, _Parchment$Embed);
6109
6110 function Embed(node) {
6111 _classCallCheck(this, Embed);
6112
6113 var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));
6114
6115 _this.contentNode = document.createElement('span');
6116 _this.contentNode.setAttribute('contenteditable', false);
6117 [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {
6118 _this.contentNode.appendChild(childNode);
6119 });
6120 _this.leftGuard = document.createTextNode(GUARD_TEXT);
6121 _this.rightGuard = document.createTextNode(GUARD_TEXT);
6122 _this.domNode.appendChild(_this.leftGuard);
6123 _this.domNode.appendChild(_this.contentNode);
6124 _this.domNode.appendChild(_this.rightGuard);
6125 return _this;
6126 }
6127
6128 _createClass(Embed, [{
6129 key: 'index',
6130 value: function index(node, offset) {
6131 if (node === this.leftGuard) return 0;
6132 if (node === this.rightGuard) return 1;
6133 return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);
6134 }
6135 }, {
6136 key: 'restore',
6137 value: function restore(node) {
6138 var range = void 0,
6139 textNode = void 0;
6140 var text = node.data.split(GUARD_TEXT).join('');
6141 if (node === this.leftGuard) {
6142 if (this.prev instanceof _text2.default) {
6143 var prevLength = this.prev.length();
6144 this.prev.insertAt(prevLength, text);
6145 range = {
6146 startNode: this.prev.domNode,
6147 startOffset: prevLength + text.length
6148 };
6149 } else {
6150 textNode = document.createTextNode(text);
6151 this.parent.insertBefore(_parchment2.default.create(textNode), this);
6152 range = {
6153 startNode: textNode,
6154 startOffset: text.length
6155 };
6156 }
6157 } else if (node === this.rightGuard) {
6158 if (this.next instanceof _text2.default) {
6159 this.next.insertAt(0, text);
6160 range = {
6161 startNode: this.next.domNode,
6162 startOffset: text.length
6163 };
6164 } else {
6165 textNode = document.createTextNode(text);
6166 this.parent.insertBefore(_parchment2.default.create(textNode), this.next);
6167 range = {
6168 startNode: textNode,
6169 startOffset: text.length
6170 };
6171 }
6172 }
6173 node.data = GUARD_TEXT;
6174 return range;
6175 }
6176 }, {
6177 key: 'update',
6178 value: function update(mutations, context) {
6179 var _this2 = this;
6180
6181 mutations.forEach(function (mutation) {
6182 if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {
6183 var range = _this2.restore(mutation.target);
6184 if (range) context.range = range;
6185 }
6186 });
6187 }
6188 }]);
6189
6190 return Embed;
6191 }(_parchment2.default.Embed);
6192
6193 exports.default = Embed;
6194
6195 /***/ }),
6196 /* 36 */
6197 /***/ (function(module, exports, __webpack_require__) {
6198
6199 "use strict";
6200
6201
6202 Object.defineProperty(exports, "__esModule", {
6203 value: true
6204 });
6205 exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
6206
6207 var _parchment = __webpack_require__(0);
6208
6209 var _parchment2 = _interopRequireDefault(_parchment);
6210
6211 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6212
6213 var config = {
6214 scope: _parchment2.default.Scope.BLOCK,
6215 whitelist: ['right', 'center', 'justify']
6216 };
6217
6218 var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
6219 var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
6220 var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
6221
6222 exports.AlignAttribute = AlignAttribute;
6223 exports.AlignClass = AlignClass;
6224 exports.AlignStyle = AlignStyle;
6225
6226 /***/ }),
6227 /* 37 */
6228 /***/ (function(module, exports, __webpack_require__) {
6229
6230 "use strict";
6231
6232
6233 Object.defineProperty(exports, "__esModule", {
6234 value: true
6235 });
6236 exports.BackgroundStyle = exports.BackgroundClass = undefined;
6237
6238 var _parchment = __webpack_require__(0);
6239
6240 var _parchment2 = _interopRequireDefault(_parchment);
6241
6242 var _color = __webpack_require__(26);
6243
6244 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6245
6246 var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
6247 scope: _parchment2.default.Scope.INLINE
6248 });
6249 var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
6250 scope: _parchment2.default.Scope.INLINE
6251 });
6252
6253 exports.BackgroundClass = BackgroundClass;
6254 exports.BackgroundStyle = BackgroundStyle;
6255
6256 /***/ }),
6257 /* 38 */
6258 /***/ (function(module, exports, __webpack_require__) {
6259
6260 "use strict";
6261
6262
6263 Object.defineProperty(exports, "__esModule", {
6264 value: true
6265 });
6266 exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
6267
6268 var _parchment = __webpack_require__(0);
6269
6270 var _parchment2 = _interopRequireDefault(_parchment);
6271
6272 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6273
6274 var config = {
6275 scope: _parchment2.default.Scope.BLOCK,
6276 whitelist: ['rtl']
6277 };
6278
6279 var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
6280 var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
6281 var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
6282
6283 exports.DirectionAttribute = DirectionAttribute;
6284 exports.DirectionClass = DirectionClass;
6285 exports.DirectionStyle = DirectionStyle;
6286
6287 /***/ }),
6288 /* 39 */
6289 /***/ (function(module, exports, __webpack_require__) {
6290
6291 "use strict";
6292
6293
6294 Object.defineProperty(exports, "__esModule", {
6295 value: true
6296 });
6297 exports.FontClass = exports.FontStyle = undefined;
6298
6299 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6300
6301 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
6302
6303 var _parchment = __webpack_require__(0);
6304
6305 var _parchment2 = _interopRequireDefault(_parchment);
6306
6307 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6308
6309 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6310
6311 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6312
6313 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6314
6315 var config = {
6316 scope: _parchment2.default.Scope.INLINE,
6317 whitelist: ['serif', 'monospace']
6318 };
6319
6320 var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
6321
6322 var FontStyleAttributor = function (_Parchment$Attributor) {
6323 _inherits(FontStyleAttributor, _Parchment$Attributor);
6324
6325 function FontStyleAttributor() {
6326 _classCallCheck(this, FontStyleAttributor);
6327
6328 return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
6329 }
6330
6331 _createClass(FontStyleAttributor, [{
6332 key: 'value',
6333 value: function value(node) {
6334 return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
6335 }
6336 }]);
6337
6338 return FontStyleAttributor;
6339 }(_parchment2.default.Attributor.Style);
6340
6341 var FontStyle = new FontStyleAttributor('font', 'font-family', config);
6342
6343 exports.FontStyle = FontStyle;
6344 exports.FontClass = FontClass;
6345
6346 /***/ }),
6347 /* 40 */
6348 /***/ (function(module, exports, __webpack_require__) {
6349
6350 "use strict";
6351
6352
6353 Object.defineProperty(exports, "__esModule", {
6354 value: true
6355 });
6356 exports.SizeStyle = exports.SizeClass = undefined;
6357
6358 var _parchment = __webpack_require__(0);
6359
6360 var _parchment2 = _interopRequireDefault(_parchment);
6361
6362 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6363
6364 var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
6365 scope: _parchment2.default.Scope.INLINE,
6366 whitelist: ['small', 'large', 'huge']
6367 });
6368 var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
6369 scope: _parchment2.default.Scope.INLINE,
6370 whitelist: ['10px', '18px', '32px']
6371 });
6372
6373 exports.SizeClass = SizeClass;
6374 exports.SizeStyle = SizeStyle;
6375
6376 /***/ }),
6377 /* 41 */
6378 /***/ (function(module, exports, __webpack_require__) {
6379
6380 "use strict";
6381
6382
6383 module.exports = {
6384 'align': {
6385 '': __webpack_require__(76),
6386 'center': __webpack_require__(77),
6387 'right': __webpack_require__(78),
6388 'justify': __webpack_require__(79)
6389 },
6390 'background': __webpack_require__(80),
6391 'blockquote': __webpack_require__(81),
6392 'bold': __webpack_require__(82),
6393 'clean': __webpack_require__(83),
6394 'code': __webpack_require__(58),
6395 'code-block': __webpack_require__(58),
6396 'color': __webpack_require__(84),
6397 'direction': {
6398 '': __webpack_require__(85),
6399 'rtl': __webpack_require__(86)
6400 },
6401 'float': {
6402 'center': __webpack_require__(87),
6403 'full': __webpack_require__(88),
6404 'left': __webpack_require__(89),
6405 'right': __webpack_require__(90)
6406 },
6407 'formula': __webpack_require__(91),
6408 'header': {
6409 '1': __webpack_require__(92),
6410 '2': __webpack_require__(93)
6411 },
6412 'italic': __webpack_require__(94),
6413 'image': __webpack_require__(95),
6414 'indent': {
6415 '+1': __webpack_require__(96),
6416 '-1': __webpack_require__(97)
6417 },
6418 'link': __webpack_require__(98),
6419 'list': {
6420 'ordered': __webpack_require__(99),
6421 'bullet': __webpack_require__(100),
6422 'check': __webpack_require__(101)
6423 },
6424 'script': {
6425 'sub': __webpack_require__(102),
6426 'super': __webpack_require__(103)
6427 },
6428 'strike': __webpack_require__(104),
6429 'underline': __webpack_require__(105),
6430 'video': __webpack_require__(106)
6431 };
6432
6433 /***/ }),
6434 /* 42 */
6435 /***/ (function(module, exports, __webpack_require__) {
6436
6437 "use strict";
6438
6439
6440 Object.defineProperty(exports, "__esModule", {
6441 value: true
6442 });
6443 exports.getLastChangeIndex = exports.default = undefined;
6444
6445 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6446
6447 var _parchment = __webpack_require__(0);
6448
6449 var _parchment2 = _interopRequireDefault(_parchment);
6450
6451 var _quill = __webpack_require__(5);
6452
6453 var _quill2 = _interopRequireDefault(_quill);
6454
6455 var _module = __webpack_require__(9);
6456
6457 var _module2 = _interopRequireDefault(_module);
6458
6459 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6460
6461 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6462
6463 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6464
6465 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6466
6467 var History = function (_Module) {
6468 _inherits(History, _Module);
6469
6470 function History(quill, options) {
6471 _classCallCheck(this, History);
6472
6473 var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
6474
6475 _this.lastRecorded = 0;
6476 _this.ignoreChange = false;
6477 _this.clear();
6478 _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
6479 if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
6480 if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
6481 _this.record(delta, oldDelta);
6482 } else {
6483 _this.transform(delta);
6484 }
6485 });
6486 _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
6487 _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
6488 if (/Win/i.test(navigator.platform)) {
6489 _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
6490 }
6491 return _this;
6492 }
6493
6494 _createClass(History, [{
6495 key: 'change',
6496 value: function change(source, dest) {
6497 if (this.stack[source].length === 0) return;
6498 var delta = this.stack[source].pop();
6499 this.stack[dest].push(delta);
6500 this.lastRecorded = 0;
6501 this.ignoreChange = true;
6502 this.quill.updateContents(delta[source], _quill2.default.sources.USER);
6503 this.ignoreChange = false;
6504 var index = getLastChangeIndex(delta[source]);
6505 this.quill.setSelection(index);
6506 }
6507 }, {
6508 key: 'clear',
6509 value: function clear() {
6510 this.stack = { undo: [], redo: [] };
6511 }
6512 }, {
6513 key: 'cutoff',
6514 value: function cutoff() {
6515 this.lastRecorded = 0;
6516 }
6517 }, {
6518 key: 'record',
6519 value: function record(changeDelta, oldDelta) {
6520 if (changeDelta.ops.length === 0) return;
6521 this.stack.redo = [];
6522 var undoDelta = this.quill.getContents().diff(oldDelta);
6523 var timestamp = Date.now();
6524 if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
6525 var delta = this.stack.undo.pop();
6526 undoDelta = undoDelta.compose(delta.undo);
6527 changeDelta = delta.redo.compose(changeDelta);
6528 } else {
6529 this.lastRecorded = timestamp;
6530 }
6531 this.stack.undo.push({
6532 redo: changeDelta,
6533 undo: undoDelta
6534 });
6535 if (this.stack.undo.length > this.options.maxStack) {
6536 this.stack.undo.shift();
6537 }
6538 }
6539 }, {
6540 key: 'redo',
6541 value: function redo() {
6542 this.change('redo', 'undo');
6543 }
6544 }, {
6545 key: 'transform',
6546 value: function transform(delta) {
6547 this.stack.undo.forEach(function (change) {
6548 change.undo = delta.transform(change.undo, true);
6549 change.redo = delta.transform(change.redo, true);
6550 });
6551 this.stack.redo.forEach(function (change) {
6552 change.undo = delta.transform(change.undo, true);
6553 change.redo = delta.transform(change.redo, true);
6554 });
6555 }
6556 }, {
6557 key: 'undo',
6558 value: function undo() {
6559 this.change('undo', 'redo');
6560 }
6561 }]);
6562
6563 return History;
6564 }(_module2.default);
6565
6566 History.DEFAULTS = {
6567 delay: 1000,
6568 maxStack: 100,
6569 userOnly: false
6570 };
6571
6572 function endsWithNewlineChange(delta) {
6573 var lastOp = delta.ops[delta.ops.length - 1];
6574 if (lastOp == null) return false;
6575 if (lastOp.insert != null) {
6576 return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
6577 }
6578 if (lastOp.attributes != null) {
6579 return Object.keys(lastOp.attributes).some(function (attr) {
6580 return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
6581 });
6582 }
6583 return false;
6584 }
6585
6586 function getLastChangeIndex(delta) {
6587 var deleteLength = delta.reduce(function (length, op) {
6588 length += op.delete || 0;
6589 return length;
6590 }, 0);
6591 var changeIndex = delta.length() - deleteLength;
6592 if (endsWithNewlineChange(delta)) {
6593 changeIndex -= 1;
6594 }
6595 return changeIndex;
6596 }
6597
6598 exports.default = History;
6599 exports.getLastChangeIndex = getLastChangeIndex;
6600
6601 /***/ }),
6602 /* 43 */
6603 /***/ (function(module, exports, __webpack_require__) {
6604
6605 "use strict";
6606
6607
6608 Object.defineProperty(exports, "__esModule", {
6609 value: true
6610 });
6611 exports.default = exports.BaseTooltip = undefined;
6612
6613 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6614
6615 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
6616
6617 var _extend = __webpack_require__(3);
6618
6619 var _extend2 = _interopRequireDefault(_extend);
6620
6621 var _quillDelta = __webpack_require__(2);
6622
6623 var _quillDelta2 = _interopRequireDefault(_quillDelta);
6624
6625 var _emitter = __webpack_require__(8);
6626
6627 var _emitter2 = _interopRequireDefault(_emitter);
6628
6629 var _keyboard = __webpack_require__(23);
6630
6631 var _keyboard2 = _interopRequireDefault(_keyboard);
6632
6633 var _theme = __webpack_require__(34);
6634
6635 var _theme2 = _interopRequireDefault(_theme);
6636
6637 var _colorPicker = __webpack_require__(59);
6638
6639 var _colorPicker2 = _interopRequireDefault(_colorPicker);
6640
6641 var _iconPicker = __webpack_require__(60);
6642
6643 var _iconPicker2 = _interopRequireDefault(_iconPicker);
6644
6645 var _picker = __webpack_require__(28);
6646
6647 var _picker2 = _interopRequireDefault(_picker);
6648
6649 var _tooltip = __webpack_require__(61);
6650
6651 var _tooltip2 = _interopRequireDefault(_tooltip);
6652
6653 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6654
6655 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6656
6657 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6658
6659 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
6660
6661 var ALIGNS = [false, 'center', 'right', 'justify'];
6662
6663 var COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
6664
6665 var FONTS = [false, 'serif', 'monospace'];
6666
6667 var HEADERS = ['1', '2', '3', false];
6668
6669 var SIZES = ['small', false, 'large', 'huge'];
6670
6671 var BaseTheme = function (_Theme) {
6672 _inherits(BaseTheme, _Theme);
6673
6674 function BaseTheme(quill, options) {
6675 _classCallCheck(this, BaseTheme);
6676
6677 var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
6678
6679 var listener = function listener(e) {
6680 if (!document.body.contains(quill.root)) {
6681 return document.body.removeEventListener('click', listener);
6682 }
6683 if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
6684 _this.tooltip.hide();
6685 }
6686 if (_this.pickers != null) {
6687 _this.pickers.forEach(function (picker) {
6688 if (!picker.container.contains(e.target)) {
6689 picker.close();
6690 }
6691 });
6692 }
6693 };
6694 quill.emitter.listenDOM('click', document.body, listener);
6695 return _this;
6696 }
6697
6698 _createClass(BaseTheme, [{
6699 key: 'addModule',
6700 value: function addModule(name) {
6701 var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
6702 if (name === 'toolbar') {
6703 this.extendToolbar(module);
6704 }
6705 return module;
6706 }
6707 }, {
6708 key: 'buildButtons',
6709 value: function buildButtons(buttons, icons) {
6710 buttons.forEach(function (button) {
6711 var className = button.getAttribute('class') || '';
6712 className.split(/\s+/).forEach(function (name) {
6713 if (!name.startsWith('ql-')) return;
6714 name = name.slice('ql-'.length);
6715 if (icons[name] == null) return;
6716 if (name === 'direction') {
6717 button.innerHTML = icons[name][''] + icons[name]['rtl'];
6718 } else if (typeof icons[name] === 'string') {
6719 button.innerHTML = icons[name];
6720 } else {
6721 var value = button.value || '';
6722 if (value != null && icons[name][value]) {
6723 button.innerHTML = icons[name][value];
6724 }
6725 }
6726 });
6727 });
6728 }
6729 }, {
6730 key: 'buildPickers',
6731 value: function buildPickers(selects, icons) {
6732 var _this2 = this;
6733
6734 this.pickers = selects.map(function (select) {
6735 if (select.classList.contains('ql-align')) {
6736 if (select.querySelector('option') == null) {
6737 fillSelect(select, ALIGNS);
6738 }
6739 return new _iconPicker2.default(select, icons.align);
6740 } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
6741 var format = select.classList.contains('ql-background') ? 'background' : 'color';
6742 if (select.querySelector('option') == null) {
6743 fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
6744 }
6745 return new _colorPicker2.default(select, icons[format]);
6746 } else {
6747 if (select.querySelector('option') == null) {
6748 if (select.classList.contains('ql-font')) {
6749 fillSelect(select, FONTS);
6750 } else if (select.classList.contains('ql-header')) {
6751 fillSelect(select, HEADERS);
6752 } else if (select.classList.contains('ql-size')) {
6753 fillSelect(select, SIZES);
6754 }
6755 }
6756 return new _picker2.default(select);
6757 }
6758 });
6759 var update = function update() {
6760 _this2.pickers.forEach(function (picker) {
6761 picker.update();
6762 });
6763 };
6764 this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
6765 }
6766 }]);
6767
6768 return BaseTheme;
6769 }(_theme2.default);
6770
6771 BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
6772 modules: {
6773 toolbar: {
6774 handlers: {
6775 formula: function formula() {
6776 this.quill.theme.tooltip.edit('formula');
6777 },
6778 image: function image() {
6779 var _this3 = this;
6780
6781 var fileInput = this.container.querySelector('input.ql-image[type=file]');
6782 if (fileInput == null) {
6783 fileInput = document.createElement('input');
6784 fileInput.setAttribute('type', 'file');
6785 fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
6786 fileInput.classList.add('ql-image');
6787 fileInput.addEventListener('change', function () {
6788 if (fileInput.files != null && fileInput.files[0] != null) {
6789 var reader = new FileReader();
6790 reader.onload = function (e) {
6791 var range = _this3.quill.getSelection(true);
6792 _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
6793 _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);
6794 fileInput.value = "";
6795 };
6796 reader.readAsDataURL(fileInput.files[0]);
6797 }
6798 });
6799 this.container.appendChild(fileInput);
6800 }
6801 fileInput.click();
6802 },
6803 video: function video() {
6804 this.quill.theme.tooltip.edit('video');
6805 }
6806 }
6807 }
6808 }
6809 });
6810
6811 var BaseTooltip = function (_Tooltip) {
6812 _inherits(BaseTooltip, _Tooltip);
6813
6814 function BaseTooltip(quill, boundsContainer) {
6815 _classCallCheck(this, BaseTooltip);
6816
6817 var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
6818
6819 _this4.textbox = _this4.root.querySelector('input[type="text"]');
6820 _this4.listen();
6821 return _this4;
6822 }
6823
6824 _createClass(BaseTooltip, [{
6825 key: 'listen',
6826 value: function listen() {
6827 var _this5 = this;
6828
6829 this.textbox.addEventListener('keydown', function (event) {
6830 if (_keyboard2.default.match(event, 'enter')) {
6831 _this5.save();
6832 event.preventDefault();
6833 } else if (_keyboard2.default.match(event, 'escape')) {
6834 _this5.cancel();
6835 event.preventDefault();
6836 }
6837 });
6838 }
6839 }, {
6840 key: 'cancel',
6841 value: function cancel() {
6842 this.hide();
6843 }
6844 }, {
6845 key: 'edit',
6846 value: function edit() {
6847 var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
6848 var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
6849
6850 this.root.classList.remove('ql-hidden');
6851 this.root.classList.add('ql-editing');
6852 if (preview != null) {
6853 this.textbox.value = preview;
6854 } else if (mode !== this.root.getAttribute('data-mode')) {
6855 this.textbox.value = '';
6856 }
6857 this.position(this.quill.getBounds(this.quill.selection.savedRange));
6858 this.textbox.select();
6859 this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
6860 this.root.setAttribute('data-mode', mode);
6861 }
6862 }, {
6863 key: 'restoreFocus',
6864 value: function restoreFocus() {
6865 var scrollTop = this.quill.scrollingContainer.scrollTop;
6866 this.quill.focus();
6867 this.quill.scrollingContainer.scrollTop = scrollTop;
6868 }
6869 }, {
6870 key: 'save',
6871 value: function save() {
6872 var value = this.textbox.value;
6873 switch (this.root.getAttribute('data-mode')) {
6874 case 'link':
6875 {
6876 var scrollTop = this.quill.root.scrollTop;
6877 if (this.linkRange) {
6878 this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
6879 delete this.linkRange;
6880 } else {
6881 this.restoreFocus();
6882 this.quill.format('link', value, _emitter2.default.sources.USER);
6883 }
6884 this.quill.root.scrollTop = scrollTop;
6885 break;
6886 }
6887 case 'video':
6888 {
6889 value = extractVideoUrl(value);
6890 } // eslint-disable-next-line no-fallthrough
6891 case 'formula':
6892 {
6893 if (!value) break;
6894 var range = this.quill.getSelection(true);
6895 if (range != null) {
6896 var index = range.index + range.length;
6897 this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
6898 if (this.root.getAttribute('data-mode') === 'formula') {
6899 this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
6900 }
6901 this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
6902 }
6903 break;
6904 }
6905 default:
6906 }
6907 this.textbox.value = '';
6908 this.hide();
6909 }
6910 }]);
6911
6912 return BaseTooltip;
6913 }(_tooltip2.default);
6914
6915 function extractVideoUrl(url) {
6916 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_-]+)/);
6917 if (match) {
6918 return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
6919 }
6920 if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
6921 // eslint-disable-line no-cond-assign
6922 return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';
6923 }
6924 return url;
6925 }
6926
6927 function fillSelect(select, values) {
6928 var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6929
6930 values.forEach(function (value) {
6931 var option = document.createElement('option');
6932 if (value === defaultValue) {
6933 option.setAttribute('selected', 'selected');
6934 } else {
6935 option.setAttribute('value', value);
6936 }
6937 select.appendChild(option);
6938 });
6939 }
6940
6941 exports.BaseTooltip = BaseTooltip;
6942 exports.default = BaseTheme;
6943
6944 /***/ }),
6945 /* 44 */
6946 /***/ (function(module, exports, __webpack_require__) {
6947
6948 "use strict";
6949
6950 Object.defineProperty(exports, "__esModule", { value: true });
6951 var LinkedList = /** @class */ (function () {
6952 function LinkedList() {
6953 this.head = this.tail = null;
6954 this.length = 0;
6955 }
6956 LinkedList.prototype.append = function () {
6957 var nodes = [];
6958 for (var _i = 0; _i < arguments.length; _i++) {
6959 nodes[_i] = arguments[_i];
6960 }
6961 this.insertBefore(nodes[0], null);
6962 if (nodes.length > 1) {
6963 this.append.apply(this, nodes.slice(1));
6964 }
6965 };
6966 LinkedList.prototype.contains = function (node) {
6967 var cur, next = this.iterator();
6968 while ((cur = next())) {
6969 if (cur === node)
6970 return true;
6971 }
6972 return false;
6973 };
6974 LinkedList.prototype.insertBefore = function (node, refNode) {
6975 if (!node)
6976 return;
6977 node.next = refNode;
6978 if (refNode != null) {
6979 node.prev = refNode.prev;
6980 if (refNode.prev != null) {
6981 refNode.prev.next = node;
6982 }
6983 refNode.prev = node;
6984 if (refNode === this.head) {
6985 this.head = node;
6986 }
6987 }
6988 else if (this.tail != null) {
6989 this.tail.next = node;
6990 node.prev = this.tail;
6991 this.tail = node;
6992 }
6993 else {
6994 node.prev = null;
6995 this.head = this.tail = node;
6996 }
6997 this.length += 1;
6998 };
6999 LinkedList.prototype.offset = function (target) {
7000 var index = 0, cur = this.head;
7001 while (cur != null) {
7002 if (cur === target)
7003 return index;
7004 index += cur.length();
7005 cur = cur.next;
7006 }
7007 return -1;
7008 };
7009 LinkedList.prototype.remove = function (node) {
7010 if (!this.contains(node))
7011 return;
7012 if (node.prev != null)
7013 node.prev.next = node.next;
7014 if (node.next != null)
7015 node.next.prev = node.prev;
7016 if (node === this.head)
7017 this.head = node.next;
7018 if (node === this.tail)
7019 this.tail = node.prev;
7020 this.length -= 1;
7021 };
7022 LinkedList.prototype.iterator = function (curNode) {
7023 if (curNode === void 0) { curNode = this.head; }
7024 // TODO use yield when we can
7025 return function () {
7026 var ret = curNode;
7027 if (curNode != null)
7028 curNode = curNode.next;
7029 return ret;
7030 };
7031 };
7032 LinkedList.prototype.find = function (index, inclusive) {
7033 if (inclusive === void 0) { inclusive = false; }
7034 var cur, next = this.iterator();
7035 while ((cur = next())) {
7036 var length = cur.length();
7037 if (index < length ||
7038 (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
7039 return [cur, index];
7040 }
7041 index -= length;
7042 }
7043 return [null, 0];
7044 };
7045 LinkedList.prototype.forEach = function (callback) {
7046 var cur, next = this.iterator();
7047 while ((cur = next())) {
7048 callback(cur);
7049 }
7050 };
7051 LinkedList.prototype.forEachAt = function (index, length, callback) {
7052 if (length <= 0)
7053 return;
7054 var _a = this.find(index), startNode = _a[0], offset = _a[1];
7055 var cur, curIndex = index - offset, next = this.iterator(startNode);
7056 while ((cur = next()) && curIndex < index + length) {
7057 var curLength = cur.length();
7058 if (index > curIndex) {
7059 callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
7060 }
7061 else {
7062 callback(cur, 0, Math.min(curLength, index + length - curIndex));
7063 }
7064 curIndex += curLength;
7065 }
7066 };
7067 LinkedList.prototype.map = function (callback) {
7068 return this.reduce(function (memo, cur) {
7069 memo.push(callback(cur));
7070 return memo;
7071 }, []);
7072 };
7073 LinkedList.prototype.reduce = function (callback, memo) {
7074 var cur, next = this.iterator();
7075 while ((cur = next())) {
7076 memo = callback(memo, cur);
7077 }
7078 return memo;
7079 };
7080 return LinkedList;
7081 }());
7082 exports.default = LinkedList;
7083
7084
7085 /***/ }),
7086 /* 45 */
7087 /***/ (function(module, exports, __webpack_require__) {
7088
7089 "use strict";
7090
7091 var __extends = (this && this.__extends) || (function () {
7092 var extendStatics = Object.setPrototypeOf ||
7093 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7094 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7095 return function (d, b) {
7096 extendStatics(d, b);
7097 function __() { this.constructor = d; }
7098 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7099 };
7100 })();
7101 Object.defineProperty(exports, "__esModule", { value: true });
7102 var container_1 = __webpack_require__(17);
7103 var Registry = __webpack_require__(1);
7104 var OBSERVER_CONFIG = {
7105 attributes: true,
7106 characterData: true,
7107 characterDataOldValue: true,
7108 childList: true,
7109 subtree: true,
7110 };
7111 var MAX_OPTIMIZE_ITERATIONS = 100;
7112 var ScrollBlot = /** @class */ (function (_super) {
7113 __extends(ScrollBlot, _super);
7114 function ScrollBlot(node) {
7115 var _this = _super.call(this, node) || this;
7116 _this.scroll = _this;
7117 _this.observer = new MutationObserver(function (mutations) {
7118 _this.update(mutations);
7119 });
7120 _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
7121 _this.attach();
7122 return _this;
7123 }
7124 ScrollBlot.prototype.detach = function () {
7125 _super.prototype.detach.call(this);
7126 this.observer.disconnect();
7127 };
7128 ScrollBlot.prototype.deleteAt = function (index, length) {
7129 this.update();
7130 if (index === 0 && length === this.length()) {
7131 this.children.forEach(function (child) {
7132 child.remove();
7133 });
7134 }
7135 else {
7136 _super.prototype.deleteAt.call(this, index, length);
7137 }
7138 };
7139 ScrollBlot.prototype.formatAt = function (index, length, name, value) {
7140 this.update();
7141 _super.prototype.formatAt.call(this, index, length, name, value);
7142 };
7143 ScrollBlot.prototype.insertAt = function (index, value, def) {
7144 this.update();
7145 _super.prototype.insertAt.call(this, index, value, def);
7146 };
7147 ScrollBlot.prototype.optimize = function (mutations, context) {
7148 var _this = this;
7149 if (mutations === void 0) { mutations = []; }
7150 if (context === void 0) { context = {}; }
7151 _super.prototype.optimize.call(this, context);
7152 // We must modify mutations directly, cannot make copy and then modify
7153 var records = [].slice.call(this.observer.takeRecords());
7154 // Array.push currently seems to be implemented by a non-tail recursive function
7155 // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
7156 while (records.length > 0)
7157 mutations.push(records.pop());
7158 // TODO use WeakMap
7159 var mark = function (blot, markParent) {
7160 if (markParent === void 0) { markParent = true; }
7161 if (blot == null || blot === _this)
7162 return;
7163 if (blot.domNode.parentNode == null)
7164 return;
7165 // @ts-ignore
7166 if (blot.domNode[Registry.DATA_KEY].mutations == null) {
7167 // @ts-ignore
7168 blot.domNode[Registry.DATA_KEY].mutations = [];
7169 }
7170 if (markParent)
7171 mark(blot.parent);
7172 };
7173 var optimize = function (blot) {
7174 // Post-order traversal
7175 if (
7176 // @ts-ignore
7177 blot.domNode[Registry.DATA_KEY] == null ||
7178 // @ts-ignore
7179 blot.domNode[Registry.DATA_KEY].mutations == null) {
7180 return;
7181 }
7182 if (blot instanceof container_1.default) {
7183 blot.children.forEach(optimize);
7184 }
7185 blot.optimize(context);
7186 };
7187 var remaining = mutations;
7188 for (var i = 0; remaining.length > 0; i += 1) {
7189 if (i >= MAX_OPTIMIZE_ITERATIONS) {
7190 throw new Error('[Parchment] Maximum optimize iterations reached');
7191 }
7192 remaining.forEach(function (mutation) {
7193 var blot = Registry.find(mutation.target, true);
7194 if (blot == null)
7195 return;
7196 if (blot.domNode === mutation.target) {
7197 if (mutation.type === 'childList') {
7198 mark(Registry.find(mutation.previousSibling, false));
7199 [].forEach.call(mutation.addedNodes, function (node) {
7200 var child = Registry.find(node, false);
7201 mark(child, false);
7202 if (child instanceof container_1.default) {
7203 child.children.forEach(function (grandChild) {
7204 mark(grandChild, false);
7205 });
7206 }
7207 });
7208 }
7209 else if (mutation.type === 'attributes') {
7210 mark(blot.prev);
7211 }
7212 }
7213 mark(blot);
7214 });
7215 this.children.forEach(optimize);
7216 remaining = [].slice.call(this.observer.takeRecords());
7217 records = remaining.slice();
7218 while (records.length > 0)
7219 mutations.push(records.pop());
7220 }
7221 };
7222 ScrollBlot.prototype.update = function (mutations, context) {
7223 var _this = this;
7224 if (context === void 0) { context = {}; }
7225 mutations = mutations || this.observer.takeRecords();
7226 // TODO use WeakMap
7227 mutations
7228 .map(function (mutation) {
7229 var blot = Registry.find(mutation.target, true);
7230 if (blot == null)
7231 return null;
7232 // @ts-ignore
7233 if (blot.domNode[Registry.DATA_KEY].mutations == null) {
7234 // @ts-ignore
7235 blot.domNode[Registry.DATA_KEY].mutations = [mutation];
7236 return blot;
7237 }
7238 else {
7239 // @ts-ignore
7240 blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
7241 return null;
7242 }
7243 })
7244 .forEach(function (blot) {
7245 if (blot == null ||
7246 blot === _this ||
7247 //@ts-ignore
7248 blot.domNode[Registry.DATA_KEY] == null)
7249 return;
7250 // @ts-ignore
7251 blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);
7252 });
7253 // @ts-ignore
7254 if (this.domNode[Registry.DATA_KEY].mutations != null) {
7255 // @ts-ignore
7256 _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);
7257 }
7258 this.optimize(mutations, context);
7259 };
7260 ScrollBlot.blotName = 'scroll';
7261 ScrollBlot.defaultChild = 'block';
7262 ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
7263 ScrollBlot.tagName = 'DIV';
7264 return ScrollBlot;
7265 }(container_1.default));
7266 exports.default = ScrollBlot;
7267
7268
7269 /***/ }),
7270 /* 46 */
7271 /***/ (function(module, exports, __webpack_require__) {
7272
7273 "use strict";
7274
7275 var __extends = (this && this.__extends) || (function () {
7276 var extendStatics = Object.setPrototypeOf ||
7277 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7278 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7279 return function (d, b) {
7280 extendStatics(d, b);
7281 function __() { this.constructor = d; }
7282 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7283 };
7284 })();
7285 Object.defineProperty(exports, "__esModule", { value: true });
7286 var format_1 = __webpack_require__(18);
7287 var Registry = __webpack_require__(1);
7288 // Shallow object comparison
7289 function isEqual(obj1, obj2) {
7290 if (Object.keys(obj1).length !== Object.keys(obj2).length)
7291 return false;
7292 // @ts-ignore
7293 for (var prop in obj1) {
7294 // @ts-ignore
7295 if (obj1[prop] !== obj2[prop])
7296 return false;
7297 }
7298 return true;
7299 }
7300 var InlineBlot = /** @class */ (function (_super) {
7301 __extends(InlineBlot, _super);
7302 function InlineBlot() {
7303 return _super !== null && _super.apply(this, arguments) || this;
7304 }
7305 InlineBlot.formats = function (domNode) {
7306 if (domNode.tagName === InlineBlot.tagName)
7307 return undefined;
7308 return _super.formats.call(this, domNode);
7309 };
7310 InlineBlot.prototype.format = function (name, value) {
7311 var _this = this;
7312 if (name === this.statics.blotName && !value) {
7313 this.children.forEach(function (child) {
7314 if (!(child instanceof format_1.default)) {
7315 child = child.wrap(InlineBlot.blotName, true);
7316 }
7317 _this.attributes.copy(child);
7318 });
7319 this.unwrap();
7320 }
7321 else {
7322 _super.prototype.format.call(this, name, value);
7323 }
7324 };
7325 InlineBlot.prototype.formatAt = function (index, length, name, value) {
7326 if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
7327 var blot = this.isolate(index, length);
7328 blot.format(name, value);
7329 }
7330 else {
7331 _super.prototype.formatAt.call(this, index, length, name, value);
7332 }
7333 };
7334 InlineBlot.prototype.optimize = function (context) {
7335 _super.prototype.optimize.call(this, context);
7336 var formats = this.formats();
7337 if (Object.keys(formats).length === 0) {
7338 return this.unwrap(); // unformatted span
7339 }
7340 var next = this.next;
7341 if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
7342 next.moveChildren(this);
7343 next.remove();
7344 }
7345 };
7346 InlineBlot.blotName = 'inline';
7347 InlineBlot.scope = Registry.Scope.INLINE_BLOT;
7348 InlineBlot.tagName = 'SPAN';
7349 return InlineBlot;
7350 }(format_1.default));
7351 exports.default = InlineBlot;
7352
7353
7354 /***/ }),
7355 /* 47 */
7356 /***/ (function(module, exports, __webpack_require__) {
7357
7358 "use strict";
7359
7360 var __extends = (this && this.__extends) || (function () {
7361 var extendStatics = Object.setPrototypeOf ||
7362 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7363 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7364 return function (d, b) {
7365 extendStatics(d, b);
7366 function __() { this.constructor = d; }
7367 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7368 };
7369 })();
7370 Object.defineProperty(exports, "__esModule", { value: true });
7371 var format_1 = __webpack_require__(18);
7372 var Registry = __webpack_require__(1);
7373 var BlockBlot = /** @class */ (function (_super) {
7374 __extends(BlockBlot, _super);
7375 function BlockBlot() {
7376 return _super !== null && _super.apply(this, arguments) || this;
7377 }
7378 BlockBlot.formats = function (domNode) {
7379 var tagName = Registry.query(BlockBlot.blotName).tagName;
7380 if (domNode.tagName === tagName)
7381 return undefined;
7382 return _super.formats.call(this, domNode);
7383 };
7384 BlockBlot.prototype.format = function (name, value) {
7385 if (Registry.query(name, Registry.Scope.BLOCK) == null) {
7386 return;
7387 }
7388 else if (name === this.statics.blotName && !value) {
7389 this.replaceWith(BlockBlot.blotName);
7390 }
7391 else {
7392 _super.prototype.format.call(this, name, value);
7393 }
7394 };
7395 BlockBlot.prototype.formatAt = function (index, length, name, value) {
7396 if (Registry.query(name, Registry.Scope.BLOCK) != null) {
7397 this.format(name, value);
7398 }
7399 else {
7400 _super.prototype.formatAt.call(this, index, length, name, value);
7401 }
7402 };
7403 BlockBlot.prototype.insertAt = function (index, value, def) {
7404 if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
7405 // Insert text or inline
7406 _super.prototype.insertAt.call(this, index, value, def);
7407 }
7408 else {
7409 var after = this.split(index);
7410 var blot = Registry.create(value, def);
7411 after.parent.insertBefore(blot, after);
7412 }
7413 };
7414 BlockBlot.prototype.update = function (mutations, context) {
7415 if (navigator.userAgent.match(/Trident/)) {
7416 this.build();
7417 }
7418 else {
7419 _super.prototype.update.call(this, mutations, context);
7420 }
7421 };
7422 BlockBlot.blotName = 'block';
7423 BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
7424 BlockBlot.tagName = 'P';
7425 return BlockBlot;
7426 }(format_1.default));
7427 exports.default = BlockBlot;
7428
7429
7430 /***/ }),
7431 /* 48 */
7432 /***/ (function(module, exports, __webpack_require__) {
7433
7434 "use strict";
7435
7436 var __extends = (this && this.__extends) || (function () {
7437 var extendStatics = Object.setPrototypeOf ||
7438 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7439 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7440 return function (d, b) {
7441 extendStatics(d, b);
7442 function __() { this.constructor = d; }
7443 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7444 };
7445 })();
7446 Object.defineProperty(exports, "__esModule", { value: true });
7447 var leaf_1 = __webpack_require__(19);
7448 var EmbedBlot = /** @class */ (function (_super) {
7449 __extends(EmbedBlot, _super);
7450 function EmbedBlot() {
7451 return _super !== null && _super.apply(this, arguments) || this;
7452 }
7453 EmbedBlot.formats = function (domNode) {
7454 return undefined;
7455 };
7456 EmbedBlot.prototype.format = function (name, value) {
7457 // super.formatAt wraps, which is what we want in general,
7458 // but this allows subclasses to overwrite for formats
7459 // that just apply to particular embeds
7460 _super.prototype.formatAt.call(this, 0, this.length(), name, value);
7461 };
7462 EmbedBlot.prototype.formatAt = function (index, length, name, value) {
7463 if (index === 0 && length === this.length()) {
7464 this.format(name, value);
7465 }
7466 else {
7467 _super.prototype.formatAt.call(this, index, length, name, value);
7468 }
7469 };
7470 EmbedBlot.prototype.formats = function () {
7471 return this.statics.formats(this.domNode);
7472 };
7473 return EmbedBlot;
7474 }(leaf_1.default));
7475 exports.default = EmbedBlot;
7476
7477
7478 /***/ }),
7479 /* 49 */
7480 /***/ (function(module, exports, __webpack_require__) {
7481
7482 "use strict";
7483
7484 var __extends = (this && this.__extends) || (function () {
7485 var extendStatics = Object.setPrototypeOf ||
7486 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7487 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7488 return function (d, b) {
7489 extendStatics(d, b);
7490 function __() { this.constructor = d; }
7491 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7492 };
7493 })();
7494 Object.defineProperty(exports, "__esModule", { value: true });
7495 var leaf_1 = __webpack_require__(19);
7496 var Registry = __webpack_require__(1);
7497 var TextBlot = /** @class */ (function (_super) {
7498 __extends(TextBlot, _super);
7499 function TextBlot(node) {
7500 var _this = _super.call(this, node) || this;
7501 _this.text = _this.statics.value(_this.domNode);
7502 return _this;
7503 }
7504 TextBlot.create = function (value) {
7505 return document.createTextNode(value);
7506 };
7507 TextBlot.value = function (domNode) {
7508 var text = domNode.data;
7509 // @ts-ignore
7510 if (text['normalize'])
7511 text = text['normalize']();
7512 return text;
7513 };
7514 TextBlot.prototype.deleteAt = function (index, length) {
7515 this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
7516 };
7517 TextBlot.prototype.index = function (node, offset) {
7518 if (this.domNode === node) {
7519 return offset;
7520 }
7521 return -1;
7522 };
7523 TextBlot.prototype.insertAt = function (index, value, def) {
7524 if (def == null) {
7525 this.text = this.text.slice(0, index) + value + this.text.slice(index);
7526 this.domNode.data = this.text;
7527 }
7528 else {
7529 _super.prototype.insertAt.call(this, index, value, def);
7530 }
7531 };
7532 TextBlot.prototype.length = function () {
7533 return this.text.length;
7534 };
7535 TextBlot.prototype.optimize = function (context) {
7536 _super.prototype.optimize.call(this, context);
7537 this.text = this.statics.value(this.domNode);
7538 if (this.text.length === 0) {
7539 this.remove();
7540 }
7541 else if (this.next instanceof TextBlot && this.next.prev === this) {
7542 this.insertAt(this.length(), this.next.value());
7543 this.next.remove();
7544 }
7545 };
7546 TextBlot.prototype.position = function (index, inclusive) {
7547 if (inclusive === void 0) { inclusive = false; }
7548 return [this.domNode, index];
7549 };
7550 TextBlot.prototype.split = function (index, force) {
7551 if (force === void 0) { force = false; }
7552 if (!force) {
7553 if (index === 0)
7554 return this;
7555 if (index === this.length())
7556 return this.next;
7557 }
7558 var after = Registry.create(this.domNode.splitText(index));
7559 this.parent.insertBefore(after, this.next);
7560 this.text = this.statics.value(this.domNode);
7561 return after;
7562 };
7563 TextBlot.prototype.update = function (mutations, context) {
7564 var _this = this;
7565 if (mutations.some(function (mutation) {
7566 return mutation.type === 'characterData' && mutation.target === _this.domNode;
7567 })) {
7568 this.text = this.statics.value(this.domNode);
7569 }
7570 };
7571 TextBlot.prototype.value = function () {
7572 return this.text;
7573 };
7574 TextBlot.blotName = 'text';
7575 TextBlot.scope = Registry.Scope.INLINE_BLOT;
7576 return TextBlot;
7577 }(leaf_1.default));
7578 exports.default = TextBlot;
7579
7580
7581 /***/ }),
7582 /* 50 */
7583 /***/ (function(module, exports, __webpack_require__) {
7584
7585 "use strict";
7586
7587
7588 var elem = document.createElement('div');
7589 elem.classList.toggle('test-class', false);
7590 if (elem.classList.contains('test-class')) {
7591 var _toggle = DOMTokenList.prototype.toggle;
7592 DOMTokenList.prototype.toggle = function (token, force) {
7593 if (arguments.length > 1 && !this.contains(token) === !force) {
7594 return force;
7595 } else {
7596 return _toggle.call(this, token);
7597 }
7598 };
7599 }
7600
7601 if (!String.prototype.startsWith) {
7602 String.prototype.startsWith = function (searchString, position) {
7603 position = position || 0;
7604 return this.substr(position, searchString.length) === searchString;
7605 };
7606 }
7607
7608 if (!String.prototype.endsWith) {
7609 String.prototype.endsWith = function (searchString, position) {
7610 var subjectString = this.toString();
7611 if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
7612 position = subjectString.length;
7613 }
7614 position -= searchString.length;
7615 var lastIndex = subjectString.indexOf(searchString, position);
7616 return lastIndex !== -1 && lastIndex === position;
7617 };
7618 }
7619
7620 if (!Array.prototype.find) {
7621 Object.defineProperty(Array.prototype, "find", {
7622 value: function value(predicate) {
7623 if (this === null) {
7624 throw new TypeError('Array.prototype.find called on null or undefined');
7625 }
7626 if (typeof predicate !== 'function') {
7627 throw new TypeError('predicate must be a function');
7628 }
7629 var list = Object(this);
7630 var length = list.length >>> 0;
7631 var thisArg = arguments[1];
7632 var value;
7633
7634 for (var i = 0; i < length; i++) {
7635 value = list[i];
7636 if (predicate.call(thisArg, value, i, list)) {
7637 return value;
7638 }
7639 }
7640 return undefined;
7641 }
7642 });
7643 }
7644
7645 document.addEventListener("DOMContentLoaded", function () {
7646 // Disable resizing in Firefox
7647 document.execCommand("enableObjectResizing", false, false);
7648 // Disable automatic linkifying in IE11
7649 document.execCommand("autoUrlDetect", false, false);
7650 });
7651
7652 /***/ }),
7653 /* 51 */
7654 /***/ (function(module, exports) {
7655
7656 /**
7657 * This library modifies the diff-patch-match library by Neil Fraser
7658 * by removing the patch and match functionality and certain advanced
7659 * options in the diff function. The original license is as follows:
7660 *
7661 * ===
7662 *
7663 * Diff Match and Patch
7664 *
7665 * Copyright 2006 Google Inc.
7666 * http://code.google.com/p/google-diff-match-patch/
7667 *
7668 * Licensed under the Apache License, Version 2.0 (the "License");
7669 * you may not use this file except in compliance with the License.
7670 * You may obtain a copy of the License at
7671 *
7672 * http://www.apache.org/licenses/LICENSE-2.0
7673 *
7674 * Unless required by applicable law or agreed to in writing, software
7675 * distributed under the License is distributed on an "AS IS" BASIS,
7676 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7677 * See the License for the specific language governing permissions and
7678 * limitations under the License.
7679 */
7680
7681
7682 /**
7683 * The data structure representing a diff is an array of tuples:
7684 * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
7685 * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
7686 */
7687 var DIFF_DELETE = -1;
7688 var DIFF_INSERT = 1;
7689 var DIFF_EQUAL = 0;
7690
7691
7692 /**
7693 * Find the differences between two texts. Simplifies the problem by stripping
7694 * any common prefix or suffix off the texts before diffing.
7695 * @param {string} text1 Old string to be diffed.
7696 * @param {string} text2 New string to be diffed.
7697 * @param {Int} cursor_pos Expected edit position in text1 (optional)
7698 * @return {Array} Array of diff tuples.
7699 */
7700 function diff_main(text1, text2, cursor_pos) {
7701 // Check for equality (speedup).
7702 if (text1 == text2) {
7703 if (text1) {
7704 return [[DIFF_EQUAL, text1]];
7705 }
7706 return [];
7707 }
7708
7709 // Check cursor_pos within bounds
7710 if (cursor_pos < 0 || text1.length < cursor_pos) {
7711 cursor_pos = null;
7712 }
7713
7714 // Trim off common prefix (speedup).
7715 var commonlength = diff_commonPrefix(text1, text2);
7716 var commonprefix = text1.substring(0, commonlength);
7717 text1 = text1.substring(commonlength);
7718 text2 = text2.substring(commonlength);
7719
7720 // Trim off common suffix (speedup).
7721 commonlength = diff_commonSuffix(text1, text2);
7722 var commonsuffix = text1.substring(text1.length - commonlength);
7723 text1 = text1.substring(0, text1.length - commonlength);
7724 text2 = text2.substring(0, text2.length - commonlength);
7725
7726 // Compute the diff on the middle block.
7727 var diffs = diff_compute_(text1, text2);
7728
7729 // Restore the prefix and suffix.
7730 if (commonprefix) {
7731 diffs.unshift([DIFF_EQUAL, commonprefix]);
7732 }
7733 if (commonsuffix) {
7734 diffs.push([DIFF_EQUAL, commonsuffix]);
7735 }
7736 diff_cleanupMerge(diffs);
7737 if (cursor_pos != null) {
7738 diffs = fix_cursor(diffs, cursor_pos);
7739 }
7740 diffs = fix_emoji(diffs);
7741 return diffs;
7742 };
7743
7744
7745 /**
7746 * Find the differences between two texts. Assumes that the texts do not
7747 * have any common prefix or suffix.
7748 * @param {string} text1 Old string to be diffed.
7749 * @param {string} text2 New string to be diffed.
7750 * @return {Array} Array of diff tuples.
7751 */
7752 function diff_compute_(text1, text2) {
7753 var diffs;
7754
7755 if (!text1) {
7756 // Just add some text (speedup).
7757 return [[DIFF_INSERT, text2]];
7758 }
7759
7760 if (!text2) {
7761 // Just delete some text (speedup).
7762 return [[DIFF_DELETE, text1]];
7763 }
7764
7765 var longtext = text1.length > text2.length ? text1 : text2;
7766 var shorttext = text1.length > text2.length ? text2 : text1;
7767 var i = longtext.indexOf(shorttext);
7768 if (i != -1) {
7769 // Shorter text is inside the longer text (speedup).
7770 diffs = [[DIFF_INSERT, longtext.substring(0, i)],
7771 [DIFF_EQUAL, shorttext],
7772 [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
7773 // Swap insertions for deletions if diff is reversed.
7774 if (text1.length > text2.length) {
7775 diffs[0][0] = diffs[2][0] = DIFF_DELETE;
7776 }
7777 return diffs;
7778 }
7779
7780 if (shorttext.length == 1) {
7781 // Single character string.
7782 // After the previous speedup, the character can't be an equality.
7783 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
7784 }
7785
7786 // Check to see if the problem can be split in two.
7787 var hm = diff_halfMatch_(text1, text2);
7788 if (hm) {
7789 // A half-match was found, sort out the return data.
7790 var text1_a = hm[0];
7791 var text1_b = hm[1];
7792 var text2_a = hm[2];
7793 var text2_b = hm[3];
7794 var mid_common = hm[4];
7795 // Send both pairs off for separate processing.
7796 var diffs_a = diff_main(text1_a, text2_a);
7797 var diffs_b = diff_main(text1_b, text2_b);
7798 // Merge the results.
7799 return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
7800 }
7801
7802 return diff_bisect_(text1, text2);
7803 };
7804
7805
7806 /**
7807 * Find the 'middle snake' of a diff, split the problem in two
7808 * and return the recursively constructed diff.
7809 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
7810 * @param {string} text1 Old string to be diffed.
7811 * @param {string} text2 New string to be diffed.
7812 * @return {Array} Array of diff tuples.
7813 * @private
7814 */
7815 function diff_bisect_(text1, text2) {
7816 // Cache the text lengths to prevent multiple calls.
7817 var text1_length = text1.length;
7818 var text2_length = text2.length;
7819 var max_d = Math.ceil((text1_length + text2_length) / 2);
7820 var v_offset = max_d;
7821 var v_length = 2 * max_d;
7822 var v1 = new Array(v_length);
7823 var v2 = new Array(v_length);
7824 // Setting all elements to -1 is faster in Chrome & Firefox than mixing
7825 // integers and undefined.
7826 for (var x = 0; x < v_length; x++) {
7827 v1[x] = -1;
7828 v2[x] = -1;
7829 }
7830 v1[v_offset + 1] = 0;
7831 v2[v_offset + 1] = 0;
7832 var delta = text1_length - text2_length;
7833 // If the total number of characters is odd, then the front path will collide
7834 // with the reverse path.
7835 var front = (delta % 2 != 0);
7836 // Offsets for start and end of k loop.
7837 // Prevents mapping of space beyond the grid.
7838 var k1start = 0;
7839 var k1end = 0;
7840 var k2start = 0;
7841 var k2end = 0;
7842 for (var d = 0; d < max_d; d++) {
7843 // Walk the front path one step.
7844 for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
7845 var k1_offset = v_offset + k1;
7846 var x1;
7847 if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
7848 x1 = v1[k1_offset + 1];
7849 } else {
7850 x1 = v1[k1_offset - 1] + 1;
7851 }
7852 var y1 = x1 - k1;
7853 while (x1 < text1_length && y1 < text2_length &&
7854 text1.charAt(x1) == text2.charAt(y1)) {
7855 x1++;
7856 y1++;
7857 }
7858 v1[k1_offset] = x1;
7859 if (x1 > text1_length) {
7860 // Ran off the right of the graph.
7861 k1end += 2;
7862 } else if (y1 > text2_length) {
7863 // Ran off the bottom of the graph.
7864 k1start += 2;
7865 } else if (front) {
7866 var k2_offset = v_offset + delta - k1;
7867 if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
7868 // Mirror x2 onto top-left coordinate system.
7869 var x2 = text1_length - v2[k2_offset];
7870 if (x1 >= x2) {
7871 // Overlap detected.
7872 return diff_bisectSplit_(text1, text2, x1, y1);
7873 }
7874 }
7875 }
7876 }
7877
7878 // Walk the reverse path one step.
7879 for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
7880 var k2_offset = v_offset + k2;
7881 var x2;
7882 if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
7883 x2 = v2[k2_offset + 1];
7884 } else {
7885 x2 = v2[k2_offset - 1] + 1;
7886 }
7887 var y2 = x2 - k2;
7888 while (x2 < text1_length && y2 < text2_length &&
7889 text1.charAt(text1_length - x2 - 1) ==
7890 text2.charAt(text2_length - y2 - 1)) {
7891 x2++;
7892 y2++;
7893 }
7894 v2[k2_offset] = x2;
7895 if (x2 > text1_length) {
7896 // Ran off the left of the graph.
7897 k2end += 2;
7898 } else if (y2 > text2_length) {
7899 // Ran off the top of the graph.
7900 k2start += 2;
7901 } else if (!front) {
7902 var k1_offset = v_offset + delta - k2;
7903 if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
7904 var x1 = v1[k1_offset];
7905 var y1 = v_offset + x1 - k1_offset;
7906 // Mirror x2 onto top-left coordinate system.
7907 x2 = text1_length - x2;
7908 if (x1 >= x2) {
7909 // Overlap detected.
7910 return diff_bisectSplit_(text1, text2, x1, y1);
7911 }
7912 }
7913 }
7914 }
7915 }
7916 // Diff took too long and hit the deadline or
7917 // number of diffs equals number of characters, no commonality at all.
7918 return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
7919 };
7920
7921
7922 /**
7923 * Given the location of the 'middle snake', split the diff in two parts
7924 * and recurse.
7925 * @param {string} text1 Old string to be diffed.
7926 * @param {string} text2 New string to be diffed.
7927 * @param {number} x Index of split point in text1.
7928 * @param {number} y Index of split point in text2.
7929 * @return {Array} Array of diff tuples.
7930 */
7931 function diff_bisectSplit_(text1, text2, x, y) {
7932 var text1a = text1.substring(0, x);
7933 var text2a = text2.substring(0, y);
7934 var text1b = text1.substring(x);
7935 var text2b = text2.substring(y);
7936
7937 // Compute both diffs serially.
7938 var diffs = diff_main(text1a, text2a);
7939 var diffsb = diff_main(text1b, text2b);
7940
7941 return diffs.concat(diffsb);
7942 };
7943
7944
7945 /**
7946 * Determine the common prefix of two strings.
7947 * @param {string} text1 First string.
7948 * @param {string} text2 Second string.
7949 * @return {number} The number of characters common to the start of each
7950 * string.
7951 */
7952 function diff_commonPrefix(text1, text2) {
7953 // Quick check for common null cases.
7954 if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
7955 return 0;
7956 }
7957 // Binary search.
7958 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
7959 var pointermin = 0;
7960 var pointermax = Math.min(text1.length, text2.length);
7961 var pointermid = pointermax;
7962 var pointerstart = 0;
7963 while (pointermin < pointermid) {
7964 if (text1.substring(pointerstart, pointermid) ==
7965 text2.substring(pointerstart, pointermid)) {
7966 pointermin = pointermid;
7967 pointerstart = pointermin;
7968 } else {
7969 pointermax = pointermid;
7970 }
7971 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
7972 }
7973 return pointermid;
7974 };
7975
7976
7977 /**
7978 * Determine the common suffix of two strings.
7979 * @param {string} text1 First string.
7980 * @param {string} text2 Second string.
7981 * @return {number} The number of characters common to the end of each string.
7982 */
7983 function diff_commonSuffix(text1, text2) {
7984 // Quick check for common null cases.
7985 if (!text1 || !text2 ||
7986 text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
7987 return 0;
7988 }
7989 // Binary search.
7990 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
7991 var pointermin = 0;
7992 var pointermax = Math.min(text1.length, text2.length);
7993 var pointermid = pointermax;
7994 var pointerend = 0;
7995 while (pointermin < pointermid) {
7996 if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
7997 text2.substring(text2.length - pointermid, text2.length - pointerend)) {
7998 pointermin = pointermid;
7999 pointerend = pointermin;
8000 } else {
8001 pointermax = pointermid;
8002 }
8003 pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
8004 }
8005 return pointermid;
8006 };
8007
8008
8009 /**
8010 * Do the two texts share a substring which is at least half the length of the
8011 * longer text?
8012 * This speedup can produce non-minimal diffs.
8013 * @param {string} text1 First string.
8014 * @param {string} text2 Second string.
8015 * @return {Array.<string>} Five element Array, containing the prefix of
8016 * text1, the suffix of text1, the prefix of text2, the suffix of
8017 * text2 and the common middle. Or null if there was no match.
8018 */
8019 function diff_halfMatch_(text1, text2) {
8020 var longtext = text1.length > text2.length ? text1 : text2;
8021 var shorttext = text1.length > text2.length ? text2 : text1;
8022 if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
8023 return null; // Pointless.
8024 }
8025
8026 /**
8027 * Does a substring of shorttext exist within longtext such that the substring
8028 * is at least half the length of longtext?
8029 * Closure, but does not reference any external variables.
8030 * @param {string} longtext Longer string.
8031 * @param {string} shorttext Shorter string.
8032 * @param {number} i Start index of quarter length substring within longtext.
8033 * @return {Array.<string>} Five element Array, containing the prefix of
8034 * longtext, the suffix of longtext, the prefix of shorttext, the suffix
8035 * of shorttext and the common middle. Or null if there was no match.
8036 * @private
8037 */
8038 function diff_halfMatchI_(longtext, shorttext, i) {
8039 // Start with a 1/4 length substring at position i as a seed.
8040 var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
8041 var j = -1;
8042 var best_common = '';
8043 var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
8044 while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
8045 var prefixLength = diff_commonPrefix(longtext.substring(i),
8046 shorttext.substring(j));
8047 var suffixLength = diff_commonSuffix(longtext.substring(0, i),
8048 shorttext.substring(0, j));
8049 if (best_common.length < suffixLength + prefixLength) {
8050 best_common = shorttext.substring(j - suffixLength, j) +
8051 shorttext.substring(j, j + prefixLength);
8052 best_longtext_a = longtext.substring(0, i - suffixLength);
8053 best_longtext_b = longtext.substring(i + prefixLength);
8054 best_shorttext_a = shorttext.substring(0, j - suffixLength);
8055 best_shorttext_b = shorttext.substring(j + prefixLength);
8056 }
8057 }
8058 if (best_common.length * 2 >= longtext.length) {
8059 return [best_longtext_a, best_longtext_b,
8060 best_shorttext_a, best_shorttext_b, best_common];
8061 } else {
8062 return null;
8063 }
8064 }
8065
8066 // First check if the second quarter is the seed for a half-match.
8067 var hm1 = diff_halfMatchI_(longtext, shorttext,
8068 Math.ceil(longtext.length / 4));
8069 // Check again based on the third quarter.
8070 var hm2 = diff_halfMatchI_(longtext, shorttext,
8071 Math.ceil(longtext.length / 2));
8072 var hm;
8073 if (!hm1 && !hm2) {
8074 return null;
8075 } else if (!hm2) {
8076 hm = hm1;
8077 } else if (!hm1) {
8078 hm = hm2;
8079 } else {
8080 // Both matched. Select the longest.
8081 hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
8082 }
8083
8084 // A half-match was found, sort out the return data.
8085 var text1_a, text1_b, text2_a, text2_b;
8086 if (text1.length > text2.length) {
8087 text1_a = hm[0];
8088 text1_b = hm[1];
8089 text2_a = hm[2];
8090 text2_b = hm[3];
8091 } else {
8092 text2_a = hm[0];
8093 text2_b = hm[1];
8094 text1_a = hm[2];
8095 text1_b = hm[3];
8096 }
8097 var mid_common = hm[4];
8098 return [text1_a, text1_b, text2_a, text2_b, mid_common];
8099 };
8100
8101
8102 /**
8103 * Reorder and merge like edit sections. Merge equalities.
8104 * Any edit section can move as long as it doesn't cross an equality.
8105 * @param {Array} diffs Array of diff tuples.
8106 */
8107 function diff_cleanupMerge(diffs) {
8108 diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
8109 var pointer = 0;
8110 var count_delete = 0;
8111 var count_insert = 0;
8112 var text_delete = '';
8113 var text_insert = '';
8114 var commonlength;
8115 while (pointer < diffs.length) {
8116 switch (diffs[pointer][0]) {
8117 case DIFF_INSERT:
8118 count_insert++;
8119 text_insert += diffs[pointer][1];
8120 pointer++;
8121 break;
8122 case DIFF_DELETE:
8123 count_delete++;
8124 text_delete += diffs[pointer][1];
8125 pointer++;
8126 break;
8127 case DIFF_EQUAL:
8128 // Upon reaching an equality, check for prior redundancies.
8129 if (count_delete + count_insert > 1) {
8130 if (count_delete !== 0 && count_insert !== 0) {
8131 // Factor out any common prefixies.
8132 commonlength = diff_commonPrefix(text_insert, text_delete);
8133 if (commonlength !== 0) {
8134 if ((pointer - count_delete - count_insert) > 0 &&
8135 diffs[pointer - count_delete - count_insert - 1][0] ==
8136 DIFF_EQUAL) {
8137 diffs[pointer - count_delete - count_insert - 1][1] +=
8138 text_insert.substring(0, commonlength);
8139 } else {
8140 diffs.splice(0, 0, [DIFF_EQUAL,
8141 text_insert.substring(0, commonlength)]);
8142 pointer++;
8143 }
8144 text_insert = text_insert.substring(commonlength);
8145 text_delete = text_delete.substring(commonlength);
8146 }
8147 // Factor out any common suffixies.
8148 commonlength = diff_commonSuffix(text_insert, text_delete);
8149 if (commonlength !== 0) {
8150 diffs[pointer][1] = text_insert.substring(text_insert.length -
8151 commonlength) + diffs[pointer][1];
8152 text_insert = text_insert.substring(0, text_insert.length -
8153 commonlength);
8154 text_delete = text_delete.substring(0, text_delete.length -
8155 commonlength);
8156 }
8157 }
8158 // Delete the offending records and add the merged ones.
8159 if (count_delete === 0) {
8160 diffs.splice(pointer - count_insert,
8161 count_delete + count_insert, [DIFF_INSERT, text_insert]);
8162 } else if (count_insert === 0) {
8163 diffs.splice(pointer - count_delete,
8164 count_delete + count_insert, [DIFF_DELETE, text_delete]);
8165 } else {
8166 diffs.splice(pointer - count_delete - count_insert,
8167 count_delete + count_insert, [DIFF_DELETE, text_delete],
8168 [DIFF_INSERT, text_insert]);
8169 }
8170 pointer = pointer - count_delete - count_insert +
8171 (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
8172 } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
8173 // Merge this equality with the previous one.
8174 diffs[pointer - 1][1] += diffs[pointer][1];
8175 diffs.splice(pointer, 1);
8176 } else {
8177 pointer++;
8178 }
8179 count_insert = 0;
8180 count_delete = 0;
8181 text_delete = '';
8182 text_insert = '';
8183 break;
8184 }
8185 }
8186 if (diffs[diffs.length - 1][1] === '') {
8187 diffs.pop(); // Remove the dummy entry at the end.
8188 }
8189
8190 // Second pass: look for single edits surrounded on both sides by equalities
8191 // which can be shifted sideways to eliminate an equality.
8192 // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
8193 var changes = false;
8194 pointer = 1;
8195 // Intentionally ignore the first and last element (don't need checking).
8196 while (pointer < diffs.length - 1) {
8197 if (diffs[pointer - 1][0] == DIFF_EQUAL &&
8198 diffs[pointer + 1][0] == DIFF_EQUAL) {
8199 // This is a single edit surrounded by equalities.
8200 if (diffs[pointer][1].substring(diffs[pointer][1].length -
8201 diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
8202 // Shift the edit over the previous equality.
8203 diffs[pointer][1] = diffs[pointer - 1][1] +
8204 diffs[pointer][1].substring(0, diffs[pointer][1].length -
8205 diffs[pointer - 1][1].length);
8206 diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
8207 diffs.splice(pointer - 1, 1);
8208 changes = true;
8209 } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
8210 diffs[pointer + 1][1]) {
8211 // Shift the edit over the next equality.
8212 diffs[pointer - 1][1] += diffs[pointer + 1][1];
8213 diffs[pointer][1] =
8214 diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
8215 diffs[pointer + 1][1];
8216 diffs.splice(pointer + 1, 1);
8217 changes = true;
8218 }
8219 }
8220 pointer++;
8221 }
8222 // If shifts were made, the diff needs reordering and another shift sweep.
8223 if (changes) {
8224 diff_cleanupMerge(diffs);
8225 }
8226 };
8227
8228
8229 var diff = diff_main;
8230 diff.INSERT = DIFF_INSERT;
8231 diff.DELETE = DIFF_DELETE;
8232 diff.EQUAL = DIFF_EQUAL;
8233
8234 module.exports = diff;
8235
8236 /*
8237 * Modify a diff such that the cursor position points to the start of a change:
8238 * E.g.
8239 * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
8240 * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
8241 * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
8242 * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
8243 *
8244 * @param {Array} diffs Array of diff tuples
8245 * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
8246 * @return {Array} A tuple [cursor location in the modified diff, modified diff]
8247 */
8248 function cursor_normalize_diff (diffs, cursor_pos) {
8249 if (cursor_pos === 0) {
8250 return [DIFF_EQUAL, diffs];
8251 }
8252 for (var current_pos = 0, i = 0; i < diffs.length; i++) {
8253 var d = diffs[i];
8254 if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
8255 var next_pos = current_pos + d[1].length;
8256 if (cursor_pos === next_pos) {
8257 return [i + 1, diffs];
8258 } else if (cursor_pos < next_pos) {
8259 // copy to prevent side effects
8260 diffs = diffs.slice();
8261 // split d into two diff changes
8262 var split_pos = cursor_pos - current_pos;
8263 var d_left = [d[0], d[1].slice(0, split_pos)];
8264 var d_right = [d[0], d[1].slice(split_pos)];
8265 diffs.splice(i, 1, d_left, d_right);
8266 return [i + 1, diffs];
8267 } else {
8268 current_pos = next_pos;
8269 }
8270 }
8271 }
8272 throw new Error('cursor_pos is out of bounds!')
8273 }
8274
8275 /*
8276 * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
8277 *
8278 * Case 1)
8279 * Check if a naive shift is possible:
8280 * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
8281 * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
8282 * Case 2)
8283 * Check if the following shifts are possible:
8284 * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
8285 * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
8286 * ^ ^
8287 * d d_next
8288 *
8289 * @param {Array} diffs Array of diff tuples
8290 * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
8291 * @return {Array} Array of diff tuples
8292 */
8293 function fix_cursor (diffs, cursor_pos) {
8294 var norm = cursor_normalize_diff(diffs, cursor_pos);
8295 var ndiffs = norm[1];
8296 var cursor_pointer = norm[0];
8297 var d = ndiffs[cursor_pointer];
8298 var d_next = ndiffs[cursor_pointer + 1];
8299
8300 if (d == null) {
8301 // Text was deleted from end of original string,
8302 // cursor is now out of bounds in new string
8303 return diffs;
8304 } else if (d[0] !== DIFF_EQUAL) {
8305 // A modification happened at the cursor location.
8306 // This is the expected outcome, so we can return the original diff.
8307 return diffs;
8308 } else {
8309 if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
8310 // Case 1)
8311 // It is possible to perform a naive shift
8312 ndiffs.splice(cursor_pointer, 2, d_next, d)
8313 return merge_tuples(ndiffs, cursor_pointer, 2)
8314 } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
8315 // Case 2)
8316 // d[1] is a prefix of d_next[1]
8317 // We can assume that d_next[0] !== 0, since d[0] === 0
8318 // Shift edit locations..
8319 ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
8320 var suffix = d_next[1].slice(d[1].length);
8321 if (suffix.length > 0) {
8322 ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
8323 }
8324 return merge_tuples(ndiffs, cursor_pointer, 3)
8325 } else {
8326 // Not possible to perform any modification
8327 return diffs;
8328 }
8329 }
8330 }
8331
8332 /*
8333 * Check diff did not split surrogate pairs.
8334 * Ex. [0, '\uD83D'], [-1, '\uDC36'], [1, '\uDC2F'] -> [-1, '\uD83D\uDC36'], [1, '\uD83D\uDC2F']
8335 * '\uD83D\uDC36' === '🐶', '\uD83D\uDC2F' === '🐯'
8336 *
8337 * @param {Array} diffs Array of diff tuples
8338 * @return {Array} Array of diff tuples
8339 */
8340 function fix_emoji (diffs) {
8341 var compact = false;
8342 var starts_with_pair_end = function(str) {
8343 return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;
8344 }
8345 var ends_with_pair_start = function(str) {
8346 return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;
8347 }
8348 for (var i = 2; i < diffs.length; i += 1) {
8349 if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&
8350 diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&
8351 diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {
8352 compact = true;
8353
8354 diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];
8355 diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];
8356
8357 diffs[i-2][1] = diffs[i-2][1].slice(0, -1);
8358 }
8359 }
8360 if (!compact) {
8361 return diffs;
8362 }
8363 var fixed_diffs = [];
8364 for (var i = 0; i < diffs.length; i += 1) {
8365 if (diffs[i][1].length > 0) {
8366 fixed_diffs.push(diffs[i]);
8367 }
8368 }
8369 return fixed_diffs;
8370 }
8371
8372 /*
8373 * Try to merge tuples with their neigbors in a given range.
8374 * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
8375 *
8376 * @param {Array} diffs Array of diff tuples.
8377 * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
8378 * @param {Int} length Number of consecutive elements to check.
8379 * @return {Array} Array of merged diff tuples.
8380 */
8381 function merge_tuples (diffs, start, length) {
8382 // Check from (start-1) to (start+length).
8383 for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
8384 if (i + 1 < diffs.length) {
8385 var left_d = diffs[i];
8386 var right_d = diffs[i+1];
8387 if (left_d[0] === right_d[1]) {
8388 diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
8389 }
8390 }
8391 }
8392 return diffs;
8393 }
8394
8395
8396 /***/ }),
8397 /* 52 */
8398 /***/ (function(module, exports) {
8399
8400 exports = module.exports = typeof Object.keys === 'function'
8401 ? Object.keys : shim;
8402
8403 exports.shim = shim;
8404 function shim (obj) {
8405 var keys = [];
8406 for (var key in obj) keys.push(key);
8407 return keys;
8408 }
8409
8410
8411 /***/ }),
8412 /* 53 */
8413 /***/ (function(module, exports) {
8414
8415 var supportsArgumentsClass = (function(){
8416 return Object.prototype.toString.call(arguments)
8417 })() == '[object Arguments]';
8418
8419 exports = module.exports = supportsArgumentsClass ? supported : unsupported;
8420
8421 exports.supported = supported;
8422 function supported(object) {
8423 return Object.prototype.toString.call(object) == '[object Arguments]';
8424 };
8425
8426 exports.unsupported = unsupported;
8427 function unsupported(object){
8428 return object &&
8429 typeof object == 'object' &&
8430 typeof object.length == 'number' &&
8431 Object.prototype.hasOwnProperty.call(object, 'callee') &&
8432 !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
8433 false;
8434 };
8435
8436
8437 /***/ }),
8438 /* 54 */
8439 /***/ (function(module, exports) {
8440
8441 'use strict';
8442
8443 var has = Object.prototype.hasOwnProperty
8444 , prefix = '~';
8445
8446 /**
8447 * Constructor to create a storage for our `EE` objects.
8448 * An `Events` instance is a plain object whose properties are event names.
8449 *
8450 * @constructor
8451 * @api private
8452 */
8453 function Events() {}
8454
8455 //
8456 // We try to not inherit from `Object.prototype`. In some engines creating an
8457 // instance in this way is faster than calling `Object.create(null)` directly.
8458 // If `Object.create(null)` is not supported we prefix the event names with a
8459 // character to make sure that the built-in object properties are not
8460 // overridden or used as an attack vector.
8461 //
8462 if (Object.create) {
8463 Events.prototype = Object.create(null);
8464
8465 //
8466 // This hack is needed because the `__proto__` property is still inherited in
8467 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
8468 //
8469 if (!new Events().__proto__) prefix = false;
8470 }
8471
8472 /**
8473 * Representation of a single event listener.
8474 *
8475 * @param {Function} fn The listener function.
8476 * @param {Mixed} context The context to invoke the listener with.
8477 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
8478 * @constructor
8479 * @api private
8480 */
8481 function EE(fn, context, once) {
8482 this.fn = fn;
8483 this.context = context;
8484 this.once = once || false;
8485 }
8486
8487 /**
8488 * Minimal `EventEmitter` interface that is molded against the Node.js
8489 * `EventEmitter` interface.
8490 *
8491 * @constructor
8492 * @api public
8493 */
8494 function EventEmitter() {
8495 this._events = new Events();
8496 this._eventsCount = 0;
8497 }
8498
8499 /**
8500 * Return an array listing the events for which the emitter has registered
8501 * listeners.
8502 *
8503 * @returns {Array}
8504 * @api public
8505 */
8506 EventEmitter.prototype.eventNames = function eventNames() {
8507 var names = []
8508 , events
8509 , name;
8510
8511 if (this._eventsCount === 0) return names;
8512
8513 for (name in (events = this._events)) {
8514 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
8515 }
8516
8517 if (Object.getOwnPropertySymbols) {
8518 return names.concat(Object.getOwnPropertySymbols(events));
8519 }
8520
8521 return names;
8522 };
8523
8524 /**
8525 * Return the listeners registered for a given event.
8526 *
8527 * @param {String|Symbol} event The event name.
8528 * @param {Boolean} exists Only check if there are listeners.
8529 * @returns {Array|Boolean}
8530 * @api public
8531 */
8532 EventEmitter.prototype.listeners = function listeners(event, exists) {
8533 var evt = prefix ? prefix + event : event
8534 , available = this._events[evt];
8535
8536 if (exists) return !!available;
8537 if (!available) return [];
8538 if (available.fn) return [available.fn];
8539
8540 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
8541 ee[i] = available[i].fn;
8542 }
8543
8544 return ee;
8545 };
8546
8547 /**
8548 * Calls each of the listeners registered for a given event.
8549 *
8550 * @param {String|Symbol} event The event name.
8551 * @returns {Boolean} `true` if the event had listeners, else `false`.
8552 * @api public
8553 */
8554 EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
8555 var evt = prefix ? prefix + event : event;
8556
8557 if (!this._events[evt]) return false;
8558
8559 var listeners = this._events[evt]
8560 , len = arguments.length
8561 , args
8562 , i;
8563
8564 if (listeners.fn) {
8565 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
8566
8567 switch (len) {
8568 case 1: return listeners.fn.call(listeners.context), true;
8569 case 2: return listeners.fn.call(listeners.context, a1), true;
8570 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
8571 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
8572 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
8573 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
8574 }
8575
8576 for (i = 1, args = new Array(len -1); i < len; i++) {
8577 args[i - 1] = arguments[i];
8578 }
8579
8580 listeners.fn.apply(listeners.context, args);
8581 } else {
8582 var length = listeners.length
8583 , j;
8584
8585 for (i = 0; i < length; i++) {
8586 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
8587
8588 switch (len) {
8589 case 1: listeners[i].fn.call(listeners[i].context); break;
8590 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
8591 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
8592 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
8593 default:
8594 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
8595 args[j - 1] = arguments[j];
8596 }
8597
8598 listeners[i].fn.apply(listeners[i].context, args);
8599 }
8600 }
8601 }
8602
8603 return true;
8604 };
8605
8606 /**
8607 * Add a listener for a given event.
8608 *
8609 * @param {String|Symbol} event The event name.
8610 * @param {Function} fn The listener function.
8611 * @param {Mixed} [context=this] The context to invoke the listener with.
8612 * @returns {EventEmitter} `this`.
8613 * @api public
8614 */
8615 EventEmitter.prototype.on = function on(event, fn, context) {
8616 var listener = new EE(fn, context || this)
8617 , evt = prefix ? prefix + event : event;
8618
8619 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
8620 else if (!this._events[evt].fn) this._events[evt].push(listener);
8621 else this._events[evt] = [this._events[evt], listener];
8622
8623 return this;
8624 };
8625
8626 /**
8627 * Add a one-time listener for a given event.
8628 *
8629 * @param {String|Symbol} event The event name.
8630 * @param {Function} fn The listener function.
8631 * @param {Mixed} [context=this] The context to invoke the listener with.
8632 * @returns {EventEmitter} `this`.
8633 * @api public
8634 */
8635 EventEmitter.prototype.once = function once(event, fn, context) {
8636 var listener = new EE(fn, context || this, true)
8637 , evt = prefix ? prefix + event : event;
8638
8639 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
8640 else if (!this._events[evt].fn) this._events[evt].push(listener);
8641 else this._events[evt] = [this._events[evt], listener];
8642
8643 return this;
8644 };
8645
8646 /**
8647 * Remove the listeners of a given event.
8648 *
8649 * @param {String|Symbol} event The event name.
8650 * @param {Function} fn Only remove the listeners that match this function.
8651 * @param {Mixed} context Only remove the listeners that have this context.
8652 * @param {Boolean} once Only remove one-time listeners.
8653 * @returns {EventEmitter} `this`.
8654 * @api public
8655 */
8656 EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
8657 var evt = prefix ? prefix + event : event;
8658
8659 if (!this._events[evt]) return this;
8660 if (!fn) {
8661 if (--this._eventsCount === 0) this._events = new Events();
8662 else delete this._events[evt];
8663 return this;
8664 }
8665
8666 var listeners = this._events[evt];
8667
8668 if (listeners.fn) {
8669 if (
8670 listeners.fn === fn
8671 && (!once || listeners.once)
8672 && (!context || listeners.context === context)
8673 ) {
8674 if (--this._eventsCount === 0) this._events = new Events();
8675 else delete this._events[evt];
8676 }
8677 } else {
8678 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
8679 if (
8680 listeners[i].fn !== fn
8681 || (once && !listeners[i].once)
8682 || (context && listeners[i].context !== context)
8683 ) {
8684 events.push(listeners[i]);
8685 }
8686 }
8687
8688 //
8689 // Reset the array, or remove it completely if we have no more listeners.
8690 //
8691 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
8692 else if (--this._eventsCount === 0) this._events = new Events();
8693 else delete this._events[evt];
8694 }
8695
8696 return this;
8697 };
8698
8699 /**
8700 * Remove all listeners, or those of the specified event.
8701 *
8702 * @param {String|Symbol} [event] The event name.
8703 * @returns {EventEmitter} `this`.
8704 * @api public
8705 */
8706 EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
8707 var evt;
8708
8709 if (event) {
8710 evt = prefix ? prefix + event : event;
8711 if (this._events[evt]) {
8712 if (--this._eventsCount === 0) this._events = new Events();
8713 else delete this._events[evt];
8714 }
8715 } else {
8716 this._events = new Events();
8717 this._eventsCount = 0;
8718 }
8719
8720 return this;
8721 };
8722
8723 //
8724 // Alias methods names because people roll like that.
8725 //
8726 EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
8727 EventEmitter.prototype.addListener = EventEmitter.prototype.on;
8728
8729 //
8730 // This function doesn't apply anymore.
8731 //
8732 EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
8733 return this;
8734 };
8735
8736 //
8737 // Expose the prefix.
8738 //
8739 EventEmitter.prefixed = prefix;
8740
8741 //
8742 // Allow `EventEmitter` to be imported as module namespace.
8743 //
8744 EventEmitter.EventEmitter = EventEmitter;
8745
8746 //
8747 // Expose the module.
8748 //
8749 if ('undefined' !== typeof module) {
8750 module.exports = EventEmitter;
8751 }
8752
8753
8754 /***/ }),
8755 /* 55 */
8756 /***/ (function(module, exports, __webpack_require__) {
8757
8758 "use strict";
8759
8760
8761 Object.defineProperty(exports, "__esModule", {
8762 value: true
8763 });
8764 exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
8765
8766 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
8767
8768 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
8769
8770 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8771
8772 var _extend2 = __webpack_require__(3);
8773
8774 var _extend3 = _interopRequireDefault(_extend2);
8775
8776 var _quillDelta = __webpack_require__(2);
8777
8778 var _quillDelta2 = _interopRequireDefault(_quillDelta);
8779
8780 var _parchment = __webpack_require__(0);
8781
8782 var _parchment2 = _interopRequireDefault(_parchment);
8783
8784 var _quill = __webpack_require__(5);
8785
8786 var _quill2 = _interopRequireDefault(_quill);
8787
8788 var _logger = __webpack_require__(10);
8789
8790 var _logger2 = _interopRequireDefault(_logger);
8791
8792 var _module = __webpack_require__(9);
8793
8794 var _module2 = _interopRequireDefault(_module);
8795
8796 var _align = __webpack_require__(36);
8797
8798 var _background = __webpack_require__(37);
8799
8800 var _code = __webpack_require__(13);
8801
8802 var _code2 = _interopRequireDefault(_code);
8803
8804 var _color = __webpack_require__(26);
8805
8806 var _direction = __webpack_require__(38);
8807
8808 var _font = __webpack_require__(39);
8809
8810 var _size = __webpack_require__(40);
8811
8812 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8813
8814 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8815
8816 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8817
8818 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8819
8820 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8821
8822 var debug = (0, _logger2.default)('quill:clipboard');
8823
8824 var DOM_KEY = '__ql-matcher';
8825
8826 var CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];
8827
8828 var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
8829 memo[attr.keyName] = attr;
8830 return memo;
8831 }, {});
8832
8833 var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
8834 memo[attr.keyName] = attr;
8835 return memo;
8836 }, {});
8837
8838 var Clipboard = function (_Module) {
8839 _inherits(Clipboard, _Module);
8840
8841 function Clipboard(quill, options) {
8842 _classCallCheck(this, Clipboard);
8843
8844 var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
8845
8846 _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
8847 _this.container = _this.quill.addContainer('ql-clipboard');
8848 _this.container.setAttribute('contenteditable', true);
8849 _this.container.setAttribute('tabindex', -1);
8850 _this.matchers = [];
8851 CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {
8852 var _ref2 = _slicedToArray(_ref, 2),
8853 selector = _ref2[0],
8854 matcher = _ref2[1];
8855
8856 if (!options.matchVisual && matcher === matchSpacing) return;
8857 _this.addMatcher(selector, matcher);
8858 });
8859 return _this;
8860 }
8861
8862 _createClass(Clipboard, [{
8863 key: 'addMatcher',
8864 value: function addMatcher(selector, matcher) {
8865 this.matchers.push([selector, matcher]);
8866 }
8867 }, {
8868 key: 'convert',
8869 value: function convert(html) {
8870 if (typeof html === 'string') {
8871 this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
8872 return this.convert();
8873 }
8874 var formats = this.quill.getFormat(this.quill.selection.savedRange.index);
8875 if (formats[_code2.default.blotName]) {
8876 var text = this.container.innerText;
8877 this.container.innerHTML = '';
8878 return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));
8879 }
8880
8881 var _prepareMatching = this.prepareMatching(),
8882 _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
8883 elementMatchers = _prepareMatching2[0],
8884 textMatchers = _prepareMatching2[1];
8885
8886 var delta = traverse(this.container, elementMatchers, textMatchers);
8887 // Remove trailing newline
8888 if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
8889 delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
8890 }
8891 debug.log('convert', this.container.innerHTML, delta);
8892 this.container.innerHTML = '';
8893 return delta;
8894 }
8895 }, {
8896 key: 'dangerouslyPasteHTML',
8897 value: function dangerouslyPasteHTML(index, html) {
8898 var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
8899
8900 if (typeof index === 'string') {
8901 this.quill.setContents(this.convert(index), html);
8902 this.quill.setSelection(0, _quill2.default.sources.SILENT);
8903 } else {
8904 var paste = this.convert(html);
8905 this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
8906 this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);
8907 }
8908 }
8909 }, {
8910 key: 'onPaste',
8911 value: function onPaste(e) {
8912 var _this2 = this;
8913
8914 if (e.defaultPrevented || !this.quill.isEnabled()) return;
8915 var range = this.quill.getSelection();
8916 var delta = new _quillDelta2.default().retain(range.index);
8917 var scrollTop = this.quill.scrollingContainer.scrollTop;
8918 this.container.focus();
8919 this.quill.selection.update(_quill2.default.sources.SILENT);
8920 setTimeout(function () {
8921 delta = delta.concat(_this2.convert()).delete(range.length);
8922 _this2.quill.updateContents(delta, _quill2.default.sources.USER);
8923 // range.length contributes to delta.length()
8924 _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
8925 _this2.quill.scrollingContainer.scrollTop = scrollTop;
8926 _this2.quill.focus();
8927 }, 1);
8928 }
8929 }, {
8930 key: 'prepareMatching',
8931 value: function prepareMatching() {
8932 var _this3 = this;
8933
8934 var elementMatchers = [],
8935 textMatchers = [];
8936 this.matchers.forEach(function (pair) {
8937 var _pair = _slicedToArray(pair, 2),
8938 selector = _pair[0],
8939 matcher = _pair[1];
8940
8941 switch (selector) {
8942 case Node.TEXT_NODE:
8943 textMatchers.push(matcher);
8944 break;
8945 case Node.ELEMENT_NODE:
8946 elementMatchers.push(matcher);
8947 break;
8948 default:
8949 [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
8950 // TODO use weakmap
8951 node[DOM_KEY] = node[DOM_KEY] || [];
8952 node[DOM_KEY].push(matcher);
8953 });
8954 break;
8955 }
8956 });
8957 return [elementMatchers, textMatchers];
8958 }
8959 }]);
8960
8961 return Clipboard;
8962 }(_module2.default);
8963
8964 Clipboard.DEFAULTS = {
8965 matchers: [],
8966 matchVisual: true
8967 };
8968
8969 function applyFormat(delta, format, value) {
8970 if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
8971 return Object.keys(format).reduce(function (delta, key) {
8972 return applyFormat(delta, key, format[key]);
8973 }, delta);
8974 } else {
8975 return delta.reduce(function (delta, op) {
8976 if (op.attributes && op.attributes[format]) {
8977 return delta.push(op);
8978 } else {
8979 return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
8980 }
8981 }, new _quillDelta2.default());
8982 }
8983 }
8984
8985 function computeStyle(node) {
8986 if (node.nodeType !== Node.ELEMENT_NODE) return {};
8987 var DOM_KEY = '__ql-computed-style';
8988 return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
8989 }
8990
8991 function deltaEndsWith(delta, text) {
8992 var endText = "";
8993 for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
8994 var op = delta.ops[i];
8995 if (typeof op.insert !== 'string') break;
8996 endText = op.insert + endText;
8997 }
8998 return endText.slice(-1 * text.length) === text;
8999 }
9000
9001 function isLine(node) {
9002 if (node.childNodes.length === 0) return false; // Exclude embed blocks
9003 var style = computeStyle(node);
9004 return ['block', 'list-item'].indexOf(style.display) > -1;
9005 }
9006
9007 function traverse(node, elementMatchers, textMatchers) {
9008 // Post-order
9009 if (node.nodeType === node.TEXT_NODE) {
9010 return textMatchers.reduce(function (delta, matcher) {
9011 return matcher(node, delta);
9012 }, new _quillDelta2.default());
9013 } else if (node.nodeType === node.ELEMENT_NODE) {
9014 return [].reduce.call(node.childNodes || [], function (delta, childNode) {
9015 var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
9016 if (childNode.nodeType === node.ELEMENT_NODE) {
9017 childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
9018 return matcher(childNode, childrenDelta);
9019 }, childrenDelta);
9020 childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
9021 return matcher(childNode, childrenDelta);
9022 }, childrenDelta);
9023 }
9024 return delta.concat(childrenDelta);
9025 }, new _quillDelta2.default());
9026 } else {
9027 return new _quillDelta2.default();
9028 }
9029 }
9030
9031 function matchAlias(format, node, delta) {
9032 return applyFormat(delta, format, true);
9033 }
9034
9035 function matchAttributor(node, delta) {
9036 var attributes = _parchment2.default.Attributor.Attribute.keys(node);
9037 var classes = _parchment2.default.Attributor.Class.keys(node);
9038 var styles = _parchment2.default.Attributor.Style.keys(node);
9039 var formats = {};
9040 attributes.concat(classes).concat(styles).forEach(function (name) {
9041 var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
9042 if (attr != null) {
9043 formats[attr.attrName] = attr.value(node);
9044 if (formats[attr.attrName]) return;
9045 }
9046 attr = ATTRIBUTE_ATTRIBUTORS[name];
9047 if (attr != null && (attr.attrName === name || attr.keyName === name)) {
9048 formats[attr.attrName] = attr.value(node) || undefined;
9049 }
9050 attr = STYLE_ATTRIBUTORS[name];
9051 if (attr != null && (attr.attrName === name || attr.keyName === name)) {
9052 attr = STYLE_ATTRIBUTORS[name];
9053 formats[attr.attrName] = attr.value(node) || undefined;
9054 }
9055 });
9056 if (Object.keys(formats).length > 0) {
9057 delta = applyFormat(delta, formats);
9058 }
9059 return delta;
9060 }
9061
9062 function matchBlot(node, delta) {
9063 var match = _parchment2.default.query(node);
9064 if (match == null) return delta;
9065 if (match.prototype instanceof _parchment2.default.Embed) {
9066 var embed = {};
9067 var value = match.value(node);
9068 if (value != null) {
9069 embed[match.blotName] = value;
9070 delta = new _quillDelta2.default().insert(embed, match.formats(node));
9071 }
9072 } else if (typeof match.formats === 'function') {
9073 delta = applyFormat(delta, match.blotName, match.formats(node));
9074 }
9075 return delta;
9076 }
9077
9078 function matchBreak(node, delta) {
9079 if (!deltaEndsWith(delta, '\n')) {
9080 delta.insert('\n');
9081 }
9082 return delta;
9083 }
9084
9085 function matchIgnore() {
9086 return new _quillDelta2.default();
9087 }
9088
9089 function matchIndent(node, delta) {
9090 var match = _parchment2.default.query(node);
9091 if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
9092 return delta;
9093 }
9094 var indent = -1,
9095 parent = node.parentNode;
9096 while (!parent.classList.contains('ql-clipboard')) {
9097 if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
9098 indent += 1;
9099 }
9100 parent = parent.parentNode;
9101 }
9102 if (indent <= 0) return delta;
9103 return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
9104 }
9105
9106 function matchNewline(node, delta) {
9107 if (!deltaEndsWith(delta, '\n')) {
9108 if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
9109 delta.insert('\n');
9110 }
9111 }
9112 return delta;
9113 }
9114
9115 function matchSpacing(node, delta) {
9116 if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
9117 var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
9118 if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
9119 delta.insert('\n');
9120 }
9121 }
9122 return delta;
9123 }
9124
9125 function matchStyles(node, delta) {
9126 var formats = {};
9127 var style = node.style || {};
9128 if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
9129 formats.italic = true;
9130 }
9131 if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
9132 formats.bold = true;
9133 }
9134 if (Object.keys(formats).length > 0) {
9135 delta = applyFormat(delta, formats);
9136 }
9137 if (parseFloat(style.textIndent || 0) > 0) {
9138 // Could be 0.5in
9139 delta = new _quillDelta2.default().insert('\t').concat(delta);
9140 }
9141 return delta;
9142 }
9143
9144 function matchText(node, delta) {
9145 var text = node.data;
9146 // Word represents empty line with <o:p>&nbsp;</o:p>
9147 if (node.parentNode.tagName === 'O:P') {
9148 return delta.insert(text.trim());
9149 }
9150 if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
9151 return delta;
9152 }
9153 if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
9154 // eslint-disable-next-line func-style
9155 var replacer = function replacer(collapse, match) {
9156 match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
9157 return match.length < 1 && collapse ? ' ' : match;
9158 };
9159 text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
9160 text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
9161 if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
9162 text = text.replace(/^\s+/, replacer.bind(replacer, false));
9163 }
9164 if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
9165 text = text.replace(/\s+$/, replacer.bind(replacer, false));
9166 }
9167 }
9168 return delta.insert(text);
9169 }
9170
9171 exports.default = Clipboard;
9172 exports.matchAttributor = matchAttributor;
9173 exports.matchBlot = matchBlot;
9174 exports.matchNewline = matchNewline;
9175 exports.matchSpacing = matchSpacing;
9176 exports.matchText = matchText;
9177
9178 /***/ }),
9179 /* 56 */
9180 /***/ (function(module, exports, __webpack_require__) {
9181
9182 "use strict";
9183
9184
9185 Object.defineProperty(exports, "__esModule", {
9186 value: true
9187 });
9188
9189 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9190
9191 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
9192
9193 var _inline = __webpack_require__(6);
9194
9195 var _inline2 = _interopRequireDefault(_inline);
9196
9197 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9198
9199 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9200
9201 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9202
9203 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9204
9205 var Bold = function (_Inline) {
9206 _inherits(Bold, _Inline);
9207
9208 function Bold() {
9209 _classCallCheck(this, Bold);
9210
9211 return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
9212 }
9213
9214 _createClass(Bold, [{
9215 key: 'optimize',
9216 value: function optimize(context) {
9217 _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);
9218 if (this.domNode.tagName !== this.statics.tagName[0]) {
9219 this.replaceWith(this.statics.blotName);
9220 }
9221 }
9222 }], [{
9223 key: 'create',
9224 value: function create() {
9225 return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
9226 }
9227 }, {
9228 key: 'formats',
9229 value: function formats() {
9230 return true;
9231 }
9232 }]);
9233
9234 return Bold;
9235 }(_inline2.default);
9236
9237 Bold.blotName = 'bold';
9238 Bold.tagName = ['STRONG', 'B'];
9239
9240 exports.default = Bold;
9241
9242 /***/ }),
9243 /* 57 */
9244 /***/ (function(module, exports, __webpack_require__) {
9245
9246 "use strict";
9247
9248
9249 Object.defineProperty(exports, "__esModule", {
9250 value: true
9251 });
9252 exports.addControls = exports.default = undefined;
9253
9254 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
9255
9256 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9257
9258 var _quillDelta = __webpack_require__(2);
9259
9260 var _quillDelta2 = _interopRequireDefault(_quillDelta);
9261
9262 var _parchment = __webpack_require__(0);
9263
9264 var _parchment2 = _interopRequireDefault(_parchment);
9265
9266 var _quill = __webpack_require__(5);
9267
9268 var _quill2 = _interopRequireDefault(_quill);
9269
9270 var _logger = __webpack_require__(10);
9271
9272 var _logger2 = _interopRequireDefault(_logger);
9273
9274 var _module = __webpack_require__(9);
9275
9276 var _module2 = _interopRequireDefault(_module);
9277
9278 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9279
9280 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9281
9282 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9283
9284 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9285
9286 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9287
9288 var debug = (0, _logger2.default)('quill:toolbar');
9289
9290 var Toolbar = function (_Module) {
9291 _inherits(Toolbar, _Module);
9292
9293 function Toolbar(quill, options) {
9294 _classCallCheck(this, Toolbar);
9295
9296 var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
9297
9298 if (Array.isArray(_this.options.container)) {
9299 var container = document.createElement('div');
9300 addControls(container, _this.options.container);
9301 quill.container.parentNode.insertBefore(container, quill.container);
9302 _this.container = container;
9303 } else if (typeof _this.options.container === 'string') {
9304 _this.container = document.querySelector(_this.options.container);
9305 } else {
9306 _this.container = _this.options.container;
9307 }
9308 if (!(_this.container instanceof HTMLElement)) {
9309 var _ret;
9310
9311 return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
9312 }
9313 _this.container.classList.add('ql-toolbar');
9314 _this.controls = [];
9315 _this.handlers = {};
9316 Object.keys(_this.options.handlers).forEach(function (format) {
9317 _this.addHandler(format, _this.options.handlers[format]);
9318 });
9319 [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
9320 _this.attach(input);
9321 });
9322 _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
9323 if (type === _quill2.default.events.SELECTION_CHANGE) {
9324 _this.update(range);
9325 }
9326 });
9327 _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
9328 var _this$quill$selection = _this.quill.selection.getRange(),
9329 _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
9330 range = _this$quill$selection2[0]; // quill.getSelection triggers update
9331
9332
9333 _this.update(range);
9334 });
9335 return _this;
9336 }
9337
9338 _createClass(Toolbar, [{
9339 key: 'addHandler',
9340 value: function addHandler(format, handler) {
9341 this.handlers[format] = handler;
9342 }
9343 }, {
9344 key: 'attach',
9345 value: function attach(input) {
9346 var _this2 = this;
9347
9348 var format = [].find.call(input.classList, function (className) {
9349 return className.indexOf('ql-') === 0;
9350 });
9351 if (!format) return;
9352 format = format.slice('ql-'.length);
9353 if (input.tagName === 'BUTTON') {
9354 input.setAttribute('type', 'button');
9355 }
9356 if (this.handlers[format] == null) {
9357 if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
9358 debug.warn('ignoring attaching to disabled format', format, input);
9359 return;
9360 }
9361 if (_parchment2.default.query(format) == null) {
9362 debug.warn('ignoring attaching to nonexistent format', format, input);
9363 return;
9364 }
9365 }
9366 var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
9367 input.addEventListener(eventName, function (e) {
9368 var value = void 0;
9369 if (input.tagName === 'SELECT') {
9370 if (input.selectedIndex < 0) return;
9371 var selected = input.options[input.selectedIndex];
9372 if (selected.hasAttribute('selected')) {
9373 value = false;
9374 } else {
9375 value = selected.value || false;
9376 }
9377 } else {
9378 if (input.classList.contains('ql-active')) {
9379 value = false;
9380 } else {
9381 value = input.value || !input.hasAttribute('value');
9382 }
9383 e.preventDefault();
9384 }
9385 _this2.quill.focus();
9386
9387 var _quill$selection$getR = _this2.quill.selection.getRange(),
9388 _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
9389 range = _quill$selection$getR2[0];
9390
9391 if (_this2.handlers[format] != null) {
9392 _this2.handlers[format].call(_this2, value);
9393 } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
9394 value = prompt('Enter ' + format);
9395 if (!value) return;
9396 _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
9397 } else {
9398 _this2.quill.format(format, value, _quill2.default.sources.USER);
9399 }
9400 _this2.update(range);
9401 });
9402 // TODO use weakmap
9403 this.controls.push([format, input]);
9404 }
9405 }, {
9406 key: 'update',
9407 value: function update(range) {
9408 var formats = range == null ? {} : this.quill.getFormat(range);
9409 this.controls.forEach(function (pair) {
9410 var _pair = _slicedToArray(pair, 2),
9411 format = _pair[0],
9412 input = _pair[1];
9413
9414 if (input.tagName === 'SELECT') {
9415 var option = void 0;
9416 if (range == null) {
9417 option = null;
9418 } else if (formats[format] == null) {
9419 option = input.querySelector('option[selected]');
9420 } else if (!Array.isArray(formats[format])) {
9421 var value = formats[format];
9422 if (typeof value === 'string') {
9423 value = value.replace(/\"/g, '\\"');
9424 }
9425 option = input.querySelector('option[value="' + value + '"]');
9426 }
9427 if (option == null) {
9428 input.value = ''; // TODO make configurable?
9429 input.selectedIndex = -1;
9430 } else {
9431 option.selected = true;
9432 }
9433 } else {
9434 if (range == null) {
9435 input.classList.remove('ql-active');
9436 } else if (input.hasAttribute('value')) {
9437 // both being null should match (default values)
9438 // '1' should match with 1 (headers)
9439 var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
9440 input.classList.toggle('ql-active', isActive);
9441 } else {
9442 input.classList.toggle('ql-active', formats[format] != null);
9443 }
9444 }
9445 });
9446 }
9447 }]);
9448
9449 return Toolbar;
9450 }(_module2.default);
9451
9452 Toolbar.DEFAULTS = {};
9453
9454 function addButton(container, format, value) {
9455 var input = document.createElement('button');
9456 input.setAttribute('type', 'button');
9457 input.classList.add('ql-' + format);
9458 if (value != null) {
9459 input.value = value;
9460 }
9461 container.appendChild(input);
9462 }
9463
9464 function addControls(container, groups) {
9465 if (!Array.isArray(groups[0])) {
9466 groups = [groups];
9467 }
9468 groups.forEach(function (controls) {
9469 var group = document.createElement('span');
9470 group.classList.add('ql-formats');
9471 controls.forEach(function (control) {
9472 if (typeof control === 'string') {
9473 addButton(group, control);
9474 } else {
9475 var format = Object.keys(control)[0];
9476 var value = control[format];
9477 if (Array.isArray(value)) {
9478 addSelect(group, format, value);
9479 } else {
9480 addButton(group, format, value);
9481 }
9482 }
9483 });
9484 container.appendChild(group);
9485 });
9486 }
9487
9488 function addSelect(container, format, values) {
9489 var input = document.createElement('select');
9490 input.classList.add('ql-' + format);
9491 values.forEach(function (value) {
9492 var option = document.createElement('option');
9493 if (value !== false) {
9494 option.setAttribute('value', value);
9495 } else {
9496 option.setAttribute('selected', 'selected');
9497 }
9498 input.appendChild(option);
9499 });
9500 container.appendChild(input);
9501 }
9502
9503 Toolbar.DEFAULTS = {
9504 container: null,
9505 handlers: {
9506 clean: function clean() {
9507 var _this3 = this;
9508
9509 var range = this.quill.getSelection();
9510 if (range == null) return;
9511 if (range.length == 0) {
9512 var formats = this.quill.getFormat();
9513 Object.keys(formats).forEach(function (name) {
9514 // Clean functionality in existing apps only clean inline formats
9515 if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
9516 _this3.quill.format(name, false);
9517 }
9518 });
9519 } else {
9520 this.quill.removeFormat(range, _quill2.default.sources.USER);
9521 }
9522 },
9523 direction: function direction(value) {
9524 var align = this.quill.getFormat()['align'];
9525 if (value === 'rtl' && align == null) {
9526 this.quill.format('align', 'right', _quill2.default.sources.USER);
9527 } else if (!value && align === 'right') {
9528 this.quill.format('align', false, _quill2.default.sources.USER);
9529 }
9530 this.quill.format('direction', value, _quill2.default.sources.USER);
9531 },
9532 indent: function indent(value) {
9533 var range = this.quill.getSelection();
9534 var formats = this.quill.getFormat(range);
9535 var indent = parseInt(formats.indent || 0);
9536 if (value === '+1' || value === '-1') {
9537 var modifier = value === '+1' ? 1 : -1;
9538 if (formats.direction === 'rtl') modifier *= -1;
9539 this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
9540 }
9541 },
9542 link: function link(value) {
9543 if (value === true) {
9544 value = prompt('Enter link URL:');
9545 }
9546 this.quill.format('link', value, _quill2.default.sources.USER);
9547 },
9548 list: function list(value) {
9549 var range = this.quill.getSelection();
9550 var formats = this.quill.getFormat(range);
9551 if (value === 'check') {
9552 if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
9553 this.quill.format('list', false, _quill2.default.sources.USER);
9554 } else {
9555 this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
9556 }
9557 } else {
9558 this.quill.format('list', value, _quill2.default.sources.USER);
9559 }
9560 }
9561 }
9562 };
9563
9564 exports.default = Toolbar;
9565 exports.addControls = addControls;
9566
9567 /***/ }),
9568 /* 58 */
9569 /***/ (function(module, exports) {
9570
9571 module.exports = "<svg viewbox=\"0 0 18 18\"> <polyline class=\"ql-even ql-stroke\" points=\"5 7 3 9 5 11\"></polyline> <polyline class=\"ql-even ql-stroke\" points=\"13 7 15 9 13 11\"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>";
9572
9573 /***/ }),
9574 /* 59 */
9575 /***/ (function(module, exports, __webpack_require__) {
9576
9577 "use strict";
9578
9579
9580 Object.defineProperty(exports, "__esModule", {
9581 value: true
9582 });
9583
9584 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9585
9586 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
9587
9588 var _picker = __webpack_require__(28);
9589
9590 var _picker2 = _interopRequireDefault(_picker);
9591
9592 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9593
9594 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9595
9596 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9597
9598 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9599
9600 var ColorPicker = function (_Picker) {
9601 _inherits(ColorPicker, _Picker);
9602
9603 function ColorPicker(select, label) {
9604 _classCallCheck(this, ColorPicker);
9605
9606 var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
9607
9608 _this.label.innerHTML = label;
9609 _this.container.classList.add('ql-color-picker');
9610 [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
9611 item.classList.add('ql-primary');
9612 });
9613 return _this;
9614 }
9615
9616 _createClass(ColorPicker, [{
9617 key: 'buildItem',
9618 value: function buildItem(option) {
9619 var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
9620 item.style.backgroundColor = option.getAttribute('value') || '';
9621 return item;
9622 }
9623 }, {
9624 key: 'selectItem',
9625 value: function selectItem(item, trigger) {
9626 _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
9627 var colorLabel = this.label.querySelector('.ql-color-label');
9628 var value = item ? item.getAttribute('data-value') || '' : '';
9629 if (colorLabel) {
9630 if (colorLabel.tagName === 'line') {
9631 colorLabel.style.stroke = value;
9632 } else {
9633 colorLabel.style.fill = value;
9634 }
9635 }
9636 }
9637 }]);
9638
9639 return ColorPicker;
9640 }(_picker2.default);
9641
9642 exports.default = ColorPicker;
9643
9644 /***/ }),
9645 /* 60 */
9646 /***/ (function(module, exports, __webpack_require__) {
9647
9648 "use strict";
9649
9650
9651 Object.defineProperty(exports, "__esModule", {
9652 value: true
9653 });
9654
9655 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9656
9657 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
9658
9659 var _picker = __webpack_require__(28);
9660
9661 var _picker2 = _interopRequireDefault(_picker);
9662
9663 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9664
9665 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9666
9667 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9668
9669 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9670
9671 var IconPicker = function (_Picker) {
9672 _inherits(IconPicker, _Picker);
9673
9674 function IconPicker(select, icons) {
9675 _classCallCheck(this, IconPicker);
9676
9677 var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
9678
9679 _this.container.classList.add('ql-icon-picker');
9680 [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
9681 item.innerHTML = icons[item.getAttribute('data-value') || ''];
9682 });
9683 _this.defaultItem = _this.container.querySelector('.ql-selected');
9684 _this.selectItem(_this.defaultItem);
9685 return _this;
9686 }
9687
9688 _createClass(IconPicker, [{
9689 key: 'selectItem',
9690 value: function selectItem(item, trigger) {
9691 _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
9692 item = item || this.defaultItem;
9693 this.label.innerHTML = item.innerHTML;
9694 }
9695 }]);
9696
9697 return IconPicker;
9698 }(_picker2.default);
9699
9700 exports.default = IconPicker;
9701
9702 /***/ }),
9703 /* 61 */
9704 /***/ (function(module, exports, __webpack_require__) {
9705
9706 "use strict";
9707
9708
9709 Object.defineProperty(exports, "__esModule", {
9710 value: true
9711 });
9712
9713 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9714
9715 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9716
9717 var Tooltip = function () {
9718 function Tooltip(quill, boundsContainer) {
9719 var _this = this;
9720
9721 _classCallCheck(this, Tooltip);
9722
9723 this.quill = quill;
9724 this.boundsContainer = boundsContainer || document.body;
9725 this.root = quill.addContainer('ql-tooltip');
9726 this.root.innerHTML = this.constructor.TEMPLATE;
9727 if (this.quill.root === this.quill.scrollingContainer) {
9728 this.quill.root.addEventListener('scroll', function () {
9729 _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
9730 });
9731 }
9732 this.hide();
9733 }
9734
9735 _createClass(Tooltip, [{
9736 key: 'hide',
9737 value: function hide() {
9738 this.root.classList.add('ql-hidden');
9739 }
9740 }, {
9741 key: 'position',
9742 value: function position(reference) {
9743 var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
9744 // root.scrollTop should be 0 if scrollContainer !== root
9745 var top = reference.bottom + this.quill.root.scrollTop;
9746 this.root.style.left = left + 'px';
9747 this.root.style.top = top + 'px';
9748 this.root.classList.remove('ql-flip');
9749 var containerBounds = this.boundsContainer.getBoundingClientRect();
9750 var rootBounds = this.root.getBoundingClientRect();
9751 var shift = 0;
9752 if (rootBounds.right > containerBounds.right) {
9753 shift = containerBounds.right - rootBounds.right;
9754 this.root.style.left = left + shift + 'px';
9755 }
9756 if (rootBounds.left < containerBounds.left) {
9757 shift = containerBounds.left - rootBounds.left;
9758 this.root.style.left = left + shift + 'px';
9759 }
9760 if (rootBounds.bottom > containerBounds.bottom) {
9761 var height = rootBounds.bottom - rootBounds.top;
9762 var verticalShift = reference.bottom - reference.top + height;
9763 this.root.style.top = top - verticalShift + 'px';
9764 this.root.classList.add('ql-flip');
9765 }
9766 return shift;
9767 }
9768 }, {
9769 key: 'show',
9770 value: function show() {
9771 this.root.classList.remove('ql-editing');
9772 this.root.classList.remove('ql-hidden');
9773 }
9774 }]);
9775
9776 return Tooltip;
9777 }();
9778
9779 exports.default = Tooltip;
9780
9781 /***/ }),
9782 /* 62 */
9783 /***/ (function(module, exports, __webpack_require__) {
9784
9785 "use strict";
9786
9787
9788 Object.defineProperty(exports, "__esModule", {
9789 value: true
9790 });
9791
9792 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
9793
9794 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
9795
9796 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9797
9798 var _extend = __webpack_require__(3);
9799
9800 var _extend2 = _interopRequireDefault(_extend);
9801
9802 var _emitter = __webpack_require__(8);
9803
9804 var _emitter2 = _interopRequireDefault(_emitter);
9805
9806 var _base = __webpack_require__(43);
9807
9808 var _base2 = _interopRequireDefault(_base);
9809
9810 var _link = __webpack_require__(27);
9811
9812 var _link2 = _interopRequireDefault(_link);
9813
9814 var _selection = __webpack_require__(15);
9815
9816 var _icons = __webpack_require__(41);
9817
9818 var _icons2 = _interopRequireDefault(_icons);
9819
9820 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9821
9822 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9823
9824 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
9825
9826 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
9827
9828 var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
9829
9830 var SnowTheme = function (_BaseTheme) {
9831 _inherits(SnowTheme, _BaseTheme);
9832
9833 function SnowTheme(quill, options) {
9834 _classCallCheck(this, SnowTheme);
9835
9836 if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
9837 options.modules.toolbar.container = TOOLBAR_CONFIG;
9838 }
9839
9840 var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
9841
9842 _this.quill.container.classList.add('ql-snow');
9843 return _this;
9844 }
9845
9846 _createClass(SnowTheme, [{
9847 key: 'extendToolbar',
9848 value: function extendToolbar(toolbar) {
9849 toolbar.container.classList.add('ql-snow');
9850 this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
9851 this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
9852 this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
9853 if (toolbar.container.querySelector('.ql-link')) {
9854 this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
9855 toolbar.handlers['link'].call(toolbar, !context.format.link);
9856 });
9857 }
9858 }
9859 }]);
9860
9861 return SnowTheme;
9862 }(_base2.default);
9863
9864 SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
9865 modules: {
9866 toolbar: {
9867 handlers: {
9868 link: function link(value) {
9869 if (value) {
9870 var range = this.quill.getSelection();
9871 if (range == null || range.length == 0) return;
9872 var preview = this.quill.getText(range);
9873 if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
9874 preview = 'mailto:' + preview;
9875 }
9876 var tooltip = this.quill.theme.tooltip;
9877 tooltip.edit('link', preview);
9878 } else {
9879 this.quill.format('link', false);
9880 }
9881 }
9882 }
9883 }
9884 }
9885 });
9886
9887 var SnowTooltip = function (_BaseTooltip) {
9888 _inherits(SnowTooltip, _BaseTooltip);
9889
9890 function SnowTooltip(quill, bounds) {
9891 _classCallCheck(this, SnowTooltip);
9892
9893 var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
9894
9895 _this2.preview = _this2.root.querySelector('a.ql-preview');
9896 return _this2;
9897 }
9898
9899 _createClass(SnowTooltip, [{
9900 key: 'listen',
9901 value: function listen() {
9902 var _this3 = this;
9903
9904 _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
9905 this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
9906 if (_this3.root.classList.contains('ql-editing')) {
9907 _this3.save();
9908 } else {
9909 _this3.edit('link', _this3.preview.textContent);
9910 }
9911 event.preventDefault();
9912 });
9913 this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
9914 if (_this3.linkRange != null) {
9915 var range = _this3.linkRange;
9916 _this3.restoreFocus();
9917 _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
9918 delete _this3.linkRange;
9919 }
9920 event.preventDefault();
9921 _this3.hide();
9922 });
9923 this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
9924 if (range == null) return;
9925 if (range.length === 0 && source === _emitter2.default.sources.USER) {
9926 var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
9927 _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
9928 link = _quill$scroll$descend2[0],
9929 offset = _quill$scroll$descend2[1];
9930
9931 if (link != null) {
9932 _this3.linkRange = new _selection.Range(range.index - offset, link.length());
9933 var preview = _link2.default.formats(link.domNode);
9934 _this3.preview.textContent = preview;
9935 _this3.preview.setAttribute('href', preview);
9936 _this3.show();
9937 _this3.position(_this3.quill.getBounds(_this3.linkRange));
9938 return;
9939 }
9940 } else {
9941 delete _this3.linkRange;
9942 }
9943 _this3.hide();
9944 });
9945 }
9946 }, {
9947 key: 'show',
9948 value: function show() {
9949 _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
9950 this.root.removeAttribute('data-mode');
9951 }
9952 }]);
9953
9954 return SnowTooltip;
9955 }(_base.BaseTooltip);
9956
9957 SnowTooltip.TEMPLATE = ['<a class="ql-preview" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
9958
9959 exports.default = SnowTheme;
9960
9961 /***/ }),
9962 /* 63 */
9963 /***/ (function(module, exports, __webpack_require__) {
9964
9965 "use strict";
9966
9967
9968 Object.defineProperty(exports, "__esModule", {
9969 value: true
9970 });
9971
9972 var _core = __webpack_require__(29);
9973
9974 var _core2 = _interopRequireDefault(_core);
9975
9976 var _align = __webpack_require__(36);
9977
9978 var _direction = __webpack_require__(38);
9979
9980 var _indent = __webpack_require__(64);
9981
9982 var _blockquote = __webpack_require__(65);
9983
9984 var _blockquote2 = _interopRequireDefault(_blockquote);
9985
9986 var _header = __webpack_require__(66);
9987
9988 var _header2 = _interopRequireDefault(_header);
9989
9990 var _list = __webpack_require__(67);
9991
9992 var _list2 = _interopRequireDefault(_list);
9993
9994 var _background = __webpack_require__(37);
9995
9996 var _color = __webpack_require__(26);
9997
9998 var _font = __webpack_require__(39);
9999
10000 var _size = __webpack_require__(40);
10001
10002 var _bold = __webpack_require__(56);
10003
10004 var _bold2 = _interopRequireDefault(_bold);
10005
10006 var _italic = __webpack_require__(68);
10007
10008 var _italic2 = _interopRequireDefault(_italic);
10009
10010 var _link = __webpack_require__(27);
10011
10012 var _link2 = _interopRequireDefault(_link);
10013
10014 var _script = __webpack_require__(69);
10015
10016 var _script2 = _interopRequireDefault(_script);
10017
10018 var _strike = __webpack_require__(70);
10019
10020 var _strike2 = _interopRequireDefault(_strike);
10021
10022 var _underline = __webpack_require__(71);
10023
10024 var _underline2 = _interopRequireDefault(_underline);
10025
10026 var _image = __webpack_require__(72);
10027
10028 var _image2 = _interopRequireDefault(_image);
10029
10030 var _video = __webpack_require__(73);
10031
10032 var _video2 = _interopRequireDefault(_video);
10033
10034 var _code = __webpack_require__(13);
10035
10036 var _code2 = _interopRequireDefault(_code);
10037
10038 var _formula = __webpack_require__(74);
10039
10040 var _formula2 = _interopRequireDefault(_formula);
10041
10042 var _syntax = __webpack_require__(75);
10043
10044 var _syntax2 = _interopRequireDefault(_syntax);
10045
10046 var _toolbar = __webpack_require__(57);
10047
10048 var _toolbar2 = _interopRequireDefault(_toolbar);
10049
10050 var _icons = __webpack_require__(41);
10051
10052 var _icons2 = _interopRequireDefault(_icons);
10053
10054 var _picker = __webpack_require__(28);
10055
10056 var _picker2 = _interopRequireDefault(_picker);
10057
10058 var _colorPicker = __webpack_require__(59);
10059
10060 var _colorPicker2 = _interopRequireDefault(_colorPicker);
10061
10062 var _iconPicker = __webpack_require__(60);
10063
10064 var _iconPicker2 = _interopRequireDefault(_iconPicker);
10065
10066 var _tooltip = __webpack_require__(61);
10067
10068 var _tooltip2 = _interopRequireDefault(_tooltip);
10069
10070 var _bubble = __webpack_require__(108);
10071
10072 var _bubble2 = _interopRequireDefault(_bubble);
10073
10074 var _snow = __webpack_require__(62);
10075
10076 var _snow2 = _interopRequireDefault(_snow);
10077
10078 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10079
10080 _core2.default.register({
10081 'attributors/attribute/direction': _direction.DirectionAttribute,
10082
10083 'attributors/class/align': _align.AlignClass,
10084 'attributors/class/background': _background.BackgroundClass,
10085 'attributors/class/color': _color.ColorClass,
10086 'attributors/class/direction': _direction.DirectionClass,
10087 'attributors/class/font': _font.FontClass,
10088 'attributors/class/size': _size.SizeClass,
10089
10090 'attributors/style/align': _align.AlignStyle,
10091 'attributors/style/background': _background.BackgroundStyle,
10092 'attributors/style/color': _color.ColorStyle,
10093 'attributors/style/direction': _direction.DirectionStyle,
10094 'attributors/style/font': _font.FontStyle,
10095 'attributors/style/size': _size.SizeStyle
10096 }, true);
10097
10098 _core2.default.register({
10099 'formats/align': _align.AlignClass,
10100 'formats/direction': _direction.DirectionClass,
10101 'formats/indent': _indent.IndentClass,
10102
10103 'formats/background': _background.BackgroundStyle,
10104 'formats/color': _color.ColorStyle,
10105 'formats/font': _font.FontClass,
10106 'formats/size': _size.SizeClass,
10107
10108 'formats/blockquote': _blockquote2.default,
10109 'formats/code-block': _code2.default,
10110 'formats/header': _header2.default,
10111 'formats/list': _list2.default,
10112
10113 'formats/bold': _bold2.default,
10114 'formats/code': _code.Code,
10115 'formats/italic': _italic2.default,
10116 'formats/link': _link2.default,
10117 'formats/script': _script2.default,
10118 'formats/strike': _strike2.default,
10119 'formats/underline': _underline2.default,
10120
10121 'formats/image': _image2.default,
10122 'formats/video': _video2.default,
10123
10124 'formats/list/item': _list.ListItem,
10125
10126 'modules/formula': _formula2.default,
10127 'modules/syntax': _syntax2.default,
10128 'modules/toolbar': _toolbar2.default,
10129
10130 'themes/bubble': _bubble2.default,
10131 'themes/snow': _snow2.default,
10132
10133 'ui/icons': _icons2.default,
10134 'ui/picker': _picker2.default,
10135 'ui/icon-picker': _iconPicker2.default,
10136 'ui/color-picker': _colorPicker2.default,
10137 'ui/tooltip': _tooltip2.default
10138 }, true);
10139
10140 exports.default = _core2.default;
10141
10142 /***/ }),
10143 /* 64 */
10144 /***/ (function(module, exports, __webpack_require__) {
10145
10146 "use strict";
10147
10148
10149 Object.defineProperty(exports, "__esModule", {
10150 value: true
10151 });
10152 exports.IndentClass = undefined;
10153
10154 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10155
10156 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10157
10158 var _parchment = __webpack_require__(0);
10159
10160 var _parchment2 = _interopRequireDefault(_parchment);
10161
10162 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10163
10164 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10165
10166 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10167
10168 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10169
10170 var IdentAttributor = function (_Parchment$Attributor) {
10171 _inherits(IdentAttributor, _Parchment$Attributor);
10172
10173 function IdentAttributor() {
10174 _classCallCheck(this, IdentAttributor);
10175
10176 return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
10177 }
10178
10179 _createClass(IdentAttributor, [{
10180 key: 'add',
10181 value: function add(node, value) {
10182 if (value === '+1' || value === '-1') {
10183 var indent = this.value(node) || 0;
10184 value = value === '+1' ? indent + 1 : indent - 1;
10185 }
10186 if (value === 0) {
10187 this.remove(node);
10188 return true;
10189 } else {
10190 return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
10191 }
10192 }
10193 }, {
10194 key: 'canAdd',
10195 value: function canAdd(node, value) {
10196 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));
10197 }
10198 }, {
10199 key: 'value',
10200 value: function value(node) {
10201 return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
10202 }
10203 }]);
10204
10205 return IdentAttributor;
10206 }(_parchment2.default.Attributor.Class);
10207
10208 var IndentClass = new IdentAttributor('indent', 'ql-indent', {
10209 scope: _parchment2.default.Scope.BLOCK,
10210 whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
10211 });
10212
10213 exports.IndentClass = IndentClass;
10214
10215 /***/ }),
10216 /* 65 */
10217 /***/ (function(module, exports, __webpack_require__) {
10218
10219 "use strict";
10220
10221
10222 Object.defineProperty(exports, "__esModule", {
10223 value: true
10224 });
10225
10226 var _block = __webpack_require__(4);
10227
10228 var _block2 = _interopRequireDefault(_block);
10229
10230 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10231
10232 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10233
10234 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10235
10236 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10237
10238 var Blockquote = function (_Block) {
10239 _inherits(Blockquote, _Block);
10240
10241 function Blockquote() {
10242 _classCallCheck(this, Blockquote);
10243
10244 return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
10245 }
10246
10247 return Blockquote;
10248 }(_block2.default);
10249
10250 Blockquote.blotName = 'blockquote';
10251 Blockquote.tagName = 'blockquote';
10252
10253 exports.default = Blockquote;
10254
10255 /***/ }),
10256 /* 66 */
10257 /***/ (function(module, exports, __webpack_require__) {
10258
10259 "use strict";
10260
10261
10262 Object.defineProperty(exports, "__esModule", {
10263 value: true
10264 });
10265
10266 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10267
10268 var _block = __webpack_require__(4);
10269
10270 var _block2 = _interopRequireDefault(_block);
10271
10272 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10273
10274 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10275
10276 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10277
10278 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10279
10280 var Header = function (_Block) {
10281 _inherits(Header, _Block);
10282
10283 function Header() {
10284 _classCallCheck(this, Header);
10285
10286 return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
10287 }
10288
10289 _createClass(Header, null, [{
10290 key: 'formats',
10291 value: function formats(domNode) {
10292 return this.tagName.indexOf(domNode.tagName) + 1;
10293 }
10294 }]);
10295
10296 return Header;
10297 }(_block2.default);
10298
10299 Header.blotName = 'header';
10300 Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
10301
10302 exports.default = Header;
10303
10304 /***/ }),
10305 /* 67 */
10306 /***/ (function(module, exports, __webpack_require__) {
10307
10308 "use strict";
10309
10310
10311 Object.defineProperty(exports, "__esModule", {
10312 value: true
10313 });
10314 exports.default = exports.ListItem = undefined;
10315
10316 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10317
10318 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10319
10320 var _parchment = __webpack_require__(0);
10321
10322 var _parchment2 = _interopRequireDefault(_parchment);
10323
10324 var _block = __webpack_require__(4);
10325
10326 var _block2 = _interopRequireDefault(_block);
10327
10328 var _container = __webpack_require__(25);
10329
10330 var _container2 = _interopRequireDefault(_container);
10331
10332 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10333
10334 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10335
10336 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10337
10338 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10339
10340 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10341
10342 var ListItem = function (_Block) {
10343 _inherits(ListItem, _Block);
10344
10345 function ListItem() {
10346 _classCallCheck(this, ListItem);
10347
10348 return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
10349 }
10350
10351 _createClass(ListItem, [{
10352 key: 'format',
10353 value: function format(name, value) {
10354 if (name === List.blotName && !value) {
10355 this.replaceWith(_parchment2.default.create(this.statics.scope));
10356 } else {
10357 _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
10358 }
10359 }
10360 }, {
10361 key: 'remove',
10362 value: function remove() {
10363 if (this.prev == null && this.next == null) {
10364 this.parent.remove();
10365 } else {
10366 _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
10367 }
10368 }
10369 }, {
10370 key: 'replaceWith',
10371 value: function replaceWith(name, value) {
10372 this.parent.isolate(this.offset(this.parent), this.length());
10373 if (name === this.parent.statics.blotName) {
10374 this.parent.replaceWith(name, value);
10375 return this;
10376 } else {
10377 this.parent.unwrap();
10378 return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
10379 }
10380 }
10381 }], [{
10382 key: 'formats',
10383 value: function formats(domNode) {
10384 return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
10385 }
10386 }]);
10387
10388 return ListItem;
10389 }(_block2.default);
10390
10391 ListItem.blotName = 'list-item';
10392 ListItem.tagName = 'LI';
10393
10394 var List = function (_Container) {
10395 _inherits(List, _Container);
10396
10397 _createClass(List, null, [{
10398 key: 'create',
10399 value: function create(value) {
10400 var tagName = value === 'ordered' ? 'OL' : 'UL';
10401 var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
10402 if (value === 'checked' || value === 'unchecked') {
10403 node.setAttribute('data-checked', value === 'checked');
10404 }
10405 return node;
10406 }
10407 }, {
10408 key: 'formats',
10409 value: function formats(domNode) {
10410 if (domNode.tagName === 'OL') return 'ordered';
10411 if (domNode.tagName === 'UL') {
10412 if (domNode.hasAttribute('data-checked')) {
10413 return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
10414 } else {
10415 return 'bullet';
10416 }
10417 }
10418 return undefined;
10419 }
10420 }]);
10421
10422 function List(domNode) {
10423 _classCallCheck(this, List);
10424
10425 var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
10426
10427 var listEventHandler = function listEventHandler(e) {
10428 if (e.target.parentNode !== domNode) return;
10429 var format = _this2.statics.formats(domNode);
10430 var blot = _parchment2.default.find(e.target);
10431 if (format === 'checked') {
10432 blot.format('list', 'unchecked');
10433 } else if (format === 'unchecked') {
10434 blot.format('list', 'checked');
10435 }
10436 };
10437
10438 domNode.addEventListener('touchstart', listEventHandler);
10439 domNode.addEventListener('mousedown', listEventHandler);
10440 return _this2;
10441 }
10442
10443 _createClass(List, [{
10444 key: 'format',
10445 value: function format(name, value) {
10446 if (this.children.length > 0) {
10447 this.children.tail.format(name, value);
10448 }
10449 }
10450 }, {
10451 key: 'formats',
10452 value: function formats() {
10453 // We don't inherit from FormatBlot
10454 return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
10455 }
10456 }, {
10457 key: 'insertBefore',
10458 value: function insertBefore(blot, ref) {
10459 if (blot instanceof ListItem) {
10460 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
10461 } else {
10462 var index = ref == null ? this.length() : ref.offset(this);
10463 var after = this.split(index);
10464 after.parent.insertBefore(blot, after);
10465 }
10466 }
10467 }, {
10468 key: 'optimize',
10469 value: function optimize(context) {
10470 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);
10471 var next = this.next;
10472 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')) {
10473 next.moveChildren(this);
10474 next.remove();
10475 }
10476 }
10477 }, {
10478 key: 'replace',
10479 value: function replace(target) {
10480 if (target.statics.blotName !== this.statics.blotName) {
10481 var item = _parchment2.default.create(this.statics.defaultChild);
10482 target.moveChildren(item);
10483 this.appendChild(item);
10484 }
10485 _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
10486 }
10487 }]);
10488
10489 return List;
10490 }(_container2.default);
10491
10492 List.blotName = 'list';
10493 List.scope = _parchment2.default.Scope.BLOCK_BLOT;
10494 List.tagName = ['OL', 'UL'];
10495 List.defaultChild = 'list-item';
10496 List.allowedChildren = [ListItem];
10497
10498 exports.ListItem = ListItem;
10499 exports.default = List;
10500
10501 /***/ }),
10502 /* 68 */
10503 /***/ (function(module, exports, __webpack_require__) {
10504
10505 "use strict";
10506
10507
10508 Object.defineProperty(exports, "__esModule", {
10509 value: true
10510 });
10511
10512 var _bold = __webpack_require__(56);
10513
10514 var _bold2 = _interopRequireDefault(_bold);
10515
10516 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10517
10518 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10519
10520 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10521
10522 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10523
10524 var Italic = function (_Bold) {
10525 _inherits(Italic, _Bold);
10526
10527 function Italic() {
10528 _classCallCheck(this, Italic);
10529
10530 return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
10531 }
10532
10533 return Italic;
10534 }(_bold2.default);
10535
10536 Italic.blotName = 'italic';
10537 Italic.tagName = ['EM', 'I'];
10538
10539 exports.default = Italic;
10540
10541 /***/ }),
10542 /* 69 */
10543 /***/ (function(module, exports, __webpack_require__) {
10544
10545 "use strict";
10546
10547
10548 Object.defineProperty(exports, "__esModule", {
10549 value: true
10550 });
10551
10552 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10553
10554 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10555
10556 var _inline = __webpack_require__(6);
10557
10558 var _inline2 = _interopRequireDefault(_inline);
10559
10560 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10561
10562 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10563
10564 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10565
10566 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10567
10568 var Script = function (_Inline) {
10569 _inherits(Script, _Inline);
10570
10571 function Script() {
10572 _classCallCheck(this, Script);
10573
10574 return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
10575 }
10576
10577 _createClass(Script, null, [{
10578 key: 'create',
10579 value: function create(value) {
10580 if (value === 'super') {
10581 return document.createElement('sup');
10582 } else if (value === 'sub') {
10583 return document.createElement('sub');
10584 } else {
10585 return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
10586 }
10587 }
10588 }, {
10589 key: 'formats',
10590 value: function formats(domNode) {
10591 if (domNode.tagName === 'SUB') return 'sub';
10592 if (domNode.tagName === 'SUP') return 'super';
10593 return undefined;
10594 }
10595 }]);
10596
10597 return Script;
10598 }(_inline2.default);
10599
10600 Script.blotName = 'script';
10601 Script.tagName = ['SUB', 'SUP'];
10602
10603 exports.default = Script;
10604
10605 /***/ }),
10606 /* 70 */
10607 /***/ (function(module, exports, __webpack_require__) {
10608
10609 "use strict";
10610
10611
10612 Object.defineProperty(exports, "__esModule", {
10613 value: true
10614 });
10615
10616 var _inline = __webpack_require__(6);
10617
10618 var _inline2 = _interopRequireDefault(_inline);
10619
10620 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10621
10622 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10623
10624 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10625
10626 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10627
10628 var Strike = function (_Inline) {
10629 _inherits(Strike, _Inline);
10630
10631 function Strike() {
10632 _classCallCheck(this, Strike);
10633
10634 return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
10635 }
10636
10637 return Strike;
10638 }(_inline2.default);
10639
10640 Strike.blotName = 'strike';
10641 Strike.tagName = 'S';
10642
10643 exports.default = Strike;
10644
10645 /***/ }),
10646 /* 71 */
10647 /***/ (function(module, exports, __webpack_require__) {
10648
10649 "use strict";
10650
10651
10652 Object.defineProperty(exports, "__esModule", {
10653 value: true
10654 });
10655
10656 var _inline = __webpack_require__(6);
10657
10658 var _inline2 = _interopRequireDefault(_inline);
10659
10660 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10661
10662 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10663
10664 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10665
10666 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10667
10668 var Underline = function (_Inline) {
10669 _inherits(Underline, _Inline);
10670
10671 function Underline() {
10672 _classCallCheck(this, Underline);
10673
10674 return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
10675 }
10676
10677 return Underline;
10678 }(_inline2.default);
10679
10680 Underline.blotName = 'underline';
10681 Underline.tagName = 'U';
10682
10683 exports.default = Underline;
10684
10685 /***/ }),
10686 /* 72 */
10687 /***/ (function(module, exports, __webpack_require__) {
10688
10689 "use strict";
10690
10691
10692 Object.defineProperty(exports, "__esModule", {
10693 value: true
10694 });
10695
10696 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10697
10698 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10699
10700 var _parchment = __webpack_require__(0);
10701
10702 var _parchment2 = _interopRequireDefault(_parchment);
10703
10704 var _link = __webpack_require__(27);
10705
10706 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10707
10708 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10709
10710 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10711
10712 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10713
10714 var ATTRIBUTES = ['alt', 'height', 'width'];
10715
10716 var Image = function (_Parchment$Embed) {
10717 _inherits(Image, _Parchment$Embed);
10718
10719 function Image() {
10720 _classCallCheck(this, Image);
10721
10722 return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
10723 }
10724
10725 _createClass(Image, [{
10726 key: 'format',
10727 value: function format(name, value) {
10728 if (ATTRIBUTES.indexOf(name) > -1) {
10729 if (value) {
10730 this.domNode.setAttribute(name, value);
10731 } else {
10732 this.domNode.removeAttribute(name);
10733 }
10734 } else {
10735 _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
10736 }
10737 }
10738 }], [{
10739 key: 'create',
10740 value: function create(value) {
10741 var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
10742 if (typeof value === 'string') {
10743 node.setAttribute('src', this.sanitize(value));
10744 }
10745 return node;
10746 }
10747 }, {
10748 key: 'formats',
10749 value: function formats(domNode) {
10750 return ATTRIBUTES.reduce(function (formats, attribute) {
10751 if (domNode.hasAttribute(attribute)) {
10752 formats[attribute] = domNode.getAttribute(attribute);
10753 }
10754 return formats;
10755 }, {});
10756 }
10757 }, {
10758 key: 'match',
10759 value: function match(url) {
10760 return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
10761 );
10762 }
10763 }, {
10764 key: 'sanitize',
10765 value: function sanitize(url) {
10766 return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
10767 }
10768 }, {
10769 key: 'value',
10770 value: function value(domNode) {
10771 return domNode.getAttribute('src');
10772 }
10773 }]);
10774
10775 return Image;
10776 }(_parchment2.default.Embed);
10777
10778 Image.blotName = 'image';
10779 Image.tagName = 'IMG';
10780
10781 exports.default = Image;
10782
10783 /***/ }),
10784 /* 73 */
10785 /***/ (function(module, exports, __webpack_require__) {
10786
10787 "use strict";
10788
10789
10790 Object.defineProperty(exports, "__esModule", {
10791 value: true
10792 });
10793
10794 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10795
10796 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10797
10798 var _block = __webpack_require__(4);
10799
10800 var _link = __webpack_require__(27);
10801
10802 var _link2 = _interopRequireDefault(_link);
10803
10804 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10805
10806 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10807
10808 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10809
10810 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10811
10812 var ATTRIBUTES = ['height', 'width'];
10813
10814 var Video = function (_BlockEmbed) {
10815 _inherits(Video, _BlockEmbed);
10816
10817 function Video() {
10818 _classCallCheck(this, Video);
10819
10820 return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
10821 }
10822
10823 _createClass(Video, [{
10824 key: 'format',
10825 value: function format(name, value) {
10826 if (ATTRIBUTES.indexOf(name) > -1) {
10827 if (value) {
10828 this.domNode.setAttribute(name, value);
10829 } else {
10830 this.domNode.removeAttribute(name);
10831 }
10832 } else {
10833 _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
10834 }
10835 }
10836 }], [{
10837 key: 'create',
10838 value: function create(value) {
10839 var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
10840 node.setAttribute('frameborder', '0');
10841 node.setAttribute('allowfullscreen', true);
10842 node.setAttribute('src', this.sanitize(value));
10843 return node;
10844 }
10845 }, {
10846 key: 'formats',
10847 value: function formats(domNode) {
10848 return ATTRIBUTES.reduce(function (formats, attribute) {
10849 if (domNode.hasAttribute(attribute)) {
10850 formats[attribute] = domNode.getAttribute(attribute);
10851 }
10852 return formats;
10853 }, {});
10854 }
10855 }, {
10856 key: 'sanitize',
10857 value: function sanitize(url) {
10858 return _link2.default.sanitize(url);
10859 }
10860 }, {
10861 key: 'value',
10862 value: function value(domNode) {
10863 return domNode.getAttribute('src');
10864 }
10865 }]);
10866
10867 return Video;
10868 }(_block.BlockEmbed);
10869
10870 Video.blotName = 'video';
10871 Video.className = 'ql-video';
10872 Video.tagName = 'IFRAME';
10873
10874 exports.default = Video;
10875
10876 /***/ }),
10877 /* 74 */
10878 /***/ (function(module, exports, __webpack_require__) {
10879
10880 "use strict";
10881
10882
10883 Object.defineProperty(exports, "__esModule", {
10884 value: true
10885 });
10886 exports.default = exports.FormulaBlot = undefined;
10887
10888 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10889
10890 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10891
10892 var _embed = __webpack_require__(35);
10893
10894 var _embed2 = _interopRequireDefault(_embed);
10895
10896 var _quill = __webpack_require__(5);
10897
10898 var _quill2 = _interopRequireDefault(_quill);
10899
10900 var _module = __webpack_require__(9);
10901
10902 var _module2 = _interopRequireDefault(_module);
10903
10904 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10905
10906 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10907
10908 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10909
10910 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10911
10912 var FormulaBlot = function (_Embed) {
10913 _inherits(FormulaBlot, _Embed);
10914
10915 function FormulaBlot() {
10916 _classCallCheck(this, FormulaBlot);
10917
10918 return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
10919 }
10920
10921 _createClass(FormulaBlot, null, [{
10922 key: 'create',
10923 value: function create(value) {
10924 var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
10925 if (typeof value === 'string') {
10926 window.katex.render(value, node, {
10927 throwOnError: false,
10928 errorColor: '#f00'
10929 });
10930 node.setAttribute('data-value', value);
10931 }
10932 return node;
10933 }
10934 }, {
10935 key: 'value',
10936 value: function value(domNode) {
10937 return domNode.getAttribute('data-value');
10938 }
10939 }]);
10940
10941 return FormulaBlot;
10942 }(_embed2.default);
10943
10944 FormulaBlot.blotName = 'formula';
10945 FormulaBlot.className = 'ql-formula';
10946 FormulaBlot.tagName = 'SPAN';
10947
10948 var Formula = function (_Module) {
10949 _inherits(Formula, _Module);
10950
10951 _createClass(Formula, null, [{
10952 key: 'register',
10953 value: function register() {
10954 _quill2.default.register(FormulaBlot, true);
10955 }
10956 }]);
10957
10958 function Formula() {
10959 _classCallCheck(this, Formula);
10960
10961 var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
10962
10963 if (window.katex == null) {
10964 throw new Error('Formula module requires KaTeX.');
10965 }
10966 return _this2;
10967 }
10968
10969 return Formula;
10970 }(_module2.default);
10971
10972 exports.FormulaBlot = FormulaBlot;
10973 exports.default = Formula;
10974
10975 /***/ }),
10976 /* 75 */
10977 /***/ (function(module, exports, __webpack_require__) {
10978
10979 "use strict";
10980
10981
10982 Object.defineProperty(exports, "__esModule", {
10983 value: true
10984 });
10985 exports.default = exports.CodeToken = exports.CodeBlock = undefined;
10986
10987 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10988
10989 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
10990
10991 var _parchment = __webpack_require__(0);
10992
10993 var _parchment2 = _interopRequireDefault(_parchment);
10994
10995 var _quill = __webpack_require__(5);
10996
10997 var _quill2 = _interopRequireDefault(_quill);
10998
10999 var _module = __webpack_require__(9);
11000
11001 var _module2 = _interopRequireDefault(_module);
11002
11003 var _code = __webpack_require__(13);
11004
11005 var _code2 = _interopRequireDefault(_code);
11006
11007 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11008
11009 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11010
11011 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
11012
11013 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
11014
11015 var SyntaxCodeBlock = function (_CodeBlock) {
11016 _inherits(SyntaxCodeBlock, _CodeBlock);
11017
11018 function SyntaxCodeBlock() {
11019 _classCallCheck(this, SyntaxCodeBlock);
11020
11021 return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
11022 }
11023
11024 _createClass(SyntaxCodeBlock, [{
11025 key: 'replaceWith',
11026 value: function replaceWith(block) {
11027 this.domNode.textContent = this.domNode.textContent;
11028 this.attach();
11029 _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
11030 }
11031 }, {
11032 key: 'highlight',
11033 value: function highlight(_highlight) {
11034 var text = this.domNode.textContent;
11035 if (this.cachedText !== text) {
11036 if (text.trim().length > 0 || this.cachedText == null) {
11037 this.domNode.innerHTML = _highlight(text);
11038 this.domNode.normalize();
11039 this.attach();
11040 }
11041 this.cachedText = text;
11042 }
11043 }
11044 }]);
11045
11046 return SyntaxCodeBlock;
11047 }(_code2.default);
11048
11049 SyntaxCodeBlock.className = 'ql-syntax';
11050
11051 var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
11052 scope: _parchment2.default.Scope.INLINE
11053 });
11054
11055 var Syntax = function (_Module) {
11056 _inherits(Syntax, _Module);
11057
11058 _createClass(Syntax, null, [{
11059 key: 'register',
11060 value: function register() {
11061 _quill2.default.register(CodeToken, true);
11062 _quill2.default.register(SyntaxCodeBlock, true);
11063 }
11064 }]);
11065
11066 function Syntax(quill, options) {
11067 _classCallCheck(this, Syntax);
11068
11069 var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
11070
11071 if (typeof _this2.options.highlight !== 'function') {
11072 throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
11073 }
11074 var timer = null;
11075 _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
11076 clearTimeout(timer);
11077 timer = setTimeout(function () {
11078 _this2.highlight();
11079 timer = null;
11080 }, _this2.options.interval);
11081 });
11082 _this2.highlight();
11083 return _this2;
11084 }
11085
11086 _createClass(Syntax, [{
11087 key: 'highlight',
11088 value: function highlight() {
11089 var _this3 = this;
11090
11091 if (this.quill.selection.composing) return;
11092 this.quill.update(_quill2.default.sources.USER);
11093 var range = this.quill.getSelection();
11094 this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
11095 code.highlight(_this3.options.highlight);
11096 });
11097 this.quill.update(_quill2.default.sources.SILENT);
11098 if (range != null) {
11099 this.quill.setSelection(range, _quill2.default.sources.SILENT);
11100 }
11101 }
11102 }]);
11103
11104 return Syntax;
11105 }(_module2.default);
11106
11107 Syntax.DEFAULTS = {
11108 highlight: function () {
11109 if (window.hljs == null) return null;
11110 return function (text) {
11111 var result = window.hljs.highlightAuto(text);
11112 return result.value;
11113 };
11114 }(),
11115 interval: 1000
11116 };
11117
11118 exports.CodeBlock = SyntaxCodeBlock;
11119 exports.CodeToken = CodeToken;
11120 exports.default = Syntax;
11121
11122 /***/ }),
11123 /* 76 */
11124 /***/ (function(module, exports) {
11125
11126 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>";
11127
11128 /***/ }),
11129 /* 77 */
11130 /***/ (function(module, exports) {
11131
11132 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>";
11133
11134 /***/ }),
11135 /* 78 */
11136 /***/ (function(module, exports) {
11137
11138 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>";
11139
11140 /***/ }),
11141 /* 79 */
11142 /***/ (function(module, exports) {
11143
11144 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>";
11145
11146 /***/ }),
11147 /* 80 */
11148 /***/ (function(module, exports) {
11149
11150 module.exports = "<svg viewbox=\"0 0 18 18\"> <g class=\"ql-fill ql-color-label\"> <polygon points=\"6 6.868 6 6 5 6 5 7 5.942 7 6 6.868\"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points=\"6.817 5 6 5 6 6 6.38 6 6.817 5\"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points=\"4 11.439 4 11 3 11 3 12 3.755 12 4 11.439\"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points=\"4.63 10 4 10 4 11 4.192 11 4.63 10\"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points=\"13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174\"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points=\"12 6.868 12 6 11.62 6 12 6.868\"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points=\"12.933 9 13 9 13 8 12.495 8 12.933 9\"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points=\"5.5 13 9 5 12.5 13\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>";
11151
11152 /***/ }),
11153 /* 81 */
11154 /***/ (function(module, exports) {
11155
11156 module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=4 y=5></rect> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=11 y=5></rect> <path class=\"ql-even ql-fill ql-stroke\" d=M7,8c0,4.031-3,5-3,5></path> <path class=\"ql-even ql-fill ql-stroke\" d=M14,8c0,4.031-3,5-3,5></path> </svg>";
11157
11158 /***/ }),
11159 /* 82 */
11160 /***/ (function(module, exports) {
11161
11162 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>";
11163
11164 /***/ }),
11165 /* 83 */
11166 /***/ (function(module, exports) {
11167
11168 module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>";
11169
11170 /***/ }),
11171 /* 84 */
11172 /***/ (function(module, exports) {
11173
11174 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-color-label ql-stroke ql-transparent\" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points=\"5.5 11 9 3 12.5 11\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>";
11175
11176 /***/ }),
11177 /* 85 */
11178 /***/ (function(module, exports) {
11179
11180 module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"3 11 5 9 3 7 3 11\"></polygon> <line class=\"ql-stroke ql-fill\" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>";
11181
11182 /***/ }),
11183 /* 86 */
11184 /***/ (function(module, exports) {
11185
11186 module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"15 12 13 10 15 8 15 12\"></polygon> <line class=\"ql-stroke ql-fill\" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>";
11187
11188 /***/ }),
11189 /* 87 */
11190 /***/ (function(module, exports) {
11191
11192 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>";
11193
11194 /***/ }),
11195 /* 88 */
11196 /***/ (function(module, exports) {
11197
11198 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>";
11199
11200 /***/ }),
11201 /* 89 */
11202 /***/ (function(module, exports) {
11203
11204 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>";
11205
11206 /***/ }),
11207 /* 90 */
11208 /***/ (function(module, exports) {
11209
11210 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform=\"translate(24 18) rotate(-180)\"/> </svg>";
11211
11212 /***/ }),
11213 /* 91 */
11214 /***/ (function(module, exports) {
11215
11216 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>";
11217
11218 /***/ }),
11219 /* 92 */
11220 /***/ (function(module, exports) {
11221
11222 module.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>";
11223
11224 /***/ }),
11225 /* 93 */
11226 /***/ (function(module, exports) {
11227
11228 module.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>";
11229
11230 /***/ }),
11231 /* 94 */
11232 /***/ (function(module, exports) {
11233
11234 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>";
11235
11236 /***/ }),
11237 /* 95 */
11238 /***/ (function(module, exports) {
11239
11240 module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class=\"ql-even ql-fill\" points=\"5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12\"></polyline> </svg>";
11241
11242 /***/ }),
11243 /* 96 */
11244 /***/ (function(module, exports) {
11245
11246 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=\"ql-fill ql-stroke\" points=\"3 7 3 11 5 9 3 7\"></polyline> </svg>";
11247
11248 /***/ }),
11249 /* 97 */
11250 /***/ (function(module, exports) {
11251
11252 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"5 7 5 11 3 9 5 7\"></polyline> </svg>";
11253
11254 /***/ }),
11255 /* 98 */
11256 /***/ (function(module, exports) {
11257
11258 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class=\"ql-even ql-stroke\" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class=\"ql-even ql-stroke\" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>";
11259
11260 /***/ }),
11261 /* 99 */
11262 /***/ (function(module, exports) {
11263
11264 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class=\"ql-stroke ql-thin\" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class=\"ql-stroke ql-thin\" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class=\"ql-stroke ql-thin\" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>";
11265
11266 /***/ }),
11267 /* 100 */
11268 /***/ (function(module, exports) {
11269
11270 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>";
11271
11272 /***/ }),
11273 /* 101 */
11274 /***/ (function(module, exports) {
11275
11276 module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points=\"3 4 4 5 6 3\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points=\"3 14 4 15 6 13\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"3 9 4 10 6 8\"></polyline> </svg>";
11277
11278 /***/ }),
11279 /* 102 */
11280 /***/ (function(module, exports) {
11281
11282 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>";
11283
11284 /***/ }),
11285 /* 103 */
11286 /***/ (function(module, exports) {
11287
11288 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>";
11289
11290 /***/ }),
11291 /* 104 */
11292 /***/ (function(module, exports) {
11293
11294 module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-stroke ql-thin\" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>";
11295
11296 /***/ }),
11297 /* 105 */
11298 /***/ (function(module, exports) {
11299
11300 module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>";
11301
11302 /***/ }),
11303 /* 106 */
11304 /***/ (function(module, exports) {
11305
11306 module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>";
11307
11308 /***/ }),
11309 /* 107 */
11310 /***/ (function(module, exports) {
11311
11312 module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=ql-stroke points=\"7 11 9 13 11 11 7 11\"></polygon> <polygon class=ql-stroke points=\"7 7 9 5 11 7 7 7\"></polygon> </svg>";
11313
11314 /***/ }),
11315 /* 108 */
11316 /***/ (function(module, exports, __webpack_require__) {
11317
11318 "use strict";
11319
11320
11321 Object.defineProperty(exports, "__esModule", {
11322 value: true
11323 });
11324 exports.default = exports.BubbleTooltip = undefined;
11325
11326 var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
11327
11328 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
11329
11330 var _extend = __webpack_require__(3);
11331
11332 var _extend2 = _interopRequireDefault(_extend);
11333
11334 var _emitter = __webpack_require__(8);
11335
11336 var _emitter2 = _interopRequireDefault(_emitter);
11337
11338 var _base = __webpack_require__(43);
11339
11340 var _base2 = _interopRequireDefault(_base);
11341
11342 var _selection = __webpack_require__(15);
11343
11344 var _icons = __webpack_require__(41);
11345
11346 var _icons2 = _interopRequireDefault(_icons);
11347
11348 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11349
11350 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11351
11352 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
11353
11354 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
11355
11356 var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
11357
11358 var BubbleTheme = function (_BaseTheme) {
11359 _inherits(BubbleTheme, _BaseTheme);
11360
11361 function BubbleTheme(quill, options) {
11362 _classCallCheck(this, BubbleTheme);
11363
11364 if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
11365 options.modules.toolbar.container = TOOLBAR_CONFIG;
11366 }
11367
11368 var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
11369
11370 _this.quill.container.classList.add('ql-bubble');
11371 return _this;
11372 }
11373
11374 _createClass(BubbleTheme, [{
11375 key: 'extendToolbar',
11376 value: function extendToolbar(toolbar) {
11377 this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
11378 this.tooltip.root.appendChild(toolbar.container);
11379 this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
11380 this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
11381 }
11382 }]);
11383
11384 return BubbleTheme;
11385 }(_base2.default);
11386
11387 BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
11388 modules: {
11389 toolbar: {
11390 handlers: {
11391 link: function link(value) {
11392 if (!value) {
11393 this.quill.format('link', false);
11394 } else {
11395 this.quill.theme.tooltip.edit();
11396 }
11397 }
11398 }
11399 }
11400 }
11401 });
11402
11403 var BubbleTooltip = function (_BaseTooltip) {
11404 _inherits(BubbleTooltip, _BaseTooltip);
11405
11406 function BubbleTooltip(quill, bounds) {
11407 _classCallCheck(this, BubbleTooltip);
11408
11409 var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
11410
11411 _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
11412 if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
11413 if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
11414 _this2.show();
11415 // Lock our width so we will expand beyond our offsetParent boundaries
11416 _this2.root.style.left = '0px';
11417 _this2.root.style.width = '';
11418 _this2.root.style.width = _this2.root.offsetWidth + 'px';
11419 var lines = _this2.quill.getLines(range.index, range.length);
11420 if (lines.length === 1) {
11421 _this2.position(_this2.quill.getBounds(range));
11422 } else {
11423 var lastLine = lines[lines.length - 1];
11424 var index = _this2.quill.getIndex(lastLine);
11425 var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
11426 var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
11427 _this2.position(_bounds);
11428 }
11429 } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
11430 _this2.hide();
11431 }
11432 });
11433 return _this2;
11434 }
11435
11436 _createClass(BubbleTooltip, [{
11437 key: 'listen',
11438 value: function listen() {
11439 var _this3 = this;
11440
11441 _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
11442 this.root.querySelector('.ql-close').addEventListener('click', function () {
11443 _this3.root.classList.remove('ql-editing');
11444 });
11445 this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
11446 // Let selection be restored by toolbar handlers before repositioning
11447 setTimeout(function () {
11448 if (_this3.root.classList.contains('ql-hidden')) return;
11449 var range = _this3.quill.getSelection();
11450 if (range != null) {
11451 _this3.position(_this3.quill.getBounds(range));
11452 }
11453 }, 1);
11454 });
11455 }
11456 }, {
11457 key: 'cancel',
11458 value: function cancel() {
11459 this.show();
11460 }
11461 }, {
11462 key: 'position',
11463 value: function position(reference) {
11464 var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
11465 var arrow = this.root.querySelector('.ql-tooltip-arrow');
11466 arrow.style.marginLeft = '';
11467 if (shift === 0) return shift;
11468 arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
11469 }
11470 }]);
11471
11472 return BubbleTooltip;
11473 }(_base.BaseTooltip);
11474
11475 BubbleTooltip.TEMPLATE = ['<span class="ql-tooltip-arrow"></span>', '<div class="ql-tooltip-editor">', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-close"></a>', '</div>'].join('');
11476
11477 exports.BubbleTooltip = BubbleTooltip;
11478 exports.default = BubbleTheme;
11479
11480 /***/ }),
11481 /* 109 */
11482 /***/ (function(module, exports, __webpack_require__) {
11483
11484 module.exports = __webpack_require__(63);
11485
11486
11487 /***/ })
11488 /******/ ])["default"];
11489 });