Commit b4462e85 authored by Яков's avatar Яков
Browse files

update fix issue

parent c8109471
{ {
"name": "react-ag-qeditor", "name": "react-ag-qeditor",
"version": "1.1.62", "version": "1.1.63",
"description": "WYSIWYG html editor", "description": "WYSIWYG html editor",
"author": "atma", "author": "atma",
"license": "MIT", "license": "MIT",
......
...@@ -829,6 +829,18 @@ const QEditor = ({ ...@@ -829,6 +829,18 @@ const QEditor = ({
}) })
], ],
content: value, content: value,
onTransaction: ({ transaction }) => {
if (!transaction.docChanged) return
// Ищем шаги, которые затрагивают image-ноды
transaction.steps.forEach((step, i) => {
const json = step.toJSON?.()
if (!json) return
const str = JSON.stringify(json)
if (str.includes('"image"') || str.includes('image')) {
console.log(`[TxDebug] шаг #${i} type=${json.stepType || json.type}`, json)
}
})
},
onUpdate: ({editor}) => onChange(editor.getHTML()), onUpdate: ({editor}) => onChange(editor.getHTML()),
onFocus: ({editor}) => { onFocus: ({editor}) => {
const wrap = editor.options.element.closest('.atma-editor-wrap') const wrap = editor.options.element.closest('.atma-editor-wrap')
......
...@@ -15,7 +15,28 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select ...@@ -15,7 +15,28 @@ const ResizableImageTemplate = ({ node, updateAttributes, editor, getPos, select
const imgRef = useRef(null); const imgRef = useRef(null);
const wrapperRef = useRef(null); const wrapperRef = useRef(null);
const isInitialized = useRef(false); const isInitialized = useRef(false);
const prevPosRef = useRef(null);
const prevWrapRef = useRef(node.attrs.wrap);
const [isResizing, setIsResizing] = useState(false); const [isResizing, setIsResizing] = useState(false);
// ── DEBUG: отслеживаем смещение ноды и изменения wrap ──────────────────
useEffect(() => {
const pos = getPos?.()
const src = node.attrs.src?.split('/').pop()
if (prevPosRef.current !== null && prevPosRef.current !== pos) {
console.warn(
`[ImageDebug] ПОЗИЦИЯ ИЗМЕНИЛАСЬ src=${src} было=${prevPosRef.current} стало=${pos}`,
new Error().stack.split('\n').slice(1, 4).join(' | ')
)
}
if (prevWrapRef.current !== node.attrs.wrap) {
console.log(`[ImageDebug] wrap изменился src=${src} wrap=${node.attrs.wrap} pos=${pos}`)
}
prevPosRef.current = pos
prevWrapRef.current = node.attrs.wrap
})
const [altModalVisible, setAltModalVisible] = useState(false); const [altModalVisible, setAltModalVisible] = useState(false);
const [tempAlt, setTempAlt] = useState(node.attrs.alt || ''); const [tempAlt, setTempAlt] = useState(node.attrs.alt || '');
const [tempFrontAlt, setTempFrontAlt] = useState(node.attrs.frontAlt || ''); const [tempFrontAlt, setTempFrontAlt] = useState(node.attrs.frontAlt || '');
......
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