Commit e1b05324 by Яков

update iframe and video

parent fe36d666
{
"name": "react-ag-qeditor",
"version": "1.1.23",
"version": "1.1.24",
"description": "WYSIWYG html editor",
"author": "atma",
"license": "MIT",
......
......@@ -36,7 +36,11 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected
const paddingRight = parseFloat(editorStyles.paddingRight) || 0
const availableEditorWidth = fullEditorWidth - paddingLeft - paddingRight
const container = wrapperRef.current?.closest('li, blockquote, td, p, div') || editorContent
// важно: стартуем от parentElement, чтобы не схватить wrapperRef.current
const startEl = wrapperRef.current?.parentElement || editorContent
const container =
startEl.closest('li, blockquote, td, p, div') || editorContent
const containerStyles = window.getComputedStyle(container)
const containerPaddingLeft = parseFloat(containerStyles.paddingLeft) || 0
const containerPaddingRight = parseFloat(containerStyles.paddingRight) || 0
......@@ -45,6 +49,7 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected
return { width: containerWidth, availableSpace: availableEditorWidth }
}
const safeUpdateAttributes = (newAttrs) => {
const { width: containerWidth, availableSpace } = getEditorDimensions()
......@@ -170,13 +175,25 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected
}
}
const align = node.attrs.align || 'left'
const wrapperStyle = {
position: 'relative',
display: node.attrs.align === 'center' ? 'block' : 'inline-block',
width: node.attrs.width ? `${node.attrs.width}px` : undefined,
height: node.attrs.height ? `${node.attrs.height}px` : undefined,
// align styles inside editor
display: align === 'center' ? 'block' : 'inline-block',
marginLeft: align === 'center' ? 'auto' : undefined,
marginRight: align === 'center' ? 'auto' : undefined,
float: align === 'left' ? 'left' : align === 'right' ? 'right' : 'none',
// чтобы текст красиво обтекал
marginInlineEnd: align === 'left' ? '1rem' : undefined,
marginInlineStart: align === 'right' ? '1rem' : undefined,
}
return (
<NodeViewWrapper
ref={wrapperRef}
......
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