Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lib
react-ag-qeditor
Commits
ba906614
Commit
ba906614
authored
May 13, 2022
by
Рамис
Browse files
fix refresh optimized video
parent
d7d8cbd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
example/src/App.js
View file @
ba906614
import
React
from
'
react
'
import
React
,
{
useEffect
}
from
'
react
'
import
QEditor
from
'
react-ag-qeditor
'
import
'
react-ag-qeditor/dist/index.css
'
...
...
src/QEditor.jsx
View file @
ba906614
...
...
@@ -27,7 +27,7 @@ export default class QEditor extends React.Component {
}
Quill
.
register
(
'
formats/video
'
,
VideoBlot
)
//
Quill.register('formats/videoLocal', VideoLocalBlot)
Quill
.
register
(
'
formats/videoLocal
'
,
VideoLocalBlot
)
Quill
.
register
(
'
modules/blotFormatter
'
,
BlotFormatter
)
Quill
.
register
(
'
formats/image
'
,
ImageBlot
)
}
...
...
@@ -36,6 +36,20 @@ export default class QEditor extends React.Component {
this
.
setState
({
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
=
{
...
...
@@ -50,7 +64,7 @@ export default class QEditor extends React.Component {
{
indent
:
'
+1
'
}
],
[{
align
:
[]},
{
color
:
[]},
{
background
:
[]}],
[
'
link
'
,
'
image
'
,
'
video
'
/*
, 'videoLocal'
*/
],
[
'
link
'
,
'
image
'
,
'
video
'
,
'
videoLocal
'
],
[
'
formula
'
],
[
'
clean
'
]
],
...
...
@@ -69,7 +83,7 @@ export default class QEditor extends React.Component {
()
=>
this
.
editorModal
.
show
({
title
:
'
Видео по ссылке
'
})
)
},
/*
videoLocal: (a) => {
videoLocal
:
(
a
)
=>
{
const
quill
=
this
.
quillRef
.
getEditor
();
let
range
=
quill
.
getSelection
();
let
index
=
range
?
range
.
index
:
0
;
...
...
@@ -79,7 +93,7 @@ export default class QEditor extends React.Component {
innerModalType
:
'
videoLocal
'
,
focusedIndex
:
index
},
()
=>
this
.
editorModal
.
show
({
title
:
'
Загрузить видео
'
}));
},
*/
},
image
:
(
a
)
=>
{
const
quill
=
this
.
quillRef
.
getEditor
();
let
range
=
quill
.
getSelection
();
...
...
@@ -102,7 +116,7 @@ export default class QEditor extends React.Component {
'
bold
'
,
'
italic
'
,
'
underline
'
,
'
strike
'
,
'
blockquote
'
,
'
list
'
,
'
bullet
'
,
'
indent
'
,
'
align
'
,
'
link
'
,
'
image
'
,
'
video
'
,
'
color
'
,
'
background
'
,
/*
'videoLocal',
*/
'
link
'
,
'
image
'
,
'
video
'
,
'
color
'
,
'
background
'
,
'
videoLocal
'
,
'
formula
'
,
]
...
...
@@ -208,6 +222,7 @@ export default class QEditor extends React.Component {
this
.
setState
({
uploaderUid
:
`uid
${
new
Date
()}
`
,
embedContent
:
''
,
uplodedPaths
:
[],
focusedIndex
:
0
},
()
=>
this
.
editorModal
.
hide
());
}
...
...
src/blots/VideoLocalBlot.js
View file @
ba906614
...
...
@@ -16,6 +16,9 @@ export default class VideoLocalBlot extends BlockEmbed {
// node.setAttribute('loop', true);
node
.
setAttribute
(
'
src
'
,
value
);
node
.
setAttribute
(
'
controls
'
,
true
);
node
.
setAttribute
(
'
disabled
'
,
true
);
node
.
setAttribute
(
'
poster
'
,
value
+
'
.jpg
'
);
return
node
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment