Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
react-ag-qeditor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lib
react-ag-qeditor
Commits
ba906614
Commit
ba906614
authored
May 13, 2022
by
Рамис
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix refresh optimized video
parent
d7d8cbd7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
App.js
example/src/App.js
+1
-1
QEditor.jsx
src/QEditor.jsx
+20
-5
VideoLocalBlot.js
src/blots/VideoLocalBlot.js
+3
-0
No files found.
example/src/App.js
View file @
ba906614
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'
...
...
src/QEditor.jsx
View file @
ba906614
...
@@ -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
());
}
}
...
...
src/blots/VideoLocalBlot.js
View file @
ba906614
...
@@ -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
;
}
}
...
...
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