@tiptap/core 2.11.2 → 2.11.3
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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/commands/focus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/commands/focus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAIxD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,KAAK,EAAE;YACL;;;;;;eAMG;YACH,KAAK,EAAE;YACL;;eAEG;YACH,QAAQ,CAAC,EAAE,aAAa;YAExB;;;eAGG;YACH,OAAO,CAAC,EAAE;gBACR,cAAc,CAAC,EAAE,OAAO,CAAC;aAC1B,KACE,UAAU,CAAC;SACjB,CAAA;KACF;CACF;AAED,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,OAAO,CA6DtC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/extensions/keymap.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAM3C,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/extensions/keymap.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAM3C,eAAO,MAAM,MAAM,qBAkJjB,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1856,13 +1856,34 @@ function resolveFocusPosition(doc, position = null) {
|
|
|
1856
1856
|
return state.TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
|
|
1857
1857
|
}
|
|
1858
1858
|
|
|
1859
|
+
function isAndroid() {
|
|
1860
|
+
return navigator.platform === 'Android' || /android/i.test(navigator.userAgent);
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
function isiOS() {
|
|
1864
|
+
return [
|
|
1865
|
+
'iPad Simulator',
|
|
1866
|
+
'iPhone Simulator',
|
|
1867
|
+
'iPod Simulator',
|
|
1868
|
+
'iPad',
|
|
1869
|
+
'iPhone',
|
|
1870
|
+
'iPod',
|
|
1871
|
+
].includes(navigator.platform)
|
|
1872
|
+
// iPad on iOS 13 detection
|
|
1873
|
+
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1859
1876
|
const focus = (position = null, options = {}) => ({ editor, view, tr, dispatch, }) => {
|
|
1860
1877
|
options = {
|
|
1861
1878
|
scrollIntoView: true,
|
|
1862
1879
|
...options,
|
|
1863
1880
|
};
|
|
1864
1881
|
const delayedFocus = () => {
|
|
1865
|
-
|
|
1882
|
+
// focus within `requestAnimationFrame` breaks focus on iOS and Android
|
|
1883
|
+
// so we have to call this
|
|
1884
|
+
if (isiOS() || isAndroid()) {
|
|
1885
|
+
view.dom.focus();
|
|
1886
|
+
}
|
|
1866
1887
|
// For React we have to focus asynchronously. Otherwise wild things happen.
|
|
1867
1888
|
// see: https://github.com/ueberdosis/tiptap/issues/1520
|
|
1868
1889
|
requestAnimationFrame(() => {
|
|
@@ -2193,19 +2214,6 @@ const joinTextblockForward = () => ({ state, dispatch }) => {
|
|
|
2193
2214
|
return commands$1.joinTextblockForward(state, dispatch);
|
|
2194
2215
|
};
|
|
2195
2216
|
|
|
2196
|
-
function isiOS() {
|
|
2197
|
-
return [
|
|
2198
|
-
'iPad Simulator',
|
|
2199
|
-
'iPhone Simulator',
|
|
2200
|
-
'iPod Simulator',
|
|
2201
|
-
'iPad',
|
|
2202
|
-
'iPhone',
|
|
2203
|
-
'iPod',
|
|
2204
|
-
].includes(navigator.platform)
|
|
2205
|
-
// iPad on iOS 13 detection
|
|
2206
|
-
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
2217
|
function isMacOS() {
|
|
2210
2218
|
return typeof navigator !== 'undefined'
|
|
2211
2219
|
? /Mac/.test(navigator.platform)
|
|
@@ -4005,6 +4013,9 @@ const Keymap = Extension.create({
|
|
|
4005
4013
|
new state.Plugin({
|
|
4006
4014
|
key: new state.PluginKey('clearDocument'),
|
|
4007
4015
|
appendTransaction: (transactions, oldState, newState) => {
|
|
4016
|
+
if (transactions.some(tr => tr.getMeta('composition'))) {
|
|
4017
|
+
return;
|
|
4018
|
+
}
|
|
4008
4019
|
const docChanges = transactions.some(transaction => transaction.docChanged)
|
|
4009
4020
|
&& !oldState.doc.eq(newState.doc);
|
|
4010
4021
|
const ignoreTr = transactions.some(transaction => transaction.getMeta('preventClearDocument'));
|
|
@@ -5074,10 +5085,6 @@ class Node {
|
|
|
5074
5085
|
}
|
|
5075
5086
|
}
|
|
5076
5087
|
|
|
5077
|
-
function isAndroid() {
|
|
5078
|
-
return navigator.platform === 'Android' || /android/i.test(navigator.userAgent);
|
|
5079
|
-
}
|
|
5080
|
-
|
|
5081
5088
|
/**
|
|
5082
5089
|
* Node views are used to customize the rendered DOM structure of a node.
|
|
5083
5090
|
* @see https://tiptap.dev/guide/node-views
|