@prosekit/core 0.7.10 → 0.7.11
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/_tsup-dts-rollup.d.ts +26 -0
- package/dist/prosekit-core.d.ts +2 -0
- package/dist/prosekit-core.js +16 -0
- package/package.json +2 -2
@@ -165,6 +165,7 @@ declare type BaseCommandsExtension = Extension<{
|
|
165
165
|
insertNode: [options: InsertNodeOptions];
|
166
166
|
removeNode: [options: RemoveNodeOptions];
|
167
167
|
wrap: [options: WrapOptions];
|
168
|
+
toggleWrap: [options: ToggleWrapOptions];
|
168
169
|
setBlockType: [options: SetBlockTypeOptions];
|
169
170
|
setNodeAttrs: [options: SetNodeAttrsOptions];
|
170
171
|
insertDefaultBlock: [options?: InsertDefaultBlockOptions];
|
@@ -2628,6 +2629,31 @@ declare interface ToggleNodeOptions {
|
|
2628
2629
|
export { ToggleNodeOptions }
|
2629
2630
|
export { ToggleNodeOptions as ToggleNodeOptions_alias_1 }
|
2630
2631
|
|
2632
|
+
/**
|
2633
|
+
* Toggle between wrapping an inactive node with the provided node type, and
|
2634
|
+
* lifting it up into it's parent.
|
2635
|
+
*
|
2636
|
+
* @param options
|
2637
|
+
*
|
2638
|
+
* @public
|
2639
|
+
*/
|
2640
|
+
declare function toggleWrap(options: ToggleWrapOptions): Command;
|
2641
|
+
export { toggleWrap }
|
2642
|
+
export { toggleWrap as toggleWrap_alias_1 }
|
2643
|
+
|
2644
|
+
declare interface ToggleWrapOptions {
|
2645
|
+
/**
|
2646
|
+
* The type of the node to toggle.
|
2647
|
+
*/
|
2648
|
+
type: string | NodeType;
|
2649
|
+
/**
|
2650
|
+
* The attributes of the node to toggle.
|
2651
|
+
*/
|
2652
|
+
attrs?: Attrs | null;
|
2653
|
+
}
|
2654
|
+
export { ToggleWrapOptions }
|
2655
|
+
export { ToggleWrapOptions as ToggleWrapOptions_alias_1 }
|
2656
|
+
|
2631
2657
|
/**
|
2632
2658
|
* @internal
|
2633
2659
|
*/
|
package/dist/prosekit-core.d.ts
CHANGED
@@ -22,6 +22,8 @@ export { unsetBlockType } from './_tsup-dts-rollup';
|
|
22
22
|
export { UnsetBlockTypeOptions } from './_tsup-dts-rollup';
|
23
23
|
export { unsetMark } from './_tsup-dts-rollup';
|
24
24
|
export { UnsetMarkOptions } from './_tsup-dts-rollup';
|
25
|
+
export { toggleWrap } from './_tsup-dts-rollup';
|
26
|
+
export { ToggleWrapOptions } from './_tsup-dts-rollup';
|
25
27
|
export { wrap } from './_tsup-dts-rollup';
|
26
28
|
export { WrapOptions } from './_tsup-dts-rollup';
|
27
29
|
export { MarkAction } from './_tsup-dts-rollup';
|
package/dist/prosekit-core.js
CHANGED
@@ -401,6 +401,9 @@ function unsetMark(options) {
|
|
401
401
|
};
|
402
402
|
}
|
403
403
|
|
404
|
+
// src/commands/toggle-wrap.ts
|
405
|
+
import { lift } from "@prosekit/pm/commands";
|
406
|
+
|
404
407
|
// src/commands/wrap.ts
|
405
408
|
import { findWrapping } from "@prosekit/pm/transform";
|
406
409
|
function wrap(options) {
|
@@ -416,6 +419,17 @@ function wrap(options) {
|
|
416
419
|
};
|
417
420
|
}
|
418
421
|
|
422
|
+
// src/commands/toggle-wrap.ts
|
423
|
+
function toggleWrap(options) {
|
424
|
+
const { type, attrs } = options;
|
425
|
+
return (state, dispatch) => {
|
426
|
+
if (isNodeActive(state, type, attrs)) {
|
427
|
+
return lift(state, dispatch);
|
428
|
+
}
|
429
|
+
return wrap({ type, attrs })(state, dispatch);
|
430
|
+
};
|
431
|
+
}
|
432
|
+
|
419
433
|
// src/editor/with-priority.ts
|
420
434
|
function withPriority(extension, priority) {
|
421
435
|
const result = union(extension);
|
@@ -462,6 +476,7 @@ function defineBaseCommands() {
|
|
462
476
|
insertNode,
|
463
477
|
removeNode,
|
464
478
|
wrap,
|
479
|
+
toggleWrap,
|
465
480
|
setBlockType,
|
466
481
|
setNodeAttrs,
|
467
482
|
insertDefaultBlock,
|
@@ -1429,6 +1444,7 @@ export {
|
|
1429
1444
|
stateFromJSON,
|
1430
1445
|
toggleMark,
|
1431
1446
|
toggleNode,
|
1447
|
+
toggleWrap,
|
1432
1448
|
union,
|
1433
1449
|
unsetBlockType,
|
1434
1450
|
unsetMark,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/core",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.7.
|
4
|
+
"version": "0.7.11",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"just-map-values": "^3.2.0",
|
46
46
|
"orderedmap": "^2.1.1",
|
47
47
|
"prosemirror-splittable": "^0.1.1",
|
48
|
-
"type-fest": "^4.
|
48
|
+
"type-fest": "^4.26.0",
|
49
49
|
"@prosekit/pm": "^0.1.8"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|