@prosekit/extensions 0.2.2 → 0.2.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.
@@ -224,6 +224,15 @@ export declare function defineCodeSpec(): Extension< {
224
224
  MARKS: "code";
225
225
  }>;
226
226
 
227
+ /**
228
+ * Show up a decoration at the drop position when something is dragged over the editor.
229
+ *
230
+ * See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
231
+ *
232
+ * @public
233
+ */
234
+ export declare function defineDropCursor(options?: DropCursorOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
235
+
227
236
  /**
228
237
  * Defines an enter rule. An enter rule applies when the text directly in front of
229
238
  * the cursor matches `regex` and user presses Enter. The `regex` should end
@@ -453,6 +462,8 @@ export declare function defineTextBlockEnterRule({ regex, type, attrs, }: TextBl
453
462
  * text is typed into it.
454
463
  *
455
464
  * See also [textblockTypeInputRule](https://prosemirror.net/docs/ref/#inputrules.textblockTypeInputRule)
465
+ *
466
+ * @public
456
467
  */
457
468
  export declare function defineTextBlockInputRule({ regex, type, attrs, }: {
458
469
  /**
@@ -497,6 +508,8 @@ MARKS: "underline";
497
508
  * string is typed.
498
509
  *
499
510
  * See also [wrappingInputRule](https://prosemirror.net/docs/ref/#inputrules.wrappingInputRule)
511
+ *
512
+ * @public
500
513
  */
501
514
  export declare function defineWrappingInputRule({ regex, type, attrs, join, }: {
502
515
  /**
@@ -523,6 +536,25 @@ export declare function defineWrappingInputRule({ regex, type, attrs, join, }: {
523
536
  join?: (match: RegExpMatchArray, node: ProseMirrorNode) => boolean;
524
537
  }): Extension;
525
538
 
539
+ export declare interface DropCursorOptions {
540
+ /**
541
+ * The color of the cursor. Use `false` to apply no color and rely only on class.
542
+ *
543
+ * @default 'black'
544
+ */
545
+ color?: string | false;
546
+ /**
547
+ * The precise width of the cursor in pixels.
548
+ *
549
+ * @default 1
550
+ */
551
+ width?: number;
552
+ /**
553
+ * A CSS class name to add to the cursor element.
554
+ */
555
+ class?: string;
556
+ }
557
+
526
558
  /**
527
559
  * @public
528
560
  */
@@ -570,6 +602,9 @@ export declare interface ImageAttrs {
570
602
  src?: string | null;
571
603
  }
572
604
 
605
+ /**
606
+ * @internal
607
+ */
573
608
  export declare function isInCodeBlock(selection: Selection_2): boolean | undefined;
574
609
 
575
610
  /**
@@ -650,6 +685,9 @@ export declare type TextBlockEnterRuleOptions = {
650
685
  attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
651
686
  };
652
687
 
688
+ /**
689
+ * @internal
690
+ */
653
691
  export declare function withSkipCodeBlock(command: Command): Command;
654
692
 
655
693
  export { }
@@ -0,0 +1,2 @@
1
+ export { defineDropCursor } from './_tsup-dts-rollup';
2
+ export { DropCursorOptions } from './_tsup-dts-rollup';
@@ -0,0 +1,9 @@
1
+ // src/drop-cursor/index.ts
2
+ import { definePlugin } from "@prosekit/core";
3
+ import { dropCursor } from "prosemirror-dropcursor";
4
+ function defineDropCursor(options) {
5
+ return definePlugin(() => dropCursor(options));
6
+ }
7
+ export {
8
+ defineDropCursor
9
+ };
@@ -13,6 +13,7 @@ function defineImageSpec() {
13
13
  },
14
14
  group: "block",
15
15
  defining: true,
16
+ draggable: true,
16
17
  parseDOM: [
17
18
  {
18
19
  tag: "img[src]",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/extensions",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -55,6 +55,11 @@
55
55
  "import": "./dist/prosekit-extensions-code-block.js",
56
56
  "default": "./dist/prosekit-extensions-code-block.js"
57
57
  },
58
+ "./drop-cursor": {
59
+ "types": "./dist/prosekit-extensions-drop-cursor.d.ts",
60
+ "import": "./dist/prosekit-extensions-drop-cursor.js",
61
+ "default": "./dist/prosekit-extensions-drop-cursor.js"
62
+ },
58
63
  "./heading": {
59
64
  "types": "./dist/prosekit-extensions-heading.d.ts",
60
65
  "import": "./dist/prosekit-extensions-heading.js",
@@ -121,8 +126,9 @@
121
126
  "dist"
122
127
  ],
123
128
  "dependencies": {
124
- "@prosekit/core": "^0.2.2",
129
+ "@prosekit/core": "^0.2.3",
125
130
  "@prosekit/pm": "^0.1.1",
131
+ "prosemirror-dropcursor": "^1.8.1",
126
132
  "prosemirror-flat-list": "^0.4.5",
127
133
  "prosemirror-highlight": "^0.4.0"
128
134
  },
@@ -136,10 +142,10 @@
136
142
  },
137
143
  "devDependencies": {
138
144
  "@prosekit/dev": "*",
139
- "shikiji": "^0.9.16",
145
+ "shikiji": "^0.9.17",
140
146
  "tsup": "^8.0.1",
141
147
  "typescript": "^5.3.3",
142
- "vitest": "^1.1.1"
148
+ "vitest": "^1.1.3"
143
149
  },
144
150
  "scripts": {
145
151
  "build:tsup": "tsup",
@@ -166,6 +172,9 @@
166
172
  "code-block": [
167
173
  "./dist/prosekit-extensions-code-block.d.ts"
168
174
  ],
175
+ "drop-cursor": [
176
+ "./dist/prosekit-extensions-drop-cursor.d.ts"
177
+ ],
169
178
  "heading": [
170
179
  "./dist/prosekit-extensions-heading.d.ts"
171
180
  ],