Skip to content

Commit e155191

Browse files
author
Loïc Mangeonjean
committed
fix: improve shadow dom feature
1 parent 754e2fd commit e155191

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

vscode-patches/0060-feat-support-shadow-dom.patch

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Subject: [PATCH] feat: support shadow dom
1212
src/vs/base/browser/ui/dnd/dnd.ts | 4 +-
1313
src/vs/base/browser/ui/findinput/findInput.ts | 3 +-
1414
.../base/browser/ui/findinput/replaceInput.ts | 3 +-
15-
src/vs/base/browser/ui/inputbox/inputBox.ts | 2 +-
15+
src/vs/base/browser/ui/inputbox/inputBox.ts | 7 ++-
1616
src/vs/base/browser/ui/sash/sash.ts | 2 +-
1717
src/vs/base/browser/ui/splitview/paneview.ts | 6 +-
1818
src/vs/base/browser/ui/splitview/splitview.ts | 6 +-
@@ -49,7 +49,7 @@ Subject: [PATCH] feat: support shadow dom
4949
.../browser/walkThroughPart.ts | 6 +-
5050
.../suggest/browser/simpleSuggestWidget.ts | 4 +-
5151
.../themes/browser/workbenchThemeService.ts | 2 +-
52-
45 files changed, 187 insertions(+), 99 deletions(-)
52+
45 files changed, 192 insertions(+), 99 deletions(-)
5353

5454
diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts
5555
index fe9d624543a..870041f35f2 100644
@@ -379,15 +379,20 @@ index 10c5b47b653..6dd9e205c71 100644
379379
let newIndex: number = -1;
380380
if (event.equals(KeyCode.RightArrow)) {
381381
diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts
382-
index 9b55cd2ec68..a7606504872 100644
382+
index 9b55cd2ec68..bdc8f7f689b 100644
383383
--- a/src/vs/base/browser/ui/inputbox/inputBox.ts
384384
+++ b/src/vs/base/browser/ui/inputbox/inputBox.ts
385-
@@ -174,7 +174,7 @@ export class InputBox extends Widget {
385+
@@ -174,7 +174,12 @@ export class InputBox extends Widget {
386386

387387
const onSelectionChange = this._register(new DomEmitter(container.ownerDocument, 'selectionchange'));
388388
const onAnchoredSelectionChange = Event.filter(onSelectionChange.event, () => {
389389
- const selection = container.ownerDocument.getSelection();
390-
+ const selection = (container.getRootNode() as Document).getSelection();
390+
+ let selection = container.ownerDocument.getSelection();
391+
+ const rootNode = container.getRootNode();
392+
+ if (dom.isShadowRoot(rootNode)) {
393+
+ // Shadow root implements the getSelection method on chrome
394+
+ selection = (rootNode as (ShadowRoot & { getSelection?: () => Selection | null })).getSelection?.() ?? selection;
395+
+ }
391396
return selection?.anchorNode === wrapper;
392397
});
393398

vscode-patches/0067-feat-support-loading-VSCode-in-an-iframe.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ index 8e857e292df..721cd5fd2d7 100644
259259

260260
/**
261261
diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts
262-
index a7606504872..4cb8615eac9 100644
262+
index bdc8f7f689b..6abb8fe88d6 100644
263263
--- a/src/vs/base/browser/ui/inputbox/inputBox.ts
264264
+++ b/src/vs/base/browser/ui/inputbox/inputBox.ts
265265
@@ -22,6 +22,7 @@ import { ScrollbarVisibility } from '../../../common/scrollable.js';
@@ -270,7 +270,7 @@ index a7606504872..4cb8615eac9 100644
270270

271271

272272
const $ = dom.$;
273-
@@ -698,7 +699,7 @@ export class HistoryInputBox extends InputBox implements IHistoryNavigationWidge
273+
@@ -703,7 +704,7 @@ export class HistoryInputBox extends InputBox implements IHistoryNavigationWidge
274274

275275
// Spot the change to the textarea class attribute which occurs when it changes between non-empty and empty,
276276
// and add the history suffix to the placeholder if not yet present

0 commit comments

Comments
 (0)