mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-06 08:52:47 +02:00
#211 - Replace text selection on media insert
This commit is contained in:
+2
-1
@@ -4,11 +4,12 @@
|
||||
|
||||
### 🎨 Enhancements
|
||||
|
||||
- [#211](https://github.com/estruyf/vscode-front-matter/issues/211): Replace text selection on media inserts
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#210](https://github.com/estruyf/vscode-front-matter/issues/210): Fix for adding media files with uppercase file extensions
|
||||
|
||||
|
||||
## [5.8.0] - 2021-12-21 - 🎄
|
||||
|
||||
### 🎨 Enhancements
|
||||
|
||||
@@ -283,7 +283,15 @@ export class MediaHelpers {
|
||||
}
|
||||
}
|
||||
|
||||
await editor?.edit(builder => builder.insert(new Position(line, character), data.snippet || ``));
|
||||
const selection = editor?.selection;
|
||||
await editor?.edit(builder => {
|
||||
const snippet = data.snippet || ``;
|
||||
if (selection !== undefined) {
|
||||
builder.replace(selection, snippet);
|
||||
} else {
|
||||
builder.insert(new Position(line, character), snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
panel.getMediaSelection();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user