1
1
import { type Message } from './common/message'
2
2
3
+ const sharedDocumentUrlPatterns : string [ ] = [
4
+ 'https://*.feishu.cn/*' ,
5
+ 'https://*.feishu.net/*' ,
6
+ 'https://*.larksuite.com/*' ,
7
+ 'https://*.feishu-pre.net/*' ,
8
+ 'https://*.larkoffice.com/*' ,
9
+ 'https://*.larkenterprise.com/*' ,
10
+ ]
11
+
3
12
enum MenuItemId {
4
13
DOWNLOAD_DOCX_AS_MARKDOWN = 'download_docx_as_markdown' ,
5
14
COPY_DOCX_AS_MARKDOWN = 'copy_docx_as_markdown' ,
@@ -10,39 +19,21 @@ chrome.runtime.onInstalled.addListener(() => {
10
19
chrome . contextMenus . create ( {
11
20
id : MenuItemId . DOWNLOAD_DOCX_AS_MARKDOWN ,
12
21
title : chrome . i18n . getMessage ( 'download_docx_as_markdown' ) ,
13
- documentUrlPatterns : [
14
- 'https://*.feishu.cn/*' ,
15
- 'https://*.feishu.net/*' ,
16
- 'https://*.larksuite.com/*' ,
17
- 'https://*.feishu-pre.net/*' ,
18
- 'https://*.larkoffice.com/*' ,
19
- ] ,
22
+ documentUrlPatterns : sharedDocumentUrlPatterns ,
20
23
contexts : [ 'page' , 'editable' ] ,
21
24
} )
22
25
23
26
chrome . contextMenus . create ( {
24
27
id : MenuItemId . COPY_DOCX_AS_MARKDOWN ,
25
28
title : chrome . i18n . getMessage ( 'copy_docx_as_markdown' ) ,
26
- documentUrlPatterns : [
27
- 'https://*.feishu.cn/*' ,
28
- 'https://*.feishu.net/*' ,
29
- 'https://*.larksuite.com/*' ,
30
- 'https://*.feishu-pre.net/*' ,
31
- 'https://*.larkoffice.com/*' ,
32
- ] ,
29
+ documentUrlPatterns : sharedDocumentUrlPatterns ,
33
30
contexts : [ 'page' , 'editable' ] ,
34
31
} )
35
32
36
33
chrome . contextMenus . create ( {
37
34
id : MenuItemId . VIEW_DOCX_AS_MARKDOWN ,
38
35
title : chrome . i18n . getMessage ( 'view_docx_as_markdown' ) ,
39
- documentUrlPatterns : [
40
- 'https://*.feishu.cn/*' ,
41
- 'https://*.feishu.net/*' ,
42
- 'https://*.larksuite.com/*' ,
43
- 'https://*.feishu-pre.net/*' ,
44
- 'https://*.larkoffice.com/*' ,
45
- ] ,
36
+ documentUrlPatterns : sharedDocumentUrlPatterns ,
46
37
contexts : [ 'page' , 'editable' ] ,
47
38
} )
48
39
} )
0 commit comments