Commit ed18ec99 by Яков

add pdf to text

parent 66978172
{
"name": "react-ag-qeditor",
"version": "1.1.19",
"version": "1.1.20",
"description": "WYSIWYG html editor",
"author": "atma",
"license": "MIT",
......
......@@ -49,6 +49,7 @@ import IframeCustomModal from './modals/IframeCustomModal'
import { isMobile } from 'react-device-detect'
import { ExportPdf } from './extensions/ExportPdf'
import { mergeAttributes } from "@tiptap/core";
import Upload from "rc-upload";
// const CustomImage = Image.extend({
// options: {inline: true},
......@@ -246,6 +247,10 @@ const QEditor = ({
title: 'Вставить презентацию pdf',
onClick: () => modalOpener('iframe_pdf', 'Вставить презентацию pdf')
},
pdf: {
title: 'Вставить pdf -> text',
onClick: () => modalOpener('pdf', 'Вставить pdf -> text')
},
export_pdf: {
title: 'Экспорт в pdf',
onClick: () => ExportPdf()
......@@ -258,6 +263,10 @@ const QEditor = ({
title: 'Загрузить изображение',
onClick: () => modalOpener('image', 'Загрузить изображение')
},
pdfToText: {
title: 'Загрузить pdf',
onClick: () => modalOpener('pdf', 'Загрузить pdf')
},
interactiveImage: {
title: 'Интерактивное изображение',
onClick: () => {
......@@ -610,7 +619,7 @@ const QEditor = ({
)
}
const getUploader = ({accept = '*', ...o}) => {
const getUploader = ({accept = '*', ...o}, custom_url = '') => {
let url = uploadOptions.url
let multiple = true
if (o.afterParams && o.afterParams.length > 0) {
......@@ -630,7 +639,7 @@ const QEditor = ({
<Uploader
key={uploaderUid}
accept={accept}
action={url}
action={custom_url.length > 0 ? custom_url : url}
errorMessage={uploadOptions.errorMessage}
onSuccess={(file) => {
const _uploadedPaths = [...uploadedPaths]
......@@ -719,6 +728,15 @@ const QEditor = ({
})}
</Fragment>
)
case 'pdf':
return (
<Fragment>
{getUploader({
accept: 'application/pdf',
afterParams: ['no_convert=1']
}, '/ru/pdf-to-text/')}
</Fragment>
)
case 'video':
return <Fragment>{getUploader({accept: 'video/mp4,.mp4'})}</Fragment>
case 'image':
......@@ -1261,6 +1279,9 @@ const QEditor = ({
).run()
})
break
case 'pdf':
editor.chain().focus().insertContent(embedContent).run()
break
case 'file':
uploadedPaths.map((file, i) => {
let exp = file.path.split('.')
......
......@@ -50,6 +50,7 @@ const toolsInit = {
'iframe',
'iframe_pptx',
'iframe_pdf',
'pdf',
'audio',
'iframe_custom',
'insertToggleBlock'
......
......@@ -183,6 +183,9 @@ export default class Uploader extends React.Component {
});
}
if (resp.state === 'success') {
console.log(resp);
}
}}
onProgress={(o, file) => {
if (this.files[file.uid]) {
......
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