未验证 提交 c8b2adbb 编写于 作者: R rebornix

fix #132314.

上级 1ca0acfe
......@@ -282,6 +282,38 @@ export class NotebookClipboardContribution extends Disposable {
};
}
private _focusInsideEmebedMonaco(editor: INotebookEditor) {
const windowSelection = window.getSelection();
if (windowSelection?.rangeCount !== 1) {
return false;
}
const activeSelection = windowSelection.getRangeAt(0);
if (activeSelection.startContainer === activeSelection.endContainer && activeSelection.endOffset - activeSelection.startOffset === 0) {
return false;
}
let container: any = activeSelection.commonAncestorContainer;
const body = editor.getDomNode();
if (!body.contains(container)) {
return false;
}
while (container
&&
container !== body) {
if ((container as HTMLElement).classList && (container as HTMLElement).classList.contains('monaco-editor')) {
return true;
}
container = container.parentNode;
}
return false;
}
runCopyAction(accessor: ServicesAccessor) {
const activeElement = <HTMLElement>document.activeElement;
if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) {
......@@ -293,6 +325,10 @@ export class NotebookClipboardContribution extends Disposable {
return false;
}
if (this._focusInsideEmebedMonaco(editor)) {
return false;
}
return runCopyCells(accessor, editor, undefined);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册