提交 f085deb2 编写于 作者: M Matt Bierner

Remove test editing code from preview

上级 74865b3a
...@@ -44,11 +44,6 @@ ...@@ -44,11 +44,6 @@
"command": "imagePreview.zoomOut", "command": "imagePreview.zoomOut",
"title": "%command.zoomOut%", "title": "%command.zoomOut%",
"category": "Image Preview" "category": "Image Preview"
},
{
"command": "imagePreview.testing.makeEdit",
"title": "Make test edit",
"category": "Image Preview"
} }
], ],
"menus": { "menus": {
...@@ -62,11 +57,6 @@ ...@@ -62,11 +57,6 @@
"command": "imagePreview.zoomOut", "command": "imagePreview.zoomOut",
"when": "imagePreviewFocus", "when": "imagePreviewFocus",
"group": "1_imagePreview" "group": "1_imagePreview"
},
{
"command": "imagePreview.testing.makeEdit",
"when": "imagePreviewTestMode",
"group": "1_imagePreview"
} }
] ]
} }
......
...@@ -38,20 +38,5 @@ export function activate(context: vscode.ExtensionContext) { ...@@ -38,20 +38,5 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomOut', () => { context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomOut', () => {
previewManager.activePreview?.zoomOut(); previewManager.activePreview?.zoomOut();
})); }));
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.testing.makeEdit', () => {
previewManager.activePreview?.test_makeEdit();
}));
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('imagePreview.customEditorTestMode')) {
updateTestMode();
}
}));
updateTestMode();
} }
function updateTestMode() {
const isInTestMode = vscode.workspace.getConfiguration('imagePreview').get<boolean>('customEditorTestMode', false);
vscode.commands.executeCommand('setContext', 'imagePreviewTestMode', isInTestMode);
}
...@@ -45,9 +45,7 @@ export class PreviewManager { ...@@ -45,9 +45,7 @@ export class PreviewManager {
} }
}); });
return { return {};
editingCapability: preview
};
} }
public get activePreview() { return this._activePreview; } public get activePreview() { return this._activePreview; }
...@@ -68,7 +66,7 @@ const enum PreviewState { ...@@ -68,7 +66,7 @@ const enum PreviewState {
Active, Active,
} }
class Preview extends Disposable implements vscode.WebviewEditorEditingCapability { class Preview extends Disposable {
private readonly id: string = `${Date.now()}-${Math.random().toString()}`; private readonly id: string = `${Date.now()}-${Math.random().toString()}`;
...@@ -251,24 +249,6 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit ...@@ -251,24 +249,6 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit
path: this.extensionRoot.path + path path: this.extensionRoot.path + path
})); }));
} }
//#region WebviewEditorCapabilities
private readonly _onEdit = this._register(new vscode.EventEmitter<{ now: number }>());
public readonly onEdit = this._onEdit.event;
async save() { console.log('save'); }
async hotExit() { }
async undoEdits(edits: any[]) { console.log('undo', edits); }
async applyEdits(edits: any[]) { console.log('apply', edits); }
//#endregion
public test_makeEdit() {
this._onEdit.fire({ now: Date.now() });
}
} }
function escapeAttribute(value: string | vscode.Uri): string { function escapeAttribute(value: string | vscode.Uri): string {
......
...@@ -122,5 +122,3 @@ export class CustomEditorModel extends Disposable implements ICustomEditorModel ...@@ -122,5 +122,3 @@ export class CustomEditorModel extends Disposable implements ICustomEditorModel
this.updateDirty(); this.updateDirty();
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册