@theia/editor-preview 1.34.3 → 1.34.4
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/LICENSE +641 -641
- package/README.md +52 -52
- package/lib/browser/editor-preview-contribution.d.ts +12 -12
- package/lib/browser/editor-preview-contribution.js +79 -79
- package/lib/browser/editor-preview-frontend-module.d.ts +4 -4
- package/lib/browser/editor-preview-frontend-module.js +42 -42
- package/lib/browser/editor-preview-manager.d.ts +24 -24
- package/lib/browser/editor-preview-manager.js +142 -142
- package/lib/browser/editor-preview-preferences.d.ts +11 -11
- package/lib/browser/editor-preview-preferences.js +47 -47
- package/lib/browser/editor-preview-tree-decorator.d.ts +23 -23
- package/lib/browser/editor-preview-tree-decorator.js +110 -110
- package/lib/browser/editor-preview-widget-factory.d.ts +13 -13
- package/lib/browser/editor-preview-widget-factory.js +52 -52
- package/lib/browser/editor-preview-widget.d.ts +25 -25
- package/lib/browser/editor-preview-widget.js +102 -102
- package/lib/package.spec.js +25 -25
- package/package.json +6 -6
- package/src/browser/editor-preview-contribution.ts +67 -67
- package/src/browser/editor-preview-frontend-module.ts +46 -46
- package/src/browser/editor-preview-manager.ts +125 -125
- package/src/browser/editor-preview-preferences.ts +53 -53
- package/src/browser/editor-preview-tree-decorator.ts +107 -107
- package/src/browser/editor-preview-widget-factory.ts +45 -45
- package/src/browser/editor-preview-widget.ts +113 -113
- package/src/browser/style/editor-preview-widget.css +23 -23
- package/src/browser/style/index.css +17 -17
- package/src/package.spec.ts +28 -28
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018-2021 Google and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.EditorPreviewManager = void 0;
|
|
28
|
-
const browser_1 = require("@theia/editor/lib/browser");
|
|
29
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
-
const editor_preview_preferences_1 = require("./editor-preview-preferences");
|
|
31
|
-
const editor_preview_widget_factory_1 = require("./editor-preview-widget-factory");
|
|
32
|
-
const editor_preview_widget_1 = require("./editor-preview-widget");
|
|
33
|
-
const frontend_application_state_1 = require("@theia/core/lib/browser/frontend-application-state");
|
|
34
|
-
let EditorPreviewManager = class EditorPreviewManager extends browser_1.EditorManager {
|
|
35
|
-
constructor() {
|
|
36
|
-
super(...arguments);
|
|
37
|
-
this.id = editor_preview_widget_factory_1.EditorPreviewWidgetFactory.ID;
|
|
38
|
-
/**
|
|
39
|
-
* Until the layout has been restored, widget state is not reliable, so we ignore creation events.
|
|
40
|
-
*/
|
|
41
|
-
this.layoutIsSet = false;
|
|
42
|
-
}
|
|
43
|
-
init() {
|
|
44
|
-
super.init();
|
|
45
|
-
// All editors are created, but not all are opened. This sets up the logic to swap previews when the editor is attached.
|
|
46
|
-
this.onCreated((widget) => {
|
|
47
|
-
if (this.layoutIsSet && widget.isPreview) {
|
|
48
|
-
const oneTimeDisposable = widget.onDidChangeVisibility(() => {
|
|
49
|
-
this.handleNewPreview(widget);
|
|
50
|
-
oneTimeDisposable.dispose();
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this.preferences.onPreferenceChanged(change => {
|
|
55
|
-
if (change.preferenceName === 'editor.enablePreview' && !change.newValue) {
|
|
56
|
-
this.all.forEach((editor) => {
|
|
57
|
-
if (editor.isPreview) {
|
|
58
|
-
editor.convertToNonPreview();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
;
|
|
63
|
-
});
|
|
64
|
-
this.stateService.reachedState('initialized_layout').then(() => {
|
|
65
|
-
const editors = this.all;
|
|
66
|
-
const currentPreview = editors.find(editor => editor.isPreview);
|
|
67
|
-
if (currentPreview) {
|
|
68
|
-
this.handleNewPreview(currentPreview);
|
|
69
|
-
}
|
|
70
|
-
this.layoutIsSet = true;
|
|
71
|
-
});
|
|
72
|
-
document.addEventListener('dblclick', this.convertEditorOnDoubleClick.bind(this));
|
|
73
|
-
}
|
|
74
|
-
async doOpen(widget, options) {
|
|
75
|
-
const { preview, widgetOptions = { area: 'main' }, mode = 'activate' } = options !== null && options !== void 0 ? options : {};
|
|
76
|
-
if (!widget.isAttached) {
|
|
77
|
-
this.shell.addWidget(widget, widgetOptions);
|
|
78
|
-
}
|
|
79
|
-
else if (!preview && widget.isPreview) {
|
|
80
|
-
widget.convertToNonPreview();
|
|
81
|
-
}
|
|
82
|
-
if (mode === 'activate') {
|
|
83
|
-
await this.shell.activateWidget(widget.id);
|
|
84
|
-
}
|
|
85
|
-
else if (mode === 'reveal') {
|
|
86
|
-
await this.shell.revealWidget(widget.id);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
handleNewPreview(newPreviewWidget) {
|
|
90
|
-
if (newPreviewWidget.isPreview) {
|
|
91
|
-
const tabbar = this.shell.getTabBarFor(newPreviewWidget);
|
|
92
|
-
if (tabbar) {
|
|
93
|
-
for (const title of tabbar.titles) {
|
|
94
|
-
if (title.owner !== newPreviewWidget && title.owner instanceof editor_preview_widget_1.EditorPreviewWidget && title.owner.isPreview) {
|
|
95
|
-
title.owner.dispose();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
tryGetPendingWidget(uri, options) {
|
|
102
|
-
var _a;
|
|
103
|
-
return (_a = super.tryGetPendingWidget(uri, Object.assign(Object.assign({}, options), { preview: true }))) !== null && _a !== void 0 ? _a : super.tryGetPendingWidget(uri, Object.assign(Object.assign({}, options), { preview: false }));
|
|
104
|
-
}
|
|
105
|
-
async getWidget(uri, options) {
|
|
106
|
-
var _a;
|
|
107
|
-
return (_a = (await super.getWidget(uri, Object.assign(Object.assign({}, options), { preview: true })))) !== null && _a !== void 0 ? _a : super.getWidget(uri, Object.assign(Object.assign({}, options), { preview: false }));
|
|
108
|
-
}
|
|
109
|
-
async getOrCreateWidget(uri, options) {
|
|
110
|
-
var _a;
|
|
111
|
-
return (_a = this.tryGetPendingWidget(uri, options)) !== null && _a !== void 0 ? _a : super.getOrCreateWidget(uri, options);
|
|
112
|
-
}
|
|
113
|
-
createWidgetOptions(uri, options) {
|
|
114
|
-
const navigatableOptions = super.createWidgetOptions(uri, options);
|
|
115
|
-
navigatableOptions.preview = !!((options === null || options === void 0 ? void 0 : options.preview) && this.preferences['editor.enablePreview']);
|
|
116
|
-
return navigatableOptions;
|
|
117
|
-
}
|
|
118
|
-
convertEditorOnDoubleClick(event) {
|
|
119
|
-
const widget = this.shell.findTargetedWidget(event);
|
|
120
|
-
if (widget instanceof editor_preview_widget_1.EditorPreviewWidget && widget.isPreview) {
|
|
121
|
-
widget.convertToNonPreview();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
__decorate([
|
|
126
|
-
(0, inversify_1.inject)(editor_preview_preferences_1.EditorPreviewPreferences),
|
|
127
|
-
__metadata("design:type", Object)
|
|
128
|
-
], EditorPreviewManager.prototype, "preferences", void 0);
|
|
129
|
-
__decorate([
|
|
130
|
-
(0, inversify_1.inject)(frontend_application_state_1.FrontendApplicationStateService),
|
|
131
|
-
__metadata("design:type", frontend_application_state_1.FrontendApplicationStateService)
|
|
132
|
-
], EditorPreviewManager.prototype, "stateService", void 0);
|
|
133
|
-
__decorate([
|
|
134
|
-
(0, inversify_1.postConstruct)(),
|
|
135
|
-
__metadata("design:type", Function),
|
|
136
|
-
__metadata("design:paramtypes", []),
|
|
137
|
-
__metadata("design:returntype", void 0)
|
|
138
|
-
], EditorPreviewManager.prototype, "init", null);
|
|
139
|
-
EditorPreviewManager = __decorate([
|
|
140
|
-
(0, inversify_1.injectable)()
|
|
141
|
-
], EditorPreviewManager);
|
|
142
|
-
exports.EditorPreviewManager = EditorPreviewManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018-2021 Google and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.EditorPreviewManager = void 0;
|
|
28
|
+
const browser_1 = require("@theia/editor/lib/browser");
|
|
29
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
+
const editor_preview_preferences_1 = require("./editor-preview-preferences");
|
|
31
|
+
const editor_preview_widget_factory_1 = require("./editor-preview-widget-factory");
|
|
32
|
+
const editor_preview_widget_1 = require("./editor-preview-widget");
|
|
33
|
+
const frontend_application_state_1 = require("@theia/core/lib/browser/frontend-application-state");
|
|
34
|
+
let EditorPreviewManager = class EditorPreviewManager extends browser_1.EditorManager {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.id = editor_preview_widget_factory_1.EditorPreviewWidgetFactory.ID;
|
|
38
|
+
/**
|
|
39
|
+
* Until the layout has been restored, widget state is not reliable, so we ignore creation events.
|
|
40
|
+
*/
|
|
41
|
+
this.layoutIsSet = false;
|
|
42
|
+
}
|
|
43
|
+
init() {
|
|
44
|
+
super.init();
|
|
45
|
+
// All editors are created, but not all are opened. This sets up the logic to swap previews when the editor is attached.
|
|
46
|
+
this.onCreated((widget) => {
|
|
47
|
+
if (this.layoutIsSet && widget.isPreview) {
|
|
48
|
+
const oneTimeDisposable = widget.onDidChangeVisibility(() => {
|
|
49
|
+
this.handleNewPreview(widget);
|
|
50
|
+
oneTimeDisposable.dispose();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
this.preferences.onPreferenceChanged(change => {
|
|
55
|
+
if (change.preferenceName === 'editor.enablePreview' && !change.newValue) {
|
|
56
|
+
this.all.forEach((editor) => {
|
|
57
|
+
if (editor.isPreview) {
|
|
58
|
+
editor.convertToNonPreview();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
;
|
|
63
|
+
});
|
|
64
|
+
this.stateService.reachedState('initialized_layout').then(() => {
|
|
65
|
+
const editors = this.all;
|
|
66
|
+
const currentPreview = editors.find(editor => editor.isPreview);
|
|
67
|
+
if (currentPreview) {
|
|
68
|
+
this.handleNewPreview(currentPreview);
|
|
69
|
+
}
|
|
70
|
+
this.layoutIsSet = true;
|
|
71
|
+
});
|
|
72
|
+
document.addEventListener('dblclick', this.convertEditorOnDoubleClick.bind(this));
|
|
73
|
+
}
|
|
74
|
+
async doOpen(widget, options) {
|
|
75
|
+
const { preview, widgetOptions = { area: 'main' }, mode = 'activate' } = options !== null && options !== void 0 ? options : {};
|
|
76
|
+
if (!widget.isAttached) {
|
|
77
|
+
this.shell.addWidget(widget, widgetOptions);
|
|
78
|
+
}
|
|
79
|
+
else if (!preview && widget.isPreview) {
|
|
80
|
+
widget.convertToNonPreview();
|
|
81
|
+
}
|
|
82
|
+
if (mode === 'activate') {
|
|
83
|
+
await this.shell.activateWidget(widget.id);
|
|
84
|
+
}
|
|
85
|
+
else if (mode === 'reveal') {
|
|
86
|
+
await this.shell.revealWidget(widget.id);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
handleNewPreview(newPreviewWidget) {
|
|
90
|
+
if (newPreviewWidget.isPreview) {
|
|
91
|
+
const tabbar = this.shell.getTabBarFor(newPreviewWidget);
|
|
92
|
+
if (tabbar) {
|
|
93
|
+
for (const title of tabbar.titles) {
|
|
94
|
+
if (title.owner !== newPreviewWidget && title.owner instanceof editor_preview_widget_1.EditorPreviewWidget && title.owner.isPreview) {
|
|
95
|
+
title.owner.dispose();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
tryGetPendingWidget(uri, options) {
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = super.tryGetPendingWidget(uri, Object.assign(Object.assign({}, options), { preview: true }))) !== null && _a !== void 0 ? _a : super.tryGetPendingWidget(uri, Object.assign(Object.assign({}, options), { preview: false }));
|
|
104
|
+
}
|
|
105
|
+
async getWidget(uri, options) {
|
|
106
|
+
var _a;
|
|
107
|
+
return (_a = (await super.getWidget(uri, Object.assign(Object.assign({}, options), { preview: true })))) !== null && _a !== void 0 ? _a : super.getWidget(uri, Object.assign(Object.assign({}, options), { preview: false }));
|
|
108
|
+
}
|
|
109
|
+
async getOrCreateWidget(uri, options) {
|
|
110
|
+
var _a;
|
|
111
|
+
return (_a = this.tryGetPendingWidget(uri, options)) !== null && _a !== void 0 ? _a : super.getOrCreateWidget(uri, options);
|
|
112
|
+
}
|
|
113
|
+
createWidgetOptions(uri, options) {
|
|
114
|
+
const navigatableOptions = super.createWidgetOptions(uri, options);
|
|
115
|
+
navigatableOptions.preview = !!((options === null || options === void 0 ? void 0 : options.preview) && this.preferences['editor.enablePreview']);
|
|
116
|
+
return navigatableOptions;
|
|
117
|
+
}
|
|
118
|
+
convertEditorOnDoubleClick(event) {
|
|
119
|
+
const widget = this.shell.findTargetedWidget(event);
|
|
120
|
+
if (widget instanceof editor_preview_widget_1.EditorPreviewWidget && widget.isPreview) {
|
|
121
|
+
widget.convertToNonPreview();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, inversify_1.inject)(editor_preview_preferences_1.EditorPreviewPreferences),
|
|
127
|
+
__metadata("design:type", Object)
|
|
128
|
+
], EditorPreviewManager.prototype, "preferences", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
(0, inversify_1.inject)(frontend_application_state_1.FrontendApplicationStateService),
|
|
131
|
+
__metadata("design:type", frontend_application_state_1.FrontendApplicationStateService)
|
|
132
|
+
], EditorPreviewManager.prototype, "stateService", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, inversify_1.postConstruct)(),
|
|
135
|
+
__metadata("design:type", Function),
|
|
136
|
+
__metadata("design:paramtypes", []),
|
|
137
|
+
__metadata("design:returntype", void 0)
|
|
138
|
+
], EditorPreviewManager.prototype, "init", null);
|
|
139
|
+
EditorPreviewManager = __decorate([
|
|
140
|
+
(0, inversify_1.injectable)()
|
|
141
|
+
], EditorPreviewManager);
|
|
142
|
+
exports.EditorPreviewManager = EditorPreviewManager;
|
|
143
143
|
//# sourceMappingURL=editor-preview-manager.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { interfaces } from '@theia/core/shared/inversify';
|
|
2
|
-
import { PreferenceProxy, PreferenceService, PreferenceSchema } from '@theia/core/lib/browser';
|
|
3
|
-
export declare const EditorPreviewConfigSchema: PreferenceSchema;
|
|
4
|
-
export interface EditorPreviewConfiguration {
|
|
5
|
-
'editor.enablePreview': boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const EditorPreviewPreferenceContribution: unique symbol;
|
|
8
|
-
export declare const EditorPreviewPreferences: unique symbol;
|
|
9
|
-
export declare type EditorPreviewPreferences = PreferenceProxy<EditorPreviewConfiguration>;
|
|
10
|
-
export declare function createEditorPreviewPreferences(preferences: PreferenceService, schema?: PreferenceSchema): EditorPreviewPreferences;
|
|
11
|
-
export declare function bindEditorPreviewPreferences(bind: interfaces.Bind): void;
|
|
1
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
2
|
+
import { PreferenceProxy, PreferenceService, PreferenceSchema } from '@theia/core/lib/browser';
|
|
3
|
+
export declare const EditorPreviewConfigSchema: PreferenceSchema;
|
|
4
|
+
export interface EditorPreviewConfiguration {
|
|
5
|
+
'editor.enablePreview': boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const EditorPreviewPreferenceContribution: unique symbol;
|
|
8
|
+
export declare const EditorPreviewPreferences: unique symbol;
|
|
9
|
+
export declare type EditorPreviewPreferences = PreferenceProxy<EditorPreviewConfiguration>;
|
|
10
|
+
export declare function createEditorPreviewPreferences(preferences: PreferenceService, schema?: PreferenceSchema): EditorPreviewPreferences;
|
|
11
|
+
export declare function bindEditorPreviewPreferences(bind: interfaces.Bind): void;
|
|
12
12
|
//# sourceMappingURL=editor-preview-preferences.d.ts.map
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 Google and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.bindEditorPreviewPreferences = exports.createEditorPreviewPreferences = exports.EditorPreviewPreferences = exports.EditorPreviewPreferenceContribution = exports.EditorPreviewConfigSchema = void 0;
|
|
19
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
21
|
-
exports.EditorPreviewConfigSchema = {
|
|
22
|
-
'type': 'object',
|
|
23
|
-
properties: {
|
|
24
|
-
'editor.enablePreview': {
|
|
25
|
-
type: 'boolean',
|
|
26
|
-
// eslint-disable-next-line max-len
|
|
27
|
-
description: nls_1.nls.localizeByDefault('Controls whether opened editors show as preview editors. Preview editors do not stay open, are reused until explicitly set to be kept open (e.g. via double click or editing), and show file names in italics.'),
|
|
28
|
-
default: true
|
|
29
|
-
},
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
exports.EditorPreviewPreferenceContribution = Symbol('EditorPreviewPreferenceContribution');
|
|
33
|
-
exports.EditorPreviewPreferences = Symbol('EditorPreviewPreferences');
|
|
34
|
-
function createEditorPreviewPreferences(preferences, schema = exports.EditorPreviewConfigSchema) {
|
|
35
|
-
return (0, browser_1.createPreferenceProxy)(preferences, schema);
|
|
36
|
-
}
|
|
37
|
-
exports.createEditorPreviewPreferences = createEditorPreviewPreferences;
|
|
38
|
-
function bindEditorPreviewPreferences(bind) {
|
|
39
|
-
bind(exports.EditorPreviewPreferences).toDynamicValue(ctx => {
|
|
40
|
-
const preferences = ctx.container.get(browser_1.PreferenceService);
|
|
41
|
-
const contribution = ctx.container.get(exports.EditorPreviewPreferenceContribution);
|
|
42
|
-
return createEditorPreviewPreferences(preferences, contribution.schema);
|
|
43
|
-
}).inSingletonScope();
|
|
44
|
-
bind(exports.EditorPreviewPreferenceContribution).toConstantValue({ schema: exports.EditorPreviewConfigSchema });
|
|
45
|
-
bind(browser_1.PreferenceContribution).toService(exports.EditorPreviewPreferenceContribution);
|
|
46
|
-
}
|
|
47
|
-
exports.bindEditorPreviewPreferences = bindEditorPreviewPreferences;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 Google and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.bindEditorPreviewPreferences = exports.createEditorPreviewPreferences = exports.EditorPreviewPreferences = exports.EditorPreviewPreferenceContribution = exports.EditorPreviewConfigSchema = void 0;
|
|
19
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
20
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
21
|
+
exports.EditorPreviewConfigSchema = {
|
|
22
|
+
'type': 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
'editor.enablePreview': {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
// eslint-disable-next-line max-len
|
|
27
|
+
description: nls_1.nls.localizeByDefault('Controls whether opened editors show as preview editors. Preview editors do not stay open, are reused until explicitly set to be kept open (e.g. via double click or editing), and show file names in italics.'),
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.EditorPreviewPreferenceContribution = Symbol('EditorPreviewPreferenceContribution');
|
|
33
|
+
exports.EditorPreviewPreferences = Symbol('EditorPreviewPreferences');
|
|
34
|
+
function createEditorPreviewPreferences(preferences, schema = exports.EditorPreviewConfigSchema) {
|
|
35
|
+
return (0, browser_1.createPreferenceProxy)(preferences, schema);
|
|
36
|
+
}
|
|
37
|
+
exports.createEditorPreviewPreferences = createEditorPreviewPreferences;
|
|
38
|
+
function bindEditorPreviewPreferences(bind) {
|
|
39
|
+
bind(exports.EditorPreviewPreferences).toDynamicValue(ctx => {
|
|
40
|
+
const preferences = ctx.container.get(browser_1.PreferenceService);
|
|
41
|
+
const contribution = ctx.container.get(exports.EditorPreviewPreferenceContribution);
|
|
42
|
+
return createEditorPreviewPreferences(preferences, contribution.schema);
|
|
43
|
+
}).inSingletonScope();
|
|
44
|
+
bind(exports.EditorPreviewPreferenceContribution).toConstantValue({ schema: exports.EditorPreviewConfigSchema });
|
|
45
|
+
bind(browser_1.PreferenceContribution).toService(exports.EditorPreviewPreferenceContribution);
|
|
46
|
+
}
|
|
47
|
+
exports.bindEditorPreviewPreferences = bindEditorPreviewPreferences;
|
|
48
48
|
//# sourceMappingURL=editor-preview-preferences.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { TreeDecorator, TreeDecoration } from '@theia/core/lib/browser/tree/tree-decorator';
|
|
2
|
-
import { Emitter } from '@theia/core/lib/common/event';
|
|
3
|
-
import { Tree } from '@theia/core/lib/browser/tree/tree';
|
|
4
|
-
import { ApplicationShell, FrontendApplication, FrontendApplicationContribution, NavigatableWidget, Widget } from '@theia/core/lib/browser';
|
|
5
|
-
import { Disposable } from '@theia/core/lib/common';
|
|
6
|
-
import { EditorPreviewManager } from './editor-preview-manager';
|
|
7
|
-
export declare class EditorPreviewTreeDecorator implements TreeDecorator, FrontendApplicationContribution {
|
|
8
|
-
protected readonly editorPreviewManager: EditorPreviewManager;
|
|
9
|
-
protected readonly shell: ApplicationShell;
|
|
10
|
-
readonly id = "theia-open-editors-file-decorator";
|
|
11
|
-
protected decorationsMap: Map<string, TreeDecoration.Data>;
|
|
12
|
-
protected readonly decorationsChangedEmitter: Emitter<any>;
|
|
13
|
-
readonly onDidChangeDecorations: import("@theia/core/lib/common").Event<any>;
|
|
14
|
-
protected readonly toDisposeOnDirtyChanged: Map<string, Disposable>;
|
|
15
|
-
protected readonly toDisposeOnPreviewPinned: Map<string, Disposable>;
|
|
16
|
-
onDidInitializeLayout(app: FrontendApplication): void;
|
|
17
|
-
protected registerEditorListeners(widget: Widget): void;
|
|
18
|
-
protected unregisterEditorListeners(widget: Widget): void;
|
|
19
|
-
protected get editorWidgets(): NavigatableWidget[];
|
|
20
|
-
protected fireDidChangeDecorations(event: (tree: Tree) => Map<string, TreeDecoration.Data>): void;
|
|
21
|
-
decorations(tree: Tree): Map<string, TreeDecoration.Data>;
|
|
22
|
-
protected collectDecorators(tree: Tree): Map<string, TreeDecoration.Data>;
|
|
23
|
-
}
|
|
1
|
+
import { TreeDecorator, TreeDecoration } from '@theia/core/lib/browser/tree/tree-decorator';
|
|
2
|
+
import { Emitter } from '@theia/core/lib/common/event';
|
|
3
|
+
import { Tree } from '@theia/core/lib/browser/tree/tree';
|
|
4
|
+
import { ApplicationShell, FrontendApplication, FrontendApplicationContribution, NavigatableWidget, Widget } from '@theia/core/lib/browser';
|
|
5
|
+
import { Disposable } from '@theia/core/lib/common';
|
|
6
|
+
import { EditorPreviewManager } from './editor-preview-manager';
|
|
7
|
+
export declare class EditorPreviewTreeDecorator implements TreeDecorator, FrontendApplicationContribution {
|
|
8
|
+
protected readonly editorPreviewManager: EditorPreviewManager;
|
|
9
|
+
protected readonly shell: ApplicationShell;
|
|
10
|
+
readonly id = "theia-open-editors-file-decorator";
|
|
11
|
+
protected decorationsMap: Map<string, TreeDecoration.Data>;
|
|
12
|
+
protected readonly decorationsChangedEmitter: Emitter<any>;
|
|
13
|
+
readonly onDidChangeDecorations: import("@theia/core/lib/common").Event<any>;
|
|
14
|
+
protected readonly toDisposeOnDirtyChanged: Map<string, Disposable>;
|
|
15
|
+
protected readonly toDisposeOnPreviewPinned: Map<string, Disposable>;
|
|
16
|
+
onDidInitializeLayout(app: FrontendApplication): void;
|
|
17
|
+
protected registerEditorListeners(widget: Widget): void;
|
|
18
|
+
protected unregisterEditorListeners(widget: Widget): void;
|
|
19
|
+
protected get editorWidgets(): NavigatableWidget[];
|
|
20
|
+
protected fireDidChangeDecorations(event: (tree: Tree) => Map<string, TreeDecoration.Data>): void;
|
|
21
|
+
decorations(tree: Tree): Map<string, TreeDecoration.Data>;
|
|
22
|
+
protected collectDecorators(tree: Tree): Map<string, TreeDecoration.Data>;
|
|
23
|
+
}
|
|
24
24
|
//# sourceMappingURL=editor-preview-tree-decorator.d.ts.map
|