Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/LiveDevelopment/BrowserScripts/RemoteFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function RemoteFunctions(config = {}) {
"reRegisterEventHandlers",
"handleClick", // handle click on an icon in the tool box.
// when escape key is presses in the editor, we may need to dismiss the live edit boxes.
"handleEscapePressFromEditor",
"handleEscapePress",
// interaction blocks acts as 'kill switch' to block all kinds of click handlers
// this is done so that links or buttons doesn't perform their natural operation in edit mode
"registerInteractionBlocker", // to block
Expand Down Expand Up @@ -1364,16 +1364,23 @@ function RemoteFunctions(config = {}) {
});
}

function _escapeKeyPressInEditor() {
function _handleEscapeKeyPress() {
enableHoverListeners(); // so that if hover lock is there it will get cleared
dismissUIAndCleanupState();
getAllToolHandlers().forEach(handler => {
if (handler.handleEscapePressFromEditor) {
handler.handleEscapePressFromEditor();
if (handler.handleEscapePress) {
handler.handleEscapePress();
}
});
}

document.addEventListener('keydown', function(event) {
if (config.mode === 'edit' && (event.key === 'Escape' || event.key === 'Esc')) {
event.preventDefault();
_handleEscapeKeyPress();
}
});

// we need to refresh the config once the load is completed
// this is important because messageBroker gets ready for use only when load fires
window.addEventListener('load', function() {
Expand All @@ -1397,7 +1404,7 @@ function RemoteFunctions(config = {}) {
"applyDOMEdits": applyDOMEdits,
"updateConfig": updateConfig,
"dismissUIAndCleanupState": dismissUIAndCleanupState,
"escapeKeyPressInEditor": _escapeKeyPressInEditor,
"escapeKeyPressInEditor": _handleEscapeKeyPress,
"getMode": function() { return config.mode; }
};

Expand Down
2 changes: 1 addition & 1 deletion tracking-repos.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"phoenixPro": {
"commitID": "ef4bccd6680a3eda8695a59f441adc0e3c3f1503"
"commitID": "42a00d0775203749b8c5088ad78e7aa1d48e7f3d"
}
}
Loading