tinymce-rails 6.7.0 → 6.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +65 -107
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/models/dom/model.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
  16. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +1 -1
  18. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -1
  19. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  20. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -1
  22. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
  23. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -1
  24. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +1 -1
  28. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  29. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +1 -1
  31. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
  32. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  34. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
  35. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  36. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  37. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1ce0ad13d60afa861fa00e6c52bd760ef860f0308a1a97ae7a593d521135f37
4
- data.tar.gz: 756d019a00e9594df9bb1353561981874192cb33eee4bb654eba526ca4d6b0a3
3
+ metadata.gz: efc80723357931ab9337eb5d78bb6aa2bee3948873596abf352086403dc3fd17
4
+ data.tar.gz: cea2141e6ee4b3305bfca7278732d0eb59a9a3f3b5769ce0093f09d99b3b4301
5
5
  SHA512:
6
- metadata.gz: b3b76844b3007da7b15f5837727034c4b3033b73a9cc2fcd142341434b65a1acfd0ddf3e27daf6ce1ce502302ec3238d0549f6cba57f814d1391121b8c6cf77b
7
- data.tar.gz: c0f49240d820146ae5e225830b7f53d771d5804087e2681444303c2d870bc0189a7aa083eb46aa7493872e0bb2a3a0f988a8aa88efcd0c21ff346868231d38dd
6
+ metadata.gz: f0f434311888363b39f94d5a89aeb49a83021b6886df6bd9cc4538d13365f08277a793c951da76a9ddd7ca58bb62a592035c76718b92db8504c30ba2132000b0
7
+ data.tar.gz: 76f3be7f4d755263432e1f8cf130da89ff593dfb68303ef7c01beb6fdfecf01cc3007a27403fd15e7f2208ba9f57d5d94e5a5fe44b434a03c7032cbc2aa0cc6c
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TinyMCE version 6.7.0 (2023-08-30)
2
+ * TinyMCE version 6.7.1 (2023-10-19)
3
3
  */
4
4
 
5
5
  (function () {
@@ -735,7 +735,7 @@
735
735
  return checkRange(str, suffix, str.length - suffix.length);
736
736
  };
737
737
  const blank = r => s => s.replace(r, '');
738
- const trim$3 = blank(/^\s+|\s+$/g);
738
+ const trim$4 = blank(/^\s+|\s+$/g);
739
739
  const lTrim = blank(/^\s+/g);
740
740
  const rTrim = blank(/\s+$/g);
741
741
  const isNotEmpty = s => s.length > 0;
@@ -1005,7 +1005,7 @@
1005
1005
  };
1006
1006
 
1007
1007
  const whiteSpaceRegExp$1 = /^\s*|\s*$/g;
1008
- const trim$2 = str => {
1008
+ const trim$3 = str => {
1009
1009
  return isNullable(str) ? '' : ('' + str).replace(whiteSpaceRegExp$1, '');
1010
1010
  };
1011
1011
  const is$3 = (obj, type) => {
@@ -1072,7 +1072,7 @@
1072
1072
  } else if (s === '') {
1073
1073
  return [];
1074
1074
  } else {
1075
- return map$1(s.split(d || ','), trim$2);
1075
+ return map$1(s.split(d || ','), trim$3);
1076
1076
  }
1077
1077
  };
1078
1078
  const _addCacheSuffix = url => {
@@ -1083,7 +1083,7 @@
1083
1083
  return url;
1084
1084
  };
1085
1085
  const Tools = {
1086
- trim: trim$2,
1086
+ trim: trim$3,
1087
1087
  isArray: isArray,
1088
1088
  is: is$3,
1089
1089
  toArray: toArray$1,
@@ -1564,7 +1564,7 @@
1564
1564
  const remove$6 = (element, property) => {
1565
1565
  const dom = element.dom;
1566
1566
  internalRemove(dom, property);
1567
- if (is$2(getOpt(element, 'style').map(trim$3), '')) {
1567
+ if (is$2(getOpt(element, 'style').map(trim$4), '')) {
1568
1568
  remove$a(element, 'style');
1569
1569
  }
1570
1570
  };
@@ -2170,7 +2170,7 @@
2170
2170
 
2171
2171
  const ZWSP$1 = zeroWidth;
2172
2172
  const isZwsp$1 = isZwsp$2;
2173
- const trim$1 = removeZwsp;
2173
+ const trim$2 = removeZwsp;
2174
2174
 
2175
2175
  const isElement$5 = isElement$6;
2176
2176
  const isText$9 = isText$a;
@@ -6309,7 +6309,7 @@
6309
6309
  };
6310
6310
  const getBookmark$2 = (selection, type, normalized = false) => {
6311
6311
  if (type === 2) {
6312
- return getOffsetBookmark(trim$1, normalized, selection);
6312
+ return getOffsetBookmark(trim$2, normalized, selection);
6313
6313
  } else if (type === 3) {
6314
6314
  return getCaretBookmark(selection);
6315
6315
  } else if (type) {
@@ -6603,7 +6603,7 @@
6603
6603
  const arr = item.split('=');
6604
6604
  const key = arr[0];
6605
6605
  const val = arr.length > 1 ? arr[1] : key;
6606
- output[trim$3(key)] = trim$3(val);
6606
+ output[trim$4(key)] = trim$4(val);
6607
6607
  return output;
6608
6608
  }, {});
6609
6609
  };
@@ -6838,7 +6838,7 @@
6838
6838
  if (valid) {
6839
6839
  if (isString(value)) {
6840
6840
  return {
6841
- value: map$3(value.split(','), trim$3),
6841
+ value: map$3(value.split(','), trim$4),
6842
6842
  valid
6843
6843
  };
6844
6844
  } else if (isArray$1(value)) {
@@ -6875,7 +6875,7 @@
6875
6875
  processor: value => {
6876
6876
  const valid = isString(value) || isArrayOf(value, isString);
6877
6877
  if (valid) {
6878
- const newValue = isArray$1(value) ? value : map$3(value.split(','), trim$3);
6878
+ const newValue = isArray$1(value) ? value : map$3(value.split(','), trim$4);
6879
6879
  return {
6880
6880
  value: newValue,
6881
6881
  valid
@@ -7455,7 +7455,7 @@
7455
7455
  }
7456
7456
  };
7457
7457
  const trimCount = text => {
7458
- const trimmedText = trim$1(text);
7458
+ const trimmedText = trim$2(text);
7459
7459
  return {
7460
7460
  count: text.length - trimmedText.length,
7461
7461
  text: trimmedText
@@ -11165,85 +11165,51 @@
11165
11165
  }
11166
11166
  }
11167
11167
 
11168
- const isConditionalComment = (html, startIndex) => /^\s*\[if [\w\W]+\]>.*<!\[endif\](--!?)?>/.test(html.substr(startIndex));
11169
- const findCommentEndIndex = (html, isBogus, startIndex = 0) => {
11170
- const lcHtml = html.toLowerCase();
11171
- if (lcHtml.indexOf('[if ', startIndex) !== -1 && isConditionalComment(lcHtml, startIndex)) {
11172
- const endIfIndex = lcHtml.indexOf('[endif]', startIndex);
11173
- return lcHtml.indexOf('>', endIfIndex);
11174
- } else {
11175
- if (isBogus) {
11176
- const endIndex = lcHtml.indexOf('>', startIndex);
11177
- return endIndex !== -1 ? endIndex : lcHtml.length;
11168
+ const getTemporaryNodeSelector = tempAttrs => `${ tempAttrs.length === 0 ? '' : `${ map$3(tempAttrs, attr => `[${ attr }]`).join(',') },` }[data-mce-bogus="all"]`;
11169
+ const getTemporaryNodes = (body, tempAttrs) => body.querySelectorAll(getTemporaryNodeSelector(tempAttrs));
11170
+ const createCommentWalker = body => document.createTreeWalker(body, NodeFilter.SHOW_COMMENT, null);
11171
+ const hasComments = body => createCommentWalker(body).nextNode() !== null;
11172
+ const hasTemporaryNodes = (body, tempAttrs) => body.querySelector(getTemporaryNodeSelector(tempAttrs)) !== null;
11173
+ const trimTemporaryNodes = (body, tempAttrs) => {
11174
+ each$e(getTemporaryNodes(body, tempAttrs), elm => {
11175
+ const element = SugarElement.fromDom(elm);
11176
+ if (get$9(element, 'data-mce-bogus') === 'all') {
11177
+ remove$5(element);
11178
11178
  } else {
11179
- const endCommentRegexp = /--!?>/g;
11180
- endCommentRegexp.lastIndex = startIndex;
11181
- const match = endCommentRegexp.exec(html);
11182
- return match ? match.index + match[0].length : lcHtml.length;
11179
+ each$e(tempAttrs, attr => {
11180
+ if (has$1(element, attr)) {
11181
+ remove$a(element, attr);
11182
+ }
11183
+ });
11183
11184
  }
11184
- }
11185
+ });
11185
11186
  };
11186
- const findMatchingEndTagIndex = (schema, html, startIndex) => {
11187
- const startTagRegExp = /<([!?\/])?([A-Za-z0-9\-_:.]+)/g;
11188
- const endTagRegExp = /(?:\s(?:[^'">]+(?:"[^"]*"|'[^']*'))*[^"'>]*(?:"[^">]*|'[^'>]*)?|\s*|\/)>/g;
11189
- const voidElements = schema.getVoidElements();
11190
- let count = 1, index = startIndex;
11191
- while (count !== 0) {
11192
- startTagRegExp.lastIndex = index;
11193
- while (true) {
11194
- const startMatch = startTagRegExp.exec(html);
11195
- if (startMatch === null) {
11196
- return index;
11197
- } else if (startMatch[1] === '!') {
11198
- if (startsWith(startMatch[2], '--')) {
11199
- index = findCommentEndIndex(html, false, startMatch.index + '!--'.length);
11200
- } else {
11201
- index = findCommentEndIndex(html, true, startMatch.index + 1);
11202
- }
11203
- break;
11204
- } else {
11205
- endTagRegExp.lastIndex = startTagRegExp.lastIndex;
11206
- const endMatch = endTagRegExp.exec(html);
11207
- if (isNull(endMatch) || endMatch.index !== startTagRegExp.lastIndex) {
11208
- continue;
11209
- }
11210
- if (startMatch[1] === '/') {
11211
- count -= 1;
11212
- } else if (!has$2(voidElements, startMatch[2])) {
11213
- count += 1;
11214
- }
11215
- index = startTagRegExp.lastIndex + endMatch[0].length;
11216
- break;
11217
- }
11187
+ const removeCommentsContainingZwsp = body => {
11188
+ const walker = createCommentWalker(body);
11189
+ let nextNode = walker.nextNode();
11190
+ while (nextNode !== null) {
11191
+ const comment = walker.currentNode;
11192
+ nextNode = walker.nextNode();
11193
+ if (isString(comment.nodeValue) && comment.nodeValue.includes(ZWSP$1)) {
11194
+ remove$5(SugarElement.fromDom(comment));
11218
11195
  }
11219
11196
  }
11220
- return index;
11221
- };
11222
- const trimHtml$1 = (tempAttrs, html) => {
11223
- const trimContentRegExp = new RegExp(['\\s?(' + tempAttrs.join('|') + ')="[^"]+"'].join('|'), 'gi');
11224
- return html.replace(trimContentRegExp, '');
11225
11197
  };
11226
- const trimInternal = (serializer, html) => {
11227
- const bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g;
11228
- const schema = serializer.schema;
11229
- let content = trimHtml$1(serializer.getTempAttrs(), html);
11230
- const voidElements = schema.getVoidElements();
11231
- let matches;
11232
- while (matches = bogusAllRegExp.exec(content)) {
11233
- const index = bogusAllRegExp.lastIndex;
11234
- const matchLength = matches[0].length;
11235
- let endTagIndex;
11236
- if (voidElements[matches[1]]) {
11237
- endTagIndex = index;
11238
- } else {
11239
- endTagIndex = findMatchingEndTagIndex(schema, content, index);
11198
+ const deepClone = body => body.cloneNode(true);
11199
+ const trim$1 = (body, tempAttrs) => {
11200
+ let trimmed = body;
11201
+ if (hasComments(body)) {
11202
+ trimmed = deepClone(body);
11203
+ removeCommentsContainingZwsp(trimmed);
11204
+ if (hasTemporaryNodes(trimmed, tempAttrs)) {
11205
+ trimTemporaryNodes(trimmed, tempAttrs);
11240
11206
  }
11241
- content = content.substring(0, index - matchLength) + content.substring(endTagIndex);
11242
- bogusAllRegExp.lastIndex = index - matchLength;
11207
+ } else if (hasTemporaryNodes(body, tempAttrs)) {
11208
+ trimmed = deepClone(body);
11209
+ trimTemporaryNodes(trimmed, tempAttrs);
11243
11210
  }
11244
- return trim$1(content);
11211
+ return trimmed;
11245
11212
  };
11246
- const trimExternal = trimInternal;
11247
11213
 
11248
11214
  const cleanupBogusElements = parent => {
11249
11215
  const bogusElements = descendants(parent, '[data-mce-bogus]');
@@ -11286,14 +11252,14 @@
11286
11252
  cleanupInputNames(offscreenDiv);
11287
11253
  const root = getContentContainer(dos);
11288
11254
  append$1(root, offscreenDiv);
11289
- const content = trim$1(offscreenDiv.dom.innerText);
11255
+ const content = trim$2(offscreenDiv.dom.innerText);
11290
11256
  remove$5(offscreenDiv);
11291
11257
  return content;
11292
11258
  };
11293
11259
  const getContentFromBody = (editor, args, body) => {
11294
11260
  let content;
11295
11261
  if (args.format === 'raw') {
11296
- content = Tools.trim(trimExternal(editor.serializer, body.innerHTML));
11262
+ content = Tools.trim(trim$2(trim$1(body, editor.serializer.getTempAttrs()).innerHTML));
11297
11263
  } else if (args.format === 'text') {
11298
11264
  content = getPlainTextContent(editor, body);
11299
11265
  } else if (args.format === 'tree') {
@@ -17477,7 +17443,7 @@
17477
17443
 
17478
17444
  const isCollapsibleWhitespace = (text, index) => index >= 0 && index < text.length && isWhiteSpace(text.charAt(index));
17479
17445
  const getInnerText = bin => {
17480
- return trim$1(bin.innerText);
17446
+ return trim$2(bin.innerText);
17481
17447
  };
17482
17448
  const getContextNodeName = parentBlockOpt => parentBlockOpt.map(block => block.nodeName).getOr('div').toLowerCase();
17483
17449
  const getTextContent = editor => Optional.from(editor.selection.getRng()).map(rng => {
@@ -17493,7 +17459,7 @@
17493
17459
  'style': 'overflow: hidden; opacity: 0;'
17494
17460
  }, rangeContentClone.dom);
17495
17461
  const text = getInnerText(bin);
17496
- const nonRenderedText = trim$1((_a = bin.textContent) !== null && _a !== void 0 ? _a : '');
17462
+ const nonRenderedText = trim$2((_a = bin.textContent) !== null && _a !== void 0 ? _a : '');
17497
17463
  editor.dom.remove(bin);
17498
17464
  if (isCollapsibleWhitespace(nonRenderedText, 0) || isCollapsibleWhitespace(nonRenderedText, nonRenderedText.length - 1)) {
17499
17465
  const parentBlock = parentBlockOpt.getOr(body);
@@ -17715,11 +17681,9 @@
17715
17681
  }
17716
17682
  });
17717
17683
  };
17718
- const read$2 = elm => {
17719
- return filter$5(map$3(from(elm.childNodes), getOuterHtml), item => {
17720
- return item.length > 0;
17721
- });
17722
- };
17684
+ const read$2 = (elm, trimZwsp) => filter$5(map$3(from(elm.childNodes), trimZwsp ? compose(trim$2, getOuterHtml) : getOuterHtml), item => {
17685
+ return item.length > 0;
17686
+ });
17723
17687
  const write = (fragments, elm) => {
17724
17688
  const currentFragments = map$3(from(elm.childNodes), getOuterHtml);
17725
17689
  applyDiff(diff(currentFragments, fragments), elm);
@@ -17727,9 +17691,7 @@
17727
17691
  };
17728
17692
 
17729
17693
  const lazyTempDocument = cached(() => document.implementation.createHTMLDocument('undo'));
17730
- const hasIframes = html => {
17731
- return html.indexOf('</iframe>') !== -1;
17732
- };
17694
+ const hasIframes = body => body.querySelector('iframe') !== null;
17733
17695
  const createFragmentedLevel = fragments => {
17734
17696
  return {
17735
17697
  type: 'fragmented',
@@ -17749,13 +17711,9 @@
17749
17711
  };
17750
17712
  };
17751
17713
  const createFromEditor = editor => {
17752
- const fragments = read$2(editor.getBody());
17753
- const trimmedFragments = bind$3(fragments, html => {
17754
- const trimmed = trimInternal(editor.serializer, html);
17755
- return trimmed.length > 0 ? [trimmed] : [];
17756
- });
17757
- const content = trimmedFragments.join('');
17758
- return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content);
17714
+ const tempAttrs = editor.serializer.getTempAttrs();
17715
+ const body = trim$1(editor.getBody(), tempAttrs);
17716
+ return hasIframes(body) ? createFragmentedLevel(read$2(body, true)) : createCompleteLevel(trim$2(body.innerHTML));
17759
17717
  };
17760
17718
  const applyToEditor = (editor, level, before) => {
17761
17719
  const bookmark = before ? level.beforeBookmark : level.bookmark;
@@ -18812,7 +18770,7 @@
18812
18770
  }
18813
18771
  };
18814
18772
  const getHtmlFromNode = (dom, node, args) => {
18815
- const html = trim$1(args.getInner ? node.innerHTML : dom.getOuterHTML(node));
18773
+ const html = trim$2(args.getInner ? node.innerHTML : dom.getOuterHTML(node));
18816
18774
  return args.selection || isWsPreserveElement(SugarElement.fromDom(node)) ? html : Tools.trim(html);
18817
18775
  };
18818
18776
  const parseHtml = (htmlParser, html, args) => {
@@ -23075,7 +23033,7 @@
23075
23033
  };
23076
23034
 
23077
23035
  const isValidTextRange = rng => rng.collapsed && isText$a(rng.startContainer);
23078
- const getText = rng => trim$1(rng.toString().replace(/\u00A0/g, ' '));
23036
+ const getText = rng => trim$2(rng.toString().replace(/\u00A0/g, ' '));
23079
23037
  const isWhitespace = chr => chr !== '' && ' \xA0\f\n\r\t\x0B'.indexOf(chr) !== -1;
23080
23038
 
23081
23039
  const stripTrigger = (text, trigger) => text.substring(trigger.length);
@@ -24377,7 +24335,7 @@
24377
24335
  const trimZwsp = fragment => {
24378
24336
  each$e(descendants$1(SugarElement.fromDom(fragment), isText$b), text => {
24379
24337
  const rawNode = text.dom;
24380
- rawNode.nodeValue = trim$1(rawNode.data);
24338
+ rawNode.nodeValue = trim$2(rawNode.data);
24381
24339
  });
24382
24340
  };
24383
24341
  const isWithinNonEditableList = (editor, node) => {
@@ -28933,7 +28891,7 @@
28933
28891
  return [];
28934
28892
  } else {
28935
28893
  const pluginNames = isArray$1(plugins) ? plugins : plugins.split(/[ ,]/);
28936
- const trimmedPlugins = map$3(pluginNames, trim$3);
28894
+ const trimmedPlugins = map$3(pluginNames, trim$4);
28937
28895
  return filter$5(trimmedPlugins, isNotEmpty);
28938
28896
  }
28939
28897
  };
@@ -30914,8 +30872,8 @@
30914
30872
  documentBaseURL: null,
30915
30873
  suffix: null,
30916
30874
  majorVersion: '6',
30917
- minorVersion: '7.0',
30918
- releaseDate: '2023-08-30',
30875
+ minorVersion: '7.1',
30876
+ releaseDate: '2023-10-19',
30919
30877
  i18n: I18n,
30920
30878
  activeEditor: null,
30921
30879
  focusedEditor: null,
@@ -1,6 +1,6 @@
1
1
  module TinyMCE
2
2
  module Rails
3
- VERSION = "6.7.0"
4
- TINYMCE_VERSION = "6.7.0"
3
+ VERSION = "6.7.1"
4
+ TINYMCE_VERSION = "6.7.1"
5
5
  end
6
6
  end