@pie-lib/editable-html 7.17.4-next.328 → 7.17.4-next.367

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,292 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.22.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.4...@pie-lib/editable-html@7.22.5) (2022-05-30)
7
+
8
+ **Note:** Version bump only for package @pie-lib/editable-html
9
+
10
+
11
+
12
+
13
+
14
+ ## [7.22.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.3...@pie-lib/editable-html@7.22.4) (2022-05-24)
15
+
16
+ **Note:** Version bump only for package @pie-lib/editable-html
17
+
18
+
19
+
20
+
21
+
22
+ ## [7.22.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.2...@pie-lib/editable-html@7.22.3) (2022-05-10)
23
+
24
+ **Note:** Version bump only for package @pie-lib/editable-html
25
+
26
+
27
+
28
+
29
+
30
+ ## [7.22.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.1...@pie-lib/editable-html@7.22.2) (2022-05-09)
31
+
32
+ **Note:** Version bump only for package @pie-lib/editable-html
33
+
34
+
35
+
36
+
37
+
38
+ ## [7.22.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.22.0...@pie-lib/editable-html@7.22.1) (2022-05-03)
39
+
40
+ **Note:** Version bump only for package @pie-lib/editable-html
41
+
42
+
43
+
44
+
45
+
46
+ # [7.22.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.21.0...@pie-lib/editable-html@7.22.0) (2022-05-03)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * use error as a function ([c767c8b](https://github.com/pie-framework/pie-lib/commit/c767c8bdc5ace6006e86862704a26095fa4b16f6))
52
+
53
+
54
+ ### Features
55
+
56
+ * PD-1707 ([9762d1f](https://github.com/pie-framework/pie-lib/commit/9762d1f4ac1bd615db4f03dfd06809010213052d))
57
+ * PD-1707 show validation errors in ecr ([bb7e95c](https://github.com/pie-framework/pie-lib/commit/bb7e95c824ae802452720856ad1117aa21c5766f))
58
+
59
+
60
+
61
+
62
+
63
+ # [7.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.20.0...@pie-lib/editable-html@7.21.0) (2022-04-28)
64
+
65
+
66
+ ### Features
67
+
68
+ * **editable-html:** disabled add response area button when maxResponseArea value is reached PD-1699 ([9c28e5b](https://github.com/pie-framework/pie-lib/commit/9c28e5b1702995a497e8528038a1b9e71b72c84f))
69
+ * **editable-html:** PD-1707 add validation ui/ux to responses areas in ecr ([7381c58](https://github.com/pie-framework/pie-lib/commit/7381c581e9f1099f48f8cfbe307f23dbd8776773))
70
+
71
+
72
+
73
+
74
+
75
+ # [7.20.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.19.3...@pie-lib/editable-html@7.20.0) (2022-04-12)
76
+
77
+
78
+ ### Bug Fixes
79
+
80
+ * **editable-html:** Removed overflow property that prevent body content from scrolling after closing dialog PD-1659 ([da2dc24](https://github.com/pie-framework/pie-lib/commit/da2dc2421448fa56d83369a043d864a568b1f886))
81
+ * **list:** fixed list in list issues [PD-1229] ([46dcec0](https://github.com/pie-framework/pie-lib/commit/46dcec0e20fc2d09969c45fd75426f647931ec08))
82
+
83
+
84
+ ### Features
85
+
86
+ * **config-ui, editable-html:** add ui/ux validation for choices and editable html fields ([d40148f](https://github.com/pie-framework/pie-lib/commit/d40148f0f4b1232ce1506867a7424aa56e26c5ec))
87
+
88
+
89
+
90
+
91
+
92
+ ## [7.19.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.19.2...@pie-lib/editable-html@7.19.3) (2022-03-21)
93
+
94
+ **Note:** Version bump only for package @pie-lib/editable-html
95
+
96
+
97
+
98
+
99
+
100
+ ## [7.19.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.19.1...@pie-lib/editable-html@7.19.2) (2022-03-08)
101
+
102
+
103
+ ### Bug Fixes
104
+
105
+ * **editable-html:** Added default values for responseAreaProps ([b49a919](https://github.com/pie-framework/pie-lib/commit/b49a919b4d5e336cb2a82e4e7926d72372369d3c))
106
+
107
+
108
+
109
+
110
+
111
+ ## [7.19.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.19.0...@pie-lib/editable-html@7.19.1) (2022-03-07)
112
+
113
+
114
+ ### Bug Fixes
115
+
116
+ * **editable-html:** Called onHandleAreaChange only for delete ([ad1c8aa](https://github.com/pie-framework/pie-lib/commit/ad1c8aa83eef71bd8201cb55ec21513c008f77a6))
117
+
118
+
119
+
120
+
121
+
122
+ # [7.19.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.18.0...@pie-lib/editable-html@7.19.0) (2022-03-07)
123
+
124
+
125
+ ### Features
126
+
127
+ * **editor:** added func callback property, called when the resp area els nr is changed in the markup [PD-1592] ([d35feee](https://github.com/pie-framework/pie-lib/commit/d35feee5c68c13375963aa5cad25b2ef6ffc39f3))
128
+
129
+
130
+
131
+
132
+
133
+ # [7.18.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.19...@pie-lib/editable-html@7.18.0) (2022-02-21)
134
+
135
+
136
+ ### Bug Fixes
137
+
138
+ * **editable-html:** fix style for table rendering PD-1459 ([7c139b5](https://github.com/pie-framework/pie-lib/commit/7c139b5))
139
+ * **editable-html:** Insert button from video/audio modal can't be pressed if the URL is empty PD-1488 ([6c7c1f6](https://github.com/pie-framework/pie-lib/commit/6c7c1f6))
140
+ * **editor:** made sure space is added after table even when there is a div wrapper [PD-1614] ([5aa8bd1](https://github.com/pie-framework/pie-lib/commit/5aa8bd1))
141
+
142
+
143
+ ### Features
144
+
145
+ * **editable-html:** drag-in-the-blank visually indicate when response area is selected, hide non-applicable tools PD-1383 ([a3b7d08](https://github.com/pie-framework/pie-lib/commit/a3b7d08))
146
+ * **editor:** made sure cursor is visible before and after custom void elements [PD-1474] ([189ee2d](https://github.com/pie-framework/pie-lib/commit/189ee2d))
147
+ * **editor:** made sure x<y is not removed from the math latex [PD-1475] ([ea94ad0](https://github.com/pie-framework/pie-lib/commit/ea94ad0))
148
+ * **table:** made sure default border is 1 for tables [PD-1459] ([e8bd0d7](https://github.com/pie-framework/pie-lib/commit/e8bd0d7))
149
+ * **table:** made sure focus is switched to first cell of the table when adding one [PD-1455] ([907c230](https://github.com/pie-framework/pie-lib/commit/907c230))
150
+
151
+
152
+
153
+
154
+
155
+ ## [7.17.19](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.18...@pie-lib/editable-html@7.17.19) (2022-02-21)
156
+
157
+ **Note:** Version bump only for package @pie-lib/editable-html
158
+
159
+
160
+
161
+
162
+
163
+ ## [7.17.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.17...@pie-lib/editable-html@7.17.18) (2022-02-04)
164
+
165
+ **Note:** Version bump only for package @pie-lib/editable-html
166
+
167
+
168
+
169
+
170
+
171
+ ## [7.17.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.16...@pie-lib/editable-html@7.17.17) (2022-02-03)
172
+
173
+ **Note:** Version bump only for package @pie-lib/editable-html
174
+
175
+
176
+
177
+
178
+
179
+ ## [7.17.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.15...@pie-lib/editable-html@7.17.16) (2022-01-24)
180
+
181
+ **Note:** Version bump only for package @pie-lib/editable-html
182
+
183
+
184
+
185
+
186
+
187
+ ## [7.17.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.14...@pie-lib/editable-html@7.17.15) (2022-01-10)
188
+
189
+ **Note:** Version bump only for package @pie-lib/editable-html
190
+
191
+
192
+
193
+
194
+
195
+ ## [7.17.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.13...@pie-lib/editable-html@7.17.14) (2021-12-22)
196
+
197
+ **Note:** Version bump only for package @pie-lib/editable-html
198
+
199
+
200
+
201
+
202
+
203
+ ## [7.17.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.12...@pie-lib/editable-html@7.17.13) (2021-12-13)
204
+
205
+ **Note:** Version bump only for package @pie-lib/editable-html
206
+
207
+
208
+
209
+
210
+
211
+ ## [7.17.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.11...@pie-lib/editable-html@7.17.12) (2021-11-29)
212
+
213
+ **Note:** Version bump only for package @pie-lib/editable-html
214
+
215
+
216
+
217
+
218
+
219
+ ## [7.17.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.10...@pie-lib/editable-html@7.17.11) (2021-10-04)
220
+
221
+ **Note:** Version bump only for package @pie-lib/editable-html
222
+
223
+
224
+
225
+
226
+
227
+ ## [7.17.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.9...@pie-lib/editable-html@7.17.10) (2021-10-04)
228
+
229
+
230
+ ### Bug Fixes
231
+
232
+ * **serialization:** made sure that units are not added to numbered values when they are encountered [PD-722] ([8d229cf](https://github.com/pie-framework/pie-lib/commit/8d229cf))
233
+
234
+
235
+
236
+
237
+
238
+ ## [7.17.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.8...@pie-lib/editable-html@7.17.9) (2021-09-20)
239
+
240
+
241
+ ### Bug Fixes
242
+
243
+ * **editor:** used dom refs in order to check if the editor is still in focus [PD-1126] ([99e0f72](https://github.com/pie-framework/pie-lib/commit/99e0f72))
244
+
245
+
246
+
247
+
248
+
249
+ ## [7.17.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.7...@pie-lib/editable-html@7.17.8) (2021-09-20)
250
+
251
+
252
+ ### Bug Fixes
253
+
254
+ * **editor:** made sure that if the editor loses focus, the onBlur function is called only if the focus is still not inside the dom element [PD-1126] ([e74f00a](https://github.com/pie-framework/pie-lib/commit/e74f00a))
255
+
256
+
257
+
258
+
259
+
260
+ ## [7.17.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.6...@pie-lib/editable-html@7.17.7) (2021-09-20)
261
+
262
+ **Note:** Version bump only for package @pie-lib/editable-html
263
+
264
+
265
+
266
+
267
+
268
+ ## [7.17.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.5...@pie-lib/editable-html@7.17.6) (2021-09-16)
269
+
270
+ **Note:** Version bump only for package @pie-lib/editable-html
271
+
272
+
273
+
274
+
275
+
276
+ ## [7.17.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.4...@pie-lib/editable-html@7.17.5) (2021-09-08)
277
+
278
+ **Note:** Version bump only for package @pie-lib/editable-html
279
+
280
+
281
+
282
+
283
+
284
+ ## [7.17.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.3...@pie-lib/editable-html@7.17.4) (2021-09-08)
285
+
286
+ **Note:** Version bump only for package @pie-lib/editable-html
287
+
288
+
289
+
290
+
291
+
6
292
  ## [7.17.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/editable-html@7.17.2...@pie-lib/editable-html@7.17.3) (2021-08-30)
7
293
 
8
294
 
package/lib/editor.js CHANGED
@@ -51,6 +51,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
51
51
 
52
52
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
53
53
 
54
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
55
+
56
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
57
+
58
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
59
+
54
60
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
61
 
56
62
  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); } }
@@ -134,7 +140,9 @@ var Editor = /*#__PURE__*/function (_React$Component) {
134
140
  props.imageSupport.add(handler);
135
141
  },
136
142
  onFocus: _this.onPluginFocus,
137
- onBlur: _this.onPluginBlur
143
+ onBlur: _this.onPluginBlur,
144
+ maxImageWidth: _this.props.maxImageWidth,
145
+ maxImageHeight: _this.props.maxImageHeight
138
146
  },
139
147
  toolbar: {
140
148
  /**
@@ -499,6 +507,81 @@ var Editor = /*#__PURE__*/function (_React$Component) {
499
507
  _this.props.focus(position, node);
500
508
  });
501
509
 
510
+ _defineProperty(_assertThisInitialized(_this), "onDropPaste", /*#__PURE__*/function () {
511
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event, change, dropContext) {
512
+ var editor, transfer, file, src, inline, range, ch;
513
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
514
+ while (1) {
515
+ switch (_context.prev = _context.next) {
516
+ case 0:
517
+ if (_this.props.imageSupport) {
518
+ _context.next = 2;
519
+ break;
520
+ }
521
+
522
+ return _context.abrupt("return");
523
+
524
+ case 2:
525
+ editor = change.editor;
526
+ transfer = (0, _slateReact.getEventTransfer)(event);
527
+ file = transfer.files[0];
528
+
529
+ if (!(file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png')) {
530
+ _context.next = 20;
531
+ break;
532
+ }
533
+
534
+ _context.prev = 6;
535
+ log('[onDropPaste]');
536
+ _context.next = 10;
537
+ return (0, serialization.getBase64)(file);
538
+
539
+ case 10:
540
+ src = _context.sent;
541
+ inline = _slate.Inline.create({
542
+ type: 'image',
543
+ isVoid: true,
544
+ data: {
545
+ loading: false,
546
+ src: src
547
+ }
548
+ });
549
+
550
+ if (dropContext) {
551
+ _this.focus();
552
+ } else {
553
+ range = (0, _slateReact.getEventRange)(event, editor);
554
+
555
+ if (range) {
556
+ change.select(range);
557
+ }
558
+ }
559
+
560
+ ch = change.insertInline(inline);
561
+
562
+ _this.onChange(ch);
563
+
564
+ _context.next = 20;
565
+ break;
566
+
567
+ case 17:
568
+ _context.prev = 17;
569
+ _context.t0 = _context["catch"](6);
570
+ log('[onDropPaste] error: ', _context.t0);
571
+
572
+ case 20:
573
+ case "end":
574
+ return _context.stop();
575
+ }
576
+ }
577
+ }, _callee, null, [[6, 17]]);
578
+ }));
579
+
580
+ return function (_x, _x2, _x3) {
581
+ return _ref.apply(this, arguments);
582
+ };
583
+ }());
584
+
502
585
  _this.state = {
503
586
  value: _props.value,
504
587
  toolbarOpts: createToolbarOpts(_props.toolbarOpts)
@@ -621,8 +704,8 @@ var Editor = /*#__PURE__*/function (_React$Component) {
621
704
  var sizeStyle = this.buildSizeStyle();
622
705
  var names = (0, _classnames["default"])((_classNames = {}, _defineProperty(_classNames, classes.withBg, highlightShape), _defineProperty(_classNames, classes.toolbarOnTop, toolbarOpts.alwaysVisible && toolbarOpts.position === 'top'), _classNames), className);
623
706
  return /*#__PURE__*/_react["default"].createElement("div", {
624
- ref: function ref(_ref) {
625
- return _this3.wrapperRef = _ref;
707
+ ref: function ref(_ref2) {
708
+ return _this3.wrapperRef = _ref2;
626
709
  },
627
710
  style: {
628
711
  width: sizeStyle.width
@@ -648,6 +731,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
648
731
  onKeyDown: onKeyDown,
649
732
  onChange: this.onChange,
650
733
  onBlur: this.onBlur,
734
+ onDrop: function onDrop(event, editor) {
735
+ return _this3.onDropPaste(event, editor, true);
736
+ },
737
+ onPaste: function onPaste(event, editor) {
738
+ return _this3.onDropPaste(event, editor);
739
+ },
651
740
  onFocus: this.onFocus,
652
741
  onEditingDone: this.onEditingDone,
653
742
  focusedNode: focusedNode,
@@ -723,7 +812,9 @@ _defineProperty(Editor, "propTypes", {
723
812
  });
724
813
  return !allValid && new Error("Invalid values: ".concat(values, ", values must be one of [").concat(_plugins.ALL_PLUGINS.join(','), "]"));
725
814
  }),
726
- className: _propTypes["default"].string
815
+ className: _propTypes["default"].string,
816
+ maxImageWidth: _propTypes["default"].number,
817
+ maxImageHeight: _propTypes["default"].number
727
818
  });
728
819
 
729
820
  _defineProperty(Editor, "defaultProps", {