@prosekit/extensions 0.4.6 → 0.4.7

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.
@@ -531,6 +531,14 @@ export declare function defineMentionSpec(): Extension< {
531
531
  NODES: "mention";
532
532
  }>;
533
533
 
534
+ /**
535
+ * By default, clicking a node while holding the mod key will select the node. This
536
+ * extension disables that behavior.
537
+ *
538
+ * @public
539
+ */
540
+ export declare function defineModClickPrevention(): Extension;
541
+
534
542
  /**
535
543
  * Add a placeholder text to the editor when the current block or document is
536
544
  * empty.
@@ -846,6 +854,11 @@ export declare function insertTable({ row, col, header, }: {
846
854
  header: boolean;
847
855
  }): Command;
848
856
 
857
+ /**
858
+ * @deprecated Use `isApple` from `@prosekit/core`
859
+ */
860
+ export declare const isApple: boolean;
861
+
849
862
  export declare const LINK_ENTER_RE: RegExp;
850
863
 
851
864
  export declare const LINK_INPUT_RE: RegExp;
@@ -1,9 +1,9 @@
1
- import {
2
- defineTextBlockEnterRule
3
- } from "./chunk-HLBUHIMJ.js";
4
1
  import {
5
2
  defineTextBlockInputRule
6
3
  } from "./chunk-CJ3SOSL6.js";
4
+ import {
5
+ defineTextBlockEnterRule
6
+ } from "./chunk-HLBUHIMJ.js";
7
7
 
8
8
  // src/code-block/code-block.ts
9
9
  import { union } from "@prosekit/core";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  defineMarkRule
3
3
  } from "./chunk-7G7COECS.js";
4
- import {
5
- defineEnterRule
6
- } from "./chunk-HLBUHIMJ.js";
7
4
  import {
8
5
  defineInputRule
9
6
  } from "./chunk-CJ3SOSL6.js";
7
+ import {
8
+ defineEnterRule
9
+ } from "./chunk-HLBUHIMJ.js";
10
10
 
11
11
  // src/link/index.ts
12
12
  import {
@@ -0,0 +1 @@
1
+ export { defineModClickPrevention } from './_tsup-dts-rollup';
@@ -0,0 +1,19 @@
1
+ // src/mod-click-prevention/index.ts
2
+ import { definePlugin } from "@prosekit/core";
3
+ import { Plugin, PluginKey } from "@prosekit/pm/state";
4
+
5
+ // src/mod-click-prevention/env.ts
6
+ var isApple = typeof navigator !== "undefined" ? /Mac|iP(hone|[ao]d)/.test(navigator.platform) : false;
7
+
8
+ // src/mod-click-prevention/index.ts
9
+ function defineModClickPrevention() {
10
+ return definePlugin(new Plugin({ key, props: { handleClick } }));
11
+ }
12
+ var key = new PluginKey("prosekit-mod-click-prevention");
13
+ function handleClick(_view, _pos, event) {
14
+ return !!event[selectNodeModifier];
15
+ }
16
+ var selectNodeModifier = isApple ? "metaKey" : "ctrlKey";
17
+ export {
18
+ defineModClickPrevention
19
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.4.6",
4
+ "version": "0.4.7",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,11 +30,6 @@
30
30
  "import": "./dist/prosekit-extensions.js",
31
31
  "default": "./dist/prosekit-extensions.js"
32
32
  },
33
- "./mark-rule": {
34
- "types": "./dist/prosekit-extensions-mark-rule.d.ts",
35
- "import": "./dist/prosekit-extensions-mark-rule.js",
36
- "default": "./dist/prosekit-extensions-mark-rule.js"
37
- },
38
33
  "./autocomplete": {
39
34
  "types": "./dist/prosekit-extensions-autocomplete.d.ts",
40
35
  "import": "./dist/prosekit-extensions-autocomplete.js",
@@ -103,11 +98,21 @@
103
98
  "./list/style.css": {
104
99
  "default": "./dist/list/style.css"
105
100
  },
101
+ "./mark-rule": {
102
+ "types": "./dist/prosekit-extensions-mark-rule.d.ts",
103
+ "import": "./dist/prosekit-extensions-mark-rule.js",
104
+ "default": "./dist/prosekit-extensions-mark-rule.js"
105
+ },
106
106
  "./mention": {
107
107
  "types": "./dist/prosekit-extensions-mention.d.ts",
108
108
  "import": "./dist/prosekit-extensions-mention.js",
109
109
  "default": "./dist/prosekit-extensions-mention.js"
110
110
  },
111
+ "./mod-click-prevention": {
112
+ "types": "./dist/prosekit-extensions-mod-click-prevention.d.ts",
113
+ "import": "./dist/prosekit-extensions-mod-click-prevention.js",
114
+ "default": "./dist/prosekit-extensions-mod-click-prevention.js"
115
+ },
111
116
  "./placeholder": {
112
117
  "types": "./dist/prosekit-extensions-placeholder.d.ts",
113
118
  "import": "./dist/prosekit-extensions-placeholder.js",
@@ -153,18 +158,18 @@
153
158
  ],
154
159
  "dependencies": {
155
160
  "@prosekit/core": "^0.4.2",
156
- "@prosekit/pm": "^0.1.2",
161
+ "@prosekit/pm": "^0.1.3",
157
162
  "prosemirror-dropcursor": "^1.8.1",
158
163
  "prosemirror-flat-list": "^0.5.0",
159
164
  "prosemirror-highlight": "^0.5.0",
160
165
  "prosemirror-tables": "^1.3.7",
161
- "shiki": "^1.3.0"
166
+ "shiki": "^1.4.0"
162
167
  },
163
168
  "devDependencies": {
164
169
  "@prosekit/dev": "*",
165
170
  "tsup": "^8.0.2",
166
171
  "typescript": "^5.4.5",
167
- "vitest": "^1.5.2"
172
+ "vitest": "^1.6.0"
168
173
  },
169
174
  "scripts": {
170
175
  "build:tsup": "tsup",
@@ -176,9 +181,6 @@
176
181
  ".": [
177
182
  "./dist/prosekit-extensions.d.ts"
178
183
  ],
179
- "mark-rule": [
180
- "./dist/prosekit-extensions-mark-rule.d.ts"
181
- ],
182
184
  "autocomplete": [
183
185
  "./dist/prosekit-extensions-autocomplete.d.ts"
184
186
  ],
@@ -218,9 +220,15 @@
218
220
  "list": [
219
221
  "./dist/prosekit-extensions-list.d.ts"
220
222
  ],
223
+ "mark-rule": [
224
+ "./dist/prosekit-extensions-mark-rule.d.ts"
225
+ ],
221
226
  "mention": [
222
227
  "./dist/prosekit-extensions-mention.d.ts"
223
228
  ],
229
+ "mod-click-prevention": [
230
+ "./dist/prosekit-extensions-mod-click-prevention.d.ts"
231
+ ],
224
232
  "placeholder": [
225
233
  "./dist/prosekit-extensions-placeholder.d.ts"
226
234
  ],