@opensumi/ide-editor 3.1.5-next-1720679730.0 → 3.1.5-next-1720770322.0
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/monaco-contrib/command/command.service.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/command/command.service.js +0 -1
- package/lib/browser/monaco-contrib/command/command.service.js.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.js +12 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.js.map +1 -1
- package/lib/browser/preference/schema.d.ts.map +1 -1
- package/lib/browser/preference/schema.js +5 -0
- package/lib/browser/preference/schema.js.map +1 -1
- package/lib/browser/tab.view.d.ts.map +1 -1
- package/lib/browser/tab.view.js +6 -3
- package/lib/browser/tab.view.js.map +1 -1
- package/lib/browser/workbench-editor.service.d.ts +1 -0
- package/lib/browser/workbench-editor.service.d.ts.map +1 -1
- package/lib/browser/workbench-editor.service.js +15 -3
- package/lib/browser/workbench-editor.service.js.map +1 -1
- package/lib/common/editor.d.ts +4 -0
- package/lib/common/editor.d.ts.map +1 -1
- package/lib/common/editor.js.map +1 -1
- package/package.json +14 -14
- package/src/browser/monaco-contrib/command/command.service.ts +0 -1
- package/src/browser/monaco-contrib/tokenizer/textmate.service.ts +11 -1
- package/src/browser/preference/schema.ts +5 -0
- package/src/browser/tab.view.tsx +7 -3
- package/src/browser/workbench-editor.service.ts +17 -3
- package/src/common/editor.ts +5 -0
|
@@ -1344,6 +1344,11 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
|
|
|
1344
1344
|
return this.pinPreviewed(uri);
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
|
+
protected getPreventScrollOption(options: IResourceOpenOptions = {}) {
|
|
1348
|
+
const preventScroll = options.preventScroll ?? this.preferenceService.get('editor.preventScrollAfterFocused');
|
|
1349
|
+
return preventScroll;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1347
1352
|
async doOpen(
|
|
1348
1353
|
uri: URI,
|
|
1349
1354
|
options: IResourceOpenOptions = {},
|
|
@@ -1357,6 +1362,7 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
|
|
|
1357
1362
|
const previewMode =
|
|
1358
1363
|
this.preferenceService.get('editor.previewMode') &&
|
|
1359
1364
|
(isUndefinedOrNull(options.preview) ? true : options.preview);
|
|
1365
|
+
|
|
1360
1366
|
if (
|
|
1361
1367
|
this.currentResource &&
|
|
1362
1368
|
this.currentResource.uri.isEqual(uri) &&
|
|
@@ -1365,7 +1371,10 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
|
|
|
1365
1371
|
) {
|
|
1366
1372
|
// 就是当前打开的 Resource
|
|
1367
1373
|
if (options.focus && this.currentEditor) {
|
|
1368
|
-
this.
|
|
1374
|
+
const preventScroll = this.getPreventScrollOption(options);
|
|
1375
|
+
this._domNode?.focus({
|
|
1376
|
+
preventScroll,
|
|
1377
|
+
});
|
|
1369
1378
|
this.currentEditor.monacoEditor.focus();
|
|
1370
1379
|
}
|
|
1371
1380
|
if (options.range && this.currentEditor) {
|
|
@@ -1611,7 +1620,8 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
|
|
|
1611
1620
|
});
|
|
1612
1621
|
|
|
1613
1622
|
if (options.focus) {
|
|
1614
|
-
this.
|
|
1623
|
+
const preventScroll = this.getPreventScrollOption(options);
|
|
1624
|
+
this._domNode?.focus({ preventScroll });
|
|
1615
1625
|
// monaco 编辑器的 focus 多了一步检查,由于此时其实对应编辑器的 dom 的 display 为 none (需要等 React 下一次渲染才会改变为 block),
|
|
1616
1626
|
// 会引起 document.activeElement !== editor.textArea.domNode,进而会导致focus失败
|
|
1617
1627
|
// 需要等待真正 append 之后再
|
|
@@ -1663,7 +1673,10 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
|
|
|
1663
1673
|
}
|
|
1664
1674
|
await this.diffEditor.compare(original, modified, options, resource.uri);
|
|
1665
1675
|
if (options.focus) {
|
|
1666
|
-
this.
|
|
1676
|
+
const preventScroll = this.getPreventScrollOption(options);
|
|
1677
|
+
this._domNode?.focus({
|
|
1678
|
+
preventScroll,
|
|
1679
|
+
});
|
|
1667
1680
|
|
|
1668
1681
|
const disposer = this.eventBus.on(CodeEditorDidVisibleEvent, (e) => {
|
|
1669
1682
|
if (e.payload.groupName === this.name && e.payload.type === EditorOpenType.diff) {
|
|
@@ -2192,6 +2205,7 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
|
|
|
2192
2205
|
|
|
2193
2206
|
focus() {
|
|
2194
2207
|
this.gainFocus();
|
|
2208
|
+
|
|
2195
2209
|
if (this.currentOpenType && this.currentOpenType.type === EditorOpenType.code) {
|
|
2196
2210
|
this.codeEditor.focus();
|
|
2197
2211
|
}
|
package/src/common/editor.ts
CHANGED
|
@@ -586,6 +586,11 @@ export interface IResourceOpenOptions {
|
|
|
586
586
|
*/
|
|
587
587
|
focus?: boolean;
|
|
588
588
|
|
|
589
|
+
/**
|
|
590
|
+
* If set `focus`, the editor's dom will be focused, This option prevents the element from being scrolled after getting the focus.
|
|
591
|
+
*/
|
|
592
|
+
preventScroll?: boolean;
|
|
593
|
+
|
|
589
594
|
/**
|
|
590
595
|
* 强制使用指定的打开方式
|
|
591
596
|
*/
|