@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/commands/focus.d.ts.map +1 -1
- package/dist/extensions/keymap.d.ts.map +1 -1
- package/dist/index.cjs +25 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -18
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +25 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/focus.ts +7 -1
- package/src/extensions/keymap.ts +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/core",
|
|
3
3
|
"description": "headless rich text editor",
|
|
4
|
-
"version": "2.11.
|
|
4
|
+
"version": "2.11.4",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tiptap/pm": "^2.11.
|
|
35
|
+
"@tiptap/pm": "^2.11.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tiptap/pm": "^2.7.0"
|
package/src/commands/focus.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isTextSelection } from '../helpers/isTextSelection.js'
|
|
2
2
|
import { resolveFocusPosition } from '../helpers/resolveFocusPosition.js'
|
|
3
3
|
import { FocusPosition, RawCommands } from '../types.js'
|
|
4
|
+
import { isAndroid } from '../utilities/isAndroid.js'
|
|
5
|
+
import { isiOS } from '../utilities/isiOS.js'
|
|
4
6
|
|
|
5
7
|
declare module '@tiptap/core' {
|
|
6
8
|
interface Commands<ReturnType> {
|
|
@@ -42,7 +44,11 @@ export const focus: RawCommands['focus'] = (position = null, options = {}) => ({
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
const delayedFocus = () => {
|
|
45
|
-
|
|
47
|
+
// focus within `requestAnimationFrame` breaks focus on iOS and Android
|
|
48
|
+
// so we have to call this
|
|
49
|
+
if (isiOS() || isAndroid()) {
|
|
50
|
+
(view.dom as HTMLElement).focus()
|
|
51
|
+
}
|
|
46
52
|
|
|
47
53
|
// For React we have to focus asynchronously. Otherwise wild things happen.
|
|
48
54
|
// see: https://github.com/ueberdosis/tiptap/issues/1520
|
package/src/extensions/keymap.ts
CHANGED
|
@@ -104,6 +104,10 @@ export const Keymap = Extension.create({
|
|
|
104
104
|
new Plugin({
|
|
105
105
|
key: new PluginKey('clearDocument'),
|
|
106
106
|
appendTransaction: (transactions, oldState, newState) => {
|
|
107
|
+
if (transactions.some(tr => tr.getMeta('composition'))) {
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
107
111
|
const docChanges = transactions.some(transaction => transaction.docChanged)
|
|
108
112
|
&& !oldState.doc.eq(newState.doc)
|
|
109
113
|
|