@tiptap/core 2.0.0-beta.166 → 2.0.0-beta.167
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/packages/core/src/commands/selectTextblockEnd.d.ts +12 -0
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +12 -0
- package/dist/packages/core/src/extensions/commands.d.ts +4 -0
- package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
- package/dist/tiptap-core.cjs.js +57 -9
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +58 -10
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +57 -9
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/commands/keyboardShortcut.ts +3 -3
- package/src/commands/selectTextblockEnd.ts +19 -0
- package/src/commands/selectTextblockStart.ts +19 -0
- package/src/extensions/commands.ts +6 -0
- package/src/extensions/keymap.ts +35 -7
- package/src/utilities/isMacOS.ts +5 -0
package/dist/tiptap-core.umd.js
CHANGED
|
@@ -737,7 +737,12 @@
|
|
|
737
737
|
joinForward: joinForward
|
|
738
738
|
});
|
|
739
739
|
|
|
740
|
-
|
|
740
|
+
function isMacOS() {
|
|
741
|
+
return typeof navigator !== 'undefined'
|
|
742
|
+
? /Mac/.test(navigator.platform)
|
|
743
|
+
: false;
|
|
744
|
+
}
|
|
745
|
+
|
|
741
746
|
function normalizeKeyName(name) {
|
|
742
747
|
const parts = name.split(/-(?!$)/);
|
|
743
748
|
let result = parts[parts.length - 1];
|
|
@@ -763,7 +768,7 @@
|
|
|
763
768
|
shift = true;
|
|
764
769
|
}
|
|
765
770
|
else if (/^mod$/i.test(mod)) {
|
|
766
|
-
if (
|
|
771
|
+
if (isiOS() || isMacOS()) {
|
|
767
772
|
meta = true;
|
|
768
773
|
}
|
|
769
774
|
else {
|
|
@@ -1015,6 +1020,26 @@
|
|
|
1015
1020
|
selectParentNode: selectParentNode
|
|
1016
1021
|
});
|
|
1017
1022
|
|
|
1023
|
+
// @ts-ignore
|
|
1024
|
+
const selectTextblockEnd = () => ({ state, dispatch }) => {
|
|
1025
|
+
return prosemirrorCommands.selectTextblockEnd(state, dispatch);
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
var selectTextblockEnd$1 = /*#__PURE__*/Object.freeze({
|
|
1029
|
+
__proto__: null,
|
|
1030
|
+
selectTextblockEnd: selectTextblockEnd
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
// @ts-ignore
|
|
1034
|
+
const selectTextblockStart = () => ({ state, dispatch }) => {
|
|
1035
|
+
return prosemirrorCommands.selectTextblockStart(state, dispatch);
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
var selectTextblockStart$1 = /*#__PURE__*/Object.freeze({
|
|
1039
|
+
__proto__: null,
|
|
1040
|
+
selectTextblockStart: selectTextblockStart
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1018
1043
|
function createDocument(content, schema, parseOptions = {}) {
|
|
1019
1044
|
return createNodeFromContent(content, schema, { slice: false, parseOptions });
|
|
1020
1045
|
}
|
|
@@ -1813,6 +1838,8 @@
|
|
|
1813
1838
|
...selectNodeBackward$1,
|
|
1814
1839
|
...selectNodeForward$1,
|
|
1815
1840
|
...selectParentNode$1,
|
|
1841
|
+
...selectTextblockEnd$1,
|
|
1842
|
+
...selectTextblockStart$1,
|
|
1816
1843
|
...setContent$1,
|
|
1817
1844
|
...setMark$1,
|
|
1818
1845
|
...setMeta$1,
|
|
@@ -2052,13 +2079,14 @@
|
|
|
2052
2079
|
() => commands.joinForward(),
|
|
2053
2080
|
() => commands.selectNodeForward(),
|
|
2054
2081
|
]);
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2082
|
+
const handleEnter = () => this.editor.commands.first(({ commands }) => [
|
|
2083
|
+
() => commands.newlineInCode(),
|
|
2084
|
+
() => commands.createParagraphNear(),
|
|
2085
|
+
() => commands.liftEmptyBlock(),
|
|
2086
|
+
() => commands.splitBlock(),
|
|
2087
|
+
]);
|
|
2088
|
+
const baseKeymap = {
|
|
2089
|
+
Enter: handleEnter,
|
|
2062
2090
|
'Mod-Enter': () => this.editor.commands.exitCode(),
|
|
2063
2091
|
Backspace: handleBackspace,
|
|
2064
2092
|
'Mod-Backspace': handleBackspace,
|
|
@@ -2067,6 +2095,26 @@
|
|
|
2067
2095
|
'Mod-Delete': handleDelete,
|
|
2068
2096
|
'Mod-a': () => this.editor.commands.selectAll(),
|
|
2069
2097
|
};
|
|
2098
|
+
const pcKeymap = {
|
|
2099
|
+
...baseKeymap,
|
|
2100
|
+
Home: () => this.editor.commands.selectTextblockStart(),
|
|
2101
|
+
End: () => this.editor.commands.selectTextblockStart(),
|
|
2102
|
+
};
|
|
2103
|
+
const macKeymap = {
|
|
2104
|
+
...baseKeymap,
|
|
2105
|
+
'Ctrl-h': handleBackspace,
|
|
2106
|
+
'Alt-Backspace': handleBackspace,
|
|
2107
|
+
'Ctrl-d': handleDelete,
|
|
2108
|
+
'Ctrl-Alt-Backspace': handleDelete,
|
|
2109
|
+
'Alt-Delete': handleDelete,
|
|
2110
|
+
'Alt-d': handleDelete,
|
|
2111
|
+
'Ctrl-a': () => this.editor.commands.selectTextblockStart(),
|
|
2112
|
+
'Ctrl-e': () => this.editor.commands.selectTextblockEnd(),
|
|
2113
|
+
};
|
|
2114
|
+
if (isiOS() || isMacOS()) {
|
|
2115
|
+
return macKeymap;
|
|
2116
|
+
}
|
|
2117
|
+
return pcKeymap;
|
|
2070
2118
|
},
|
|
2071
2119
|
addProseMirrorPlugins() {
|
|
2072
2120
|
return [
|