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
484527bb
Commit
484527bb
authored
Jul 04, 2025
by
Яков
Browse files
update
parent
2a0e3c7e
Changes
2
Show whitespace changes
Inline
Side-by-side
package.json
View file @
484527bb
{
{
"name"
:
"react-ag-qeditor"
,
"name"
:
"react-ag-qeditor"
,
"version"
:
"1.1.
2
"
,
"version"
:
"1.1.
3
"
,
"description"
:
"WYSIWYG html editor"
,
"description"
:
"WYSIWYG html editor"
,
"author"
:
"atma"
,
"author"
:
"atma"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/extensions/Image.jsx
View file @
484527bb
...
@@ -183,7 +183,6 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
...
@@ -183,7 +183,6 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
requestAnimationFrame
(()
=>
{
requestAnimationFrame
(()
=>
{
const
maxWidth
=
node
.
attrs
.
align
===
'
center
'
?
initialEditorWidth
:
initialAvailableSpace
;
const
maxWidth
=
node
.
attrs
.
align
===
'
center
'
?
initialEditorWidth
:
initialAvailableSpace
;
console
.
log
(
maxWidth
);
const
deltaX
=
e
.
clientX
-
startX
;
const
deltaX
=
e
.
clientX
-
startX
;
const
deltaY
=
e
.
clientY
-
startY
;
const
deltaY
=
e
.
clientY
-
startY
;
...
@@ -450,6 +449,47 @@ const ResizableImageExtension = TipTapImage.extend({
...
@@ -450,6 +449,47 @@ const ResizableImageExtension = TipTapImage.extend({
}
}
};
};
},
},
renderHTML
({
node
,
HTMLAttributes
})
{
const
{
src
,
alt
=
''
,
title
=
''
,
width
,
height
,
...
rest
}
=
HTMLAttributes
;
const
align
=
node
.
attrs
.
align
||
'
left
'
;
const
style
=
[];
if
(
align
===
'
center
'
)
{
style
.
push
(
'
display: block
'
,
'
margin-left: auto
'
,
'
margin-right: auto
'
);
}
else
if
(
align
===
'
left
'
)
{
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: top
'
,
'
margin-right: 1rem
'
);
}
else
if
(
align
===
'
right
'
)
{
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: top
'
,
'
margin-left: 1rem
'
);
}
else
if
(
align
===
'
text
'
)
{
style
.
push
(
'
display: inline-block
'
,
'
vertical-align: middle
'
,
'
margin: 0 0.2rem
'
);
}
if
(
width
)
style
.
push
(
`width:
${
width
}
px`
);
if
(
height
)
style
.
push
(
`height:
${
height
}
px`
);
return
[
'
img
'
,
{
src
,
alt
,
title
,
width
,
height
,
'
data-align
'
:
align
,
style
:
style
.
join
(
'
;
'
),
...
rest
,
}
];
},
addNodeView
()
{
addNodeView
()
{
return
ReactNodeViewRenderer
(
ResizableImageTemplate
);
return
ReactNodeViewRenderer
(
ResizableImageTemplate
);
...
...
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