@opensumi/ide-comments 2.21.7-rc-1670229502.0 → 2.21.7
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.
- package/lib/browser/comments-feature.registry.js.map +1 -1
- package/lib/browser/comments-thread.js +6 -6
- package/lib/browser/comments-thread.js.map +1 -1
- package/lib/browser/comments-zone.service.js.map +1 -1
- package/lib/browser/comments-zone.view.js +1 -1
- package/lib/browser/comments-zone.view.js.map +1 -1
- package/lib/browser/comments.contribution.js.map +1 -1
- package/lib/browser/comments.service.js.map +1 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/common/index.d.ts +4 -4
- package/lib/common/index.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/browser/comment-reactions.view.tsx +0 -109
- package/src/browser/comments-body.tsx +0 -57
- package/src/browser/comments-feature.registry.ts +0 -91
- package/src/browser/comments-item.view.tsx +0 -362
- package/src/browser/comments-panel.view.tsx +0 -127
- package/src/browser/comments-textarea.view.tsx +0 -194
- package/src/browser/comments-thread.ts +0 -300
- package/src/browser/comments-zone.service.ts +0 -29
- package/src/browser/comments-zone.view.tsx +0 -206
- package/src/browser/comments.contribution.ts +0 -196
- package/src/browser/comments.module.less +0 -210
- package/src/browser/comments.service.ts +0 -540
- package/src/browser/index.ts +0 -26
- package/src/browser/markdown.style.ts +0 -25
- package/src/browser/mentions.style.ts +0 -55
- package/src/common/index.ts +0 -707
- package/src/index.ts +0 -1
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { Autowired } from '@opensumi/di';
|
|
2
|
-
import {
|
|
3
|
-
Domain,
|
|
4
|
-
ClientAppContribution,
|
|
5
|
-
Disposable,
|
|
6
|
-
localize,
|
|
7
|
-
ContributionProvider,
|
|
8
|
-
Event,
|
|
9
|
-
ToolbarRegistry,
|
|
10
|
-
CommandContribution,
|
|
11
|
-
CommandRegistry,
|
|
12
|
-
getIcon,
|
|
13
|
-
TabBarToolbarContribution,
|
|
14
|
-
IEventBus,
|
|
15
|
-
} from '@opensumi/ide-core-browser';
|
|
16
|
-
import { IMenuRegistry, MenuId, MenuContribution } from '@opensumi/ide-core-browser/lib/menu/next';
|
|
17
|
-
import { IEditor } from '@opensumi/ide-editor';
|
|
18
|
-
import { BrowserEditorContribution, IEditorFeatureRegistry } from '@opensumi/ide-editor/lib/browser';
|
|
19
|
-
import { IMainLayoutService } from '@opensumi/ide-main-layout';
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
ICommentsService,
|
|
23
|
-
CommentPanelId,
|
|
24
|
-
CommentsContribution,
|
|
25
|
-
ICommentsFeatureRegistry,
|
|
26
|
-
CollapseId,
|
|
27
|
-
CommentPanelCollapse,
|
|
28
|
-
CloseThreadId,
|
|
29
|
-
ICommentThreadTitle,
|
|
30
|
-
SwitchCommandReaction,
|
|
31
|
-
ICommentsThread,
|
|
32
|
-
CommentReactionPayload,
|
|
33
|
-
CommentReactionClick,
|
|
34
|
-
} from '../common';
|
|
35
|
-
|
|
36
|
-
@Domain(
|
|
37
|
-
ClientAppContribution,
|
|
38
|
-
BrowserEditorContribution,
|
|
39
|
-
CommandContribution,
|
|
40
|
-
TabBarToolbarContribution,
|
|
41
|
-
MenuContribution,
|
|
42
|
-
)
|
|
43
|
-
export class CommentsBrowserContribution
|
|
44
|
-
extends Disposable
|
|
45
|
-
implements
|
|
46
|
-
ClientAppContribution,
|
|
47
|
-
BrowserEditorContribution,
|
|
48
|
-
CommandContribution,
|
|
49
|
-
TabBarToolbarContribution,
|
|
50
|
-
MenuContribution
|
|
51
|
-
{
|
|
52
|
-
@Autowired(ICommentsService)
|
|
53
|
-
private readonly commentsService: ICommentsService;
|
|
54
|
-
|
|
55
|
-
@Autowired(IMainLayoutService)
|
|
56
|
-
private readonly layoutService: IMainLayoutService;
|
|
57
|
-
|
|
58
|
-
@Autowired(ICommentsFeatureRegistry)
|
|
59
|
-
private readonly commentsFeatureRegistry: ICommentsFeatureRegistry;
|
|
60
|
-
|
|
61
|
-
@Autowired(CommentsContribution)
|
|
62
|
-
private readonly contributions: ContributionProvider<CommentsContribution>;
|
|
63
|
-
|
|
64
|
-
@Autowired(IEventBus)
|
|
65
|
-
private readonly eventBus: IEventBus;
|
|
66
|
-
|
|
67
|
-
onStart() {
|
|
68
|
-
this.registerCommentsFeature();
|
|
69
|
-
this.listenToCreateCommentsPanel();
|
|
70
|
-
this.commentsService.init();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get panelBadge() {
|
|
74
|
-
const length = this.commentsService.commentsThreads.length;
|
|
75
|
-
return length ? length + '' : '';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
registerCommands(registry: CommandRegistry) {
|
|
79
|
-
registry.registerCommand(
|
|
80
|
-
{
|
|
81
|
-
id: CollapseId,
|
|
82
|
-
label: '%comments.panel.action.collapse%',
|
|
83
|
-
iconClass: getIcon('collapse-all'),
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
execute: () => {
|
|
87
|
-
this.eventBus.fire(new CommentPanelCollapse());
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
registry.registerCommand(
|
|
93
|
-
{
|
|
94
|
-
id: CloseThreadId,
|
|
95
|
-
label: '%comments.thread.action.close%',
|
|
96
|
-
iconClass: getIcon('up'),
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
execute: (threadTitle: ICommentThreadTitle) => {
|
|
100
|
-
const { thread, widget } = threadTitle;
|
|
101
|
-
if (!thread.comments.length) {
|
|
102
|
-
thread.dispose();
|
|
103
|
-
} else {
|
|
104
|
-
if (widget.isShow) {
|
|
105
|
-
widget.toggle();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
registry.registerCommand(
|
|
113
|
-
{ id: SwitchCommandReaction },
|
|
114
|
-
{
|
|
115
|
-
execute: (payload: CommentReactionPayload) => {
|
|
116
|
-
this.eventBus.fire(new CommentReactionClick(payload));
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
registerMenus(registry: IMenuRegistry): void {
|
|
123
|
-
registry.registerMenuItem(MenuId.CommentsCommentThreadTitle, {
|
|
124
|
-
command: CloseThreadId,
|
|
125
|
-
group: 'inline',
|
|
126
|
-
order: Number.MAX_SAFE_INTEGER,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
registerToolbarItems(registry: ToolbarRegistry) {
|
|
131
|
-
registry.registerItem({
|
|
132
|
-
id: CollapseId,
|
|
133
|
-
viewId: CommentPanelId,
|
|
134
|
-
command: CollapseId,
|
|
135
|
-
tooltip: localize('comments.panel.action.collapse'),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
private registerCommentsFeature() {
|
|
140
|
-
this.contributions.getContributions().forEach((contribution, index) => {
|
|
141
|
-
this.addDispose(
|
|
142
|
-
this.commentsService.registerCommentRangeProvider(`contribution_${index}`, {
|
|
143
|
-
getCommentingRanges: (documentModel) => contribution.provideCommentingRanges(documentModel),
|
|
144
|
-
}),
|
|
145
|
-
);
|
|
146
|
-
if (contribution.registerCommentsFeature) {
|
|
147
|
-
contribution.registerCommentsFeature(this.commentsFeatureRegistry);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* 因为大多数情况下没有评论,所以默认先不注册底部面板
|
|
153
|
-
* 在第一次创建 thread 的时候再创建底部面板
|
|
154
|
-
* @memberof CommentsBrowserContribution
|
|
155
|
-
*/
|
|
156
|
-
private listenToCreateCommentsPanel() {
|
|
157
|
-
if (this.commentsFeatureRegistry.getCommentsPanelOptions().defaultShow) {
|
|
158
|
-
this.commentsService.registerCommentPanel();
|
|
159
|
-
} else {
|
|
160
|
-
Event.once(this.commentsService.onThreadsCreated)(() => {
|
|
161
|
-
this.commentsService.registerCommentPanel();
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
this.addDispose(
|
|
166
|
-
Event.debounce(
|
|
167
|
-
this.commentsService.onThreadsChanged,
|
|
168
|
-
() => {},
|
|
169
|
-
100,
|
|
170
|
-
)(() => {
|
|
171
|
-
const handler = this.layoutService.getTabbarHandler(CommentPanelId);
|
|
172
|
-
handler?.setBadge(this.panelBadge);
|
|
173
|
-
}, this),
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
registerEditorFeature(registry: IEditorFeatureRegistry) {
|
|
178
|
-
registry.registerEditorFeatureContribution({
|
|
179
|
-
contribute: (editor: IEditor) => this.commentsService.handleOnCreateEditor(editor),
|
|
180
|
-
provideEditorOptionsForUri: async (uri) => {
|
|
181
|
-
const ranges = await this.commentsService.getContributionRanges(uri);
|
|
182
|
-
|
|
183
|
-
// 说明当前 uri 可以评论
|
|
184
|
-
if (ranges.length) {
|
|
185
|
-
return {
|
|
186
|
-
// 让编辑器的 lineDecorationsWidth 宽一点,以便放下评论 icon
|
|
187
|
-
lineDecorationsWidth: 25,
|
|
188
|
-
lineNumbersMinChars: 5,
|
|
189
|
-
};
|
|
190
|
-
} else {
|
|
191
|
-
return {};
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
:global {
|
|
2
|
-
.monaco-editor {
|
|
3
|
-
.comments-decoration {
|
|
4
|
-
border-radius: 50%;
|
|
5
|
-
// 防止被其他的 decoration 盖住
|
|
6
|
-
position: absolute;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
z-index: 1;
|
|
9
|
-
&::before {
|
|
10
|
-
font-weight: normal;
|
|
11
|
-
color: var(--foreground);
|
|
12
|
-
background: var(--editor-background);
|
|
13
|
-
border-radius: 50%;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.comments-add {
|
|
18
|
-
margin-left: 2px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.comments-thread {
|
|
22
|
-
left: 4px !important;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.cldr.insert-sign,
|
|
26
|
-
.cldr.delete-sign {
|
|
27
|
-
background-position: right;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.comment_container {
|
|
33
|
-
font-size: 12px;
|
|
34
|
-
background-color: var(--kt-popover-background);
|
|
35
|
-
border-top: 1px solid var(--peekView-border);
|
|
36
|
-
border-bottom: 1px solid var(--peekView-border);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.head {
|
|
40
|
-
display: flex;
|
|
41
|
-
justify-content: space-between;
|
|
42
|
-
align-items: center;
|
|
43
|
-
height: 28px;
|
|
44
|
-
line-height: 22px;
|
|
45
|
-
padding: 0 2px 0 14px;
|
|
46
|
-
border-bottom: 1px solid var(--kt-tab-borderDown);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.review_title {
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
text-overflow: ellipsis;
|
|
52
|
-
white-space: nowrap;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.title_actions {
|
|
56
|
-
display: flex;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.comment_body {
|
|
60
|
-
padding: 18px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.comment_shadow_box {
|
|
64
|
-
padding: 8px 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.comment_bottom_actions {
|
|
68
|
-
margin-top: 12px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.reply_item_title {
|
|
72
|
-
visibility: hidden;
|
|
73
|
-
display: inline-block;
|
|
74
|
-
margin-left: 8px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.textarea_container {
|
|
78
|
-
background-color: var(--input-background);
|
|
79
|
-
padding: 4px 16px;
|
|
80
|
-
border-radius: 2px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.mention {
|
|
84
|
-
width: 100%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.textarea_preview {
|
|
88
|
-
min-height: 56px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.comment_reply_actions {
|
|
92
|
-
justify-content: flex-start;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.comment_item {
|
|
96
|
-
display: flex;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.comment_item_content {
|
|
100
|
-
flex: 1;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.comment_item_head {
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
justify-content: space-between;
|
|
107
|
-
margin-bottom: 4px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.comment_item_author {
|
|
111
|
-
display: flex;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.comment_item_name {
|
|
115
|
-
display: flex;
|
|
116
|
-
align-items: center;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.comment_item_author_name {
|
|
120
|
-
line-height: 20px;
|
|
121
|
-
color: var(--descriptionForeground);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.comment_item_timestamp {
|
|
125
|
-
margin-left: 2px;
|
|
126
|
-
line-height: 20px;
|
|
127
|
-
color: var(--descriptionForeground);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.comment_item_markdown_header {
|
|
131
|
-
display: flex;
|
|
132
|
-
justify-content: space-between;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.comment_item_label {
|
|
136
|
-
margin-left: 5px;
|
|
137
|
-
color: var(--descriptionForeground);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.comment_item_icon {
|
|
141
|
-
width: 24px;
|
|
142
|
-
height: 24px;
|
|
143
|
-
border-radius: 50%;
|
|
144
|
-
margin-right: 10px;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.reply_item {
|
|
148
|
-
margin-bottom: 8px;
|
|
149
|
-
&:last-child {
|
|
150
|
-
margin-bottom: 0;
|
|
151
|
-
}
|
|
152
|
-
&:hover {
|
|
153
|
-
.reply_item_title {
|
|
154
|
-
visibility: visible;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.reply_item_icon {
|
|
160
|
-
width: 16px;
|
|
161
|
-
height: 16px;
|
|
162
|
-
border-radius: 50%;
|
|
163
|
-
margin-right: 8px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.comment_item_actions {
|
|
167
|
-
display: flex;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.comment_item_reply_button {
|
|
171
|
-
margin: 0 6px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.comment_item_reply_wrap {
|
|
175
|
-
margin-top: 4px;
|
|
176
|
-
padding: 14px 12px;
|
|
177
|
-
background: var(--kt-popover-prominentBackground);
|
|
178
|
-
border-radius: 2px;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.comment_item_reply {
|
|
182
|
-
margin-top: 12px;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.comment_item_context {
|
|
186
|
-
margin: 12px 0;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.comment_panel {
|
|
190
|
-
font-size: 12px;
|
|
191
|
-
line-height: 22px;
|
|
192
|
-
width: 100%;
|
|
193
|
-
height: 100%;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.panel_placeholder {
|
|
197
|
-
position: absolute;
|
|
198
|
-
top: 50%;
|
|
199
|
-
left: 50%;
|
|
200
|
-
transform: translate(-50%, -50%);
|
|
201
|
-
color: var(--kt-panel-secondaryForeground);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.comment_reactions {
|
|
205
|
-
margin-top: 4px;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.comment_reaction {
|
|
209
|
-
margin-right: 4px;
|
|
210
|
-
}
|