Skip to content

Commit 80d9edb

Browse files
authored
Render share link text as readonly div (microsoft#183372)
1 parent 82c9994 commit 80d9edb

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

src/vs/workbench/contrib/share/browser/share.contribution.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import 'vs/css!./share';
67
import { CancellationTokenSource } from 'vs/base/common/cancellation';
78
import { Codicon } from 'vs/base/common/codicons';
9+
import { MarkdownString } from 'vs/base/common/htmlContent';
810
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
911
import { localize } from 'vs/nls';
1012
import { Action2, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions';
@@ -78,19 +80,23 @@ class ShareWorkbenchContribution {
7880

7981
const uri = await shareService.provideShare({ resourceUri }, new CancellationTokenSource().token);
8082
if (uri) {
81-
await clipboardService.writeText(uri.toString());
82-
const result = await dialogService.input(
83+
const uriText = uri.toString();
84+
await clipboardService.writeText(uriText);
85+
dialogService.prompt(
8386
{
8487
type: Severity.Info,
85-
inputs: [{ type: 'text', value: uri.toString() }],
8688
message: localize('shareSuccess', 'Copied link to clipboard!'),
87-
custom: { icon: Codicon.check },
88-
primaryButton: localize('open link', 'Open Link')
89+
custom: {
90+
icon: Codicon.check,
91+
markdownDetails: [{
92+
markdown: new MarkdownString(`<div aria-label='${uriText}'>${uriText}</div>`, { supportHtml: true }),
93+
classes: ['share-dialog-input']
94+
}]
95+
},
96+
cancelButton: localize('close', 'Close'),
97+
buttons: [{ label: localize('open link', 'Open Link'), run: () => { urlService.open(uri, { openExternal: true }); } }]
8998
}
9099
);
91-
if (result.confirmed) {
92-
urlService.open(uri, { openExternal: true });
93-
}
94100
}
95101
}
96102
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
div.share-dialog-input {
7+
border: 1px solid var(--vscode-input-border, transparent);
8+
border-radius: 2px;
9+
color: var(--vscode-input-foreground);
10+
background-color: var(--vscode-input-background);
11+
overflow: hidden;
12+
white-space: nowrap;
13+
text-overflow: ellipsis;
14+
padding: 2px;
15+
user-select: all;
16+
line-height: 24px;
17+
}
18+

0 commit comments

Comments
 (0)