Skip to content

Commit 15dd201

Browse files
committed
feat: ctrl s to work on live preview
1 parent 49d06b0 commit 15dd201

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/LiveDevelopment/BrowserScripts/LiveDevProtocolRemote.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,15 @@
455455
redoLivePreviewOperation: true
456456
});
457457
}
458+
459+
// for save
460+
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "s") {
461+
e.preventDefault();
462+
MessageBroker.send({
463+
livePreviewEditEnabled: true,
464+
saveCurrentDocument: true
465+
});
466+
}
458467
});
459468

460469
}(this));

src/LiveDevelopment/LivePreviewEdit.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ define(function (require, exports, module) {
3030
const LiveDevelopment = require("LiveDevelopment/main");
3131
const CodeMirror = require("thirdparty/CodeMirror/lib/codemirror");
3232
const ProjectManager = require("project/ProjectManager");
33+
const CommandManager = require("command/CommandManager");
34+
const Commands = require("command/Commands");
3335
const FileSystem = require("filesystem/FileSystem");
3436
const PathUtils = require("thirdparty/path-utils/path-utils");
3537
const StringMatch = require("utils/StringMatch");
@@ -1289,6 +1291,12 @@ define(function (require, exports, module) {
12891291
* these are the main properties that are passed through the message
12901292
*/
12911293
function handleLivePreviewEditOperation(message) {
1294+
// handle save current document in live preview (ctrl/cmd + s)
1295+
if (message.saveCurrentDocument) {
1296+
CommandManager.execute(Commands.FILE_SAVE);
1297+
return;
1298+
}
1299+
12921300
// handle reset image folder selection
12931301
if (message.resetImageFolderSelection) {
12941302
_handleResetImageFolderSelection();

0 commit comments

Comments
 (0)