monaco-editor 0.56.0-dev-20260120 → 0.56.0-dev-20260121
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/dev/vs/basic-languages/monaco.contribution.js +18 -18
- package/dev/vs/{cssMode-DYAvCb0Q.js → cssMode-B0VkNrib.js} +1 -1
- package/dev/vs/editor/editor.main.css +34 -20
- package/dev/vs/editor/editor.main.js +1 -1
- package/dev/vs/{editor-V-thM4Kh.js → editor-CR18QzPP.js} +541 -177
- package/dev/vs/editor.js +1 -1
- package/dev/vs/{freemarker2-DNhaeW6n.js → freemarker2-Byr9HmH9.js} +1 -1
- package/dev/vs/{handlebars-B9XLHU9b.js → handlebars-BEVXeROF.js} +1 -1
- package/dev/vs/{html-CSZlVq5J.js → html-CetHjWIf.js} +1 -1
- package/dev/vs/{htmlMode-DkNCbjhM.js → htmlMode-BNKYUVNo.js} +1 -1
- package/dev/vs/{index-CuJyCoc4.js → index-g_7JbDIY.js} +1 -1
- package/dev/vs/index.js +1 -1
- package/dev/vs/{javascript-D1PoJUjx.js → javascript-BEgEU725.js} +1 -1
- package/dev/vs/{jsonMode-C84g5aG1.js → jsonMode-CT2UkfFE.js} +1 -1
- package/dev/vs/language/css/monaco.contribution.js +1 -1
- package/dev/vs/language/html/monaco.contribution.js +1 -1
- package/dev/vs/language/json/monaco.contribution.js +1 -1
- package/dev/vs/language/typescript/monaco.contribution.js +1 -1
- package/dev/vs/{liquid-BR1qAgSc.js → liquid-D-aiCb1P.js} +1 -1
- package/dev/vs/{lspLanguageFeatures-e8bPBYUK.js → lspLanguageFeatures-CE9Occyu.js} +1 -1
- package/dev/vs/{mdx-BLfAN-pP.js → mdx-DchJ8pbq.js} +1 -1
- package/dev/vs/{monaco.contribution-BpJCJ2aN.js → monaco.contribution-CHqb1dWh.js} +2 -2
- package/dev/vs/{monaco.contribution-BoVCpaaV.js → monaco.contribution-CVBrIlxn.js} +2 -2
- package/dev/vs/{monaco.contribution-Ccg01HGd.js → monaco.contribution-CZxuzvA9.js} +2 -2
- package/dev/vs/{monaco.contribution-ehavOHIf.js → monaco.contribution-Cw4OdERZ.js} +2 -2
- package/dev/vs/nls/lang/cs.js +1 -1
- package/dev/vs/nls/lang/de.js +1 -1
- package/dev/vs/nls/lang/es.js +1 -1
- package/dev/vs/nls/lang/fr.js +1 -1
- package/dev/vs/nls/lang/it.js +1 -1
- package/dev/vs/nls/lang/ja.js +1 -1
- package/dev/vs/nls/lang/ko.js +1 -1
- package/dev/vs/nls/lang/pl.js +1 -1
- package/dev/vs/nls/lang/pt-br.js +1 -1
- package/dev/vs/nls/lang/ru.js +1 -1
- package/dev/vs/nls/lang/tr.js +1 -1
- package/dev/vs/nls/lang/zh-cn.js +1 -1
- package/dev/vs/nls/lang/zh-tw.js +1 -1
- package/dev/vs/{python-sycHAgxs.js → python-BCOSaCC8.js} +1 -1
- package/dev/vs/{razor-B62R6Lsx.js → razor-BM2tZCwj.js} +1 -1
- package/dev/vs/{toggleHighContrast-3bUMPAmT.js → toggleHighContrast-CLgtrrIB.js} +141 -310
- package/dev/vs/{tsMode-Co79Xo5K.js → tsMode-jpkv3SbL.js} +1 -1
- package/dev/vs/{typescript-_1BH4dlp.js → typescript-f8pt88eA.js} +1 -1
- package/dev/vs/{workers-BGdHt1rb.js → workers-zrUx_2Gw.js} +1 -1
- package/dev/vs/{xml-Cqh8dVgY.js → xml-CmSjtiR0.js} +1 -1
- package/dev/vs/{yaml-D6-bhWv5.js → yaml-PRriLGdw.js} +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +1 -0
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +81 -35
- package/esm/vs/editor/browser/controller/editContext/editContext.js +11 -0
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +39 -32
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +5 -16
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +39 -16
- package/esm/vs/editor/browser/dataTransfer.js +1 -1
- package/esm/vs/editor/browser/view.js +21 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +18 -0
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js +3 -3
- package/esm/vs/editor/common/model/textModel.js +4 -4
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +20 -16
- package/esm/vs/editor/common/viewModel/viewModelDecorations.js +11 -4
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +25 -14
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +28 -64
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +27 -20
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.js +37 -9
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.css +7 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +22 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +1 -0
- package/esm/vs/editor/editor.api.d.ts +5 -1
- package/esm/vs/nls/lang/cs.js +1 -1
- package/esm/vs/nls/lang/de.js +1 -1
- package/esm/vs/nls/lang/es.js +1 -1
- package/esm/vs/nls/lang/fr.js +1 -1
- package/esm/vs/nls/lang/it.js +1 -1
- package/esm/vs/nls/lang/ja.js +1 -1
- package/esm/vs/nls/lang/ko.js +1 -1
- package/esm/vs/nls/lang/pl.js +1 -1
- package/esm/vs/nls/lang/pt-br.js +1 -1
- package/esm/vs/nls/lang/ru.js +1 -1
- package/esm/vs/nls/lang/tr.js +1 -1
- package/esm/vs/nls/lang/zh-cn.js +1 -1
- package/esm/vs/nls/lang/zh-tw.js +1 -1
- package/esm/vs/platform/actionWidget/browser/actionList.js +46 -6
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +9 -2
- package/min/vs/basic-languages/monaco.contribution.js +1 -1
- package/min/vs/{cssMode-C9eBIuJR.js → cssMode-CheCY05R.js} +1 -1
- package/min/vs/editor/editor.main.css +1 -1
- package/min/vs/editor/editor.main.js +1 -1
- package/min/vs/{editor-Ch74nR58.js → editor-DxYWA3-X.js} +112 -110
- package/min/vs/editor.js +1 -1
- package/min/vs/{freemarker2-sjIgVc3I.js → freemarker2-C7J7V1Hp.js} +1 -1
- package/min/vs/{handlebars-IDPYJ5Bq.js → handlebars-DsCar5Ix.js} +1 -1
- package/min/vs/{html-DfUrEqvV.js → html-BGLIaUZV.js} +1 -1
- package/min/vs/{htmlMode-Dg0zLT1w.js → htmlMode-BB6WOoy3.js} +1 -1
- package/min/vs/{index-D6TJnMd3.js → index-BdR0nSqf.js} +1 -1
- package/min/vs/index.js +1 -1
- package/min/vs/{javascript-BpnRo0yM.js → javascript-CXE3i1eX.js} +1 -1
- package/min/vs/{jsonMode-DtUQxAtK.js → jsonMode-rtaE9alu.js} +1 -1
- package/min/vs/language/css/monaco.contribution.js +1 -1
- package/min/vs/language/html/monaco.contribution.js +1 -1
- package/min/vs/language/json/monaco.contribution.js +1 -1
- package/min/vs/language/typescript/monaco.contribution.js +1 -1
- package/min/vs/{liquid-Bpv368IV.js → liquid-CEdn0ovR.js} +1 -1
- package/min/vs/{lspLanguageFeatures-C0Mzq6q_.js → lspLanguageFeatures-CRAjJmzF.js} +1 -1
- package/min/vs/{mdx-CT-XRvYr.js → mdx-DLDMIqnu.js} +1 -1
- package/min/vs/{monaco.contribution-tn0sN6iU.js → monaco.contribution-BrRAk-VA.js} +1 -1
- package/min/vs/{monaco.contribution-B6pVhtM0.js → monaco.contribution-C67XgReK.js} +1 -1
- package/min/vs/{monaco.contribution-ZmSpiAe2.js → monaco.contribution-CYT-Sx3l.js} +1 -1
- package/min/vs/{monaco.contribution-Bp7k_fZE.js → monaco.contribution-DjiQkKLa.js} +1 -1
- package/min/vs/nls/lang/cs.js +1 -1
- package/min/vs/nls/lang/de.js +1 -1
- package/min/vs/nls/lang/es.js +1 -1
- package/min/vs/nls/lang/fr.js +1 -1
- package/min/vs/nls/lang/it.js +1 -1
- package/min/vs/nls/lang/ja.js +1 -1
- package/min/vs/nls/lang/ko.js +1 -1
- package/min/vs/nls/lang/pl.js +1 -1
- package/min/vs/nls/lang/pt-br.js +1 -1
- package/min/vs/nls/lang/ru.js +1 -1
- package/min/vs/nls/lang/tr.js +1 -1
- package/min/vs/nls/lang/zh-cn.js +1 -1
- package/min/vs/nls/lang/zh-tw.js +1 -1
- package/min/vs/{python-CdDzXJRR.js → python-CKbl_I3e.js} +1 -1
- package/min/vs/{razor-oKyioz5n.js → razor--RjiPxbd.js} +1 -1
- package/min/vs/{toggleHighContrast-CKdnSOZR.js → toggleHighContrast-BKDMxisH.js} +30 -32
- package/min/vs/{tsMode-cB-UHsG6.js → tsMode-C48d5M22.js} +1 -1
- package/min/vs/{typescript-B8RK7Scz.js → typescript-e7oUhPyX.js} +1 -1
- package/min/vs/{workers-DYaZhUMn.js → workers-CtpYUoCo.js} +1 -1
- package/min/vs/{xml-DvqAg4in.js → xml-tOyfgws7.js} +1 -1
- package/min/vs/{yaml-KLiQ2nzu.js → yaml-Cmf9NYDf.js} +1 -1
- package/monaco.d.ts +5 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define("vs/tsMode-
|
|
1
|
+
define("vs/tsMode-jpkv3SbL", ["exports", "./ts.worker-CArJhH03", "./editor-CR18QzPP", "./workers-zrUx_2Gw", "./monaco.contribution-CVBrIlxn"], (function(exports, ts_worker, editor, workers, src_deprecated_language_typescript_monaco_contribution_ts) {
|
|
2
2
|
"use strict";
|
|
3
3
|
class WorkerManager {
|
|
4
4
|
constructor(_modeId, _defaults) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define("vs/typescript-
|
|
1
|
+
define("vs/typescript-f8pt88eA", ["exports", "./editor-CR18QzPP"], (function(exports, editor) {
|
|
2
2
|
"use strict";
|
|
3
3
|
const conf = {
|
|
4
4
|
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define("vs/workers-
|
|
1
|
+
define("vs/workers-zrUx_2Gw", ["exports", "./editor-CR18QzPP", "./toggleHighContrast-CLgtrrIB"], (function(exports, editor, toggleHighContrast) {
|
|
2
2
|
"use strict";
|
|
3
3
|
function createTrustedTypesPolicy(policyName, policyOptions) {
|
|
4
4
|
const monacoEnvironment = globalThis.MonacoEnvironment;
|
|
@@ -498,6 +498,7 @@ function getDomSanitizerConfig(mdStrConfig, options) {
|
|
|
498
498
|
Schemas.vscodeRemote,
|
|
499
499
|
Schemas.vscodeRemoteResource,
|
|
500
500
|
Schemas.vscodeNotebookCell,
|
|
501
|
+
Schemas.vscodeChatPrompt,
|
|
501
502
|
// For links that are handled entirely by the action handler
|
|
502
503
|
Schemas.internal,
|
|
503
504
|
];
|
|
@@ -1,55 +1,42 @@
|
|
|
1
1
|
import { isWindows } from '../../../../base/common/platform.js';
|
|
2
2
|
import { Mimes } from '../../../../base/common/mime.js';
|
|
3
|
-
import { LogLevel } from '../../../../platform/log/common/log.js';
|
|
4
3
|
import { generateUuid } from '../../../../base/common/uuid.js';
|
|
4
|
+
import { toExternalVSDataTransfer } from '../../dataTransfer.js';
|
|
5
5
|
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
// execCommand('copy') does not always work (it does not fire a clipboard event)
|
|
17
|
-
// !!!!!
|
|
18
|
-
// We signal that we have executed a copy command
|
|
19
|
-
CopyOptions.electronBugWorkaroundCopyEventHasFired = true;
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
if (e.clipboardData) {
|
|
22
|
-
ClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, storedMetadata);
|
|
23
|
-
}
|
|
24
|
-
logService.trace('ensureClipboardGetsEditorSelection with id : ', id, ' with text.length: ', dataToCopy.text.length);
|
|
6
|
+
function generateDataToCopyAndStoreInMemory(viewModel, id, isFirefox) {
|
|
7
|
+
const { dataToCopy, metadata } = generateDataToCopy(viewModel);
|
|
8
|
+
storeMetadataInMemory(dataToCopy.text, metadata, isFirefox);
|
|
9
|
+
return { dataToCopy, metadata };
|
|
10
|
+
}
|
|
11
|
+
function storeMetadataInMemory(textToCopy, metadata, isFirefox) {
|
|
12
|
+
InMemoryClipboardMetadataManager.INSTANCE.set(
|
|
13
|
+
// When writing "LINE\r\n" to the clipboard and then pasting,
|
|
14
|
+
// Firefox pastes "LINE\n", so let's work around this quirk
|
|
15
|
+
(isFirefox ? textToCopy.replace(/\r\n/g, '\n') : textToCopy), metadata);
|
|
25
16
|
}
|
|
26
|
-
function
|
|
27
|
-
const emptySelectionClipboard =
|
|
28
|
-
const copyWithSyntaxHighlighting =
|
|
17
|
+
function generateDataToCopy(viewModel) {
|
|
18
|
+
const emptySelectionClipboard = viewModel.getEditorOption(45 /* EditorOption.emptySelectionClipboard */);
|
|
19
|
+
const copyWithSyntaxHighlighting = viewModel.getEditorOption(31 /* EditorOption.copyWithSyntaxHighlighting */);
|
|
29
20
|
const selections = viewModel.getCursorStates().map(cursorState => cursorState.modelState.selection);
|
|
30
21
|
const dataToCopy = getDataToCopy(viewModel, selections, emptySelectionClipboard, copyWithSyntaxHighlighting);
|
|
31
|
-
const
|
|
22
|
+
const metadata = {
|
|
32
23
|
version: 1,
|
|
33
|
-
id,
|
|
24
|
+
id: generateUuid(),
|
|
34
25
|
isFromEmptySelection: dataToCopy.isFromEmptySelection,
|
|
35
26
|
multicursorText: dataToCopy.multicursorText,
|
|
36
27
|
mode: dataToCopy.mode
|
|
37
28
|
};
|
|
38
|
-
|
|
39
|
-
// When writing "LINE\r\n" to the clipboard and then pasting,
|
|
40
|
-
// Firefox pastes "LINE\n", so let's work around this quirk
|
|
41
|
-
(isFirefox ? dataToCopy.text.replace(/\r\n/g, '\n') : dataToCopy.text), storedMetadata);
|
|
42
|
-
return { dataToCopy, storedMetadata };
|
|
29
|
+
return { dataToCopy, metadata };
|
|
43
30
|
}
|
|
44
31
|
function getDataToCopy(viewModel, modelSelections, emptySelectionClipboard, copyWithSyntaxHighlighting) {
|
|
45
|
-
const
|
|
32
|
+
const { sourceRanges, sourceText } = viewModel.getPlainTextToCopy(modelSelections, emptySelectionClipboard, isWindows);
|
|
46
33
|
const newLineCharacter = viewModel.model.getEOL();
|
|
47
34
|
const isFromEmptySelection = (emptySelectionClipboard && modelSelections.length === 1 && modelSelections[0].isEmpty());
|
|
48
|
-
const multicursorText = (Array.isArray(
|
|
49
|
-
const text = (Array.isArray(
|
|
35
|
+
const multicursorText = (Array.isArray(sourceText) ? sourceText : null);
|
|
36
|
+
const text = (Array.isArray(sourceText) ? sourceText.join(newLineCharacter) : sourceText);
|
|
50
37
|
let html = undefined;
|
|
51
38
|
let mode = null;
|
|
52
|
-
if (CopyOptions.forceCopyWithSyntaxHighlighting || (copyWithSyntaxHighlighting &&
|
|
39
|
+
if (CopyOptions.forceCopyWithSyntaxHighlighting || (copyWithSyntaxHighlighting && sourceText.length < 65536)) {
|
|
53
40
|
const richText = viewModel.getRichTextToCopy(modelSelections, emptySelectionClipboard);
|
|
54
41
|
if (richText) {
|
|
55
42
|
html = richText.html;
|
|
@@ -58,6 +45,7 @@ function getDataToCopy(viewModel, modelSelections, emptySelectionClipboard, copy
|
|
|
58
45
|
}
|
|
59
46
|
const dataToCopy = {
|
|
60
47
|
isFromEmptySelection,
|
|
48
|
+
sourceRanges,
|
|
61
49
|
multicursorText,
|
|
62
50
|
text,
|
|
63
51
|
html,
|
|
@@ -122,5 +110,63 @@ const ClipboardEventUtils = {
|
|
|
122
110
|
clipboardData.setData('vscode-editor-data', JSON.stringify(metadata));
|
|
123
111
|
}
|
|
124
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* Creates an IClipboardCopyEvent from a DOM ClipboardEvent.
|
|
115
|
+
*/
|
|
116
|
+
function createClipboardCopyEvent(e, isCut, context, logService, isFirefox) {
|
|
117
|
+
const { dataToCopy, metadata } = generateDataToCopy(context.viewModel);
|
|
118
|
+
let handled = false;
|
|
119
|
+
return {
|
|
120
|
+
isCut,
|
|
121
|
+
clipboardData: {
|
|
122
|
+
setData: (type, value) => {
|
|
123
|
+
e.clipboardData?.setData(type, value);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
dataToCopy,
|
|
127
|
+
ensureClipboardGetsEditorData: () => {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
if (e.clipboardData) {
|
|
130
|
+
ClipboardEventUtils.setTextData(e.clipboardData, dataToCopy.text, dataToCopy.html, metadata);
|
|
131
|
+
}
|
|
132
|
+
storeMetadataInMemory(dataToCopy.text, metadata, isFirefox);
|
|
133
|
+
logService.trace('ensureClipboardGetsEditorSelection with id : ', metadata.id, ' with text.length: ', dataToCopy.text.length);
|
|
134
|
+
},
|
|
135
|
+
setHandled: () => {
|
|
136
|
+
handled = true;
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
e.stopImmediatePropagation();
|
|
139
|
+
},
|
|
140
|
+
get isHandled() { return handled; },
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Creates an IClipboardPasteEvent from a DOM ClipboardEvent.
|
|
145
|
+
*/
|
|
146
|
+
function createClipboardPasteEvent(e) {
|
|
147
|
+
let handled = false;
|
|
148
|
+
let [text, metadata] = e.clipboardData ? ClipboardEventUtils.getTextData(e.clipboardData) : ['', null];
|
|
149
|
+
metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
|
|
150
|
+
return {
|
|
151
|
+
clipboardData: createReadableClipboardData(e.clipboardData),
|
|
152
|
+
metadata,
|
|
153
|
+
text,
|
|
154
|
+
toExternalVSDataTransfer: () => e.clipboardData ? toExternalVSDataTransfer(e.clipboardData) : undefined,
|
|
155
|
+
browserEvent: e,
|
|
156
|
+
setHandled: () => {
|
|
157
|
+
handled = true;
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
e.stopImmediatePropagation();
|
|
160
|
+
},
|
|
161
|
+
get isHandled() { return handled; },
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function createReadableClipboardData(dataTransfer) {
|
|
165
|
+
return {
|
|
166
|
+
types: Array.from(dataTransfer?.types ?? []),
|
|
167
|
+
files: Array.prototype.slice.call(dataTransfer?.files ?? [], 0),
|
|
168
|
+
getData: (type) => dataTransfer?.getData(type) ?? '',
|
|
169
|
+
};
|
|
170
|
+
}
|
|
125
171
|
|
|
126
|
-
export {
|
|
172
|
+
export { CopyOptions, InMemoryClipboardMetadataManager, createClipboardCopyEvent, createClipboardPasteEvent, createReadableClipboardData, generateDataToCopyAndStoreInMemory };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Emitter } from '../../../../base/common/event.js';
|
|
1
2
|
import { ViewPart } from '../../view/viewPart.js';
|
|
2
3
|
|
|
3
4
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -5,6 +6,16 @@ import { ViewPart } from '../../view/viewPart.js';
|
|
|
5
6
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
7
|
*--------------------------------------------------------------------------------------------*/
|
|
7
8
|
class AbstractEditContext extends ViewPart {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
// Clipboard events - emitted before the default clipboard handling
|
|
12
|
+
this._onWillCopy = this._register(new Emitter());
|
|
13
|
+
this.onWillCopy = this._onWillCopy.event;
|
|
14
|
+
this._onWillCut = this._register(new Emitter());
|
|
15
|
+
this.onWillCut = this._onWillCut.event;
|
|
16
|
+
this._onWillPaste = this._register(new Emitter());
|
|
17
|
+
this.onWillPaste = this._onWillPaste.event;
|
|
18
|
+
}
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
export { AbstractEditContext };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './nativeEditContext.css';
|
|
2
2
|
import { isFirefox } from '../../../../../base/browser/browser.js';
|
|
3
|
-
import { getWindow, addDisposableListener, getActiveElement, getWindowId
|
|
3
|
+
import { getWindow, addDisposableListener, getActiveElement, getWindowId } from '../../../../../base/browser/dom.js';
|
|
4
4
|
import { FastDomNode } from '../../../../../base/browser/fastDomNode.js';
|
|
5
5
|
import { StandardKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';
|
|
6
6
|
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
|
|
7
|
-
import {
|
|
7
|
+
import { CopyOptions, createClipboardCopyEvent, createClipboardPasteEvent } from '../clipboardUtils.js';
|
|
8
8
|
import { AbstractEditContext } from '../editContext.js';
|
|
9
9
|
import { FocusTracker, editContextAddDisposableListener } from './nativeEditContextUtils.js';
|
|
10
10
|
import { ScreenReaderSupport } from './screenReaderSupport.js';
|
|
@@ -81,14 +81,30 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
|
|
|
81
81
|
this._screenReaderSupport = this._register(instantiationService.createInstance(ScreenReaderSupport, this.domNode, context, this._viewController));
|
|
82
82
|
this._register(addDisposableListener(this.domNode.domNode, 'copy', (e) => {
|
|
83
83
|
this.logService.trace('NativeEditContext#copy');
|
|
84
|
-
|
|
84
|
+
// !!!!!
|
|
85
|
+
// This is a workaround for what we think is an Electron bug where
|
|
86
|
+
// execCommand('copy') does not always work (it does not fire a clipboard event)
|
|
87
|
+
// !!!!!
|
|
88
|
+
// We signal that we have executed a copy command
|
|
89
|
+
CopyOptions.electronBugWorkaroundCopyEventHasFired = true;
|
|
90
|
+
const copyEvent = createClipboardCopyEvent(e, /* isCut */ false, this._context, this.logService, isFirefox);
|
|
91
|
+
this._onWillCopy.fire(copyEvent);
|
|
92
|
+
if (copyEvent.isHandled) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
copyEvent.ensureClipboardGetsEditorData();
|
|
85
96
|
}));
|
|
86
97
|
this._register(addDisposableListener(this.domNode.domNode, 'cut', (e) => {
|
|
87
98
|
this.logService.trace('NativeEditContext#cut');
|
|
99
|
+
const cutEvent = createClipboardCopyEvent(e, /* isCut */ true, this._context, this.logService, isFirefox);
|
|
100
|
+
this._onWillCut.fire(cutEvent);
|
|
101
|
+
if (cutEvent.isHandled) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
88
104
|
// Pretend here we touched the text area, as the `cut` event will most likely
|
|
89
105
|
// result in a `selectionchange` event which we want to ignore
|
|
90
106
|
this._screenReaderSupport.onWillCut();
|
|
91
|
-
|
|
107
|
+
cutEvent.ensureClipboardGetsEditorData();
|
|
92
108
|
this.logService.trace('NativeEditContext#cut (before viewController.cut)');
|
|
93
109
|
this._viewController.cut();
|
|
94
110
|
}));
|
|
@@ -107,28 +123,32 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
|
|
|
107
123
|
}));
|
|
108
124
|
this._register(addDisposableListener(this.domNode.domNode, 'paste', (e) => {
|
|
109
125
|
this.logService.trace('NativeEditContext#paste');
|
|
126
|
+
const pasteEvent = createClipboardPasteEvent(e);
|
|
127
|
+
this._onWillPaste.fire(pasteEvent);
|
|
128
|
+
if (pasteEvent.isHandled) {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
110
132
|
e.preventDefault();
|
|
111
133
|
if (!e.clipboardData) {
|
|
112
134
|
return;
|
|
113
135
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (!text) {
|
|
136
|
+
this.logService.trace('NativeEditContext#paste with id : ', pasteEvent.metadata?.id, ' with text.length: ', pasteEvent.text.length);
|
|
137
|
+
if (!pasteEvent.text) {
|
|
117
138
|
return;
|
|
118
139
|
}
|
|
119
|
-
metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
|
|
120
140
|
let pasteOnNewLine = false;
|
|
121
141
|
let multicursorText = null;
|
|
122
142
|
let mode = null;
|
|
123
|
-
if (metadata) {
|
|
143
|
+
if (pasteEvent.metadata) {
|
|
124
144
|
const options = this._context.configuration.options;
|
|
125
145
|
const emptySelectionClipboard = options.get(45 /* EditorOption.emptySelectionClipboard */);
|
|
126
|
-
pasteOnNewLine = emptySelectionClipboard && !!metadata.isFromEmptySelection;
|
|
127
|
-
multicursorText = typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null;
|
|
128
|
-
mode = metadata.mode;
|
|
146
|
+
pasteOnNewLine = emptySelectionClipboard && !!pasteEvent.metadata.isFromEmptySelection;
|
|
147
|
+
multicursorText = typeof pasteEvent.metadata.multicursorText !== 'undefined' ? pasteEvent.metadata.multicursorText : null;
|
|
148
|
+
mode = pasteEvent.metadata.mode;
|
|
129
149
|
}
|
|
130
150
|
this.logService.trace('NativeEditContext#paste (before viewController.paste)');
|
|
131
|
-
this._viewController.paste(text, pasteOnNewLine, multicursorText, mode);
|
|
151
|
+
this._viewController.paste(pasteEvent.text, pasteOnNewLine, multicursorText, mode);
|
|
132
152
|
}));
|
|
133
153
|
// Edit context events
|
|
134
154
|
this._register(editContextAddDisposableListener(this._editContext, 'textformatupdate', (e) => this._handleTextFormatUpdate(e)));
|
|
@@ -196,8 +216,6 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
|
|
|
196
216
|
this.domNode.domNode.blur();
|
|
197
217
|
this.domNode.domNode.remove();
|
|
198
218
|
this._imeTextArea.domNode.remove();
|
|
199
|
-
this._selectionAndControlBoundsUpdateDisposable?.dispose();
|
|
200
|
-
this._selectionAndControlBoundsUpdateDisposable = undefined;
|
|
201
219
|
super.dispose();
|
|
202
220
|
}
|
|
203
221
|
setAriaOptions(options) {
|
|
@@ -262,15 +280,15 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
|
|
|
262
280
|
onZonesChanged(e) {
|
|
263
281
|
return true;
|
|
264
282
|
}
|
|
265
|
-
|
|
266
|
-
this.logService.trace('NativeEditContext#
|
|
267
|
-
this.
|
|
283
|
+
handleWillPaste() {
|
|
284
|
+
this.logService.trace('NativeEditContext#handleWillPaste');
|
|
285
|
+
this._prepareScreenReaderForPaste();
|
|
268
286
|
}
|
|
269
|
-
|
|
287
|
+
_prepareScreenReaderForPaste() {
|
|
270
288
|
this._screenReaderSupport.onWillPaste();
|
|
271
289
|
}
|
|
272
|
-
|
|
273
|
-
this.logService.trace('NativeEditContext#
|
|
290
|
+
handleWillCopy() {
|
|
291
|
+
this.logService.trace('NativeEditContext#handleWillCopy');
|
|
274
292
|
this.logService.trace('NativeEditContext#isFocused : ', this.domNode.domNode === getActiveElement());
|
|
275
293
|
}
|
|
276
294
|
writeScreenReaderContent() {
|
|
@@ -435,17 +453,6 @@ let NativeEditContext = class NativeEditContext extends AbstractEditContext {
|
|
|
435
453
|
}
|
|
436
454
|
}
|
|
437
455
|
_updateSelectionAndControlBoundsAfterRender() {
|
|
438
|
-
if (this._selectionAndControlBoundsUpdateDisposable) {
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
// Schedule this work after render so we avoid triggering a layout while still painting.
|
|
442
|
-
const targetWindow = getWindow(this.domNode.domNode);
|
|
443
|
-
this._selectionAndControlBoundsUpdateDisposable = scheduleAtNextAnimationFrame(targetWindow, () => {
|
|
444
|
-
this._selectionAndControlBoundsUpdateDisposable = undefined;
|
|
445
|
-
this._applySelectionAndControlBounds();
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
_applySelectionAndControlBounds() {
|
|
449
456
|
const options = this._context.configuration.options;
|
|
450
457
|
const contentLeft = options.get(165 /* EditorOption.layoutInfo */).contentLeft;
|
|
451
458
|
const viewSelection = this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import './textAreaEditContext.css';
|
|
2
2
|
import { localize } from '../../../../../nls.js';
|
|
3
3
|
import { isSafari, isFirefox, isChrome, isAndroid } from '../../../../../base/browser/browser.js';
|
|
4
|
-
import { getWindow, scheduleAtNextAnimationFrame } from '../../../../../base/browser/dom.js';
|
|
5
4
|
import { createFastDomNode } from '../../../../../base/browser/fastDomNode.js';
|
|
6
5
|
import { OS, isMacintosh } from '../../../../../base/common/platform.js';
|
|
7
6
|
import { isHighSurrogate } from '../../../../../base/common/strings.js';
|
|
@@ -99,7 +98,6 @@ let TextAreaEditContext = class TextAreaEditContext extends AbstractEditContext
|
|
|
99
98
|
super(context);
|
|
100
99
|
this._keybindingService = _keybindingService;
|
|
101
100
|
this._instantiationService = _instantiationService;
|
|
102
|
-
this._scheduledRender = null;
|
|
103
101
|
this._primaryCursorPosition = new Position(1, 1);
|
|
104
102
|
this._primaryCursorVisibleRange = null;
|
|
105
103
|
this._viewController = viewController;
|
|
@@ -207,6 +205,10 @@ let TextAreaEditContext = class TextAreaEditContext extends AbstractEditContext
|
|
|
207
205
|
isFirefox: isFirefox,
|
|
208
206
|
isSafari: isSafari,
|
|
209
207
|
}));
|
|
208
|
+
// Relay clipboard events from TextAreaInput
|
|
209
|
+
this._register(this._textAreaInput.onWillCopy(e => this._onWillCopy.fire(e)));
|
|
210
|
+
this._register(this._textAreaInput.onWillCut(e => this._onWillCut.fire(e)));
|
|
211
|
+
this._register(this._textAreaInput.onWillPaste(e => this._onWillPaste.fire(e)));
|
|
210
212
|
this._register(this._textAreaInput.onKeyDown((e) => {
|
|
211
213
|
this._viewController.emitKeyDown(e);
|
|
212
214
|
}));
|
|
@@ -333,8 +335,6 @@ let TextAreaEditContext = class TextAreaEditContext extends AbstractEditContext
|
|
|
333
335
|
this._textAreaInput.writeNativeTextAreaContent(reason);
|
|
334
336
|
}
|
|
335
337
|
dispose() {
|
|
336
|
-
this._scheduledRender?.dispose();
|
|
337
|
-
this._scheduledRender = null;
|
|
338
338
|
super.dispose();
|
|
339
339
|
this.textArea.domNode.remove();
|
|
340
340
|
this.textAreaCover.domNode.remove();
|
|
@@ -536,18 +536,7 @@ let TextAreaEditContext = class TextAreaEditContext extends AbstractEditContext
|
|
|
536
536
|
}
|
|
537
537
|
render(ctx) {
|
|
538
538
|
this._textAreaInput.writeNativeTextAreaContent('render');
|
|
539
|
-
this.
|
|
540
|
-
}
|
|
541
|
-
// Delay expensive DOM updates until the next animation frame to reduce reflow pressure.
|
|
542
|
-
_scheduleRender() {
|
|
543
|
-
if (this._scheduledRender) {
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
const targetWindow = getWindow(this.textArea.domNode);
|
|
547
|
-
this._scheduledRender = scheduleAtNextAnimationFrame(targetWindow, () => {
|
|
548
|
-
this._scheduledRender = null;
|
|
549
|
-
this._render();
|
|
550
|
-
});
|
|
539
|
+
this._render();
|
|
551
540
|
}
|
|
552
541
|
_render() {
|
|
553
542
|
if (this._visibleTextArea) {
|
|
@@ -10,7 +10,7 @@ import { isHighSurrogate } from '../../../../../base/common/strings.js';
|
|
|
10
10
|
import { Selection } from '../../../../common/core/selection.js';
|
|
11
11
|
import { IAccessibilityService } from '../../../../../platform/accessibility/common/accessibility.js';
|
|
12
12
|
import { ILogService } from '../../../../../platform/log/common/log.js';
|
|
13
|
-
import { InMemoryClipboardMetadataManager,
|
|
13
|
+
import { InMemoryClipboardMetadataManager, createClipboardCopyEvent, CopyOptions, createClipboardPasteEvent } from '../clipboardUtils.js';
|
|
14
14
|
import { TextAreaState } from './textAreaEditContextState.js';
|
|
15
15
|
|
|
16
16
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -78,6 +78,12 @@ let TextAreaInput = class TextAreaInput extends Disposable {
|
|
|
78
78
|
this.onCut = this._onCut.event;
|
|
79
79
|
this._onPaste = this._register(new Emitter());
|
|
80
80
|
this.onPaste = this._onPaste.event;
|
|
81
|
+
this._onWillCopy = this._register(new Emitter());
|
|
82
|
+
this.onWillCopy = this._onWillCopy.event;
|
|
83
|
+
this._onWillCut = this._register(new Emitter());
|
|
84
|
+
this.onWillCut = this._onWillCut.event;
|
|
85
|
+
this._onWillPaste = this._register(new Emitter());
|
|
86
|
+
this.onWillPaste = this._onWillPaste.event;
|
|
81
87
|
this._onType = this._register(new Emitter());
|
|
82
88
|
this.onType = this._onType.event;
|
|
83
89
|
this._onCompositionStart = this._register(new Emitter());
|
|
@@ -238,40 +244,57 @@ let TextAreaInput = class TextAreaInput extends Disposable {
|
|
|
238
244
|
// --- Clipboard operations
|
|
239
245
|
this._register(this._textArea.onCut((e) => {
|
|
240
246
|
this._logService.trace(`TextAreaInput#onCut`, e);
|
|
247
|
+
// Fire onWillCut event to allow interception
|
|
248
|
+
const cutEvent = createClipboardCopyEvent(e, /* isCut */ true, this._host.context, this._logService, this._browser.isFirefox);
|
|
249
|
+
this._onWillCut.fire(cutEvent);
|
|
250
|
+
if (cutEvent.isHandled) {
|
|
251
|
+
// Event was handled externally, skip default processing
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
241
254
|
// Pretend here we touched the text area, as the `cut` event will most likely
|
|
242
255
|
// result in a `selectionchange` event which we want to ignore
|
|
243
256
|
this._textArea.setIgnoreSelectionChangeTime('received cut event');
|
|
244
|
-
|
|
245
|
-
ensureClipboardGetsEditorSelection(e, this._host.context, this._logService, this._browser.isFirefox);
|
|
246
|
-
}
|
|
257
|
+
cutEvent.ensureClipboardGetsEditorData();
|
|
247
258
|
this._asyncTriggerCut.schedule();
|
|
248
259
|
}));
|
|
249
260
|
this._register(this._textArea.onCopy((e) => {
|
|
250
261
|
this._logService.trace(`TextAreaInput#onCopy`, e);
|
|
251
|
-
|
|
252
|
-
|
|
262
|
+
// !!!!!
|
|
263
|
+
// This is a workaround for what we think is an Electron bug where
|
|
264
|
+
// execCommand('copy') does not always work (it does not fire a clipboard event)
|
|
265
|
+
// !!!!!
|
|
266
|
+
// We signal that we have executed a copy command
|
|
267
|
+
CopyOptions.electronBugWorkaroundCopyEventHasFired = true;
|
|
268
|
+
// Fire onWillCopy event to allow interception
|
|
269
|
+
const copyEvent = createClipboardCopyEvent(e, /* isCut */ false, this._host.context, this._logService, this._browser.isFirefox);
|
|
270
|
+
this._onWillCopy.fire(copyEvent);
|
|
271
|
+
if (copyEvent.isHandled) {
|
|
272
|
+
// Event was handled externally, skip default processing
|
|
273
|
+
return;
|
|
253
274
|
}
|
|
275
|
+
copyEvent.ensureClipboardGetsEditorData();
|
|
254
276
|
}));
|
|
255
277
|
this._register(this._textArea.onPaste((e) => {
|
|
256
278
|
this._logService.trace(`TextAreaInput#onPaste`, e);
|
|
279
|
+
// Fire onWillPaste event to allow interception
|
|
280
|
+
const pasteEvent = createClipboardPasteEvent(e);
|
|
281
|
+
this._onWillPaste.fire(pasteEvent);
|
|
282
|
+
if (pasteEvent.isHandled) {
|
|
283
|
+
// Event was handled externally, skip default processing
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
257
286
|
// Pretend here we touched the text area, as the `paste` event will most likely
|
|
258
287
|
// result in a `selectionchange` event which we want to ignore
|
|
259
288
|
this._textArea.setIgnoreSelectionChangeTime('received paste event');
|
|
260
289
|
e.preventDefault();
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
let [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
|
|
265
|
-
this._logService.trace(`TextAreaInput#onPaste with id : `, metadata?.id, ' with text.length: ', text.length);
|
|
266
|
-
if (!text) {
|
|
290
|
+
this._logService.trace(`TextAreaInput#onPaste with id : `, pasteEvent.metadata?.id, ' with text.length: ', pasteEvent.text.length);
|
|
291
|
+
if (!pasteEvent.text) {
|
|
267
292
|
return;
|
|
268
293
|
}
|
|
269
|
-
// try the in-memory store
|
|
270
|
-
metadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
|
|
271
294
|
this._logService.trace(`TextAreaInput#onPaste (before onPaste)`);
|
|
272
295
|
this._onPaste.fire({
|
|
273
|
-
text: text,
|
|
274
|
-
metadata: metadata
|
|
296
|
+
text: pasteEvent.text,
|
|
297
|
+
metadata: pasteEvent.metadata
|
|
275
298
|
});
|
|
276
299
|
}));
|
|
277
300
|
this._register(this._textArea.onFocus(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataTransfers } from '../../base/browser/dnd.js';
|
|
2
|
-
import {
|
|
2
|
+
import { createStringDataTransferItem, UriList, VSDataTransfer, createFileDataTransferItem } from '../../base/common/dataTransfer.js';
|
|
3
3
|
import { Mimes } from '../../base/common/mime.js';
|
|
4
4
|
import { URI } from '../../base/common/uri.js';
|
|
5
5
|
import { getPathForFile, CodeDataTransfers } from '../../platform/dnd/browser/dnd.js';
|
|
@@ -2,7 +2,7 @@ import { runAtThisOrScheduleAtNextAnimationFrame, getWindow, trackFocus } from '
|
|
|
2
2
|
import { createFastDomNode } from '../../base/browser/fastDomNode.js';
|
|
3
3
|
import { inputLatency } from '../../base/browser/performance.js';
|
|
4
4
|
import { BugIndicatingError, onUnexpectedError } from '../../base/common/errors.js';
|
|
5
|
-
import { Disposable } from '../../base/common/lifecycle.js';
|
|
5
|
+
import { DisposableStore, Disposable } from '../../base/common/lifecycle.js';
|
|
6
6
|
import { PointerHandlerLastRenderData } from './controller/mouseTarget.js';
|
|
7
7
|
import { PointerHandler } from './controller/pointerHandler.js';
|
|
8
8
|
import { RenderingContext } from './view/renderingContext.js';
|
|
@@ -66,6 +66,14 @@ let View = class View extends ViewEventHandler {
|
|
|
66
66
|
constructor(editorContainer, ownerID, commandDelegate, configuration, colorTheme, model, userInputEvents, overflowWidgetsDomNode, _instantiationService) {
|
|
67
67
|
super();
|
|
68
68
|
this._instantiationService = _instantiationService;
|
|
69
|
+
this._editContextClipboardListeners = new DisposableStore();
|
|
70
|
+
// Clipboard events relayed from editContext
|
|
71
|
+
this._onWillCopy = this._register(new Emitter());
|
|
72
|
+
this.onWillCopy = this._onWillCopy.event;
|
|
73
|
+
this._onWillCut = this._register(new Emitter());
|
|
74
|
+
this.onWillCut = this._onWillCut.event;
|
|
75
|
+
this._onWillPaste = this._register(new Emitter());
|
|
76
|
+
this.onWillPaste = this._onWillPaste.event;
|
|
69
77
|
// Actual mutable state
|
|
70
78
|
this._shouldRecomputeGlyphMarginLanes = false;
|
|
71
79
|
this._ownerID = ownerID;
|
|
@@ -88,6 +96,7 @@ let View = class View extends ViewEventHandler {
|
|
|
88
96
|
this._editContextEnabled = this._context.configuration.options.get(170 /* EditorOption.effectiveEditContext */);
|
|
89
97
|
this._accessibilitySupport = this._context.configuration.options.get(2 /* EditorOption.accessibilitySupport */);
|
|
90
98
|
this._editContext = this._instantiateEditContext();
|
|
99
|
+
this._connectEditContextClipboardEvents();
|
|
91
100
|
this._viewParts.push(this._editContext);
|
|
92
101
|
// These two dom nodes must be constructed up front, since references are needed in the layout provider (scrolling & co.)
|
|
93
102
|
this._linesContent = createFastDomNode(document.createElement('div'));
|
|
@@ -211,6 +220,7 @@ let View = class View extends ViewEventHandler {
|
|
|
211
220
|
const indexOfEditContext = this._viewParts.indexOf(this._editContext);
|
|
212
221
|
this._editContext.dispose();
|
|
213
222
|
this._editContext = this._instantiateEditContext();
|
|
223
|
+
this._connectEditContextClipboardEvents();
|
|
214
224
|
if (isEditContextFocused) {
|
|
215
225
|
this._editContext.focus();
|
|
216
226
|
}
|
|
@@ -218,6 +228,14 @@ let View = class View extends ViewEventHandler {
|
|
|
218
228
|
this._viewParts.splice(indexOfEditContext, 1, this._editContext);
|
|
219
229
|
}
|
|
220
230
|
}
|
|
231
|
+
_connectEditContextClipboardEvents() {
|
|
232
|
+
// Dispose old listeners
|
|
233
|
+
this._editContextClipboardListeners.clear();
|
|
234
|
+
// Connect to current edit context's clipboard events
|
|
235
|
+
this._editContextClipboardListeners.add(this._editContext.onWillCopy(e => this._onWillCopy.fire(e)));
|
|
236
|
+
this._editContextClipboardListeners.add(this._editContext.onWillCut(e => this._onWillCut.fire(e)));
|
|
237
|
+
this._editContextClipboardListeners.add(this._editContext.onWillPaste(e => this._onWillPaste.fire(e)));
|
|
238
|
+
}
|
|
221
239
|
_computeGlyphMarginLanes() {
|
|
222
240
|
const model = this._context.viewModel.model;
|
|
223
241
|
const laneModel = this._context.viewModel.glyphLanes;
|
|
@@ -353,6 +371,8 @@ let View = class View extends ViewEventHandler {
|
|
|
353
371
|
this._renderAnimationFrame.dispose();
|
|
354
372
|
this._renderAnimationFrame = null;
|
|
355
373
|
}
|
|
374
|
+
// Dispose clipboard event listeners
|
|
375
|
+
this._editContextClipboardListeners.dispose();
|
|
356
376
|
this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove();
|
|
357
377
|
this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove();
|
|
358
378
|
this._context.removeEventHandler(this);
|
|
@@ -134,6 +134,12 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
|
|
|
134
134
|
this.onDidCompositionEnd = this._onDidCompositionEnd.event;
|
|
135
135
|
this._onDidPaste = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
|
|
136
136
|
this.onDidPaste = this._onDidPaste.event;
|
|
137
|
+
this._onWillCopy = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
|
|
138
|
+
this.onWillCopy = this._onWillCopy.event;
|
|
139
|
+
this._onWillCut = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
|
|
140
|
+
this.onWillCut = this._onWillCut.event;
|
|
141
|
+
this._onWillPaste = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
|
|
142
|
+
this.onWillPaste = this._onWillPaste.event;
|
|
137
143
|
this._onMouseUp = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
|
|
138
144
|
this.onMouseUp = this._onMouseUp.event;
|
|
139
145
|
this._onMouseDown = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
|
|
@@ -1240,6 +1246,14 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
|
|
|
1240
1246
|
this._modelData.view.render(true, forceRedraw);
|
|
1241
1247
|
});
|
|
1242
1248
|
}
|
|
1249
|
+
renderAsync(forceRedraw = false) {
|
|
1250
|
+
if (!this._modelData || !this._modelData.hasRealView) {
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
this._modelData.viewModel.batchEvents(() => {
|
|
1254
|
+
this._modelData.view.render(false, forceRedraw);
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1243
1257
|
setAriaOptions(options) {
|
|
1244
1258
|
if (!this._modelData || !this._modelData.hasRealView) {
|
|
1245
1259
|
return;
|
|
@@ -1396,6 +1410,10 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
|
|
|
1396
1410
|
}
|
|
1397
1411
|
view.render(false, true);
|
|
1398
1412
|
view.domNode.domNode.setAttribute('data-uri', model.uri.toString());
|
|
1413
|
+
// Connect clipboard events from View
|
|
1414
|
+
listenersToRemove.push(view.onWillCopy(e => this._onWillCopy.fire(e)));
|
|
1415
|
+
listenersToRemove.push(view.onWillCut(e => this._onWillCut.fire(e)));
|
|
1416
|
+
listenersToRemove.push(view.onWillPaste(e => this._onWillPaste.fire(e)));
|
|
1399
1417
|
}
|
|
1400
1418
|
this._modelData = new ModelData(model, viewModel, view, hasRealView, listenersToRemove, attachedView);
|
|
1401
1419
|
}
|
|
@@ -25,7 +25,7 @@ class ColorizedBracketPairsDecorationProvider extends Disposable {
|
|
|
25
25
|
this.colorizationOptions = this.textModel.getOptions().bracketPairColorizationOptions;
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
|
-
getDecorationsInRange(range, ownerId, filterOutValidation, onlyMinimapDecorations) {
|
|
28
|
+
getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMinimapDecorations) {
|
|
29
29
|
if (onlyMinimapDecorations) {
|
|
30
30
|
// Bracket pair colorization decorations are not rendered in the minimap
|
|
31
31
|
return [];
|
|
@@ -47,14 +47,14 @@ class ColorizedBracketPairsDecorationProvider extends Disposable {
|
|
|
47
47
|
})).toArray();
|
|
48
48
|
return result;
|
|
49
49
|
}
|
|
50
|
-
getAllDecorations(ownerId, filterOutValidation) {
|
|
50
|
+
getAllDecorations(ownerId, filterOutValidation, filterFontDecorations) {
|
|
51
51
|
if (ownerId === undefined) {
|
|
52
52
|
return [];
|
|
53
53
|
}
|
|
54
54
|
if (!this.colorizationOptions.enabled) {
|
|
55
55
|
return [];
|
|
56
56
|
}
|
|
57
|
-
return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation);
|
|
57
|
+
return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation, filterFontDecorations);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
class ColorProvider {
|