@prosekit/extensions
Advanced tools
Comparing version 0.7.17 to 0.7.18
@@ -1709,5 +1709,6 @@ import { Attrs } from '@prosekit/pm/model'; | ||
/** | ||
* The placeholder text to use. | ||
* The placeholder to use. It can be a static string or a function that | ||
* receives the current editor state and returns a string. | ||
*/ | ||
placeholder: string; | ||
placeholder: string | ((state: EditorState) => string); | ||
/** | ||
@@ -1714,0 +1715,0 @@ * By default, the placeholder text will be shown whenever the current text |
@@ -8,3 +8,6 @@ // src/placeholder/index.ts | ||
} | ||
function createPlaceholderPlugin(options) { | ||
function createPlaceholderPlugin({ | ||
placeholder, | ||
strategy = "block" | ||
}) { | ||
return new Plugin({ | ||
@@ -14,3 +17,3 @@ key: new PluginKey("prosekit-placeholder"), | ||
decorations: (state) => { | ||
if (options.strategy === "doc" && !isDocEmpty(state.doc)) { | ||
if (strategy === "doc" && !isDocEmpty(state.doc)) { | ||
return null; | ||
@@ -21,3 +24,3 @@ } | ||
} | ||
const placeholderText = options.placeholder; | ||
const placeholderText = typeof placeholder === "function" ? placeholder(state) : placeholder; | ||
const deco = createPlaceholderDecoration(state, placeholderText); | ||
@@ -24,0 +27,0 @@ if (!deco) { |
{ | ||
"name": "@prosekit/extensions", | ||
"type": "module", | ||
"version": "0.7.17", | ||
"version": "0.7.18", | ||
"private": false, | ||
@@ -217,3 +217,3 @@ "author": { | ||
"prosemirror-tables": "^1.5.0", | ||
"shiki": "^1.16.2", | ||
"shiki": "^1.17.7", | ||
"@prosekit/core": "^0.7.11", | ||
@@ -243,13 +243,13 @@ "@prosekit/pm": "^0.1.8" | ||
"devDependencies": { | ||
"@vitest/browser": "^2.0.5", | ||
"@vitest/browser": "^2.1.2", | ||
"just-pick": "^4.2.0", | ||
"loro-crdt": "^0.16.12", | ||
"loro-prosemirror": "^0.0.7", | ||
"tsup": "^8.2.4", | ||
"tsup": "^8.3.0", | ||
"type-fest": "^4.26.1", | ||
"typescript": "^5.5.4", | ||
"vitest": "^2.0.5", | ||
"typescript": "^5.6.2", | ||
"vitest": "^2.1.2", | ||
"y-prosemirror": "^1.2.12", | ||
"y-protocols": "^1.0.6", | ||
"yjs": "^13.6.18", | ||
"yjs": "^13.6.19", | ||
"@prosekit/dev": "0.0.0" | ||
@@ -256,0 +256,0 @@ }, |
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
175632
5222
Updatedshiki@^1.17.7