Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lib
react-ag-qeditor
Commits
79263e8a
Commit
79263e8a
authored
Jul 04, 2025
by
Яков
Browse files
update
parent
c8be1c9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
package.json
View file @
79263e8a
{
{
"name"
:
"react-ag-qeditor"
,
"name"
:
"react-ag-qeditor"
,
"version"
:
"1.0.9
5
"
,
"version"
:
"1.0.9
6
"
,
"description"
:
"WYSIWYG html editor"
,
"description"
:
"WYSIWYG html editor"
,
"author"
:
"atma"
,
"author"
:
"atma"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/extensions/DragAndDrop.js
View file @
79263e8a
...
@@ -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
)}
`
...
...
src/extensions/Image.jsx
View file @
79263e8a
...
@@ -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
();
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment