Skip to content

Commit 9941a9c

Browse files
committed
fix: allow the tool to specify of we should retain the options box
1 parent 202f5fb commit 9941a9c

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ function RemoteFunctions(config = {}) {
505505
startEditing(element);
506506
} else if (action === "duplicate") {
507507
_handleDuplicateOptionClick(e, element);
508+
return true;
508509
} else if (action === "delete") {
509510
_handleDeleteOptionClick(e, element);
510511
} else if (action === "cut") {
@@ -517,9 +518,10 @@ function RemoteFunctions(config = {}) {
517518
_handleAIOptionClick(e, element);
518519
} else if (action === "image-gallery") {
519520
_handleImageGalleryOptionClick(e, element);
521+
return true;
520522
} else if(LivePreviewView.getNodeMoreOptionsHandler(action)) {
521523
const handler = LivePreviewView.getNodeMoreOptionsHandler(action);
522-
handler.handleClick(e, element);
524+
return handler.handleClick(e, element);
523525
}
524526
}
525527

@@ -1019,9 +1021,9 @@ function RemoteFunctions(config = {}) {
10191021
_moreOptionsDropdown = new MoreOptionsDropdown(this.element, event.currentTarget);
10201022
}
10211023
} else {
1022-
handleOptionClick(event, action, this.element);
1024+
const keepExitingToolBox = handleOptionClick(event, action, this.element);
10231025
// as we don't want to remove the options box on duplicate button click
1024-
if (action !== 'duplicate') {
1026+
if (!keepExitingToolBox) {
10251027
this.remove();
10261028
}
10271029
}
@@ -1218,10 +1220,12 @@ function RemoteFunctions(config = {}) {
12181220

12191221
if (!handlerHandledIt) {
12201222
// Standard option - handle and close dropdown
1221-
handleOptionClick(event, action, this.targetElement);
1222-
this.remove();
1223-
if (_nodeMoreOptionsBox) {
1224-
_nodeMoreOptionsBox.remove();
1223+
const keepExitingToolBox = handleOptionClick(event, action, this.targetElement);
1224+
if(!keepExitingToolBox){
1225+
this.remove();
1226+
if (_nodeMoreOptionsBox) {
1227+
_nodeMoreOptionsBox.remove();
1228+
}
12251229
}
12261230
}
12271231
});

0 commit comments

Comments
 (0)