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
a6ac6046
Commit
a6ac6046
authored
May 22, 2026
by
Яков
Browse files
update fix issue
parent
b4462e85
Changes
3
Show whitespace changes
Inline
Side-by-side
package.json
View file @
a6ac6046
{
{
"name"
:
"react-ag-qeditor"
,
"name"
:
"react-ag-qeditor"
,
"version"
:
"1.1.6
3
"
,
"version"
:
"1.1.6
4
"
,
"description"
:
"WYSIWYG html editor"
,
"description"
:
"WYSIWYG html editor"
,
"author"
:
"atma"
,
"author"
:
"atma"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/QEditor.jsx
View file @
a6ac6046
...
@@ -140,6 +140,31 @@ const WordNavigation = Extension.create({
...
@@ -140,6 +140,31 @@ const WordNavigation = Extension.create({
}
}
})
})
const
ImageWrapEnter
=
Extension
.
create
({
name
:
'
imageWrapEnter
'
,
addKeyboardShortcuts
()
{
return
{
'
Enter
'
:
({
editor
})
=>
{
const
{
state
}
=
editor
const
{
$from
}
=
state
.
selection
const
parent
=
$from
.
parent
const
cursorOffset
=
$from
.
parentOffset
let
lastWrappedEnd
=
null
parent
.
forEach
((
child
,
offset
)
=>
{
if
(
child
.
type
.
name
===
'
image
'
&&
child
.
attrs
.
wrap
&&
offset
>=
cursorOffset
)
{
lastWrappedEnd
=
$from
.
start
()
+
offset
+
child
.
nodeSize
}
})
if
(
lastWrappedEnd
===
null
)
return
false
return
editor
.
chain
()
.
setTextSelection
(
lastWrappedEnd
)
.
splitBlock
()
.
run
()
}
}
}
})
const
initialBubbleItems
=
[
const
initialBubbleItems
=
[
'
bold
'
,
'
bold
'
,
'
italic
'
,
'
italic
'
,
...
@@ -811,6 +836,7 @@ const QEditor = ({
...
@@ -811,6 +836,7 @@ const QEditor = ({
ToggleBlock
,
ToggleBlock
,
InteractiveImage
,
InteractiveImage
,
WordNavigation
,
WordNavigation
,
ImageWrapEnter
,
DragAndDrop
.
configure
({
DragAndDrop
.
configure
({
uploadUrl
:
uploadOptions
.
url
,
uploadUrl
:
uploadOptions
.
url
,
allowedFileTypes
:
[
allowedFileTypes
:
[
...
@@ -829,18 +855,6 @@ const QEditor = ({
...
@@ -829,18 +855,6 @@ const QEditor = ({
})
})
],
],
content
:
value
,
content
:
value
,
onTransaction
:
({
transaction
})
=>
{
if
(
!
transaction
.
docChanged
)
return
// Ищем шаги, которые затрагивают image-ноды
transaction
.
steps
.
forEach
((
step
,
i
)
=>
{
const
json
=
step
.
toJSON
?.()
if
(
!
json
)
return
const
str
=
JSON
.
stringify
(
json
)
if
(
str
.
includes
(
'
"image"
'
)
||
str
.
includes
(
'
image
'
))
{
console
.
log
(
`[TxDebug] шаг #
${
i
}
type=
${
json
.
stepType
||
json
.
type
}
`
,
json
)
}
})
},
onUpdate
:
({
editor
})
=>
onChange
(
editor
.
getHTML
()),
onUpdate
:
({
editor
})
=>
onChange
(
editor
.
getHTML
()),
onFocus
:
({
editor
})
=>
{
onFocus
:
({
editor
})
=>
{
const
wrap
=
editor
.
options
.
element
.
closest
(
'
.atma-editor-wrap
'
)
const
wrap
=
editor
.
options
.
element
.
closest
(
'
.atma-editor-wrap
'
)
...
...
src/extensions/Image.jsx
View file @
a6ac6046
...
@@ -15,28 +15,7 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
...
@@ -15,28 +15,7 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const
imgRef
=
useRef
(
null
);
const
imgRef
=
useRef
(
null
);
const
wrapperRef
=
useRef
(
null
);
const
wrapperRef
=
useRef
(
null
);
const
isInitialized
=
useRef
(
false
);
const
isInitialized
=
useRef
(
false
);
const
prevPosRef
=
useRef
(
null
);
const
prevWrapRef
=
useRef
(
node
.
attrs
.
wrap
);
const
[
isResizing
,
setIsResizing
]
=
useState
(
false
);
const
[
isResizing
,
setIsResizing
]
=
useState
(
false
);
// ── DEBUG: отслеживаем смещение ноды и изменения wrap ──────────────────
useEffect
(()
=>
{
const
pos
=
getPos
?.()
const
src
=
node
.
attrs
.
src
?.
split
(
'
/
'
).
pop
()
if
(
prevPosRef
.
current
!==
null
&&
prevPosRef
.
current
!==
pos
)
{
console
.
warn
(
`[ImageDebug] ПОЗИЦИЯ ИЗМЕНИЛАСЬ src=
${
src
}
было=
${
prevPosRef
.
current
}
стало=
${
pos
}
`
,
new
Error
().
stack
.
split
(
'
\n
'
).
slice
(
1
,
4
).
join
(
'
|
'
)
)
}
if
(
prevWrapRef
.
current
!==
node
.
attrs
.
wrap
)
{
console
.
log
(
`[ImageDebug] wrap изменился src=
${
src
}
wrap=
${
node
.
attrs
.
wrap
}
pos=
${
pos
}
`
)
}
prevPosRef
.
current
=
pos
prevWrapRef
.
current
=
node
.
attrs
.
wrap
})
const
[
altModalVisible
,
setAltModalVisible
]
=
useState
(
false
);
const
[
altModalVisible
,
setAltModalVisible
]
=
useState
(
false
);
const
[
tempAlt
,
setTempAlt
]
=
useState
(
node
.
attrs
.
alt
||
''
);
const
[
tempAlt
,
setTempAlt
]
=
useState
(
node
.
attrs
.
alt
||
''
);
const
[
tempFrontAlt
,
setTempFrontAlt
]
=
useState
(
node
.
attrs
.
frontAlt
||
''
);
const
[
tempFrontAlt
,
setTempFrontAlt
]
=
useState
(
node
.
attrs
.
frontAlt
||
''
);
...
...
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