@prosekit/extensions
Advanced tools
Comparing version 0.7.18 to 0.7.19
@@ -20,3 +20,5 @@ // src/image/image.ts | ||
attrs: { | ||
src: { default: null } | ||
src: { default: null }, | ||
width: { default: null }, | ||
height: { default: null } | ||
}, | ||
@@ -34,3 +36,13 @@ group: "block", | ||
const src = element.getAttribute("src") || null; | ||
return { src }; | ||
let width = null; | ||
let height = null; | ||
const rect = element.getBoundingClientRect(); | ||
if (rect.width > 0 && rect.height > 0) { | ||
width = rect.width; | ||
height = rect.height; | ||
} else if (element instanceof HTMLImageElement && element.naturalWidth > 0 && element.naturalHeight > 0) { | ||
width = element.naturalWidth; | ||
height = element.naturalHeight; | ||
} | ||
return { src, width, height }; | ||
} | ||
@@ -37,0 +49,0 @@ } |
// src/placeholder/index.ts | ||
import { definePlugin, isInCodeBlock } from "@prosekit/core"; | ||
import { definePlugin, isInCodeBlock, maybeRun } from "@prosekit/core"; | ||
import { Plugin, PluginKey } from "@prosekit/pm/state"; | ||
@@ -22,3 +22,3 @@ import { Decoration, DecorationSet } from "@prosekit/pm/view"; | ||
} | ||
const placeholderText = typeof placeholder === "function" ? placeholder(state) : placeholder; | ||
const placeholderText = maybeRun(placeholder, state); | ||
const deco = createPlaceholderDecoration(state, placeholderText); | ||
@@ -25,0 +25,0 @@ if (!deco) { |
{ | ||
"name": "@prosekit/extensions", | ||
"type": "module", | ||
"version": "0.7.18", | ||
"version": "0.7.19", | ||
"private": false, | ||
@@ -76,2 +76,7 @@ "author": { | ||
}, | ||
"./file": { | ||
"types": "./dist/prosekit-extensions-file.d.ts", | ||
"import": "./dist/prosekit-extensions-file.js", | ||
"default": "./dist/prosekit-extensions-file.js" | ||
}, | ||
"./gap-cursor": { | ||
@@ -218,4 +223,4 @@ "types": "./dist/prosekit-extensions-gap-cursor.d.ts", | ||
"prosemirror-tables": "^1.5.0", | ||
"shiki": "^1.17.7", | ||
"@prosekit/core": "^0.7.11", | ||
"shiki": "^1.22.0", | ||
"@prosekit/core": "^0.7.12", | ||
"@prosekit/pm": "^0.1.8" | ||
@@ -244,3 +249,3 @@ }, | ||
"devDependencies": { | ||
"@vitest/browser": "^2.1.2", | ||
"@vitest/browser": "^2.1.3", | ||
"just-pick": "^4.2.0", | ||
@@ -251,7 +256,7 @@ "loro-crdt": "^0.16.12", | ||
"type-fest": "^4.26.1", | ||
"typescript": "^5.6.2", | ||
"vitest": "^2.1.2", | ||
"typescript": "^5.6.3", | ||
"vitest": "^2.1.3", | ||
"y-prosemirror": "^1.2.12", | ||
"y-protocols": "^1.0.6", | ||
"yjs": "^13.6.19", | ||
"yjs": "^13.6.20", | ||
"@prosekit/dev": "0.0.0" | ||
@@ -293,2 +298,5 @@ }, | ||
], | ||
"file": [ | ||
"./dist/prosekit-extensions-file.d.ts" | ||
], | ||
"gap-cursor": [ | ||
@@ -295,0 +303,0 @@ "./dist/prosekit-extensions-gap-cursor.d.ts" |
Sorry, the diff of this file is too big to display
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
185624
79
5528
Updated@prosekit/core@^0.7.12
Updatedshiki@^1.22.0