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
269ad207
Commit
269ad207
authored
Jul 04, 2025
by
Яков
Browse files
fix
parent
484527bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
package.json
View file @
269ad207
{
{
"name"
:
"react-ag-qeditor"
,
"name"
:
"react-ag-qeditor"
,
"version"
:
"1.1.
3
"
,
"version"
:
"1.1.
4
"
,
"description"
:
"WYSIWYG html editor"
,
"description"
:
"WYSIWYG html editor"
,
"author"
:
"atma"
,
"author"
:
"atma"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/extensions/Image.jsx
View file @
269ad207
...
@@ -13,6 +13,21 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
...
@@ -13,6 +13,21 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const
isInitialized
=
useRef
(
false
);
const
isInitialized
=
useRef
(
false
);
const
[
isResizing
,
setIsResizing
]
=
useState
(
false
);
const
[
isResizing
,
setIsResizing
]
=
useState
(
false
);
// Добавляем прозрачный нулевой пробел после изображения
useEffect
(()
=>
{
if
(
!
editor
||
!
getPos
)
return
;
const
pos
=
getPos
()
+
1
;
const
doc
=
editor
.
state
.
doc
;
if
(
doc
.
nodeSize
>
pos
&&
doc
.
nodeAt
(
pos
)?.
textContent
!==
'
\
u200B
'
)
{
editor
.
commands
.
insertContentAt
(
pos
,
{
type
:
'
text
'
,
text
:
'
\
u200B
'
// Невидимый нулевой пробел
});
}
},
[
editor
,
getPos
]);
// Получаем текущую ширину редактора и доступное пространство
// Получаем текущую ширину редактора и доступное пространство
const
getEditorDimensions
=
()
=>
{
const
getEditorDimensions
=
()
=>
{
const
editorContent
=
editor
?.
options
?.
element
?.
closest
(
'
.atma-editor-content
'
);
const
editorContent
=
editor
?.
options
?.
element
?.
closest
(
'
.atma-editor-content
'
);
...
@@ -463,12 +478,13 @@ const ResizableImageExtension = TipTapImage.extend({
...
@@ -463,12 +478,13 @@ const ResizableImageExtension = TipTapImage.extend({
const
style
=
[];
const
style
=
[];
if
(
align
===
'
center
'
)
{
if
(
align
===
'
center
'
)
{
style
.
push
(
'
display: block
'
,
'
margin-left: auto
'
,
'
margin-right: auto
'
);
style
.
push
(
'
display: block
'
,
'
margin-left: auto
'
,
'
margin-right: auto
'
);
}
else
if
(
align
===
'
left
'
)
{
}
else
if
(
align
===
'
left
'
)
{
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: top
'
,
'
margin-right: 1rem
'
);
style
.
push
(
'
float: left
'
,
'
margin-right: 1rem
'
);
}
else
if
(
align
===
'
right
'
)
{
}
else
if
(
align
===
'
right
'
)
{
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: top
'
,
'
margin-left: 1rem
'
);
style
.
push
(
'
float: right
'
,
'
margin-left: 1rem
'
);
}
else
if
(
align
===
'
text
'
)
{
}
else
if
(
align
===
'
text
'
)
{
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: middle
'
,
'
margin: 0 0.2rem
'
);
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: middle
'
,
'
margin: 0 0.2rem
'
);
}
}
...
...
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