Commit 79263e8a by Яков

update

parent c8be1c9b
{ {
"name": "react-ag-qeditor", "name": "react-ag-qeditor",
"version": "1.0.95", "version": "1.0.96",
"description": "WYSIWYG html editor", "description": "WYSIWYG html editor",
"author": "atma", "author": "atma",
"license": "MIT", "license": "MIT",
......
...@@ -72,10 +72,10 @@ export const DragAndDrop = Extension.create({ ...@@ -72,10 +72,10 @@ export const DragAndDrop = Extension.create({
result = response.data; 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({ const node = view.state.schema.nodes[nodeType].create({
src: result.url, src: result.file_path,
alt: file.name, alt: file.name,
title: file.name, title: file.name,
'data-node-id': `img-${Date.now()}-${Math.random().toString(36).substr(2, 9)}` 'data-node-id': `img-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
......
...@@ -66,6 +66,9 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select ...@@ -66,6 +66,9 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
// Явно устанавливаем выделение перед началом ресайза
editor.commands.setNodeSelection(getPos());
const startWidth = node.attrs.width || imgRef.current.naturalWidth; const startWidth = node.attrs.width || imgRef.current.naturalWidth;
const startHeight = node.attrs.height || imgRef.current.naturalHeight; const startHeight = node.attrs.height || imgRef.current.naturalHeight;
const aspectRatio = startWidth / startHeight; const aspectRatio = startWidth / startHeight;
...@@ -106,6 +109,8 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select ...@@ -106,6 +109,8 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const onMouseUp = () => { const onMouseUp = () => {
window.removeEventListener('mousemove', onMouseMove); window.removeEventListener('mousemove', onMouseMove);
window.removeEventListener('mouseup', onMouseUp); window.removeEventListener('mouseup', onMouseUp);
// Явно восстанавливаем выделение после ресайза
editor.commands.setNodeSelection(getPos());
editor.commands.focus(); 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