Commit ba906614 by Рамис

fix refresh optimized video

parent d7d8cbd7
import React from 'react' import React, { useEffect } from 'react'
import QEditor from 'react-ag-qeditor' import QEditor from 'react-ag-qeditor'
import 'react-ag-qeditor/dist/index.css' import 'react-ag-qeditor/dist/index.css'
......
...@@ -27,7 +27,7 @@ export default class QEditor extends React.Component { ...@@ -27,7 +27,7 @@ export default class QEditor extends React.Component {
} }
Quill.register('formats/video', VideoBlot) Quill.register('formats/video', VideoBlot)
// Quill.register('formats/videoLocal', VideoLocalBlot) Quill.register('formats/videoLocal', VideoLocalBlot)
Quill.register('modules/blotFormatter', BlotFormatter) Quill.register('modules/blotFormatter', BlotFormatter)
Quill.register('formats/image', ImageBlot) Quill.register('formats/image', ImageBlot)
} }
...@@ -36,6 +36,20 @@ export default class QEditor extends React.Component { ...@@ -36,6 +36,20 @@ export default class QEditor extends React.Component {
this.setState({ this.setState({
init: true init: true
}); });
if(window.checkOptimizeVideo === undefined){
window.checkOptimizeVideo = setInterval(()=>{
const children = [...document.getElementsByTagName('video')];
if(children.length > 0){
children.forEach((video, i) => {
if(video.duration === 2.48){
video.setAttribute('src', video.getAttribute('src') + `?${Date.now()/1000}`)
}
})
}
}, 3000);
}
} }
modules = { modules = {
...@@ -50,7 +64,7 @@ export default class QEditor extends React.Component { ...@@ -50,7 +64,7 @@ export default class QEditor extends React.Component {
{indent: '+1'} {indent: '+1'}
], ],
[{align: []}, {color: []}, {background: []}], [{align: []}, {color: []}, {background: []}],
['link', 'image', 'video'/* , 'videoLocal' */], ['link', 'image', 'video', 'videoLocal'],
['formula'], ['formula'],
['clean'] ['clean']
], ],
...@@ -69,7 +83,7 @@ export default class QEditor extends React.Component { ...@@ -69,7 +83,7 @@ export default class QEditor extends React.Component {
() => this.editorModal.show({title: 'Видео по ссылке'}) () => this.editorModal.show({title: 'Видео по ссылке'})
) )
}, },
/* videoLocal: (a) => { videoLocal: (a) => {
const quill = this.quillRef.getEditor(); const quill = this.quillRef.getEditor();
let range = quill.getSelection(); let range = quill.getSelection();
let index = range ? range.index : 0; let index = range ? range.index : 0;
...@@ -79,7 +93,7 @@ export default class QEditor extends React.Component { ...@@ -79,7 +93,7 @@ export default class QEditor extends React.Component {
innerModalType: 'videoLocal', innerModalType: 'videoLocal',
focusedIndex: index focusedIndex: index
}, () => this.editorModal.show({title: 'Загрузить видео'})); }, () => this.editorModal.show({title: 'Загрузить видео'}));
}, */ },
image: (a) => { image: (a) => {
const quill = this.quillRef.getEditor(); const quill = this.quillRef.getEditor();
let range = quill.getSelection(); let range = quill.getSelection();
...@@ -102,7 +116,7 @@ export default class QEditor extends React.Component { ...@@ -102,7 +116,7 @@ export default class QEditor extends React.Component {
'bold', 'italic', 'underline', 'strike', 'blockquote', 'bold', 'italic', 'underline', 'strike', 'blockquote',
'list', 'bullet', 'indent', 'list', 'bullet', 'indent',
'align', 'align',
'link', 'image', 'video', 'color', 'background', /* 'videoLocal', */ 'link', 'image', 'video', 'color', 'background', 'videoLocal',
'formula', 'formula',
] ]
...@@ -208,6 +222,7 @@ export default class QEditor extends React.Component { ...@@ -208,6 +222,7 @@ export default class QEditor extends React.Component {
this.setState({ this.setState({
uploaderUid: `uid${new Date()}`, uploaderUid: `uid${new Date()}`,
embedContent: '', embedContent: '',
uplodedPaths: [],
focusedIndex: 0 focusedIndex: 0
}, () => this.editorModal.hide()); }, () => this.editorModal.hide());
} }
......
...@@ -16,6 +16,9 @@ export default class VideoLocalBlot extends BlockEmbed { ...@@ -16,6 +16,9 @@ export default class VideoLocalBlot extends BlockEmbed {
// node.setAttribute('loop', true); // node.setAttribute('loop', true);
node.setAttribute('src', value); node.setAttribute('src', value);
node.setAttribute('controls', true); node.setAttribute('controls', true);
node.setAttribute('disabled', true);
node.setAttribute('poster', value + '.jpg');
return node; return node;
} }
......
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