Skip to content

Commit

Permalink
[RNMobile] Fixes a crash on pasting MS Word list markup (#56653)
Browse files Browse the repository at this point in the history
* Add polyfill for Element.prototype.remove

* Enable unit tests of `raw-handling` API filter `ms-list-converter`

* Update `react-native-editor` changelog
  • Loading branch information
fluiddot committed Dec 5, 2023
1 parent 67f099e commit 3d42ef9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For each user feature we should also add a importance categorization label to i

## 1.109.1
- [***] Fix issue when backspacing in an empty Paragraph block [#56496]
- [**] Fixes a crash on pasting MS Word list markup [#56653]

## 1.109.0
- [*] Audio block: Improve legibility of audio file details on various background colors [#55627]
Expand Down
12 changes: 12 additions & 0 deletions packages/react-native-editor/src/jsdom-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ Element.prototype.closest = function ( selector ) {
return null;
};

/**
* Implementation of Element.prototype.remove based on polyfills:
* - https://github.com/chenzhenxi/element-remove/blob/master/index.js
* (referenced in https://developer.mozilla.org/en-US/docs/Web/API/Element/remove#see_also)
* - https://github.com/JakeChampion/polyfill-library/blob/master/polyfills/Element/prototype/remove/polyfill.js
*/
Element.prototype.remove = function () {
if ( this.parentNode ) {
this.parentNode.removeChild( this );
}
};

/**
* Helper function to check if a node implements the NonDocumentTypeChildNode
* interface
Expand Down
1 change: 0 additions & 1 deletion test/native/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const transpiledPackageNames = glob( 'packages/*/src/index.{js,ts}' ).map(
const RAW_HANDLING_UNSUPPORTED_UNIT_TESTS = [
'html-formatting-remover',
'phrasing-content-reducer',
'ms-list-converter',
'figure-content-reducer',
'special-comment-converter',
'normalise-blocks',
Expand Down

0 comments on commit 3d42ef9

Please sign in to comment.