Commit 79263e8a by Яков

update

parent c8be1c9b
{
"name": "react-ag-qeditor",
"version": "1.0.95",
"version": "1.0.96",
"description": "WYSIWYG html editor",
"author": "atma",
"license": "MIT",
......
......@@ -72,10 +72,10 @@ export const DragAndDrop = Extension.create({
result = response.data;
}
if (!result?.url) throw new Error('Invalid response from server');
if (!result?.file_path) throw new Error('Invalid response from server');
const node = view.state.schema.nodes[nodeType].create({
src: result.url,
src: result.file_path,
alt: file.name,
title: file.name,
'data-node-id': `img-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
......
......@@ -66,6 +66,9 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
e.preventDefault();
e.stopPropagation();
// Явно устанавливаем выделение перед началом ресайза
editor.commands.setNodeSelection(getPos());
const startWidth = node.attrs.width || imgRef.current.naturalWidth;
const startHeight = node.attrs.height || imgRef.current.naturalHeight;
const aspectRatio = startWidth / startHeight;
......@@ -106,6 +109,8 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const onMouseUp = () => {
window.removeEventListener('mousemove', onMouseMove);
window.removeEventListener('mouseup', onMouseUp);
// Явно восстанавливаем выделение после ресайза
editor.commands.setNodeSelection(getPos());
editor.commands.focus();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment