@tiptap/core 2.11.2 → 2.11.4

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/dist/index.umd.js CHANGED
@@ -1852,13 +1852,34 @@
1852
1852
  return state.TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
1853
1853
  }
1854
1854
 
1855
+ function isAndroid() {
1856
+ return navigator.platform === 'Android' || /android/i.test(navigator.userAgent);
1857
+ }
1858
+
1859
+ function isiOS() {
1860
+ return [
1861
+ 'iPad Simulator',
1862
+ 'iPhone Simulator',
1863
+ 'iPod Simulator',
1864
+ 'iPad',
1865
+ 'iPhone',
1866
+ 'iPod',
1867
+ ].includes(navigator.platform)
1868
+ // iPad on iOS 13 detection
1869
+ || (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
1870
+ }
1871
+
1855
1872
  const focus = (position = null, options = {}) => ({ editor, view, tr, dispatch, }) => {
1856
1873
  options = {
1857
1874
  scrollIntoView: true,
1858
1875
  ...options,
1859
1876
  };
1860
1877
  const delayedFocus = () => {
1861
- view.dom.focus();
1878
+ // focus within `requestAnimationFrame` breaks focus on iOS and Android
1879
+ // so we have to call this
1880
+ if (isiOS() || isAndroid()) {
1881
+ view.dom.focus();
1882
+ }
1862
1883
  // For React we have to focus asynchronously. Otherwise wild things happen.
1863
1884
  // see: https://github.com/ueberdosis/tiptap/issues/1520
1864
1885
  requestAnimationFrame(() => {
@@ -2189,19 +2210,6 @@
2189
2210
  return commands$1.joinTextblockForward(state, dispatch);
2190
2211
  };
2191
2212
 
2192
- function isiOS() {
2193
- return [
2194
- 'iPad Simulator',
2195
- 'iPhone Simulator',
2196
- 'iPod Simulator',
2197
- 'iPad',
2198
- 'iPhone',
2199
- 'iPod',
2200
- ].includes(navigator.platform)
2201
- // iPad on iOS 13 detection
2202
- || (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
2203
- }
2204
-
2205
2213
  function isMacOS() {
2206
2214
  return typeof navigator !== 'undefined'
2207
2215
  ? /Mac/.test(navigator.platform)
@@ -4001,6 +4009,9 @@
4001
4009
  new state.Plugin({
4002
4010
  key: new state.PluginKey('clearDocument'),
4003
4011
  appendTransaction: (transactions, oldState, newState) => {
4012
+ if (transactions.some(tr => tr.getMeta('composition'))) {
4013
+ return;
4014
+ }
4004
4015
  const docChanges = transactions.some(transaction => transaction.docChanged)
4005
4016
  && !oldState.doc.eq(newState.doc);
4006
4017
  const ignoreTr = transactions.some(transaction => transaction.getMeta('preventClearDocument'));
@@ -5070,10 +5081,6 @@ img.ProseMirror-separator {
5070
5081
  }
5071
5082
  }
5072
5083
 
5073
- function isAndroid() {
5074
- return navigator.platform === 'Android' || /android/i.test(navigator.userAgent);
5075
- }
5076
-
5077
5084
  /**
5078
5085
  * Node views are used to customize the rendered DOM structure of a node.
5079
5086
  * @see https://tiptap.dev/guide/node-views