Skip to content

Commit 7b7bb50

Browse files
committed
fix: save not working when user is between editing text
1 parent 15dd201 commit 7b7bb50

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/LiveDevelopment/BrowserScripts/LiveDevProtocolRemote.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,19 @@
459459
// for save
460460
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "s") {
461461
e.preventDefault();
462+
463+
// to check if user was in between editing text
464+
// in such cases we first finish the editing and then save
465+
const activeElement = document.activeElement;
466+
if (activeElement &&
467+
activeElement.hasAttribute("contenteditable") &&
468+
activeElement.hasAttribute("data-brackets-id") &&
469+
window._LD &&
470+
window._LD.finishEditing) {
471+
472+
window._LD.finishEditing(activeElement);
473+
}
474+
462475
MessageBroker.send({
463476
livePreviewEditEnabled: true,
464477
saveCurrentDocument: true

0 commit comments

Comments
 (0)