@prosekit/core
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -465,6 +465,7 @@ import { AllSelection } from '@prosekit/pm/state'; | ||
declare function defineHistory(): Extension< { | ||
Nodes: any; | ||
Marks: any; | ||
Nodes: never; | ||
Marks: never; | ||
Commands: { | ||
[x: string]: any; | ||
undo: []; | ||
redo: []; | ||
}; | ||
@@ -940,3 +941,3 @@ }>; | ||
*/ | ||
export declare type ExtractTyping<E extends Extension> = E extends Extension<infer T> ? T : never; | ||
export declare type ExtractTyping<E extends Extension> = E extends Extension<ExtensionTyping<infer N, infer M, infer C>> ? ExtensionTyping<PickStringLiteral<N>, PickStringLiteral<M>, PickKnownCommandTyping<C>> : never; | ||
@@ -1509,2 +1510,14 @@ /** | ||
*/ | ||
export declare type PickKnownCommandTyping<T extends CommandTyping> = [ | ||
CommandTyping | ||
] extends [T] ? never : T; | ||
/** | ||
* @internal | ||
*/ | ||
export declare type PickStringLiteral<T extends string> = [string] extends [T] ? never : T; | ||
/** | ||
* @internal | ||
*/ | ||
declare const pluginFacet: Facet<PluginPayload, StatePayload>; | ||
@@ -1794,3 +1807,3 @@ export { pluginFacet } | ||
*/ | ||
declare function union<E extends Extension | Extension[]>(extension: E): UnionExtension<E>; | ||
declare function union<const E extends Extension | readonly Extension[]>(extension: E): UnionExtension<E>; | ||
export { union } | ||
@@ -1802,3 +1815,3 @@ export { union as union_alias_1 } | ||
*/ | ||
declare type UnionExtension<E extends Extension | Extension[]> = E extends Extension[] ? Extension<{ | ||
declare type UnionExtension<E extends Extension | readonly Extension[]> = E extends readonly Extension[] ? Extension<{ | ||
Nodes: ExtractNodes<E[number]>; | ||
@@ -1805,0 +1818,0 @@ Marks: ExtractMarks<E[number]>; |
export { addMark } from './_tsup-dts-rollup'; | ||
export { expandMark } from './_tsup-dts-rollup'; | ||
export { insertNode } from './_tsup-dts-rollup'; | ||
export { removeMark } from './_tsup-dts-rollup'; | ||
export { removeNode } from './_tsup-dts-rollup'; | ||
export { removeMark } from './_tsup-dts-rollup'; | ||
export { setBlockType } from './_tsup-dts-rollup'; | ||
@@ -7,0 +7,0 @@ export { setNodeAttrs } from './_tsup-dts-rollup'; |
@@ -120,2 +120,13 @@ // src/commands/add-mark.ts | ||
// src/commands/remove-mark.ts | ||
import "@prosekit/pm/model"; | ||
import "@prosekit/pm/state"; | ||
function removeMark(options) { | ||
return (state, dispatch) => { | ||
var _a, _b; | ||
let markType = getMarkType(state.schema, options.type), mark = options.attrs ? markType.create(options.attrs) : markType, from = (_a = options.from) != null ? _a : state.selection.from, to = (_b = options.to) != null ? _b : state.selection.to; | ||
return from > to ? !1 : (dispatch == null || dispatch(state.tr.removeMark(from, to, mark)), !0); | ||
}; | ||
} | ||
// src/utils/find-parent-node.ts | ||
@@ -145,13 +156,2 @@ function findParentNode(nodeType, $pos) { | ||
// src/commands/remove-mark.ts | ||
import "@prosekit/pm/model"; | ||
import "@prosekit/pm/state"; | ||
function removeMark(options) { | ||
return (state, dispatch) => { | ||
var _a, _b; | ||
let markType = getMarkType(state.schema, options.type), mark = options.attrs ? markType.create(options.attrs) : markType, from = (_a = options.from) != null ? _a : state.selection.from, to = (_b = options.to) != null ? _b : state.selection.to; | ||
return from > to ? !1 : (dispatch == null || dispatch(state.tr.removeMark(from, to, mark)), !0); | ||
}; | ||
} | ||
// src/commands/set-block-type.ts | ||
@@ -956,3 +956,3 @@ import "@prosekit/pm/state"; | ||
let view = this.view; | ||
return view ? commandCreator(...args)(view.state, view.dispatch.bind(view), view) : !1; | ||
return assert(view, `Cannot call command "${name}" before the editor is mounted`), commandCreator(...args)(view.state, view.dispatch.bind(view), view); | ||
}; | ||
@@ -959,0 +959,0 @@ applier.canApply = (...args) => { |
{ | ||
"name": "@prosekit/core", | ||
"type": "module", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122741
3545