feat: Image resizing (#4368)
* wip * works * wip * refactor * Support replacing image and retain width fix: Copy paste does not retain size * cleanup * fix: Cannot resize past 100% fix: Borders to edges on unresized images * Handle Escape key while dragging * fix: Embeds and images dont render when edit state changes fix: Small animation regression
This commit is contained in:
@@ -13,6 +13,8 @@ export type Options = {
|
||||
isAttachment?: boolean;
|
||||
/** Set to true to replace any existing image at the users selection */
|
||||
replaceExisting?: boolean;
|
||||
/** Width to use when inserting image */
|
||||
width?: number;
|
||||
uploadFile?: (file: File) => Promise<string>;
|
||||
onFileUploadStart?: () => void;
|
||||
onFileUploadStop?: () => void;
|
||||
@@ -112,7 +114,7 @@ const insertFiles = function (
|
||||
.replaceWith(
|
||||
from,
|
||||
to || from,
|
||||
schema.nodes.image.create({ src })
|
||||
schema.nodes.image.create({ src, width: options.width })
|
||||
)
|
||||
.setMeta(uploadPlaceholderPlugin, { remove: { id } })
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user