@prosekit/core
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -168,3 +168,3 @@ import { AllSelection } from '@prosekit/pm/state'; | ||
*/ | ||
declare function createEditor<E extends Extension>({ extension, defaultDoc, defaultHTML, defaultSelection, }: EditorOptions<E>): Editor<E>; | ||
declare function createEditor<E extends Extension>(options: EditorOptions<E>): Editor<E>; | ||
export { createEditor } | ||
@@ -521,2 +521,3 @@ export { createEditor as createEditor_alias_1 } | ||
use(extension: Extension): VoidFunction; | ||
get state(): EditorState; | ||
get nodes(): Record<ExtractNodes<E>, NodeBuilder>; | ||
@@ -786,2 +787,11 @@ get marks(): Record<ExtractMarks<E>, MarkBuilder>; | ||
/** | ||
* Check if the selection is in a code block. | ||
* | ||
* @internal | ||
*/ | ||
declare function isInCodeBlock(selection: Selection_2): boolean | undefined; | ||
export { isInCodeBlock } | ||
export { isInCodeBlock as isInCodeBlock_alias_1 } | ||
export declare const isMac: boolean; | ||
@@ -1243,2 +1253,7 @@ | ||
/** | ||
* Merge multiple extensions into one. | ||
* | ||
* @public | ||
*/ | ||
declare function union<E extends Extension | Extension[]>(extension: E): SimplifyExtension<E>; | ||
@@ -1245,0 +1260,0 @@ export { union } |
@@ -73,2 +73,3 @@ export { addMark } from './_tsup-dts-rollup'; | ||
export { getNodeType } from './_tsup-dts-rollup'; | ||
export { isInCodeBlock } from './_tsup-dts-rollup'; | ||
export { jsonFromElement } from './_tsup-dts-rollup'; | ||
@@ -75,0 +76,0 @@ export { jsonFromHTML } from './_tsup-dts-rollup'; |
@@ -828,8 +828,5 @@ // src/commands/add-mark.ts | ||
// src/editor/editor.ts | ||
function createEditor({ | ||
extension, | ||
defaultDoc, | ||
defaultHTML, | ||
defaultSelection | ||
}) { | ||
function createEditor(options) { | ||
const { defaultDoc, defaultHTML, defaultSelection } = options; | ||
let extension = options.extension; | ||
if (defaultDoc || defaultHTML) { | ||
@@ -862,2 +859,3 @@ extension = union([ | ||
const state = EditorState2.create(stateConfig); | ||
this.cachedState = state; | ||
if (commandInput) { | ||
@@ -870,6 +868,3 @@ for (const [name, commandCreator] of Object.entries(commandInput)) { | ||
this.schema = this.directEditorProps.state.schema; | ||
const getState = () => { | ||
var _a; | ||
return (_a = this.view) == null ? void 0 : _a.state; | ||
}; | ||
const getState = () => this.getState(); | ||
this.nodeBuilders = Object.fromEntries( | ||
@@ -888,2 +883,8 @@ Object.values(this.schema.nodes).map((type) => [ | ||
} | ||
getState() { | ||
if (this.view) { | ||
this.cachedState = this.view.state; | ||
} | ||
return this.cachedState; | ||
} | ||
updateExtension(extension, mode) { | ||
@@ -1061,2 +1062,5 @@ var _a; | ||
} | ||
get state() { | ||
return this.instance.getState(); | ||
} | ||
get nodes() { | ||
@@ -1682,6 +1686,3 @@ return this.instance.nodeBuilders; | ||
// src/utils/unicode.ts | ||
var OBJECT_REPLACEMENT_CHARACTER = "\uFFFC"; | ||
// src/utils/with-skip-code-block.ts | ||
// src/utils/is-in-code-block.ts | ||
function isCodeBlockType(type) { | ||
@@ -1693,2 +1694,7 @@ return type.spec.code && type.isBlock; | ||
} | ||
// src/utils/unicode.ts | ||
var OBJECT_REPLACEMENT_CHARACTER = "\uFFFC"; | ||
// src/utils/with-skip-code-block.ts | ||
function withSkipCodeBlock(command) { | ||
@@ -1739,2 +1745,3 @@ return (state, dispatch, view) => { | ||
isAllSelection, | ||
isInCodeBlock, | ||
isMark, | ||
@@ -1741,0 +1748,0 @@ isNodeSelection, |
{ | ||
"name": "@prosekit/core", | ||
"type": "module", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"private": false, | ||
@@ -47,3 +47,3 @@ "author": { | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.1.3" | ||
"vitest": "^1.2.0" | ||
}, | ||
@@ -50,0 +50,0 @@ "scripts": { |
@@ -86,2 +86,3 @@ export { addMark } from './commands/add-mark' | ||
export { getNodeType } from './utils/get-node-type' | ||
export { isInCodeBlock } from './utils/is-in-code-block' | ||
export { | ||
@@ -88,0 +89,0 @@ jsonFromElement, |
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
94995
3054