slate-react 0.70.1 → 0.70.2-20211020183127

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
@@ -1,5 +1,11 @@
1
1
  # slate-react
2
2
 
3
+ ## 0.70.2-20211020183127
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4661](https://github.com/ianstormtaylor/slate/pull/4661) [`0f194a86`](https://github.com/ianstormtaylor/slate/commit/0f194a86a08d5de07e58e20fb95c9dc760e9d52d) Thanks [@leoc4e](https://github.com/leoc4e)! - use ownerDocument to create element
8
+
3
9
  ## 0.70.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.es.js CHANGED
@@ -3968,7 +3968,7 @@ var withReact = editor => {
3968
3968
  // node, wrap it in a `<span>` so we have something to set an attribute on.
3969
3969
 
3970
3970
  if (isDOMText(attach)) {
3971
- var span = document.createElement('span'); // COMPAT: In Chrome and Safari, if we don't add the `white-space` style
3971
+ var span = attach.ownerDocument.createElement('span'); // COMPAT: In Chrome and Safari, if we don't add the `white-space` style
3972
3972
  // then leading and trailing spaces will be ignored. (2017/09/21)
3973
3973
 
3974
3974
  span.style.whiteSpace = 'pre';
@@ -3983,13 +3983,13 @@ var withReact = editor => {
3983
3983
  attach.setAttribute('data-slate-fragment', encoded);
3984
3984
  data.setData('application/x-slate-fragment', encoded); // Add the content to a <div> so that we can get its inner HTML.
3985
3985
 
3986
- var div = document.createElement('div');
3986
+ var div = contents.ownerDocument.createElement('div');
3987
3987
  div.appendChild(contents);
3988
3988
  div.setAttribute('hidden', 'true');
3989
- document.body.appendChild(div);
3989
+ contents.ownerDocument.body.appendChild(div);
3990
3990
  data.setData('text/html', div.innerHTML);
3991
3991
  data.setData('text/plain', getPlainText(div));
3992
- document.body.removeChild(div);
3992
+ contents.ownerDocument.body.removeChild(div);
3993
3993
  return data;
3994
3994
  };
3995
3995