Rev 637 | Rev 759 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 637 | Rev 679 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. |
2 | * Copyright (c) Tiny Technologies, Inc. All rights reserved. |
3 | * Licensed under the LGPL or a commercial license. |
3 | * Licensed under the LGPL or a commercial license. |
4 | * For LGPL see License.txt in the project root for license information. |
4 | * For LGPL see License.txt in the project root for license information. |
5 | * For commercial licenses see https://www.tiny.cloud/ |
5 | * For commercial licenses see https://www.tiny.cloud/ |
6 | * |
6 | * |
7 | * Version: 5.9.2 (2021-09-08) |
7 | * Version: 5.10.2 (2021-11-17) |
8 | */ |
8 | */ |
9 | (function () { |
9 | (function () { |
10 | 'use strict'; |
10 | 'use strict'; |
11 | 11 | ||
12 | var Cell = function (initial) { |
12 | var Cell = function (initial) { |
Line 38... | Line 38... | ||
38 | 38 | ||
39 | var get = function (clipboard) { |
39 | var get = function (clipboard) { |
40 | return { clipboard: clipboard }; |
40 | return { clipboard: clipboard }; |
41 | }; |
41 | }; |
42 | 42 | ||
- | 43 | var typeOf = function (x) { |
|
- | 44 | var t = typeof x; |
|
- | 45 | if (x === null) { |
|
- | 46 | return 'null'; |
|
- | 47 | } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { |
|
- | 48 | return 'array'; |
|
- | 49 | } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { |
|
- | 50 | return 'string'; |
|
- | 51 | } else { |
|
- | 52 | return t; |
|
- | 53 | } |
|
- | 54 | }; |
|
- | 55 | var isType = function (type) { |
|
- | 56 | return function (value) { |
|
- | 57 | return typeOf(value) === type; |
|
- | 58 | }; |
|
- | 59 | }; |
|
43 | var isSimpleType = function (type) { |
60 | var isSimpleType = function (type) { |
44 | return function (value) { |
61 | return function (value) { |
45 | return typeof value === type; |
62 | return typeof value === type; |
46 | }; |
63 | }; |
47 | }; |
64 | }; |
- | 65 | var isArray = isType('array'); |
|
48 | var isNullable = function (a) { |
66 | var isNullable = function (a) { |
49 | return a === null || a === undefined; |
67 | return a === null || a === undefined; |
50 | }; |
68 | }; |
51 | var isNonNullable = function (a) { |
69 | var isNonNullable = function (a) { |
52 | return !isNullable(a); |
70 | return !isNullable(a); |
Line 154... | Line 172... | ||
154 | none: none, |
172 | none: none, |
155 | from: from$1 |
173 | from: from$1 |
156 | }; |
174 | }; |
157 | 175 | ||
158 | var nativeSlice = Array.prototype.slice; |
176 | var nativeSlice = Array.prototype.slice; |
- | 177 | var nativePush = Array.prototype.push; |
|
159 | var exists = function (xs, pred) { |
178 | var exists = function (xs, pred) { |
160 | for (var i = 0, len = xs.length; i < len; i++) { |
179 | for (var i = 0, len = xs.length; i < len; i++) { |
161 | var x = xs[i]; |
180 | var x = xs[i]; |
162 | if (pred(x, i)) { |
181 | if (pred(x, i)) { |
163 | return true; |
182 | return true; |
Line 194... | Line 213... | ||
194 | each(xs, function (x, i) { |
213 | each(xs, function (x, i) { |
195 | acc = f(acc, x, i); |
214 | acc = f(acc, x, i); |
196 | }); |
215 | }); |
197 | return acc; |
216 | return acc; |
198 | }; |
217 | }; |
- | 218 | var flatten = function (xs) { |
|
- | 219 | var r = []; |
|
- | 220 | for (var i = 0, len = xs.length; i < len; ++i) { |
|
- | 221 | if (!isArray(xs[i])) { |
|
- | 222 | throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); |
|
- | 223 | } |
|
- | 224 | nativePush.apply(r, xs[i]); |
|
- | 225 | } |
|
- | 226 | return r; |
|
- | 227 | }; |
|
- | 228 | var bind = function (xs, f) { |
|
- | 229 | return flatten(map(xs, f)); |
|
- | 230 | }; |
|
199 | var from = isFunction(Array.from) ? Array.from : function (x) { |
231 | var from = isFunction(Array.from) ? Array.from : function (x) { |
200 | return nativeSlice.call(x); |
232 | return nativeSlice.call(x); |
201 | }; |
233 | }; |
202 | 234 | ||
203 | var __assign = function () { |
235 | var __assign = function () { |
Line 1098... | Line 1130... | ||
1098 | return getImageMimeType(extension) === file.type; |
1130 | return getImageMimeType(extension) === file.type; |
1099 | }); |
1131 | }); |
1100 | }; |
1132 | }; |
1101 | }; |
1133 | }; |
1102 | var getImagesFromDataTransfer = function (editor, dataTransfer) { |
1134 | var getImagesFromDataTransfer = function (editor, dataTransfer) { |
1103 | var items = dataTransfer.items ? map(from(dataTransfer.items), function (item) { |
1135 | var items = dataTransfer.items ? bind(from(dataTransfer.items), function (item) { |
1104 | return item.getAsFile(); |
1136 | return item.kind === 'file' ? [item.getAsFile()] : []; |
1105 | }) : []; |
1137 | }) : []; |
1106 | var files = dataTransfer.files ? from(dataTransfer.files) : []; |
1138 | var files = dataTransfer.files ? from(dataTransfer.files) : []; |
1107 | return filter$1(items.length > 0 ? items : files, isImage(editor)); |
1139 | return filter$1(items.length > 0 ? items : files, isImage(editor)); |
1108 | }; |
1140 | }; |
1109 | var pasteImageData = function (editor, e, rng) { |
1141 | var pasteImageData = function (editor, e, rng) { |