Commit 269ad207 by Яков

fix

parent 484527bb
{
"name": "react-ag-qeditor",
"version": "1.1.3",
"version": "1.1.4",
"description": "WYSIWYG html editor",
"author": "atma",
"license": "MIT",
......
......@@ -13,6 +13,21 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const isInitialized = useRef(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 editorContent = editor?.options?.element?.closest('.atma-editor-content');
......@@ -463,12 +478,13 @@ const ResizableImageExtension = TipTapImage.extend({
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');
style.push('float: left', 'margin-right: 1rem');
} 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') {
style.push('display: inline-block', 'vertical-align: middle', 'margin: 0 0.2rem');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment