提交 3a2f2e40 编写于 作者: D Denis Malinochkin 提交者: Erich Gamma

Fix #8316 (error decoding DataURI without workspace) (#8352)

上级 c5c24893
......@@ -16,8 +16,9 @@ import {Action} from 'vs/base/common/actions';
import {CommonEditorRegistry, EditorActionDescriptor} from 'vs/editor/common/editorCommonExtensions';
import {IEditorActionDescriptorData, ICommonCodeEditor} from 'vs/editor/common/editorCommon';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IQuickOpenService, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IMessageService, Severity} from 'vs/platform/message/common/message';
import {IQuickOpenService, IInputOptions} from 'vs/workbench/services/quickopen/common/quickOpenService';
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
class EncodeDecodeDataUrlAction extends EmmetEditorAction {
......@@ -26,6 +27,7 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor,
@IConfigurationService configurationService: IConfigurationService,
@IWorkspaceContextService private workspaceContext: IWorkspaceContextService,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IMessageService private messageService: IMessageService) {
super(descriptor, editor, configurationService);
......@@ -38,6 +40,12 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
return;
}
if (!this.workspaceContext.getWorkspace()) {
const message = nls.localize('noWorkspace', "Decoding **data:url** image are only available on a workspace folder.");
this.messageService.show(Severity.Warning, message);
return;
}
let options: IInputOptions = {
prompt: nls.localize('enterImagePath', "Enter path to file (absolute or relative)"),
placeHolder: nls.localize('path', "Path to file")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册