提交 33c058d0 编写于 作者: R rebornix

fix mouse click on text status item

上级 d23c8824
......@@ -37,7 +37,8 @@ export interface IClickTarget {
export const enum ClickTargetType {
Container = 0,
CellStatus = 1,
ContributedItem = 2
ContributedTextItem = 2,
ContributedCommandItem = 3
}
export class CellEditorStatusBar extends Disposable {
......@@ -95,10 +96,18 @@ export class CellEditorStatusBar extends Disposable {
event: e
});
} else {
this._onDidClick.fire({
type: ClickTargetType.ContributedItem,
event: e
});
if ((e.target as HTMLElement).classList.contains('cell-status-item-has-command')) {
this._onDidClick.fire({
type: ClickTargetType.ContributedCommandItem,
event: e
});
} else {
// text
this._onDidClick.fire({
type: ClickTargetType.ContributedTextItem,
event: e
});
}
}
}));
}
......@@ -222,6 +231,7 @@ export class CellLanguageStatusBarItem extends Disposable {
super();
this.labelElement = DOM.append(container, $('.cell-language-picker.cell-status-item'));
this.labelElement.tabIndex = 0;
this.labelElement.classList.add('cell-status-item-has-command');
this._register(DOM.addDisposableListener(this.labelElement, DOM.EventType.CLICK, () => {
this.run();
......
......@@ -175,7 +175,7 @@ export class CodeCell extends Disposable {
// Mouse click handlers
this._register(templateData.statusBar.onDidClick(e => {
if (e.type !== ClickTargetType.ContributedItem) {
if (e.type !== ClickTargetType.ContributedCommandItem) {
const target = templateData.editor.getTargetAtClientPoint(e.event.clientX, e.event.clientY - viewCell.getEditorStatusbarHeight());
if (target?.position) {
templateData.editor.setPosition(target.position);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册