@seafile/sdoc-editor 1.0.206-test0.3.2 → 1.0.206-test0.3.4

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.
@@ -55,11 +55,6 @@ class SeafileAPI {
55
55
  const url = '/api/v2.1/seadoc/download-image/' + docUuid + '/' + encodeURIComponent(imageName);
56
56
  return this.req.get(url);
57
57
  }
58
- getSdocDownloadVideoUrl(docUuid, imageName) {
59
- console.log(docUuid, imageName);
60
- const url = '/api/v2.1/seadoc/download-video/' + docUuid + '/' + encodeURIComponent(imageName);
61
- return this.req.get(url);
62
- }
63
58
  getVideoFileNameWithUuid(file) {
64
59
  return 'video-' + _slugid.default.nice() + file.name.slice(file.name.lastIndexOf('.'));
65
60
  }
@@ -61,7 +61,6 @@ const InsertElementDialog = _ref => {
61
61
  }, []);
62
62
  const onVideoFileChanged = (0, _react.useCallback)(event => {
63
63
  const files = event.target.files;
64
- console.log(files);
65
64
  // Show warning for 3s and no further insertion if video file is more than 5MB
66
65
  if (files[0].size > _index5.VIDEO_MAX_SIZE_5MB) {
67
66
  handleDisplayAlert();
@@ -40,7 +40,7 @@ const SelectSdocFileDialog = _ref => {
40
40
  modalTitle = 'Select_sdoc_document';
41
41
  break;
42
42
  case _constants.ELEMENT_TYPE.VIDEO:
43
- modalTitle = 'Select_video';
43
+ modalTitle = 'Select_video_file';
44
44
  break;
45
45
  default:
46
46
  break;
@@ -56,13 +56,11 @@ const generateVideoNode = (src, videoFiles) => {
56
56
  exports.generateVideoNode = generateVideoNode;
57
57
  const parseVideoLink = url => {
58
58
  if (!url) return false;
59
- console.log(0, url);
60
59
 
61
60
  // Youtube url conversion
62
61
  if (url.includes('youtube.com')) {
63
62
  const videoId = new URL(url).searchParams.get('v');
64
63
  const videoUrl = videoId ? `https://www.youtube.com/embed/${videoId}/?rel=0` : false;
65
- console.log(videoUrl);
66
64
  return videoUrl;
67
65
  }
68
66
 
@@ -70,7 +68,6 @@ const parseVideoLink = url => {
70
68
  if (url.includes('v.qq.com')) {
71
69
  const vidMatch = url.match(/\/([^\/]+)\.html$/);
72
70
  const videoUrl = vidMatch !== null && vidMatch !== void 0 && vidMatch[1] ? `https://v.qq.com/txp/iframe/player.html?vid=${vidMatch[1]}` : false;
73
- console.log(videoUrl);
74
71
  return videoUrl;
75
72
  }
76
73
 
@@ -85,14 +82,14 @@ const insertVideo = function (editor, videoFiles, srcList, selection) {
85
82
  if (position !== _constants.INSERT_POSITION.AFTER) {
86
83
  if (isInsertVideoMenuDisabled(editor)) return;
87
84
  }
88
- console.log(videoFiles, srcList);
89
85
  let videoNodes;
90
86
  // Parse youtube and tencent video url when embed thirdPlatform link
91
87
  if (Array.isArray(videoFiles) && (_videoFiles$ = videoFiles[0]) !== null && _videoFiles$ !== void 0 && _videoFiles$.isEmbeddableLink) {
92
88
  const parsedSrc = parseVideoLink(srcList[0]);
93
89
  if (!parsedSrc) return;
94
- console.log([parsedSrc]);
95
- videoNodes = generateVideoNode([parsedSrc], videoFiles);
90
+ videoNodes = [parsedSrc].map(src => {
91
+ return generateVideoNode(src, videoFiles);
92
+ });
96
93
  } else {
97
94
  videoNodes = srcList.map(src => {
98
95
  return generateVideoNode(src, videoFiles);
@@ -164,8 +161,6 @@ const getVideoURL = data => {
164
161
  if (url && url.startsWith('http')) return url;
165
162
  const serviceUrl = _context.default.getSetting('serviceUrl');
166
163
  const assetsUrl = _context.default.getSetting('assetsUrl');
167
- console.log(3, serviceUrl, assetsUrl, url);
168
- console.log(4, (0, _urlJoin.default)(serviceUrl, assetsUrl, url));
169
164
  return (0, _urlJoin.default)(serviceUrl, assetsUrl, url);
170
165
  };
171
166
  exports.getVideoURL = getVideoURL;
@@ -60,15 +60,6 @@
60
60
  width: 100%;
61
61
  }
62
62
 
63
- /* .sdoc-video-element canvas {
64
- position: fixed;
65
- top: 0;
66
- left: 0;
67
- width: 100vw;
68
- height: 100vh;
69
- object-fit: contain;
70
- } */
71
-
72
63
  .sdoc-video-inner .sdoc-video-element:focus-visible {
73
64
  outline: none;
74
65
  }
@@ -73,6 +73,6 @@ const VideoMenu = _ref => {
73
73
  }, t('Add_video_link')), /*#__PURE__*/_react.default.createElement("div", {
74
74
  className: "sdoc-dropdown-menu-item",
75
75
  onClick: openSelectVideoFileDialog
76
- }, t('Link_to_Seafile_video_file')))));
76
+ }, t('Link_Seafile_video_file')))));
77
77
  };
78
78
  var _default = exports.default = VideoMenu;
@@ -24,10 +24,9 @@ const Video = _ref => {
24
24
  const [isLoaded, setIsLoaded] = (0, _react.useState)(false);
25
25
  const [isSelected, setIsSelected] = (0, _react.useState)(false);
26
26
  const [videoStates, setVideoStates] = (0, _react.useState)({});
27
- const videoFileName = data.videoFiles && ((_data$videoFiles$ = data.videoFiles[0]) === null || _data$videoFiles$ === void 0 ? void 0 : _data$videoFiles$.name) || null;
27
+ const videoFileName = data.videoFiles && ((_data$videoFiles$ = data.videoFiles[0]) === null || _data$videoFiles$ === void 0 ? void 0 : _data$videoFiles$.name) || data.src || 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.videoFiles && ((_data$videoFiles$3 = data.videoFiles[0]) === null || _data$videoFiles$3 === void 0 ? void 0 : _data$videoFiles$3.isEmbeddableLink) || false;
30
- console.log(55, data.videoFiles, isEmbeddableLink, (0, _helpers.getVideoURL)(data));
31
30
  const handlePlay = () => {
32
31
  setVideoStates(prev => ({
33
32
  ...prev,
@@ -69,25 +68,6 @@ const Video = _ref => {
69
68
  document.removeEventListener('click', onClickOutside);
70
69
  };
71
70
  }, [onClickOutside]);
72
- (0, _react.useEffect)(() => {
73
- const enterFullscreen = () => {
74
- if (videoRef.current) {
75
- const iframeElement = videoRef.current;
76
- console.log(333);
77
- if (iframeElement.requestFullscreen) {
78
- iframeElement.requestFullscreen();
79
- } else if (iframeElement.webkitRequestFullscreen) {
80
- iframeElement.webkitRequestFullscreen(); // Safari
81
- } else if (iframeElement.mozRequestFullScreen) {
82
- iframeElement.mozRequestFullScreen(); // Firefox
83
- } else if (iframeElement.msRequestFullscreen) {
84
- iframeElement.msRequestFullscreen(); // IE/Edge
85
- }
86
- }
87
- };
88
-
89
- // enterFullscreen();
90
- }, []);
91
71
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !isLoaded && /*#__PURE__*/_react.default.createElement("div", {
92
72
  className: "video-loading-placeholder"
93
73
  }, /*#__PURE__*/_react.default.createElement("img", {
@@ -134,12 +114,16 @@ const Video = _ref => {
134
114
  contentEditable: "false"
135
115
  })), isEmbeddableLink && /*#__PURE__*/_react.default.createElement("iframe", {
136
116
  className: "sdoc-video-element",
137
- ref: videoRef,
138
117
  title: data.src,
139
118
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
140
119
  allowFullScreen: true,
141
120
  src: (0, _helpers.getVideoURL)(data),
142
- onLoad: handleVideoLoad
121
+ onLoad: handleVideoLoad,
122
+ style: {
123
+ width: '100%',
124
+ height: '100%',
125
+ border: 'none'
126
+ }
143
127
  }))));
144
128
  };
145
129
  const SdocVideo = (0, _reactI18next.withTranslation)('sdoc-editor')(Video);
package/dist/context.js CHANGED
@@ -51,16 +51,6 @@ class Context {
51
51
  return relative_path;
52
52
  });
53
53
  });
54
- (0, _defineProperty2.default)(this, "getSeafileVideo", videoName => {
55
- const docUuid = this.getSetting('docUuid');
56
- return this.api.getSdocDownloadVideoUrl(docUuid, videoName).then(res => {
57
- console.log(3, docUuid, videoName, res);
58
- const {
59
- relative_path
60
- } = res.data;
61
- return relative_path;
62
- });
63
- });
64
54
  this.settings = null;
65
55
  this.sdocServerApi = null;
66
56
  this.api = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.206-test0.3.2",
3
+ "version": "1.0.206-test0.3.4",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "KI fragen",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Vidéo",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 columns",
574
574
  "Full_width_mode": "Full width mode",
575
575
  "Video": "Video",
576
- "Upload_local_video": "Upload_local_video",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "The_current_version_does_not_support_>5MB_video_file",
578
578
  "Token_expired_Please_refresh_the_page": "Token expired. Please refresh the page.",
579
579
  "Link_to_page": "Link to page",
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "Ask AI",
607
607
  "Enter_reply": "Enter reply",
608
608
  "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
609
+ "AI_error_message": "Request error, please try again",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -573,7 +573,7 @@
573
573
  "Five_column": "5 столбцов",
574
574
  "Full_width_mode": "Режим полной ширины",
575
575
  "Video": "Видео",
576
- "Upload_local_video": "Загрузка_локального_видео",
576
+ "Upload_local_video": "Upload local video",
577
577
  "The_current_version_does_not_support_>5MB_video_file": "Текущая_версия_не_поддерживает_видео_файл_>5_МБ",
578
578
  "Token_expired_Please_refresh_the_page": "Срок действия токена истек. Обновите страницу.",
579
579
  "Link_to_page": "Ссылка на страницу",
@@ -605,6 +605,9 @@
605
605
  "Chinese": "Китайский",
606
606
  "Ask_AI": "Спросить ИИ",
607
607
  "Enter_reply": "Введите ответ",
608
- "Processing_content_cannot_be_empty": "Processing content cannot be empty",
609
- "AI_error_message": "Request error, please try again"
608
+ "Processing_content_cannot_be_empty": "Содержимое обработки не может быть пустым",
609
+ "AI_error_message": "Ошибка запроса, попробуйте еще раз",
610
+ "Add_video_link": "Add video link",
611
+ "Link_Seafile_video_file": "Link Seafile video file",
612
+ "Select_video_file": "Select video file"
610
613
  }
@@ -606,5 +606,8 @@
606
606
  "Ask_AI": "询问 AI",
607
607
  "Enter_reply": "输入回复",
608
608
  "Processing_content_cannot_be_empty": "处理内容不能为空",
609
- "AI_error_message": "请求错误,请重试"
609
+ "AI_error_message": "请求错误,请重试",
610
+ "Add_video_link": "添加视频链接",
611
+ "Link_Seafile_video_file": "链接Seafile视频文件",
612
+ "Select_video_file": "选择视频文件"
610
613
  }