Commit e1b05324 by Яков

update iframe and video

parent fe36d666
{ {
"name": "react-ag-qeditor", "name": "react-ag-qeditor",
"version": "1.1.23", "version": "1.1.24",
"description": "WYSIWYG html editor", "description": "WYSIWYG html editor",
"author": "atma", "author": "atma",
"license": "MIT", "license": "MIT",
......
...@@ -36,7 +36,11 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected ...@@ -36,7 +36,11 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected
const paddingRight = parseFloat(editorStyles.paddingRight) || 0 const paddingRight = parseFloat(editorStyles.paddingRight) || 0
const availableEditorWidth = fullEditorWidth - paddingLeft - paddingRight 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 containerStyles = window.getComputedStyle(container)
const containerPaddingLeft = parseFloat(containerStyles.paddingLeft) || 0 const containerPaddingLeft = parseFloat(containerStyles.paddingLeft) || 0
const containerPaddingRight = parseFloat(containerStyles.paddingRight) || 0 const containerPaddingRight = parseFloat(containerStyles.paddingRight) || 0
...@@ -45,6 +49,7 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected ...@@ -45,6 +49,7 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected
return { width: containerWidth, availableSpace: availableEditorWidth } return { width: containerWidth, availableSpace: availableEditorWidth }
} }
const safeUpdateAttributes = (newAttrs) => { const safeUpdateAttributes = (newAttrs) => {
const { width: containerWidth, availableSpace } = getEditorDimensions() const { width: containerWidth, availableSpace } = getEditorDimensions()
...@@ -170,13 +175,25 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected ...@@ -170,13 +175,25 @@ const ResizableIframeView = ({ editor, node, updateAttributes, getPos, selected
} }
} }
const align = node.attrs.align || 'left'
const wrapperStyle = { const wrapperStyle = {
position: 'relative', position: 'relative',
display: node.attrs.align === 'center' ? 'block' : 'inline-block',
width: node.attrs.width ? `${node.attrs.width}px` : undefined, width: node.attrs.width ? `${node.attrs.width}px` : undefined,
height: node.attrs.height ? `${node.attrs.height}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 ( return (
<NodeViewWrapper <NodeViewWrapper
ref={wrapperRef} 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