@theia/notebook 1.53.0-next.4 → 1.53.0-next.55
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/README.md +30 -30
- package/lib/browser/contributions/cell-operations.d.ts.map +1 -1
- package/lib/browser/contributions/cell-operations.js +8 -1
- package/lib/browser/contributions/cell-operations.js.map +1 -1
- package/lib/browser/contributions/notebook-actions-contribution.d.ts +1 -0
- package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -1
- package/lib/browser/contributions/notebook-actions-contribution.js +31 -6
- package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -1
- package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +4 -0
- package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -1
- package/lib/browser/contributions/notebook-cell-actions-contribution.js +49 -12
- package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -1
- package/lib/browser/contributions/notebook-status-bar-contribution.d.ts +14 -0
- package/lib/browser/contributions/notebook-status-bar-contribution.d.ts.map +1 -0
- package/lib/browser/contributions/notebook-status-bar-contribution.js +75 -0
- package/lib/browser/contributions/notebook-status-bar-contribution.js.map +1 -0
- package/lib/browser/notebook-editor-widget.d.ts.map +1 -1
- package/lib/browser/notebook-editor-widget.js +3 -5
- package/lib/browser/notebook-editor-widget.js.map +1 -1
- package/lib/browser/notebook-frontend-module.d.ts.map +1 -1
- package/lib/browser/notebook-frontend-module.js +3 -0
- package/lib/browser/notebook-frontend-module.js.map +1 -1
- package/lib/browser/notebook-open-handler.d.ts +3 -2
- package/lib/browser/notebook-open-handler.d.ts.map +1 -1
- package/lib/browser/notebook-open-handler.js +12 -5
- package/lib/browser/notebook-open-handler.js.map +1 -1
- package/lib/browser/service/notebook-options.d.ts +1 -0
- package/lib/browser/service/notebook-options.d.ts.map +1 -1
- package/lib/browser/service/notebook-options.js +1 -0
- package/lib/browser/service/notebook-options.js.map +1 -1
- package/lib/browser/service/notebook-service.d.ts +1 -0
- package/lib/browser/service/notebook-service.d.ts.map +1 -1
- package/lib/browser/service/notebook-service.js +7 -0
- package/lib/browser/service/notebook-service.js.map +1 -1
- package/lib/browser/view/notebook-cell-editor.d.ts +1 -0
- package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -1
- package/lib/browser/view/notebook-cell-editor.js +30 -16
- package/lib/browser/view/notebook-cell-editor.js.map +1 -1
- package/lib/browser/view/notebook-cell-list-view.d.ts +7 -4
- package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -1
- package/lib/browser/view/notebook-cell-list-view.js +39 -29
- package/lib/browser/view/notebook-cell-list-view.js.map +1 -1
- package/lib/browser/view-model/notebook-cell-model.d.ts +3 -0
- package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -1
- package/lib/browser/view-model/notebook-cell-model.js +5 -0
- package/lib/browser/view-model/notebook-cell-model.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/contributions/cell-operations.ts +44 -39
- package/src/browser/contributions/notebook-actions-contribution.ts +379 -351
- package/src/browser/contributions/notebook-cell-actions-contribution.ts +525 -485
- package/src/browser/contributions/notebook-color-contribution.ts +268 -268
- package/src/browser/contributions/notebook-context-keys.ts +113 -113
- package/src/browser/contributions/notebook-label-provider-contribution.ts +85 -85
- package/src/browser/contributions/notebook-outline-contribution.ts +114 -114
- package/src/browser/contributions/notebook-output-action-contribution.ts +82 -82
- package/src/browser/contributions/notebook-preferences.ts +92 -92
- package/src/browser/contributions/notebook-status-bar-contribution.ts +77 -0
- package/src/browser/contributions/notebook-undo-redo-handler.ts +41 -41
- package/src/browser/index.ts +27 -27
- package/src/browser/notebook-cell-resource-resolver.ts +130 -130
- package/src/browser/notebook-editor-widget-factory.ts +82 -82
- package/src/browser/notebook-editor-widget.tsx +330 -331
- package/src/browser/notebook-frontend-module.ts +119 -115
- package/src/browser/notebook-open-handler.ts +120 -114
- package/src/browser/notebook-output-utils.ts +119 -119
- package/src/browser/notebook-renderer-registry.ts +85 -85
- package/src/browser/notebook-type-registry.ts +54 -54
- package/src/browser/notebook-types.ts +186 -186
- package/src/browser/renderers/cell-output-webview.ts +33 -33
- package/src/browser/service/notebook-clipboard-service.ts +43 -43
- package/src/browser/service/notebook-context-manager.ts +162 -162
- package/src/browser/service/notebook-editor-widget-service.ts +101 -101
- package/src/browser/service/notebook-execution-service.ts +139 -139
- package/src/browser/service/notebook-execution-state-service.ts +311 -311
- package/src/browser/service/notebook-kernel-history-service.ts +124 -124
- package/src/browser/service/notebook-kernel-quick-pick-service.ts +479 -479
- package/src/browser/service/notebook-kernel-service.ts +357 -357
- package/src/browser/service/notebook-model-resolver-service.ts +160 -160
- package/src/browser/service/notebook-monaco-text-model-service.ts +48 -48
- package/src/browser/service/notebook-options.ts +155 -154
- package/src/browser/service/notebook-renderer-messaging-service.ts +121 -121
- package/src/browser/service/notebook-service.ts +215 -209
- package/src/browser/style/index.css +483 -467
- package/src/browser/view/notebook-cell-editor.tsx +263 -247
- package/src/browser/view/notebook-cell-list-view.tsx +279 -259
- package/src/browser/view/notebook-cell-toolbar-factory.tsx +102 -102
- package/src/browser/view/notebook-cell-toolbar.tsx +74 -74
- package/src/browser/view/notebook-code-cell-view.tsx +350 -350
- package/src/browser/view/notebook-find-widget.tsx +335 -335
- package/src/browser/view/notebook-main-toolbar.tsx +235 -235
- package/src/browser/view/notebook-markdown-cell-view.tsx +208 -208
- package/src/browser/view/notebook-viewport-service.ts +61 -61
- package/src/browser/view-model/notebook-cell-model.ts +473 -466
- package/src/browser/view-model/notebook-cell-output-model.ts +100 -100
- package/src/browser/view-model/notebook-model.ts +550 -550
- package/src/common/index.ts +18 -18
- package/src/common/notebook-common.ts +337 -337
- package/src/common/notebook-protocol.ts +35 -35
- package/src/common/notebook-range.ts +30 -30
|
@@ -1,186 +1,186 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
CellData, CellEditType, CellMetadataEdit, CellOutput, CellOutputItem, CellRange, NotebookCellContentChangeEvent,
|
|
19
|
-
NotebookCellInternalMetadata,
|
|
20
|
-
NotebookCellMetadata,
|
|
21
|
-
NotebookCellsChangeInternalMetadataEvent,
|
|
22
|
-
NotebookCellsChangeLanguageEvent,
|
|
23
|
-
NotebookCellsChangeMetadataEvent,
|
|
24
|
-
NotebookCellsChangeType, NotebookCellTextModelSplice, NotebookDocumentMetadata
|
|
25
|
-
} from '../common';
|
|
26
|
-
import { NotebookCell } from './view-model/notebook-cell-model';
|
|
27
|
-
|
|
28
|
-
export interface NotebookTextModelChangedEvent {
|
|
29
|
-
readonly rawEvents: NotebookContentChangedEvent[];
|
|
30
|
-
// readonly versionId: number;
|
|
31
|
-
readonly synchronous?: boolean;
|
|
32
|
-
readonly endSelectionState?: SelectionState;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type NotebookContentChangedEvent = (NotebookCellsInitializeEvent<NotebookCell> | NotebookDocumentChangeMetadataEvent | NotebookCellContentChangeEvent |
|
|
36
|
-
NotebookCellsModelChangedEvent<NotebookCell> | NotebookCellsModelMoveEvent<NotebookCell> | NotebookOutputChangedEvent | NotebookOutputItemChangedEvent |
|
|
37
|
-
NotebookCellsChangeLanguageEvent | NotebookCellsChangeMetadataEvent |
|
|
38
|
-
NotebookCellsChangeInternalMetadataEvent | NotebookDocumentUnknownChangeEvent); // & { transient: boolean };
|
|
39
|
-
|
|
40
|
-
export interface NotebookCellsInitializeEvent<T> {
|
|
41
|
-
readonly kind: NotebookCellsChangeType.Initialize;
|
|
42
|
-
readonly changes: NotebookCellTextModelSplice<T>[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface NotebookDocumentChangeMetadataEvent {
|
|
46
|
-
readonly kind: NotebookCellsChangeType.ChangeDocumentMetadata;
|
|
47
|
-
readonly metadata: NotebookDocumentMetadata;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface NotebookCellsModelChangedEvent<T> {
|
|
51
|
-
readonly kind: NotebookCellsChangeType.ModelChange;
|
|
52
|
-
readonly changes: NotebookCellTextModelSplice<T>[];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface NotebookModelWillAddRemoveEvent {
|
|
56
|
-
readonly rawEvent: NotebookCellsModelChangedEvent<CellData>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export interface NotebookCellsModelMoveEvent<T> {
|
|
60
|
-
readonly kind: NotebookCellsChangeType.Move;
|
|
61
|
-
readonly index: number;
|
|
62
|
-
readonly length: number;
|
|
63
|
-
readonly newIdx: number;
|
|
64
|
-
readonly cells: T[];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface NotebookOutputChangedEvent {
|
|
68
|
-
readonly kind: NotebookCellsChangeType.Output;
|
|
69
|
-
readonly index: number;
|
|
70
|
-
readonly outputs: CellOutput[];
|
|
71
|
-
readonly append: boolean;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface NotebookOutputItemChangedEvent {
|
|
75
|
-
readonly kind: NotebookCellsChangeType.OutputItem;
|
|
76
|
-
readonly index: number;
|
|
77
|
-
readonly outputId: string;
|
|
78
|
-
readonly outputItems: CellOutputItem[];
|
|
79
|
-
readonly append: boolean;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface NotebookDocumentUnknownChangeEvent {
|
|
83
|
-
readonly kind: NotebookCellsChangeType.Unknown;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export enum SelectionStateType {
|
|
87
|
-
Handle = 0,
|
|
88
|
-
Index = 1
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface SelectionHandleState {
|
|
92
|
-
kind: SelectionStateType.Handle;
|
|
93
|
-
primary: number | null;
|
|
94
|
-
selections: number[];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface SelectionIndexState {
|
|
98
|
-
kind: SelectionStateType.Index;
|
|
99
|
-
focus: CellRange;
|
|
100
|
-
selections: CellRange[];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export type SelectionState = SelectionHandleState | SelectionIndexState;
|
|
104
|
-
|
|
105
|
-
export interface NotebookModelWillAddRemoveEvent {
|
|
106
|
-
readonly newCellIds?: number[];
|
|
107
|
-
readonly rawEvent: NotebookCellsModelChangedEvent<CellData>;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export interface CellOutputEdit {
|
|
111
|
-
editType: CellEditType.Output;
|
|
112
|
-
index: number;
|
|
113
|
-
outputs: CellOutput[];
|
|
114
|
-
deleteCount?: number;
|
|
115
|
-
append?: boolean;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export interface CellOutputEditByHandle {
|
|
119
|
-
editType: CellEditType.Output;
|
|
120
|
-
handle: number;
|
|
121
|
-
outputs: CellOutput[];
|
|
122
|
-
deleteCount?: number;
|
|
123
|
-
append?: boolean;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface CellOutputItemEdit {
|
|
127
|
-
editType: CellEditType.OutputItems;
|
|
128
|
-
items: CellOutputItem[];
|
|
129
|
-
outputId: string;
|
|
130
|
-
append?: boolean;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface CellLanguageEdit {
|
|
134
|
-
editType: CellEditType.CellLanguage;
|
|
135
|
-
index: number;
|
|
136
|
-
language: string;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface DocumentMetadataEdit {
|
|
140
|
-
editType: CellEditType.DocumentMetadata;
|
|
141
|
-
metadata: NotebookDocumentMetadata;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface CellMoveEdit {
|
|
145
|
-
editType: CellEditType.Move;
|
|
146
|
-
index: number;
|
|
147
|
-
length: number;
|
|
148
|
-
newIdx: number;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export interface CellReplaceEdit {
|
|
152
|
-
editType: CellEditType.Replace;
|
|
153
|
-
index: number;
|
|
154
|
-
count: number;
|
|
155
|
-
cells: CellData[];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface CellPartialMetadataEdit {
|
|
159
|
-
editType: CellEditType.PartialMetadata;
|
|
160
|
-
index: number;
|
|
161
|
-
metadata: NullablePartialNotebookCellMetadata;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export type ImmediateCellEditOperation = CellOutputEditByHandle | CellOutputItemEdit | CellPartialInternalMetadataEditByHandle; // add more later on
|
|
165
|
-
export type CellEditOperation = ImmediateCellEditOperation | CellReplaceEdit | CellOutputEdit |
|
|
166
|
-
CellMetadataEdit | CellLanguageEdit | DocumentMetadataEdit | CellMoveEdit | CellPartialMetadataEdit; // add more later on
|
|
167
|
-
|
|
168
|
-
export type NullablePartialNotebookCellInternalMetadata = {
|
|
169
|
-
[Key in keyof Partial<NotebookCellInternalMetadata>]: NotebookCellInternalMetadata[Key] | null
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export type NullablePartialNotebookCellMetadata = {
|
|
173
|
-
[Key in keyof Partial<NotebookCellMetadata>]: NotebookCellMetadata[Key] | null
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export interface CellPartialInternalMetadataEditByHandle {
|
|
177
|
-
editType: CellEditType.PartialInternalMetadata;
|
|
178
|
-
handle: number;
|
|
179
|
-
internalMetadata: NullablePartialNotebookCellInternalMetadata;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface NotebookCellOutputsSplice {
|
|
183
|
-
start: number;
|
|
184
|
-
deleteCount: number;
|
|
185
|
-
newOutputs: CellOutput[];
|
|
186
|
-
};
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
CellData, CellEditType, CellMetadataEdit, CellOutput, CellOutputItem, CellRange, NotebookCellContentChangeEvent,
|
|
19
|
+
NotebookCellInternalMetadata,
|
|
20
|
+
NotebookCellMetadata,
|
|
21
|
+
NotebookCellsChangeInternalMetadataEvent,
|
|
22
|
+
NotebookCellsChangeLanguageEvent,
|
|
23
|
+
NotebookCellsChangeMetadataEvent,
|
|
24
|
+
NotebookCellsChangeType, NotebookCellTextModelSplice, NotebookDocumentMetadata
|
|
25
|
+
} from '../common';
|
|
26
|
+
import { NotebookCell } from './view-model/notebook-cell-model';
|
|
27
|
+
|
|
28
|
+
export interface NotebookTextModelChangedEvent {
|
|
29
|
+
readonly rawEvents: NotebookContentChangedEvent[];
|
|
30
|
+
// readonly versionId: number;
|
|
31
|
+
readonly synchronous?: boolean;
|
|
32
|
+
readonly endSelectionState?: SelectionState;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type NotebookContentChangedEvent = (NotebookCellsInitializeEvent<NotebookCell> | NotebookDocumentChangeMetadataEvent | NotebookCellContentChangeEvent |
|
|
36
|
+
NotebookCellsModelChangedEvent<NotebookCell> | NotebookCellsModelMoveEvent<NotebookCell> | NotebookOutputChangedEvent | NotebookOutputItemChangedEvent |
|
|
37
|
+
NotebookCellsChangeLanguageEvent | NotebookCellsChangeMetadataEvent |
|
|
38
|
+
NotebookCellsChangeInternalMetadataEvent | NotebookDocumentUnknownChangeEvent); // & { transient: boolean };
|
|
39
|
+
|
|
40
|
+
export interface NotebookCellsInitializeEvent<T> {
|
|
41
|
+
readonly kind: NotebookCellsChangeType.Initialize;
|
|
42
|
+
readonly changes: NotebookCellTextModelSplice<T>[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface NotebookDocumentChangeMetadataEvent {
|
|
46
|
+
readonly kind: NotebookCellsChangeType.ChangeDocumentMetadata;
|
|
47
|
+
readonly metadata: NotebookDocumentMetadata;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface NotebookCellsModelChangedEvent<T> {
|
|
51
|
+
readonly kind: NotebookCellsChangeType.ModelChange;
|
|
52
|
+
readonly changes: NotebookCellTextModelSplice<T>[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface NotebookModelWillAddRemoveEvent {
|
|
56
|
+
readonly rawEvent: NotebookCellsModelChangedEvent<CellData>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export interface NotebookCellsModelMoveEvent<T> {
|
|
60
|
+
readonly kind: NotebookCellsChangeType.Move;
|
|
61
|
+
readonly index: number;
|
|
62
|
+
readonly length: number;
|
|
63
|
+
readonly newIdx: number;
|
|
64
|
+
readonly cells: T[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface NotebookOutputChangedEvent {
|
|
68
|
+
readonly kind: NotebookCellsChangeType.Output;
|
|
69
|
+
readonly index: number;
|
|
70
|
+
readonly outputs: CellOutput[];
|
|
71
|
+
readonly append: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface NotebookOutputItemChangedEvent {
|
|
75
|
+
readonly kind: NotebookCellsChangeType.OutputItem;
|
|
76
|
+
readonly index: number;
|
|
77
|
+
readonly outputId: string;
|
|
78
|
+
readonly outputItems: CellOutputItem[];
|
|
79
|
+
readonly append: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface NotebookDocumentUnknownChangeEvent {
|
|
83
|
+
readonly kind: NotebookCellsChangeType.Unknown;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export enum SelectionStateType {
|
|
87
|
+
Handle = 0,
|
|
88
|
+
Index = 1
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface SelectionHandleState {
|
|
92
|
+
kind: SelectionStateType.Handle;
|
|
93
|
+
primary: number | null;
|
|
94
|
+
selections: number[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface SelectionIndexState {
|
|
98
|
+
kind: SelectionStateType.Index;
|
|
99
|
+
focus: CellRange;
|
|
100
|
+
selections: CellRange[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type SelectionState = SelectionHandleState | SelectionIndexState;
|
|
104
|
+
|
|
105
|
+
export interface NotebookModelWillAddRemoveEvent {
|
|
106
|
+
readonly newCellIds?: number[];
|
|
107
|
+
readonly rawEvent: NotebookCellsModelChangedEvent<CellData>;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export interface CellOutputEdit {
|
|
111
|
+
editType: CellEditType.Output;
|
|
112
|
+
index: number;
|
|
113
|
+
outputs: CellOutput[];
|
|
114
|
+
deleteCount?: number;
|
|
115
|
+
append?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface CellOutputEditByHandle {
|
|
119
|
+
editType: CellEditType.Output;
|
|
120
|
+
handle: number;
|
|
121
|
+
outputs: CellOutput[];
|
|
122
|
+
deleteCount?: number;
|
|
123
|
+
append?: boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface CellOutputItemEdit {
|
|
127
|
+
editType: CellEditType.OutputItems;
|
|
128
|
+
items: CellOutputItem[];
|
|
129
|
+
outputId: string;
|
|
130
|
+
append?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface CellLanguageEdit {
|
|
134
|
+
editType: CellEditType.CellLanguage;
|
|
135
|
+
index: number;
|
|
136
|
+
language: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface DocumentMetadataEdit {
|
|
140
|
+
editType: CellEditType.DocumentMetadata;
|
|
141
|
+
metadata: NotebookDocumentMetadata;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface CellMoveEdit {
|
|
145
|
+
editType: CellEditType.Move;
|
|
146
|
+
index: number;
|
|
147
|
+
length: number;
|
|
148
|
+
newIdx: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface CellReplaceEdit {
|
|
152
|
+
editType: CellEditType.Replace;
|
|
153
|
+
index: number;
|
|
154
|
+
count: number;
|
|
155
|
+
cells: CellData[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface CellPartialMetadataEdit {
|
|
159
|
+
editType: CellEditType.PartialMetadata;
|
|
160
|
+
index: number;
|
|
161
|
+
metadata: NullablePartialNotebookCellMetadata;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export type ImmediateCellEditOperation = CellOutputEditByHandle | CellOutputItemEdit | CellPartialInternalMetadataEditByHandle; // add more later on
|
|
165
|
+
export type CellEditOperation = ImmediateCellEditOperation | CellReplaceEdit | CellOutputEdit |
|
|
166
|
+
CellMetadataEdit | CellLanguageEdit | DocumentMetadataEdit | CellMoveEdit | CellPartialMetadataEdit; // add more later on
|
|
167
|
+
|
|
168
|
+
export type NullablePartialNotebookCellInternalMetadata = {
|
|
169
|
+
[Key in keyof Partial<NotebookCellInternalMetadata>]: NotebookCellInternalMetadata[Key] | null
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type NullablePartialNotebookCellMetadata = {
|
|
173
|
+
[Key in keyof Partial<NotebookCellMetadata>]: NotebookCellMetadata[Key] | null
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export interface CellPartialInternalMetadataEditByHandle {
|
|
177
|
+
editType: CellEditType.PartialInternalMetadata;
|
|
178
|
+
handle: number;
|
|
179
|
+
internalMetadata: NullablePartialNotebookCellInternalMetadata;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface NotebookCellOutputsSplice {
|
|
183
|
+
start: number;
|
|
184
|
+
deleteCount: number;
|
|
185
|
+
newOutputs: CellOutput[];
|
|
186
|
+
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { Disposable } from '@theia/core';
|
|
18
|
-
import { NotebookCellModel } from '../view-model/notebook-cell-model';
|
|
19
|
-
import { NotebookModel } from '../view-model/notebook-model';
|
|
20
|
-
|
|
21
|
-
export const CellOutputWebviewFactory = Symbol('outputWebviewFactory');
|
|
22
|
-
|
|
23
|
-
export type CellOutputWebviewFactory = (cell: NotebookCellModel, notebook: NotebookModel) => Promise<CellOutputWebview>;
|
|
24
|
-
|
|
25
|
-
export interface CellOutputWebview extends Disposable {
|
|
26
|
-
|
|
27
|
-
readonly id: string;
|
|
28
|
-
|
|
29
|
-
render(): React.ReactNode;
|
|
30
|
-
|
|
31
|
-
attachWebview(): void;
|
|
32
|
-
isAttached(): boolean
|
|
33
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { Disposable } from '@theia/core';
|
|
18
|
+
import { NotebookCellModel } from '../view-model/notebook-cell-model';
|
|
19
|
+
import { NotebookModel } from '../view-model/notebook-model';
|
|
20
|
+
|
|
21
|
+
export const CellOutputWebviewFactory = Symbol('outputWebviewFactory');
|
|
22
|
+
|
|
23
|
+
export type CellOutputWebviewFactory = (cell: NotebookCellModel, notebook: NotebookModel) => Promise<CellOutputWebview>;
|
|
24
|
+
|
|
25
|
+
export interface CellOutputWebview extends Disposable {
|
|
26
|
+
|
|
27
|
+
readonly id: string;
|
|
28
|
+
|
|
29
|
+
render(): React.ReactNode;
|
|
30
|
+
|
|
31
|
+
attachWebview(): void;
|
|
32
|
+
isAttached(): boolean
|
|
33
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2024 Typefox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
|
|
19
|
-
import { NotebookCellModel } from '../view-model/notebook-cell-model';
|
|
20
|
-
import { environment } from '@theia/core';
|
|
21
|
-
import { CellData } from '../../common';
|
|
22
|
-
|
|
23
|
-
@injectable()
|
|
24
|
-
export class NotebookClipboardService {
|
|
25
|
-
|
|
26
|
-
protected copiedCell: CellData | undefined;
|
|
27
|
-
|
|
28
|
-
@inject(ClipboardService)
|
|
29
|
-
protected readonly clipboardService: ClipboardService;
|
|
30
|
-
|
|
31
|
-
copyCell(cell: NotebookCellModel): void {
|
|
32
|
-
this.copiedCell = cell.getData();
|
|
33
|
-
|
|
34
|
-
if (environment.electron.is()) {
|
|
35
|
-
this.clipboardService.writeText(cell.text);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getCell(): CellData | undefined {
|
|
40
|
-
return this.copiedCell;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 Typefox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ClipboardService } from '@theia/core/lib/browser/clipboard-service';
|
|
19
|
+
import { NotebookCellModel } from '../view-model/notebook-cell-model';
|
|
20
|
+
import { environment } from '@theia/core';
|
|
21
|
+
import { CellData } from '../../common';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class NotebookClipboardService {
|
|
25
|
+
|
|
26
|
+
protected copiedCell: CellData | undefined;
|
|
27
|
+
|
|
28
|
+
@inject(ClipboardService)
|
|
29
|
+
protected readonly clipboardService: ClipboardService;
|
|
30
|
+
|
|
31
|
+
copyCell(cell: NotebookCellModel): void {
|
|
32
|
+
this.copiedCell = cell.getData();
|
|
33
|
+
|
|
34
|
+
if (environment.electron.is()) {
|
|
35
|
+
this.clipboardService.writeText(cell.text);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getCell(): CellData | undefined {
|
|
40
|
+
return this.copiedCell;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|