tinymce-rails 5.1.5 → 5.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +602 -554
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/colorpicker/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  16. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +1 -1
  18. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  19. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +1 -1
  20. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  22. data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +2 -2
  23. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  24. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -1
  29. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +1 -1
  31. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
  32. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  34. data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +1 -1
  35. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  36. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  37. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -1
  38. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -1
  39. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +1 -1
  40. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  41. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
  42. data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +1 -1
  43. data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +1 -1
  44. data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +1 -1
  45. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  46. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  47. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
  48. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  49. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  50. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  51. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  52. data/vendor/assets/javascripts/tinymce/themes/mobile/theme.js +2 -2
  53. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  54. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  55. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 203779fa7ed0935f03b670b710ad5fb44c95c2f66a23c82fad393841ee68e53f
4
- data.tar.gz: ef77eae72fc9c2e5d1a094c1354fdaaf62c0cf077d9985839f0eb2009c7a5d77
3
+ metadata.gz: 8c40a7a4dcf3eab50b32baefafccd198375b60b45fa4d88045eee219397f6290
4
+ data.tar.gz: b2677f3838c755145b9307e1efab0a4fc00e2c9267c9f8ae3246b8238fcf7221
5
5
  SHA512:
6
- metadata.gz: be254e259a159526a5381e11fa4880e890df0ed2a6e374c82f410440373179be5780a6db5edacec944b5c8186d48850ac3ffc962c538c280d5f485e7bc8d2a62
7
- data.tar.gz: 3941072580e700cee867ac176fa1f22eda9e87093d0725d7dd769b025117bb2e23a5f88d12b7427b83f7d8efc741c22e58a1367c12bd39a1452973eb960a33de
6
+ metadata.gz: 9ad3c45fc5f4bc23840cecffcc6c78cdc38f665494ffa18f7ba73396bf045cc44ccfaa3fd1aa4c8734637893cb62c156d3d441ca39e93125b4fa0571b7218c99
7
+ data.tar.gz: ef73edd26b642107bdf253d9f4b4008131ea32a1cb4b2bf894c290abffe31cf52188d93125aa6d5f7637e2c2b2d5e6d2ed351f0d1fa7f8c2c65d161375eded7a
@@ -4,7 +4,7 @@
4
4
  * For LGPL see License.txt in the project root for license information.
5
5
  * For commercial licenses see https://www.tiny.cloud/
6
6
  *
7
- * Version: 5.1.5 (2019-12-19)
7
+ * Version: 5.1.6 (2020-01-28)
8
8
  */
9
9
  (function (domGlobals) {
10
10
  'use strict';
@@ -588,6 +588,7 @@
588
588
  var osx = 'OSX';
589
589
  var solaris = 'Solaris';
590
590
  var freebsd = 'FreeBSD';
591
+ var chromeos = 'ChromeOS';
591
592
  var isOS = function (name, current) {
592
593
  return function () {
593
594
  return current === name;
@@ -611,7 +612,8 @@
611
612
  isOSX: isOS(osx, current),
612
613
  isLinux: isOS(linux, current),
613
614
  isSolaris: isOS(solaris, current),
614
- isFreeBSD: isOS(freebsd, current)
615
+ isFreeBSD: isOS(freebsd, current),
616
+ isChromeOS: isOS(chromeos, current)
615
617
  };
616
618
  };
617
619
  var OperatingSystem = {
@@ -623,7 +625,8 @@
623
625
  linux: constant(linux),
624
626
  osx: constant(osx),
625
627
  solaris: constant(solaris),
626
- freebsd: constant(freebsd)
628
+ freebsd: constant(freebsd),
629
+ chromeos: constant(chromeos)
627
630
  };
628
631
 
629
632
  var DeviceType = function (os, browser, userAgent, mediaMatch) {
@@ -785,8 +788,8 @@
785
788
  },
786
789
  {
787
790
  name: 'OSX',
788
- search: checkContains('os x'),
789
- versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
791
+ search: checkContains('mac os x'),
792
+ versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]
790
793
  },
791
794
  {
792
795
  name: 'Linux',
@@ -802,6 +805,11 @@
802
805
  name: 'FreeBSD',
803
806
  search: checkContains('freebsd'),
804
807
  versionRegexes: []
808
+ },
809
+ {
810
+ name: 'ChromeOS',
811
+ search: checkContains('cros'),
812
+ versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/]
805
813
  }
806
814
  ];
807
815
  var PlatformInfo = {
@@ -974,6 +982,9 @@
974
982
  var v = element.dom().getAttribute(key);
975
983
  return v === null ? undefined : v;
976
984
  };
985
+ var getOpt = function (element, key) {
986
+ return Option.from(get$1(element, key));
987
+ };
977
988
  var has$1 = function (element, key) {
978
989
  var dom = element.dom();
979
990
  return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
@@ -2272,6 +2283,7 @@
2272
2283
  current: os.current,
2273
2284
  version: os.version,
2274
2285
  isAndroid: os.isAndroid,
2286
+ isChromeOS: os.isChromeOS,
2275
2287
  isFreeBSD: os.isFreeBSD,
2276
2288
  isiOS: os.isiOS,
2277
2289
  isLinux: os.isLinux,
@@ -10793,7 +10805,7 @@
10793
10805
  return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;
10794
10806
  };
10795
10807
  var trimComments = function (text) {
10796
- return text.replace(/<!--|-->/g, '');
10808
+ return text.replace(/<!--|--!?>/g, '');
10797
10809
  };
10798
10810
  var isInvalidUri = function (settings, uri) {
10799
10811
  if (settings.allow_html_data_urls) {
@@ -12977,135 +12989,6 @@
12977
12989
 
12978
12990
  var ThemeManager = AddOnManager$1.ThemeManager;
12979
12991
 
12980
- function Uploader(uploadStatus, settings) {
12981
- var pendingPromises = {};
12982
- var pathJoin = function (path1, path2) {
12983
- if (path1) {
12984
- return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
12985
- }
12986
- return path2;
12987
- };
12988
- var defaultHandler = function (blobInfo, success, failure, progress) {
12989
- var xhr, formData;
12990
- xhr = new domGlobals.XMLHttpRequest();
12991
- xhr.open('POST', settings.url);
12992
- xhr.withCredentials = settings.credentials;
12993
- xhr.upload.onprogress = function (e) {
12994
- progress(e.loaded / e.total * 100);
12995
- };
12996
- xhr.onerror = function () {
12997
- failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
12998
- };
12999
- xhr.onload = function () {
13000
- var json;
13001
- if (xhr.status < 200 || xhr.status >= 300) {
13002
- failure('HTTP Error: ' + xhr.status);
13003
- return;
13004
- }
13005
- json = JSON.parse(xhr.responseText);
13006
- if (!json || typeof json.location !== 'string') {
13007
- failure('Invalid JSON: ' + xhr.responseText);
13008
- return;
13009
- }
13010
- success(pathJoin(settings.basePath, json.location));
13011
- };
13012
- formData = new domGlobals.FormData();
13013
- formData.append('file', blobInfo.blob(), blobInfo.filename());
13014
- xhr.send(formData);
13015
- };
13016
- var noUpload = function () {
13017
- return new promiseObj(function (resolve) {
13018
- resolve([]);
13019
- });
13020
- };
13021
- var handlerSuccess = function (blobInfo, url) {
13022
- return {
13023
- url: url,
13024
- blobInfo: blobInfo,
13025
- status: true
13026
- };
13027
- };
13028
- var handlerFailure = function (blobInfo, error) {
13029
- return {
13030
- url: '',
13031
- blobInfo: blobInfo,
13032
- status: false,
13033
- error: error
13034
- };
13035
- };
13036
- var resolvePending = function (blobUri, result) {
13037
- Tools.each(pendingPromises[blobUri], function (resolve) {
13038
- resolve(result);
13039
- });
13040
- delete pendingPromises[blobUri];
13041
- };
13042
- var uploadBlobInfo = function (blobInfo, handler, openNotification) {
13043
- uploadStatus.markPending(blobInfo.blobUri());
13044
- return new promiseObj(function (resolve) {
13045
- var notification, progress;
13046
- var noop = function () {
13047
- };
13048
- try {
13049
- var closeNotification_1 = function () {
13050
- if (notification) {
13051
- notification.close();
13052
- progress = noop;
13053
- }
13054
- };
13055
- var success = function (url) {
13056
- closeNotification_1();
13057
- uploadStatus.markUploaded(blobInfo.blobUri(), url);
13058
- resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
13059
- resolve(handlerSuccess(blobInfo, url));
13060
- };
13061
- var failure = function (error) {
13062
- closeNotification_1();
13063
- uploadStatus.removeFailed(blobInfo.blobUri());
13064
- resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));
13065
- resolve(handlerFailure(blobInfo, error));
13066
- };
13067
- progress = function (percent) {
13068
- if (percent < 0 || percent > 100) {
13069
- return;
13070
- }
13071
- if (!notification) {
13072
- notification = openNotification();
13073
- }
13074
- notification.progressBar.value(percent);
13075
- };
13076
- handler(blobInfo, success, failure, progress);
13077
- } catch (ex) {
13078
- resolve(handlerFailure(blobInfo, ex.message));
13079
- }
13080
- });
13081
- };
13082
- var isDefaultHandler = function (handler) {
13083
- return handler === defaultHandler;
13084
- };
13085
- var pendingUploadBlobInfo = function (blobInfo) {
13086
- var blobUri = blobInfo.blobUri();
13087
- return new promiseObj(function (resolve) {
13088
- pendingPromises[blobUri] = pendingPromises[blobUri] || [];
13089
- pendingPromises[blobUri].push(resolve);
13090
- });
13091
- };
13092
- var uploadBlobs = function (blobInfos, openNotification) {
13093
- blobInfos = Tools.grep(blobInfos, function (blobInfo) {
13094
- return !uploadStatus.isUploaded(blobInfo.blobUri());
13095
- });
13096
- return promiseObj.all(Tools.map(blobInfos, function (blobInfo) {
13097
- return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
13098
- }));
13099
- };
13100
- var upload = function (blobInfos, openNotification) {
13101
- return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);
13102
- };
13103
- if (isFunction(settings.handler) === false) {
13104
- settings.handler = defaultHandler;
13105
- }
13106
- return { upload: upload };
13107
- }
13108
-
13109
12992
  var blobUriToBlob = function (url) {
13110
12993
  return new promiseObj(function (resolve, reject) {
13111
12994
  var rejectWithError = function () {
@@ -13297,105 +13180,134 @@
13297
13180
  return { findAll: findAll };
13298
13181
  }
13299
13182
 
13300
- var count$1 = 0;
13301
- var seed = function () {
13302
- var rnd = function () {
13303
- return Math.round(Math.random() * 4294967295).toString(36);
13183
+ function Uploader(uploadStatus, settings) {
13184
+ var pendingPromises = {};
13185
+ var pathJoin = function (path1, path2) {
13186
+ if (path1) {
13187
+ return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
13188
+ }
13189
+ return path2;
13304
13190
  };
13305
- var now = new Date().getTime();
13306
- return 's' + now.toString(36) + rnd() + rnd() + rnd();
13307
- };
13308
- var uuid = function (prefix) {
13309
- return prefix + count$1++ + seed();
13310
- };
13311
- var Uuid = { uuid: uuid };
13312
-
13313
- var BlobCache = function () {
13314
- var cache = [];
13315
- var mimeToExt = function (mime) {
13316
- var mimes = {
13317
- 'image/jpeg': 'jpg',
13318
- 'image/jpg': 'jpg',
13319
- 'image/gif': 'gif',
13320
- 'image/png': 'png'
13191
+ var defaultHandler = function (blobInfo, success, failure, progress) {
13192
+ var xhr, formData;
13193
+ xhr = new domGlobals.XMLHttpRequest();
13194
+ xhr.open('POST', settings.url);
13195
+ xhr.withCredentials = settings.credentials;
13196
+ xhr.upload.onprogress = function (e) {
13197
+ progress(e.loaded / e.total * 100);
13321
13198
  };
13322
- return mimes[mime.toLowerCase()] || 'dat';
13199
+ xhr.onerror = function () {
13200
+ failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
13201
+ };
13202
+ xhr.onload = function () {
13203
+ var json;
13204
+ if (xhr.status < 200 || xhr.status >= 300) {
13205
+ failure('HTTP Error: ' + xhr.status);
13206
+ return;
13207
+ }
13208
+ json = JSON.parse(xhr.responseText);
13209
+ if (!json || typeof json.location !== 'string') {
13210
+ failure('Invalid JSON: ' + xhr.responseText);
13211
+ return;
13212
+ }
13213
+ success(pathJoin(settings.basePath, json.location));
13214
+ };
13215
+ formData = new domGlobals.FormData();
13216
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
13217
+ xhr.send(formData);
13323
13218
  };
13324
- var create = function (o, blob, base64, filename) {
13325
- if (isString(o)) {
13326
- var id = o;
13327
- return toBlobInfo({
13328
- id: id,
13329
- name: filename,
13330
- blob: blob,
13331
- base64: base64
13332
- });
13333
- } else if (isObject(o)) {
13334
- return toBlobInfo(o);
13335
- } else {
13336
- throw new Error('Unknown input type');
13337
- }
13219
+ var noUpload = function () {
13220
+ return new promiseObj(function (resolve) {
13221
+ resolve([]);
13222
+ });
13338
13223
  };
13339
- var toBlobInfo = function (o) {
13340
- var id, name;
13341
- if (!o.blob || !o.base64) {
13342
- throw new Error('blob and base64 representations of the image are required for BlobInfo to be created');
13343
- }
13344
- id = o.id || Uuid.uuid('blobid');
13345
- name = o.name || id;
13224
+ var handlerSuccess = function (blobInfo, url) {
13346
13225
  return {
13347
- id: constant(id),
13348
- name: constant(name),
13349
- filename: constant(name + '.' + mimeToExt(o.blob.type)),
13350
- blob: constant(o.blob),
13351
- base64: constant(o.base64),
13352
- blobUri: constant(o.blobUri || domGlobals.URL.createObjectURL(o.blob)),
13353
- uri: constant(o.uri)
13226
+ url: url,
13227
+ blobInfo: blobInfo,
13228
+ status: true
13354
13229
  };
13355
13230
  };
13356
- var add = function (blobInfo) {
13357
- if (!get(blobInfo.id())) {
13358
- cache.push(blobInfo);
13359
- }
13360
- };
13361
- var get = function (id) {
13362
- return findFirst(function (cachedBlobInfo) {
13363
- return cachedBlobInfo.id() === id;
13364
- });
13365
- };
13366
- var findFirst = function (predicate) {
13367
- return filter(cache, predicate)[0];
13231
+ var handlerFailure = function (blobInfo, error) {
13232
+ return {
13233
+ url: '',
13234
+ blobInfo: blobInfo,
13235
+ status: false,
13236
+ error: error
13237
+ };
13368
13238
  };
13369
- var getByUri = function (blobUri) {
13370
- return findFirst(function (blobInfo) {
13371
- return blobInfo.blobUri() === blobUri;
13239
+ var resolvePending = function (blobUri, result) {
13240
+ Tools.each(pendingPromises[blobUri], function (resolve) {
13241
+ resolve(result);
13372
13242
  });
13243
+ delete pendingPromises[blobUri];
13373
13244
  };
13374
- var removeByUri = function (blobUri) {
13375
- cache = filter(cache, function (blobInfo) {
13376
- if (blobInfo.blobUri() === blobUri) {
13377
- domGlobals.URL.revokeObjectURL(blobInfo.blobUri());
13378
- return false;
13379
- }
13380
- return true;
13381
- });
13245
+ var uploadBlobInfo = function (blobInfo, handler, openNotification) {
13246
+ uploadStatus.markPending(blobInfo.blobUri());
13247
+ return new promiseObj(function (resolve) {
13248
+ var notification, progress;
13249
+ var noop = function () {
13250
+ };
13251
+ try {
13252
+ var closeNotification_1 = function () {
13253
+ if (notification) {
13254
+ notification.close();
13255
+ progress = noop;
13256
+ }
13257
+ };
13258
+ var success = function (url) {
13259
+ closeNotification_1();
13260
+ uploadStatus.markUploaded(blobInfo.blobUri(), url);
13261
+ resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
13262
+ resolve(handlerSuccess(blobInfo, url));
13263
+ };
13264
+ var failure = function (error) {
13265
+ closeNotification_1();
13266
+ uploadStatus.removeFailed(blobInfo.blobUri());
13267
+ resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));
13268
+ resolve(handlerFailure(blobInfo, error));
13269
+ };
13270
+ progress = function (percent) {
13271
+ if (percent < 0 || percent > 100) {
13272
+ return;
13273
+ }
13274
+ if (!notification) {
13275
+ notification = openNotification();
13276
+ }
13277
+ notification.progressBar.value(percent);
13278
+ };
13279
+ handler(blobInfo, success, failure, progress);
13280
+ } catch (ex) {
13281
+ resolve(handlerFailure(blobInfo, ex.message));
13282
+ }
13283
+ });
13382
13284
  };
13383
- var destroy = function () {
13384
- each(cache, function (cachedBlobInfo) {
13385
- domGlobals.URL.revokeObjectURL(cachedBlobInfo.blobUri());
13285
+ var isDefaultHandler = function (handler) {
13286
+ return handler === defaultHandler;
13287
+ };
13288
+ var pendingUploadBlobInfo = function (blobInfo) {
13289
+ var blobUri = blobInfo.blobUri();
13290
+ return new promiseObj(function (resolve) {
13291
+ pendingPromises[blobUri] = pendingPromises[blobUri] || [];
13292
+ pendingPromises[blobUri].push(resolve);
13386
13293
  });
13387
- cache = [];
13388
13294
  };
13389
- return {
13390
- create: create,
13391
- add: add,
13392
- get: get,
13393
- getByUri: getByUri,
13394
- findFirst: findFirst,
13395
- removeByUri: removeByUri,
13396
- destroy: destroy
13295
+ var uploadBlobs = function (blobInfos, openNotification) {
13296
+ blobInfos = Tools.grep(blobInfos, function (blobInfo) {
13297
+ return !uploadStatus.isUploaded(blobInfo.blobUri());
13298
+ });
13299
+ return promiseObj.all(Tools.map(blobInfos, function (blobInfo) {
13300
+ return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
13301
+ }));
13397
13302
  };
13398
- };
13303
+ var upload = function (blobInfos, openNotification) {
13304
+ return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);
13305
+ };
13306
+ if (isFunction(settings.handler) === false) {
13307
+ settings.handler = defaultHandler;
13308
+ }
13309
+ return { upload: upload };
13310
+ }
13399
13311
 
13400
13312
  function UploadStatus () {
13401
13313
  var PENDING = 1, UPLOADED = 2;
@@ -13443,6 +13355,106 @@
13443
13355
  };
13444
13356
  }
13445
13357
 
13358
+ var count$1 = 0;
13359
+ var seed = function () {
13360
+ var rnd = function () {
13361
+ return Math.round(Math.random() * 4294967295).toString(36);
13362
+ };
13363
+ var now = new Date().getTime();
13364
+ return 's' + now.toString(36) + rnd() + rnd() + rnd();
13365
+ };
13366
+ var uuid = function (prefix) {
13367
+ return prefix + count$1++ + seed();
13368
+ };
13369
+ var Uuid = { uuid: uuid };
13370
+
13371
+ var BlobCache = function () {
13372
+ var cache = [];
13373
+ var mimeToExt = function (mime) {
13374
+ var mimes = {
13375
+ 'image/jpeg': 'jpg',
13376
+ 'image/jpg': 'jpg',
13377
+ 'image/gif': 'gif',
13378
+ 'image/png': 'png'
13379
+ };
13380
+ return mimes[mime.toLowerCase()] || 'dat';
13381
+ };
13382
+ var create = function (o, blob, base64, filename) {
13383
+ if (isString(o)) {
13384
+ var id = o;
13385
+ return toBlobInfo({
13386
+ id: id,
13387
+ name: filename,
13388
+ blob: blob,
13389
+ base64: base64
13390
+ });
13391
+ } else if (isObject(o)) {
13392
+ return toBlobInfo(o);
13393
+ } else {
13394
+ throw new Error('Unknown input type');
13395
+ }
13396
+ };
13397
+ var toBlobInfo = function (o) {
13398
+ var id, name;
13399
+ if (!o.blob || !o.base64) {
13400
+ throw new Error('blob and base64 representations of the image are required for BlobInfo to be created');
13401
+ }
13402
+ id = o.id || Uuid.uuid('blobid');
13403
+ name = o.name || id;
13404
+ return {
13405
+ id: constant(id),
13406
+ name: constant(name),
13407
+ filename: constant(name + '.' + mimeToExt(o.blob.type)),
13408
+ blob: constant(o.blob),
13409
+ base64: constant(o.base64),
13410
+ blobUri: constant(o.blobUri || domGlobals.URL.createObjectURL(o.blob)),
13411
+ uri: constant(o.uri)
13412
+ };
13413
+ };
13414
+ var add = function (blobInfo) {
13415
+ if (!get(blobInfo.id())) {
13416
+ cache.push(blobInfo);
13417
+ }
13418
+ };
13419
+ var get = function (id) {
13420
+ return findFirst(function (cachedBlobInfo) {
13421
+ return cachedBlobInfo.id() === id;
13422
+ });
13423
+ };
13424
+ var findFirst = function (predicate) {
13425
+ return filter(cache, predicate)[0];
13426
+ };
13427
+ var getByUri = function (blobUri) {
13428
+ return findFirst(function (blobInfo) {
13429
+ return blobInfo.blobUri() === blobUri;
13430
+ });
13431
+ };
13432
+ var removeByUri = function (blobUri) {
13433
+ cache = filter(cache, function (blobInfo) {
13434
+ if (blobInfo.blobUri() === blobUri) {
13435
+ domGlobals.URL.revokeObjectURL(blobInfo.blobUri());
13436
+ return false;
13437
+ }
13438
+ return true;
13439
+ });
13440
+ };
13441
+ var destroy = function () {
13442
+ each(cache, function (cachedBlobInfo) {
13443
+ domGlobals.URL.revokeObjectURL(cachedBlobInfo.blobUri());
13444
+ });
13445
+ cache = [];
13446
+ };
13447
+ return {
13448
+ create: create,
13449
+ add: add,
13450
+ get: get,
13451
+ getByUri: getByUri,
13452
+ findFirst: findFirst,
13453
+ removeByUri: removeByUri,
13454
+ destroy: destroy
13455
+ };
13456
+ };
13457
+
13446
13458
  var EditorUpload = function (editor) {
13447
13459
  var blobCache = BlobCache();
13448
13460
  var uploader, imageScanner;
@@ -13512,8 +13524,7 @@
13512
13524
  });
13513
13525
  }
13514
13526
  return scanForImages().then(aliveGuard(function (imageInfos) {
13515
- var blobInfos;
13516
- blobInfos = map(imageInfos, function (imageInfo) {
13527
+ var blobInfos = map(imageInfos, function (imageInfo) {
13517
13528
  return imageInfo.blobInfo;
13518
13529
  });
13519
13530
  return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) {
@@ -24759,261 +24770,66 @@
24759
24770
  };
24760
24771
  var Render = { render: render };
24761
24772
 
24762
- var internalContentEditableAttr = 'data-mce-contenteditable';
24763
- var toggleClass = function (elm, cls, state) {
24764
- if (has$2(elm, cls) && state === false) {
24765
- remove$4(elm, cls);
24766
- } else if (state) {
24767
- add$3(elm, cls);
24773
+ var hasOnlyOneChild$1 = function (node) {
24774
+ return node.firstChild && node.firstChild === node.lastChild;
24775
+ };
24776
+ var isPaddingNode = function (node) {
24777
+ return node.name === 'br' || node.value === '\xA0';
24778
+ };
24779
+ var isPaddedEmptyBlock = function (schema, node) {
24780
+ var blockElements = schema.getBlockElements();
24781
+ return blockElements[node.name] && hasOnlyOneChild$1(node) && isPaddingNode(node.firstChild);
24782
+ };
24783
+ var isEmptyFragmentElement = function (schema, node) {
24784
+ var nonEmptyElements = schema.getNonEmptyElements();
24785
+ return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node));
24786
+ };
24787
+ var isListFragment = function (schema, fragment) {
24788
+ var firstChild = fragment.firstChild;
24789
+ var lastChild = fragment.lastChild;
24790
+ if (firstChild && firstChild.name === 'meta') {
24791
+ firstChild = firstChild.next;
24792
+ }
24793
+ if (lastChild && lastChild.attr('id') === 'mce_marker') {
24794
+ lastChild = lastChild.prev;
24795
+ }
24796
+ if (isEmptyFragmentElement(schema, lastChild)) {
24797
+ lastChild = lastChild.prev;
24798
+ }
24799
+ if (!firstChild || firstChild !== lastChild) {
24800
+ return false;
24768
24801
  }
24802
+ return firstChild.name === 'ul' || firstChild.name === 'ol';
24769
24803
  };
24770
- var setEditorCommandState = function (editor, cmd, state) {
24771
- try {
24772
- editor.getDoc().execCommand(cmd, false, state);
24773
- } catch (ex) {
24804
+ var cleanupDomFragment = function (domFragment) {
24805
+ var firstChild = domFragment.firstChild;
24806
+ var lastChild = domFragment.lastChild;
24807
+ if (firstChild && firstChild.nodeName === 'META') {
24808
+ firstChild.parentNode.removeChild(firstChild);
24809
+ }
24810
+ if (lastChild && lastChild.id === 'mce_marker') {
24811
+ lastChild.parentNode.removeChild(lastChild);
24774
24812
  }
24813
+ return domFragment;
24775
24814
  };
24776
- var setContentEditable = function (elm, state) {
24777
- elm.dom().contentEditable = state ? 'true' : 'false';
24815
+ var toDomFragment = function (dom, serializer, fragment) {
24816
+ var html = serializer.serialize(fragment);
24817
+ var domFragment = dom.createFragment(html);
24818
+ return cleanupDomFragment(domFragment);
24778
24819
  };
24779
- var switchOffContentEditableTrue = function (elm) {
24780
- each(descendants$1(elm, '*[contenteditable="true"]'), function (elm) {
24781
- set(elm, internalContentEditableAttr, 'true');
24782
- setContentEditable(elm, false);
24820
+ var listItems$1 = function (elm) {
24821
+ return Tools.grep(elm.childNodes, function (child) {
24822
+ return child.nodeName === 'LI';
24783
24823
  });
24784
24824
  };
24785
- var switchOnContentEditableTrue = function (elm) {
24786
- each(descendants$1(elm, '*[' + internalContentEditableAttr + '="true"]'), function (elm) {
24787
- remove(elm, internalContentEditableAttr);
24788
- setContentEditable(elm, true);
24789
- });
24825
+ var isPadding = function (node) {
24826
+ return node.data === '\xA0' || NodeType.isBr(node);
24790
24827
  };
24791
- var removeFakeSelection = function (editor) {
24792
- Option.from(editor.selection.getNode()).each(function (elm) {
24793
- elm.removeAttribute('data-mce-selected');
24794
- });
24828
+ var isListItemPadded = function (node) {
24829
+ return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild);
24795
24830
  };
24796
- var restoreFakeSelection = function (editor) {
24797
- editor.selection.setRng(editor.selection.getRng());
24798
- };
24799
- var toggleReadOnly = function (editor, state) {
24800
- var body = Element.fromDom(editor.getBody());
24801
- toggleClass(body, 'mce-content-readonly', state);
24802
- if (state) {
24803
- editor.selection.controlSelection.hideResizeRect();
24804
- editor._selectionOverrides.hideFakeCaret();
24805
- removeFakeSelection(editor);
24806
- editor.readonly = true;
24807
- setContentEditable(body, false);
24808
- switchOffContentEditableTrue(body);
24809
- } else {
24810
- editor.readonly = false;
24811
- setContentEditable(body, true);
24812
- switchOnContentEditableTrue(body);
24813
- setEditorCommandState(editor, 'StyleWithCSS', false);
24814
- setEditorCommandState(editor, 'enableInlineTableEditing', false);
24815
- setEditorCommandState(editor, 'enableObjectResizing', false);
24816
- if (EditorFocus.hasEditorOrUiFocus(editor)) {
24817
- editor.focus();
24818
- }
24819
- restoreFakeSelection(editor);
24820
- editor.nodeChanged();
24821
- }
24822
- };
24823
- var isReadOnly = function (editor) {
24824
- return editor.readonly === true;
24825
- };
24826
- var registerFilters = function (editor) {
24827
- editor.parser.addAttributeFilter('contenteditable', function (nodes) {
24828
- if (isReadOnly(editor)) {
24829
- each(nodes, function (node) {
24830
- node.attr(internalContentEditableAttr, node.attr('contenteditable'));
24831
- node.attr('contenteditable', 'false');
24832
- });
24833
- }
24834
- });
24835
- editor.serializer.addAttributeFilter(internalContentEditableAttr, function (nodes) {
24836
- if (isReadOnly(editor)) {
24837
- each(nodes, function (node) {
24838
- node.attr('contenteditable', node.attr(internalContentEditableAttr));
24839
- });
24840
- }
24841
- });
24842
- editor.serializer.addTempAttr(internalContentEditableAttr);
24843
- };
24844
- var registerReadOnlyContentFilters = function (editor) {
24845
- if (editor.serializer) {
24846
- registerFilters(editor);
24847
- } else {
24848
- editor.on('PreInit', function () {
24849
- registerFilters(editor);
24850
- });
24851
- }
24852
- };
24853
- var isClickEvent = function (e) {
24854
- return e.type === 'click';
24855
- };
24856
- var preventReadOnlyEvents = function (e) {
24857
- var target = e.target;
24858
- if (isClickEvent(e) && target.tagName === 'A' && !VK.metaKeyPressed(e)) {
24859
- e.preventDefault();
24860
- }
24861
- };
24862
- var registerReadOnlySelectionBlockers = function (editor) {
24863
- editor.on('ShowCaret', function (e) {
24864
- if (isReadOnly(editor)) {
24865
- e.preventDefault();
24866
- }
24867
- });
24868
- editor.on('ObjectSelected', function (e) {
24869
- if (isReadOnly(editor)) {
24870
- e.preventDefault();
24871
- }
24872
- });
24873
- };
24874
-
24875
- var defaultModes = [
24876
- 'design',
24877
- 'readonly'
24878
- ];
24879
- var switchToMode = function (editor, activeMode, availableModes, mode) {
24880
- var oldMode = availableModes[activeMode.get()];
24881
- var newMode = availableModes[mode];
24882
- try {
24883
- newMode.activate();
24884
- } catch (e) {
24885
- domGlobals.console.error('problem while activating editor mode ' + mode + ':', e);
24886
- return;
24887
- }
24888
- oldMode.deactivate();
24889
- if (oldMode.editorReadOnly !== newMode.editorReadOnly) {
24890
- toggleReadOnly(editor, newMode.editorReadOnly);
24891
- }
24892
- activeMode.set(mode);
24893
- Events.fireSwitchMode(editor, mode);
24894
- };
24895
- var setMode = function (editor, availableModes, activeMode, mode) {
24896
- if (mode === activeMode.get()) {
24897
- return;
24898
- } else if (!has(availableModes, mode)) {
24899
- throw new Error('Editor mode \'' + mode + '\' is invalid');
24900
- }
24901
- if (editor.initialized) {
24902
- switchToMode(editor, activeMode, availableModes, mode);
24903
- } else {
24904
- editor.on('init', function () {
24905
- return switchToMode(editor, activeMode, availableModes, mode);
24906
- });
24907
- }
24908
- };
24909
- var registerMode = function (availableModes, mode, api) {
24910
- var _a;
24911
- if (contains(defaultModes, mode)) {
24912
- throw new Error('Cannot override default mode ' + mode);
24913
- }
24914
- return __assign(__assign({}, availableModes), (_a = {}, _a[mode] = __assign(__assign({}, api), {
24915
- deactivate: function () {
24916
- try {
24917
- api.deactivate();
24918
- } catch (e) {
24919
- domGlobals.console.error('problem while deactivating editor mode ' + mode + ':', e);
24920
- }
24921
- }
24922
- }), _a));
24923
- };
24924
-
24925
- var create$4 = function (editor) {
24926
- var activeMode = Cell('design');
24927
- var availableModes = Cell({
24928
- design: {
24929
- activate: noop,
24930
- deactivate: noop,
24931
- editorReadOnly: false
24932
- },
24933
- readonly: {
24934
- activate: noop,
24935
- deactivate: noop,
24936
- editorReadOnly: true
24937
- }
24938
- });
24939
- registerReadOnlyContentFilters(editor);
24940
- registerReadOnlySelectionBlockers(editor);
24941
- return {
24942
- isReadOnly: function () {
24943
- return isReadOnly(editor);
24944
- },
24945
- set: function (mode) {
24946
- return setMode(editor, availableModes.get(), activeMode, mode);
24947
- },
24948
- get: function () {
24949
- return activeMode.get();
24950
- },
24951
- register: function (mode, api) {
24952
- availableModes.set(registerMode(availableModes.get(), mode, api));
24953
- }
24954
- };
24955
- };
24956
-
24957
- var hasOnlyOneChild$1 = function (node) {
24958
- return node.firstChild && node.firstChild === node.lastChild;
24959
- };
24960
- var isPaddingNode = function (node) {
24961
- return node.name === 'br' || node.value === '\xA0';
24962
- };
24963
- var isPaddedEmptyBlock = function (schema, node) {
24964
- var blockElements = schema.getBlockElements();
24965
- return blockElements[node.name] && hasOnlyOneChild$1(node) && isPaddingNode(node.firstChild);
24966
- };
24967
- var isEmptyFragmentElement = function (schema, node) {
24968
- var nonEmptyElements = schema.getNonEmptyElements();
24969
- return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node));
24970
- };
24971
- var isListFragment = function (schema, fragment) {
24972
- var firstChild = fragment.firstChild;
24973
- var lastChild = fragment.lastChild;
24974
- if (firstChild && firstChild.name === 'meta') {
24975
- firstChild = firstChild.next;
24976
- }
24977
- if (lastChild && lastChild.attr('id') === 'mce_marker') {
24978
- lastChild = lastChild.prev;
24979
- }
24980
- if (isEmptyFragmentElement(schema, lastChild)) {
24981
- lastChild = lastChild.prev;
24982
- }
24983
- if (!firstChild || firstChild !== lastChild) {
24984
- return false;
24985
- }
24986
- return firstChild.name === 'ul' || firstChild.name === 'ol';
24987
- };
24988
- var cleanupDomFragment = function (domFragment) {
24989
- var firstChild = domFragment.firstChild;
24990
- var lastChild = domFragment.lastChild;
24991
- if (firstChild && firstChild.nodeName === 'META') {
24992
- firstChild.parentNode.removeChild(firstChild);
24993
- }
24994
- if (lastChild && lastChild.id === 'mce_marker') {
24995
- lastChild.parentNode.removeChild(lastChild);
24996
- }
24997
- return domFragment;
24998
- };
24999
- var toDomFragment = function (dom, serializer, fragment) {
25000
- var html = serializer.serialize(fragment);
25001
- var domFragment = dom.createFragment(html);
25002
- return cleanupDomFragment(domFragment);
25003
- };
25004
- var listItems$1 = function (elm) {
25005
- return Tools.grep(elm.childNodes, function (child) {
25006
- return child.nodeName === 'LI';
25007
- });
25008
- };
25009
- var isPadding = function (node) {
25010
- return node.data === '\xA0' || NodeType.isBr(node);
25011
- };
25012
- var isListItemPadded = function (node) {
25013
- return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild);
25014
- };
25015
- var isEmptyOrPadded = function (elm) {
25016
- return !elm.firstChild || isListItemPadded(elm);
24831
+ var isEmptyOrPadded = function (elm) {
24832
+ return !elm.firstChild || isListItemPadded(elm);
25017
24833
  };
25018
24834
  var trimListItems = function (elms) {
25019
24835
  return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms;
@@ -25447,16 +25263,50 @@
25447
25263
  forwardDeleteCommand: forwardDeleteCommand
25448
25264
  };
25449
25265
 
25266
+ var ancestor$3 = function (scope, transform, isRoot) {
25267
+ var element = scope.dom();
25268
+ var stop = isFunction(isRoot) ? isRoot : constant(false);
25269
+ while (element.parentNode) {
25270
+ element = element.parentNode;
25271
+ var el = Element.fromDom(element);
25272
+ var transformed = transform(el);
25273
+ if (transformed.isSome()) {
25274
+ return transformed;
25275
+ } else if (stop(el)) {
25276
+ break;
25277
+ }
25278
+ }
25279
+ return Option.none();
25280
+ };
25281
+ var closest$2 = function (scope, transform, isRoot) {
25282
+ var current = transform(scope);
25283
+ return current.orThunk(function () {
25284
+ return isRoot(scope) ? Option.none() : ancestor$3(scope, transform, isRoot);
25285
+ });
25286
+ };
25287
+
25288
+ var legacyPropNames = {
25289
+ 'font-size': 'size',
25290
+ 'font-family': 'face'
25291
+ };
25450
25292
  var getSpecifiedFontProp = function (propName, rootElm, elm) {
25451
25293
  var getProperty = function (elm) {
25452
- return getRaw(elm, propName);
25294
+ return getRaw(elm, propName).orThunk(function () {
25295
+ if (name(elm) === 'font') {
25296
+ return get(legacyPropNames, propName).bind(function (legacyPropName) {
25297
+ return getOpt(elm, legacyPropName);
25298
+ });
25299
+ } else {
25300
+ return Option.none();
25301
+ }
25302
+ });
25453
25303
  };
25454
25304
  var isRoot = function (elm) {
25455
25305
  return eq(Element.fromDom(rootElm), elm);
25456
25306
  };
25457
- return closest(Element.fromDom(elm), function (elm) {
25458
- return getProperty(elm).isSome();
25459
- }, isRoot).bind(getProperty);
25307
+ return closest$2(Element.fromDom(elm), function (elm) {
25308
+ return getProperty(elm);
25309
+ }, isRoot);
25460
25310
  };
25461
25311
  var round$1 = function (number, precision) {
25462
25312
  var factor = Math.pow(10, precision);
@@ -26137,22 +25987,138 @@
26137
25987
  }
26138
25988
  };
26139
25989
 
26140
- var DOM$7 = DOMUtils$1.DOM;
26141
- var customEventRootDelegates;
26142
- var getEventTarget = function (editor, eventName) {
26143
- if (eventName === 'selectionchange') {
26144
- return editor.getDoc();
26145
- }
26146
- if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
26147
- return editor.getDoc().documentElement;
26148
- }
26149
- if (editor.settings.event_root) {
26150
- if (!editor.eventRoot) {
26151
- editor.eventRoot = DOM$7.select(editor.settings.event_root)[0];
26152
- }
26153
- return editor.eventRoot;
25990
+ var internalContentEditableAttr = 'data-mce-contenteditable';
25991
+ var toggleClass = function (elm, cls, state) {
25992
+ if (has$2(elm, cls) && state === false) {
25993
+ remove$4(elm, cls);
25994
+ } else if (state) {
25995
+ add$3(elm, cls);
26154
25996
  }
26155
- return editor.getBody();
25997
+ };
25998
+ var setEditorCommandState = function (editor, cmd, state) {
25999
+ try {
26000
+ editor.getDoc().execCommand(cmd, false, state);
26001
+ } catch (ex) {
26002
+ }
26003
+ };
26004
+ var setContentEditable = function (elm, state) {
26005
+ elm.dom().contentEditable = state ? 'true' : 'false';
26006
+ };
26007
+ var switchOffContentEditableTrue = function (elm) {
26008
+ each(descendants$1(elm, '*[contenteditable="true"]'), function (elm) {
26009
+ set(elm, internalContentEditableAttr, 'true');
26010
+ setContentEditable(elm, false);
26011
+ });
26012
+ };
26013
+ var switchOnContentEditableTrue = function (elm) {
26014
+ each(descendants$1(elm, '*[' + internalContentEditableAttr + '="true"]'), function (elm) {
26015
+ remove(elm, internalContentEditableAttr);
26016
+ setContentEditable(elm, true);
26017
+ });
26018
+ };
26019
+ var removeFakeSelection = function (editor) {
26020
+ Option.from(editor.selection.getNode()).each(function (elm) {
26021
+ elm.removeAttribute('data-mce-selected');
26022
+ });
26023
+ };
26024
+ var restoreFakeSelection = function (editor) {
26025
+ editor.selection.setRng(editor.selection.getRng());
26026
+ };
26027
+ var toggleReadOnly = function (editor, state) {
26028
+ var body = Element.fromDom(editor.getBody());
26029
+ toggleClass(body, 'mce-content-readonly', state);
26030
+ if (state) {
26031
+ editor.selection.controlSelection.hideResizeRect();
26032
+ editor._selectionOverrides.hideFakeCaret();
26033
+ removeFakeSelection(editor);
26034
+ editor.readonly = true;
26035
+ setContentEditable(body, false);
26036
+ switchOffContentEditableTrue(body);
26037
+ } else {
26038
+ editor.readonly = false;
26039
+ setContentEditable(body, true);
26040
+ switchOnContentEditableTrue(body);
26041
+ setEditorCommandState(editor, 'StyleWithCSS', false);
26042
+ setEditorCommandState(editor, 'enableInlineTableEditing', false);
26043
+ setEditorCommandState(editor, 'enableObjectResizing', false);
26044
+ if (EditorFocus.hasEditorOrUiFocus(editor)) {
26045
+ editor.focus();
26046
+ }
26047
+ restoreFakeSelection(editor);
26048
+ editor.nodeChanged();
26049
+ }
26050
+ };
26051
+ var isReadOnly = function (editor) {
26052
+ return editor.readonly === true;
26053
+ };
26054
+ var registerFilters = function (editor) {
26055
+ editor.parser.addAttributeFilter('contenteditable', function (nodes) {
26056
+ if (isReadOnly(editor)) {
26057
+ each(nodes, function (node) {
26058
+ node.attr(internalContentEditableAttr, node.attr('contenteditable'));
26059
+ node.attr('contenteditable', 'false');
26060
+ });
26061
+ }
26062
+ });
26063
+ editor.serializer.addAttributeFilter(internalContentEditableAttr, function (nodes) {
26064
+ if (isReadOnly(editor)) {
26065
+ each(nodes, function (node) {
26066
+ node.attr('contenteditable', node.attr(internalContentEditableAttr));
26067
+ });
26068
+ }
26069
+ });
26070
+ editor.serializer.addTempAttr(internalContentEditableAttr);
26071
+ };
26072
+ var registerReadOnlyContentFilters = function (editor) {
26073
+ if (editor.serializer) {
26074
+ registerFilters(editor);
26075
+ } else {
26076
+ editor.on('PreInit', function () {
26077
+ registerFilters(editor);
26078
+ });
26079
+ }
26080
+ };
26081
+ var isClickEvent = function (e) {
26082
+ return e.type === 'click';
26083
+ };
26084
+ var isInAnchor = function (editor, target) {
26085
+ return editor.dom.getParent(target, 'a') !== null;
26086
+ };
26087
+ var preventReadOnlyEvents = function (editor, e) {
26088
+ var target = e.target;
26089
+ if (isClickEvent(e) && !VK.metaKeyPressed(e) && isInAnchor(editor, target)) {
26090
+ e.preventDefault();
26091
+ }
26092
+ };
26093
+ var registerReadOnlySelectionBlockers = function (editor) {
26094
+ editor.on('ShowCaret', function (e) {
26095
+ if (isReadOnly(editor)) {
26096
+ e.preventDefault();
26097
+ }
26098
+ });
26099
+ editor.on('ObjectSelected', function (e) {
26100
+ if (isReadOnly(editor)) {
26101
+ e.preventDefault();
26102
+ }
26103
+ });
26104
+ };
26105
+
26106
+ var DOM$7 = DOMUtils$1.DOM;
26107
+ var customEventRootDelegates;
26108
+ var getEventTarget = function (editor, eventName) {
26109
+ if (eventName === 'selectionchange') {
26110
+ return editor.getDoc();
26111
+ }
26112
+ if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
26113
+ return editor.getDoc().documentElement;
26114
+ }
26115
+ if (editor.settings.event_root) {
26116
+ if (!editor.eventRoot) {
26117
+ editor.eventRoot = DOM$7.select(editor.settings.event_root)[0];
26118
+ }
26119
+ return editor.eventRoot;
26120
+ }
26121
+ return editor.getBody();
26156
26122
  };
26157
26123
  var isListening = function (editor) {
26158
26124
  return !editor.hidden && !isReadOnly(editor);
@@ -26161,7 +26127,7 @@
26161
26127
  if (isListening(editor)) {
26162
26128
  editor.fire(eventName, e);
26163
26129
  } else if (isReadOnly(editor)) {
26164
- preventReadOnlyEvents(e);
26130
+ preventReadOnlyEvents(editor, e);
26165
26131
  }
26166
26132
  };
26167
26133
  var bindEventDelegate = function (editor, eventName) {
@@ -26262,6 +26228,88 @@
26262
26228
  }
26263
26229
  });
26264
26230
 
26231
+ var defaultModes = [
26232
+ 'design',
26233
+ 'readonly'
26234
+ ];
26235
+ var switchToMode = function (editor, activeMode, availableModes, mode) {
26236
+ var oldMode = availableModes[activeMode.get()];
26237
+ var newMode = availableModes[mode];
26238
+ try {
26239
+ newMode.activate();
26240
+ } catch (e) {
26241
+ domGlobals.console.error('problem while activating editor mode ' + mode + ':', e);
26242
+ return;
26243
+ }
26244
+ oldMode.deactivate();
26245
+ if (oldMode.editorReadOnly !== newMode.editorReadOnly) {
26246
+ toggleReadOnly(editor, newMode.editorReadOnly);
26247
+ }
26248
+ activeMode.set(mode);
26249
+ Events.fireSwitchMode(editor, mode);
26250
+ };
26251
+ var setMode = function (editor, availableModes, activeMode, mode) {
26252
+ if (mode === activeMode.get()) {
26253
+ return;
26254
+ } else if (!has(availableModes, mode)) {
26255
+ throw new Error('Editor mode \'' + mode + '\' is invalid');
26256
+ }
26257
+ if (editor.initialized) {
26258
+ switchToMode(editor, activeMode, availableModes, mode);
26259
+ } else {
26260
+ editor.on('init', function () {
26261
+ return switchToMode(editor, activeMode, availableModes, mode);
26262
+ });
26263
+ }
26264
+ };
26265
+ var registerMode = function (availableModes, mode, api) {
26266
+ var _a;
26267
+ if (contains(defaultModes, mode)) {
26268
+ throw new Error('Cannot override default mode ' + mode);
26269
+ }
26270
+ return __assign(__assign({}, availableModes), (_a = {}, _a[mode] = __assign(__assign({}, api), {
26271
+ deactivate: function () {
26272
+ try {
26273
+ api.deactivate();
26274
+ } catch (e) {
26275
+ domGlobals.console.error('problem while deactivating editor mode ' + mode + ':', e);
26276
+ }
26277
+ }
26278
+ }), _a));
26279
+ };
26280
+
26281
+ var create$4 = function (editor) {
26282
+ var activeMode = Cell('design');
26283
+ var availableModes = Cell({
26284
+ design: {
26285
+ activate: noop,
26286
+ deactivate: noop,
26287
+ editorReadOnly: false
26288
+ },
26289
+ readonly: {
26290
+ activate: noop,
26291
+ deactivate: noop,
26292
+ editorReadOnly: true
26293
+ }
26294
+ });
26295
+ registerReadOnlyContentFilters(editor);
26296
+ registerReadOnlySelectionBlockers(editor);
26297
+ return {
26298
+ isReadOnly: function () {
26299
+ return isReadOnly(editor);
26300
+ },
26301
+ set: function (mode) {
26302
+ return setMode(editor, availableModes.get(), activeMode, mode);
26303
+ },
26304
+ get: function () {
26305
+ return activeMode.get();
26306
+ },
26307
+ register: function (mode, api) {
26308
+ availableModes.set(registerMode(availableModes.get(), mode, api));
26309
+ }
26310
+ };
26311
+ };
26312
+
26265
26313
  var each$h = Tools.each, explode$3 = Tools.explode;
26266
26314
  var keyCodeLookup = {
26267
26315
  f1: 112,
@@ -26415,6 +26463,70 @@
26415
26463
  return Shortcuts;
26416
26464
  }();
26417
26465
 
26466
+ var create$5 = function () {
26467
+ var buttons = {};
26468
+ var menuItems = {};
26469
+ var popups = {};
26470
+ var icons = {};
26471
+ var contextMenus = {};
26472
+ var contextToolbars = {};
26473
+ var sidebars = {};
26474
+ var add = function (collection, type) {
26475
+ return function (name, spec) {
26476
+ return collection[name.toLowerCase()] = __assign(__assign({}, spec), { type: type });
26477
+ };
26478
+ };
26479
+ var addIcon = function (name, svgData) {
26480
+ return icons[name.toLowerCase()] = svgData;
26481
+ };
26482
+ return {
26483
+ addButton: add(buttons, 'button'),
26484
+ addToggleButton: add(buttons, 'togglebutton'),
26485
+ addMenuButton: add(buttons, 'menubutton'),
26486
+ addSplitButton: add(buttons, 'splitbutton'),
26487
+ addMenuItem: add(menuItems, 'menuitem'),
26488
+ addNestedMenuItem: add(menuItems, 'nestedmenuitem'),
26489
+ addToggleMenuItem: add(menuItems, 'togglemenuitem'),
26490
+ addAutocompleter: add(popups, 'autocompleter'),
26491
+ addContextMenu: add(contextMenus, 'contextmenu'),
26492
+ addContextToolbar: add(contextToolbars, 'contexttoolbar'),
26493
+ addContextForm: add(contextToolbars, 'contextform'),
26494
+ addSidebar: add(sidebars, 'sidebar'),
26495
+ addIcon: addIcon,
26496
+ getAll: function () {
26497
+ return {
26498
+ buttons: buttons,
26499
+ menuItems: menuItems,
26500
+ icons: icons,
26501
+ popups: popups,
26502
+ contextMenus: contextMenus,
26503
+ contextToolbars: contextToolbars,
26504
+ sidebars: sidebars
26505
+ };
26506
+ }
26507
+ };
26508
+ };
26509
+
26510
+ var registry = function () {
26511
+ var bridge = create$5();
26512
+ return {
26513
+ addAutocompleter: bridge.addAutocompleter,
26514
+ addButton: bridge.addButton,
26515
+ addContextForm: bridge.addContextForm,
26516
+ addContextMenu: bridge.addContextMenu,
26517
+ addContextToolbar: bridge.addContextToolbar,
26518
+ addIcon: bridge.addIcon,
26519
+ addMenuButton: bridge.addMenuButton,
26520
+ addMenuItem: bridge.addMenuItem,
26521
+ addNestedMenuItem: bridge.addNestedMenuItem,
26522
+ addSidebar: bridge.addSidebar,
26523
+ addSplitButton: bridge.addSplitButton,
26524
+ addToggleButton: bridge.addToggleButton,
26525
+ addToggleMenuItem: bridge.addToggleMenuItem,
26526
+ getAll: bridge.getAll
26527
+ };
26528
+ };
26529
+
26418
26530
  var each$i = Tools.each, trim$4 = Tools.trim;
26419
26531
  var queryParts = 'source protocol authority userInfo user password host port relative path directory file query anchor'.split(' ');
26420
26532
  var DEFAULT_PORTS = {
@@ -26660,70 +26772,6 @@
26660
26772
  return URI;
26661
26773
  }();
26662
26774
 
26663
- var create$5 = function () {
26664
- var buttons = {};
26665
- var menuItems = {};
26666
- var popups = {};
26667
- var icons = {};
26668
- var contextMenus = {};
26669
- var contextToolbars = {};
26670
- var sidebars = {};
26671
- var add = function (collection, type) {
26672
- return function (name, spec) {
26673
- return collection[name.toLowerCase()] = __assign(__assign({}, spec), { type: type });
26674
- };
26675
- };
26676
- var addIcon = function (name, svgData) {
26677
- return icons[name.toLowerCase()] = svgData;
26678
- };
26679
- return {
26680
- addButton: add(buttons, 'button'),
26681
- addToggleButton: add(buttons, 'togglebutton'),
26682
- addMenuButton: add(buttons, 'menubutton'),
26683
- addSplitButton: add(buttons, 'splitbutton'),
26684
- addMenuItem: add(menuItems, 'menuitem'),
26685
- addNestedMenuItem: add(menuItems, 'nestedmenuitem'),
26686
- addToggleMenuItem: add(menuItems, 'togglemenuitem'),
26687
- addAutocompleter: add(popups, 'autocompleter'),
26688
- addContextMenu: add(contextMenus, 'contextmenu'),
26689
- addContextToolbar: add(contextToolbars, 'contexttoolbar'),
26690
- addContextForm: add(contextToolbars, 'contextform'),
26691
- addSidebar: add(sidebars, 'sidebar'),
26692
- addIcon: addIcon,
26693
- getAll: function () {
26694
- return {
26695
- buttons: buttons,
26696
- menuItems: menuItems,
26697
- icons: icons,
26698
- popups: popups,
26699
- contextMenus: contextMenus,
26700
- contextToolbars: contextToolbars,
26701
- sidebars: sidebars
26702
- };
26703
- }
26704
- };
26705
- };
26706
-
26707
- var registry = function () {
26708
- var bridge = create$5();
26709
- return {
26710
- addAutocompleter: bridge.addAutocompleter,
26711
- addButton: bridge.addButton,
26712
- addContextForm: bridge.addContextForm,
26713
- addContextMenu: bridge.addContextMenu,
26714
- addContextToolbar: bridge.addContextToolbar,
26715
- addIcon: bridge.addIcon,
26716
- addMenuButton: bridge.addMenuButton,
26717
- addMenuItem: bridge.addMenuItem,
26718
- addNestedMenuItem: bridge.addNestedMenuItem,
26719
- addSidebar: bridge.addSidebar,
26720
- addSplitButton: bridge.addSplitButton,
26721
- addToggleButton: bridge.addToggleButton,
26722
- addToggleMenuItem: bridge.addToggleMenuItem,
26723
- getAll: bridge.getAll
26724
- };
26725
- };
26726
-
26727
26775
  var DOM$8 = DOMUtils$1.DOM;
26728
26776
  var extend$3 = Tools.extend, each$j = Tools.each;
26729
26777
  var resolve$3 = Tools.resolve;
@@ -27171,8 +27219,8 @@
27171
27219
  suffix: null,
27172
27220
  $: DomQuery,
27173
27221
  majorVersion: '5',
27174
- minorVersion: '1.5',
27175
- releaseDate: '2019-12-19',
27222
+ minorVersion: '1.6',
27223
+ releaseDate: '2020-01-28',
27176
27224
  editors: legacyEditors,
27177
27225
  i18n: I18n,
27178
27226
  activeEditor: null,