@prosekit/extensions
Advanced tools
Comparing version 0.2.5 to 0.3.0
@@ -18,3 +18,2 @@ import { Attrs } from '@prosekit/pm/model'; | ||
import { ProseMirrorNode } from '@prosekit/pm/model'; | ||
import type { Selection as Selection_2 } from '@prosekit/pm/state'; | ||
import { ToggleCollapsedOptions } from 'prosemirror-flat-list'; | ||
@@ -79,2 +78,8 @@ import { Transaction } from '@prosekit/pm/state'; | ||
/** | ||
* Wraps the text block in a blockquote when `>` is typed at the start of a new | ||
* line followed by a space. | ||
*/ | ||
export declare function defineBlockquoteInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
export declare function defineBlockquoteSpec(): Extension< { | ||
@@ -134,3 +139,2 @@ NODES: "blockquote"; | ||
setCodeBlockAttrs: [attrs: CodeBlockAttrs]; | ||
setCodeBlockLanguage: [language: string]; | ||
}; | ||
@@ -150,3 +154,2 @@ }>; | ||
setCodeBlockAttrs: [attrs: CodeBlockAttrs]; | ||
setCodeBlockLanguage: [language: string]; | ||
}; | ||
@@ -272,2 +275,6 @@ }>; | ||
/** | ||
* Converts the text block to a heading when `#` is typed at the start of a new | ||
* line followed by a space. | ||
*/ | ||
export declare function defineHeadingInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>; | ||
@@ -343,2 +350,3 @@ | ||
toggleLink: [attrs: LinkAttrs]; | ||
expandLink: []; | ||
}; | ||
@@ -352,2 +360,3 @@ }>; | ||
toggleLink: [attrs: LinkAttrs]; | ||
expandLink: []; | ||
}; | ||
@@ -519,2 +528,14 @@ }>; | ||
/** | ||
* Shows a virtual selection when the editor is not focused. When the editor is | ||
* not focused, the selected inline content will be wrapped in a `<span>` | ||
* element with the class `prosekit-virtual-selection`. | ||
* | ||
* This is useful when you want to move the focus to an element outside the | ||
* editor, but still want to show the selection. | ||
* | ||
* @public | ||
*/ | ||
export declare function defineVirtualSelection(): Extension; | ||
/** | ||
* Defines an input rule for automatically wrapping a textblock when a given | ||
@@ -619,9 +640,2 @@ * string is typed. | ||
/** | ||
* @internal | ||
* | ||
* @deprecated Use the one from `@prosekit/core` instead. | ||
*/ | ||
export declare function isInCodeBlock(selection: Selection_2): boolean | undefined; | ||
/** | ||
* @public | ||
@@ -628,0 +642,0 @@ */ |
export { defineBlockquoteSpec } from './_tsup-dts-rollup'; | ||
export { defineBlockquoteInputRule } from './_tsup-dts-rollup'; | ||
export { defineBlockquote } from './_tsup-dts-rollup'; |
@@ -0,1 +1,5 @@ | ||
import { | ||
defineWrappingInputRule | ||
} from "./chunk-DYFRBXUX.js"; | ||
// src/blockquote/index.ts | ||
@@ -15,8 +19,15 @@ import { defineNodeSpec, union } from "@prosekit/core"; | ||
} | ||
function defineBlockquoteInputRule() { | ||
return defineWrappingInputRule({ | ||
regex: /^>\s/, | ||
type: "blockquote" | ||
}); | ||
} | ||
function defineBlockquote() { | ||
return union([defineBlockquoteSpec()]); | ||
return union([defineBlockquoteSpec(), defineBlockquoteInputRule()]); | ||
} | ||
export { | ||
defineBlockquote, | ||
defineBlockquoteInputRule, | ||
defineBlockquoteSpec | ||
}; |
@@ -29,9 +29,2 @@ import { | ||
return setNodeAttrs({ type: "codeBlock", attrs }); | ||
}, | ||
/** | ||
* @deprecated Use `setCodeBlockAttrs` instead. | ||
*/ | ||
setCodeBlockLanguage: (language) => { | ||
const attrs = { language }; | ||
return setNodeAttrs({ type: "codeBlock", attrs }); | ||
} | ||
@@ -38,0 +31,0 @@ }); |
@@ -8,3 +8,4 @@ // src/link/index.ts | ||
removeMark, | ||
toggleMark | ||
toggleMark, | ||
expandMark | ||
} from "@prosekit/core"; | ||
@@ -37,3 +38,4 @@ function defineLinkSpec() { | ||
removeLink: () => removeMark({ type: "link" }), | ||
toggleLink: (attrs) => toggleMark({ type: "link", attrs }) | ||
toggleLink: (attrs) => toggleMark({ type: "link", attrs }), | ||
expandLink: () => expandMark({ type: "link" }) | ||
}); | ||
@@ -40,0 +42,0 @@ } |
// src/placeholder/index.ts | ||
import { definePlugin } from "@prosekit/core"; | ||
import { definePlugin, isInCodeBlock } from "@prosekit/core"; | ||
import "@prosekit/pm/model"; | ||
import { Plugin, PluginKey } from "@prosekit/pm/state"; | ||
import { Decoration, DecorationSet } from "@prosekit/pm/view"; | ||
// src/utils/is-in-code-block.ts | ||
function isInCodeBlock(selection) { | ||
const type = selection.$from.parent.type; | ||
return type.spec.code && type.isBlock; | ||
} | ||
// src/placeholder/index.ts | ||
function definePlaceholder(options) { | ||
@@ -15,0 +7,0 @@ return definePlugin(createPlaceholderPlugin(options)); |
{ | ||
"name": "@prosekit/extensions", | ||
"type": "module", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"private": false, | ||
@@ -123,2 +123,10 @@ "author": { | ||
"default": "./dist/prosekit-extensions-underline.js" | ||
}, | ||
"./virtual-selection": { | ||
"types": "./dist/prosekit-extensions-virtual-selection.d.ts", | ||
"import": "./dist/prosekit-extensions-virtual-selection.js", | ||
"default": "./dist/prosekit-extensions-virtual-selection.js" | ||
}, | ||
"./virtual-selection/style.css": { | ||
"default": "./dist/virtual-selection/style.css" | ||
} | ||
@@ -130,7 +138,7 @@ }, | ||
"dependencies": { | ||
"@prosekit/core": "^0.2.6", | ||
"@prosekit/core": "^0.3.0", | ||
"@prosekit/pm": "^0.1.1", | ||
"prosemirror-dropcursor": "^1.8.1", | ||
"prosemirror-flat-list": "^0.4.5", | ||
"prosemirror-highlight": "^0.4.0" | ||
"prosemirror-flat-list": "^0.4.6", | ||
"prosemirror-highlight": "^0.4.1" | ||
}, | ||
@@ -147,6 +155,6 @@ "peerDependencies": { | ||
"@prosekit/dev": "*", | ||
"shikiji": "^0.9.19", | ||
"shikiji": "^0.10.2", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.2.0" | ||
"vitest": "^1.2.2" | ||
}, | ||
@@ -213,2 +221,5 @@ "scripts": { | ||
"./dist/prosekit-extensions-underline.d.ts" | ||
], | ||
"virtual-selection": [ | ||
"./dist/prosekit-extensions-virtual-selection.d.ts" | ||
] | ||
@@ -215,0 +226,0 @@ } |
Sorry, the diff of this file is not supported yet
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
65808
46
2050
+ Added@prosekit/core@0.3.2(transitive)
- Removed@prosekit/core@0.2.7(transitive)
Updated@prosekit/core@^0.3.0
Updatedprosemirror-flat-list@^0.4.6
Updatedprosemirror-highlight@^0.4.1