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
3fa66ac5
Commit
3fa66ac5
authored
May 21, 2026
by
Яков
Browse files
update fix issue
parent
fe688702
Changes
3
Show whitespace changes
Inline
Side-by-side
package.json
View file @
3fa66ac5
{
{
"name"
:
"react-ag-qeditor"
,
"name"
:
"react-ag-qeditor"
,
"version"
:
"1.1.5
4
"
,
"version"
:
"1.1.5
5
"
,
"description"
:
"WYSIWYG html editor"
,
"description"
:
"WYSIWYG html editor"
,
"author"
:
"atma"
,
"author"
:
"atma"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/QEditor.jsx
View file @
3fa66ac5
...
@@ -1542,9 +1542,23 @@ const QEditor = ({
...
@@ -1542,9 +1542,23 @@ const QEditor = ({
})
})
.
command
(({
tr
,
state
})
=>
{
.
command
(({
tr
,
state
})
=>
{
// После setImage курсор — NodeSelection на картинке.
// После setImage курсор — NodeSelection на картинке.
// Переводим в TextSelection сразу после неё.
// На десктопе: TextSelection сразу после картинки (inline).
// На мобильном: курсор в следующий параграф — иначе он
// растягивается на всю высоту картинки.
const
{
$to
}
=
state
.
selection
const
{
$to
}
=
state
.
selection
if
(
isMobile
)
{
const
afterPara
=
$to
.
after
(
Math
.
min
(
$to
.
depth
,
1
))
const
target
=
afterPara
<
tr
.
doc
.
nodeSize
-
1
?
afterPara
+
1
:
afterPara
try
{
tr
.
setSelection
(
TextSelection
.
create
(
tr
.
doc
,
target
))
}
catch
{
tr
.
setSelection
(
TextSelection
.
create
(
tr
.
doc
,
$to
.
pos
))
}
}
else
{
tr
.
setSelection
(
TextSelection
.
create
(
tr
.
doc
,
$to
.
pos
))
tr
.
setSelection
(
TextSelection
.
create
(
tr
.
doc
,
$to
.
pos
))
}
return
true
return
true
})
})
.
run
()
.
run
()
...
...
src/extensions/Image.jsx
View file @
3fa66ac5
...
@@ -23,8 +23,11 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
...
@@ -23,8 +23,11 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const
isNoWrap
=
!
node
.
attrs
.
wrap
&&
(
node
.
attrs
.
align
===
'
left
'
||
node
.
attrs
.
align
===
'
right
'
);
const
isNoWrap
=
!
node
.
attrs
.
wrap
&&
(
node
.
attrs
.
align
===
'
left
'
||
node
.
attrs
.
align
===
'
right
'
);
// Добавляем прозрачный нулевой пробел после изображения
// На десктопе вставляем \u200B после картинки, чтобы курсор можно было
// поставить inline сразу после неё. На мобильном это не нужно — там курсор
// всё равно встаёт на всю высоту картинки, выглядит некорректно.
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isMobile
)
return
if
(
!
editor
||
!
getPos
||
editor
.
isDestroyed
)
return
if
(
!
editor
||
!
getPos
||
editor
.
isDestroyed
)
return
let
pos
let
pos
...
...
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