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

update fix issue

parent 5b8e6efe
{ {
"name": "react-ag-qeditor", "name": "react-ag-qeditor",
"version": "1.1.59", "version": "1.1.60",
"description": "WYSIWYG html editor", "description": "WYSIWYG html editor",
"author": "atma", "author": "atma",
"license": "MIT", "license": "MIT",
......
...@@ -137,6 +137,13 @@ export const DragAndDrop = Extension.create({ ...@@ -137,6 +137,13 @@ export const DragAndDrop = Extension.create({
if (!result?.file_path) throw new Error('Invalid response from server'); if (!result?.file_path) throw new Error('Invalid response from server');
// Регистрируем файл так же, как это делает Uploader.js
axios.post('/api/web/ru/set-file-data/', {
...result,
pathname: window.location.pathname,
slug: 'redactor'
}, { withCredentials: true }).catch(() => {});
const id = `img-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; const id = `img-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
if (nodeType === 'image') { if (nodeType === 'image') {
...@@ -272,6 +279,12 @@ export const DragAndDrop = Extension.create({ ...@@ -272,6 +279,12 @@ export const DragAndDrop = Extension.create({
const ext = blob.type.split('/')[1]?.split('+')[0] || 'png'; const ext = blob.type.split('/')[1]?.split('+')[0] || 'png';
const result = await uploadBlob(blob, `pasted-image.${ext}`); const result = await uploadBlob(blob, `pasted-image.${ext}`);
if (!result?.file_path) return null; if (!result?.file_path) return null;
// Регистрируем файл
axios.post('/api/web/ru/set-file-data/', {
...result,
pathname: window.location.pathname,
slug: 'redactor'
}, { withCredentials: true }).catch(() => {});
return { filePath: result.file_path, width, height, style }; return { filePath: result.file_path, width, height, style };
} catch (e) { } catch (e) {
console.warn('[DragAndDrop] не удалось загрузить:', src?.slice(0, 80), e); console.warn('[DragAndDrop] не удалось загрузить:', src?.slice(0, 80), e);
......
This diff is collapsed.
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