@lvce-editor/editor-worker 19.20.0 → 19.20.1
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/dist/editorWorkerMain.js +15 -1
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4158,6 +4158,10 @@ const getLanguageByFileName = (languages, fileNameLower) => {
|
|
|
4158
4158
|
}
|
|
4159
4159
|
return '';
|
|
4160
4160
|
};
|
|
4161
|
+
const getFileName = uri => {
|
|
4162
|
+
const slashIndex = Math.max(uri.lastIndexOf('/'), uri.lastIndexOf('\\'));
|
|
4163
|
+
return uri.slice(slashIndex + 1);
|
|
4164
|
+
};
|
|
4161
4165
|
const getLanguageId$1 = (uri, languages) => {
|
|
4162
4166
|
string(uri);
|
|
4163
4167
|
// TODO this is inefficient for icon theme, as file extension is computed twice
|
|
@@ -4170,7 +4174,7 @@ const getLanguageId$1 = (uri, languages) => {
|
|
|
4170
4174
|
if (candidate1) {
|
|
4171
4175
|
return candidate1;
|
|
4172
4176
|
}
|
|
4173
|
-
const fileNameLower = uri.toLowerCase();
|
|
4177
|
+
const fileNameLower = getFileName(uri).toLowerCase();
|
|
4174
4178
|
const secondExtensionIndex = getNthFileExtension(uri, extensionIndex - 1);
|
|
4175
4179
|
const secondExtension = uri.slice(secondExtensionIndex);
|
|
4176
4180
|
const candidate2 = getLanguageByExtension(languages, secondExtension);
|
|
@@ -7573,6 +7577,15 @@ const handleTouchMove = (editor, touchEvent) => {
|
|
|
7573
7577
|
setDeltaYFixedValue(editor, offsetY);
|
|
7574
7578
|
};
|
|
7575
7579
|
|
|
7580
|
+
const handleUriChange = async (editor, newUri) => {
|
|
7581
|
+
const content = getText$1(editor);
|
|
7582
|
+
await invoke$6(TextDocumentSyncFull, newUri, editor.id, editor.languageId, content);
|
|
7583
|
+
return {
|
|
7584
|
+
...editor,
|
|
7585
|
+
uri: newUri
|
|
7586
|
+
};
|
|
7587
|
+
};
|
|
7588
|
+
|
|
7576
7589
|
// Keep wheel handling as a dedicated command entry point and delegate
|
|
7577
7590
|
// the actual scroll state update to the shared setDelta logic.
|
|
7578
7591
|
// @ts-ignore
|
|
@@ -12811,6 +12824,7 @@ const commandMap = {
|
|
|
12811
12824
|
'Editor.handleTouchMove': wrapCommand(handleTouchMove),
|
|
12812
12825
|
'Editor.handleTouchStart': wrapCommand(handleTouchStart),
|
|
12813
12826
|
'Editor.handleTripleClick': wrapCommand(handleTripleClick),
|
|
12827
|
+
'Editor.handleUriChange': wrapCommand(handleUriChange),
|
|
12814
12828
|
'Editor.handleWheel': wrapCommand(handleWheel$2),
|
|
12815
12829
|
'Editor.hotReload': hotReload,
|
|
12816
12830
|
'Editor.indendLess': wrapCommand(indentLess),
|