@contentful/field-editor-rich-text 3.4.15 → 3.4.17

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,18 @@
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
+ ## [3.4.17](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.16...@contentful/field-editor-rich-text@3.4.17) (2023-04-04)
7
+
8
+ ### Bug Fixes
9
+
10
+ - correct misleading action origin on paste event - rich text ([#1385](https://github.com/contentful/field-editors/issues/1385)) ([23e313f](https://github.com/contentful/field-editors/commit/23e313f4158de0205dfb5415f4334c5b906dc2c7))
11
+
12
+ ## [3.4.16](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.15...@contentful/field-editor-rich-text@3.4.16) (2023-03-31)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **rte:** pasting tables from ms word or google docs freezes the page ([#1384](https://github.com/contentful/field-editors/issues/1384)) ([b89cd18](https://github.com/contentful/field-editors/commit/b89cd181080706a8e93992843fe937bfe63d037f))
17
+
6
18
  ## [3.4.15](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.14...@contentful/field-editor-rich-text@3.4.15) (2023-03-20)
7
19
 
8
20
  ### Bug Fixes
@@ -6264,12 +6264,10 @@ var sanitizeHTML = function sanitizeHTML(html) {
6264
6264
 
6265
6265
  if (doc.querySelector('table')) {
6266
6266
  // remove div container from tables
6267
- // capture groups explained:
6268
- // 1. and 3. every content/linebreaks before and after the div container
6269
- // 2. the table inside the container, including content and linebreaks
6270
6267
  // The div container including attributes and possible linebreaks inside wil be removed
6271
6268
  replacers.unshift(function (innerHtml) {
6272
- return innerHtml.replace(/(.*\s)?<div.*>\s*(<table(?:.|\s)*<\/table>)\s*<\/div>(.*\s)?/g, '$1$2$3');
6269
+ var result = innerHtml.replace(/<div[^>]*>\s*(<table(?:.|\s)*<\/table>)\s*<\/div>/g, '$1');
6270
+ return result;
6273
6271
  });
6274
6272
  }
6275
6273
 
@@ -7183,6 +7181,7 @@ var actionOrigin = {
7183
7181
  TOOLBAR: 'toolbar-icon',
7184
7182
  SHORTCUT: 'shortcut',
7185
7183
  VIEWPORT: 'viewport-interaction',
7184
+ SHORTCUT_OR_VIEWPORT: 'shortcut-or-viewport',
7186
7185
  COMMAND_PALETTE: 'command-palette'
7187
7186
  };
7188
7187
  function getPastingSource(data) {
@@ -7240,6 +7239,15 @@ var createTrackingPlugin = function createTrackingPlugin(onAction) {
7240
7239
  origin: actionOrigin.SHORTCUT
7241
7240
  }, data));
7242
7241
  },
7242
+ onShortcutOrViewportAction: function onShortcutOrViewportAction(actionName, data) {
7243
+ if (data === void 0) {
7244
+ data = {};
7245
+ }
7246
+
7247
+ return onAction(actionName, _extends({
7248
+ origin: actionOrigin.SHORTCUT_OR_VIEWPORT
7249
+ }, data));
7250
+ },
7243
7251
  onToolbarAction: function onToolbarAction(actionName, data) {
7244
7252
  if (data === void 0) {
7245
7253
  data = {};
@@ -7275,7 +7283,7 @@ var createTrackingPlugin = function createTrackingPlugin(onAction) {
7275
7283
  var characterCountBefore = getCharacterCount(editor);
7276
7284
  setTimeout(function () {
7277
7285
  var characterCountAfter = getCharacterCount(editor);
7278
- trackingActions.onShortcutAction('paste', {
7286
+ trackingActions.onShortcutOrViewportAction('paste', {
7279
7287
  characterCountAfter: characterCountAfter,
7280
7288
  characterCountBefore: characterCountBefore,
7281
7289
  characterCountSelection: characterCountSelection,