@seafile/sdoc-editor 1.0.206-test0.2.3 → 1.0.206-test0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -70,14 +70,12 @@ const SelectSdocFileDialog = _ref => {
|
|
|
70
70
|
const {
|
|
71
71
|
fileServerRoot
|
|
72
72
|
} = window.app.config;
|
|
73
|
+
// Get seafile's video download url as src
|
|
73
74
|
const url = `${fileServerRoot}repos/${repoID}/files${fileInfo.path}/?op=download`;
|
|
74
75
|
const encodedUrl = encodeURI(url);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
name: fileInfo.name
|
|
79
|
-
}]
|
|
80
|
-
}, [encodedUrl]);
|
|
76
|
+
insertVideo && insertVideo(editor, [{
|
|
77
|
+
name: fileInfo.name
|
|
78
|
+
}], [encodedUrl]);
|
|
81
79
|
break;
|
|
82
80
|
default:
|
|
83
81
|
break;
|
|
@@ -94,8 +92,6 @@ const SelectSdocFileDialog = _ref => {
|
|
|
94
92
|
|
|
95
93
|
// Insert video element in sdoc
|
|
96
94
|
if (dialogType === _constants.ELEMENT_TYPE.VIDEO) {
|
|
97
|
-
console.log(0);
|
|
98
|
-
console.log(1, fileInfo);
|
|
99
95
|
insertFile(fileInfo);
|
|
100
96
|
closeDialog();
|
|
101
97
|
return;
|
|
@@ -60,6 +60,7 @@ const insertVideo = function (editor, videoFiles, srcList, selection) {
|
|
|
60
60
|
if (position !== _constants.INSERT_POSITION.AFTER) {
|
|
61
61
|
if (isInsertVideoMenuDisabled(editor)) return;
|
|
62
62
|
}
|
|
63
|
+
console.log('helper', videoFiles, srcList);
|
|
63
64
|
const videoNodes = srcList.map(src => {
|
|
64
65
|
return generateVideoNode(src, videoFiles);
|
|
65
66
|
});
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
|
|
50
50
|
.sdoc-video-wrapper .sdoc-video-inner {
|
|
51
51
|
position: relative;
|
|
52
|
-
width:
|
|
52
|
+
width: 100%;
|
|
53
53
|
display: flex;
|
|
54
54
|
margin-top: 5px;
|
|
55
55
|
margin-bottom: 10px;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.sdoc-video-inner .sdoc-video-element{
|
|
59
|
-
width:
|
|
59
|
+
width: 100%;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
.sdoc-video-inner .sdoc-video-element:focus-visible {
|
|
@@ -12,7 +12,7 @@ var _reactI18next = require("react-i18next");
|
|
|
12
12
|
var _helpers = require("./helpers");
|
|
13
13
|
require("./index.css");
|
|
14
14
|
const Video = _ref => {
|
|
15
|
-
var _data$videoFiles$, _data$videoFiles$2, _videoStates$element$;
|
|
15
|
+
var _data$videoFiles$, _data$videoFiles$2, _data$videoFiles$3, _videoStates$element$;
|
|
16
16
|
let {
|
|
17
17
|
element,
|
|
18
18
|
editor
|
|
@@ -26,7 +26,8 @@ const Video = _ref => {
|
|
|
26
26
|
const [videoStates, setVideoStates] = (0, _react.useState)({});
|
|
27
27
|
const videoFileName = data.videoFiles && ((_data$videoFiles$ = data.videoFiles[0]) === null || _data$videoFiles$ === void 0 ? void 0 : _data$videoFiles$.name) || null;
|
|
28
28
|
const videoFileSize = data.videoFiles && ((_data$videoFiles$2 = data.videoFiles[0]) === null || _data$videoFiles$2 === void 0 ? void 0 : _data$videoFiles$2.size) || null;
|
|
29
|
-
|
|
29
|
+
const isEmbeddableLink = data.isEmbeddableLink && ((_data$videoFiles$3 = data.videoFiles[0]) === null || _data$videoFiles$3 === void 0 ? void 0 : _data$videoFiles$3.isEmbeddableLink) || false;
|
|
30
|
+
console.log(55, isEmbeddableLink, (0, _helpers.getVideoURL)(data));
|
|
30
31
|
const handlePlay = () => {
|
|
31
32
|
setVideoStates(prev => ({
|
|
32
33
|
...prev,
|
|
@@ -93,10 +94,10 @@ const Video = _ref => {
|
|
|
93
94
|
style: {
|
|
94
95
|
visibility: isLoaded ? 'visible' : 'hidden'
|
|
95
96
|
}
|
|
96
|
-
}, /*#__PURE__*/_react.default.createElement("video", {
|
|
97
|
+
}, !isEmbeddableLink && /*#__PURE__*/_react.default.createElement("video", {
|
|
97
98
|
className: "sdoc-video-element",
|
|
98
99
|
ref: videoRef,
|
|
99
|
-
src: (0, _helpers.getVideoURL)(data
|
|
100
|
+
src: (0, _helpers.getVideoURL)(data),
|
|
100
101
|
controls: true,
|
|
101
102
|
onClick: onClickVideo,
|
|
102
103
|
draggable: false,
|
|
@@ -106,6 +107,21 @@ const Video = _ref => {
|
|
|
106
107
|
style: {
|
|
107
108
|
boxShadow: isSelected ? '0 0 0 2px #007bff' : 'none'
|
|
108
109
|
}
|
|
110
|
+
}), isEmbeddableLink && /*#__PURE__*/_react.default.createElement("iframe", {
|
|
111
|
+
className: "sdoc-video-element",
|
|
112
|
+
ref: videoRef,
|
|
113
|
+
src: (0, _helpers.getVideoURL)(data),
|
|
114
|
+
onClick: onClickVideo,
|
|
115
|
+
draggable: false,
|
|
116
|
+
onPlay: handlePlay,
|
|
117
|
+
onPause: handlePause,
|
|
118
|
+
onLoad: handleVideoLoad,
|
|
119
|
+
title: data.src,
|
|
120
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
121
|
+
allowFullScreen: true,
|
|
122
|
+
style: {
|
|
123
|
+
boxShadow: isSelected ? '0 0 0 2px #007bff' : 'none'
|
|
124
|
+
}
|
|
109
125
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
110
126
|
className: "sdoc-video-play sdocfont sdoc-play icon-font",
|
|
111
127
|
style: {
|