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

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.
@@ -56,6 +56,7 @@ const generateVideoNode = (src, videoFiles) => {
56
56
  exports.generateVideoNode = generateVideoNode;
57
57
  const parseVideoLink = url => {
58
58
  if (!url) return false;
59
+ console.log(url);
59
60
 
60
61
  // Youtube url conversion
61
62
  if (url.includes('youtube.com')) {
@@ -71,6 +72,22 @@ const parseVideoLink = url => {
71
72
  return videoUrl;
72
73
  }
73
74
 
75
+ // Bilibili url conversion
76
+ if (url.includes('bilibili.com')) {
77
+ const vidMatch = url.match(/\/video\/(BV[0-9A-Za-z]+)/);
78
+ const videoUrl = vidMatch !== null && vidMatch !== void 0 && vidMatch[1] ? `https://player.bilibili.com/player.html?bvid=${vidMatch[1]}` : false;
79
+ console.log(videoUrl);
80
+ return videoUrl;
81
+ }
82
+
83
+ // Youku url conversion
84
+ if (url.includes('v.youku.com')) {
85
+ const vidMatch = url.match(/id_([A-Za-z0-9=]+)\.html/);
86
+ const videoUrl = vidMatch !== null && vidMatch !== void 0 && vidMatch[1] ? `https://player.youku.com/embed/${vidMatch[1]}` : false;
87
+ console.log(videoUrl);
88
+ return videoUrl;
89
+ }
90
+
74
91
  // Unsupported url
75
92
  return false;
76
93
  };
@@ -83,7 +100,7 @@ const insertVideo = function (editor, videoFiles, srcList, selection) {
83
100
  if (isInsertVideoMenuDisabled(editor)) return;
84
101
  }
85
102
  let videoNodes;
86
- // Parse youtube and tencent video url when embed thirdPlatform link
103
+ // Parse youtube, tencent or bilibili video url when embed thirdPlatform link
87
104
  if (Array.isArray(videoFiles) && (_videoFiles$ = videoFiles[0]) !== null && _videoFiles$ !== void 0 && _videoFiles$.isEmbeddableLink) {
88
105
  const parsedSrc = parseVideoLink(srcList[0]);
89
106
  if (!parsedSrc) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.206-test0.3.4",
3
+ "version": "1.0.206-test0.3.6",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",