Update browser title with flow name if set

Fixes #4394
This commit is contained in:
Nick O'Leary 2023-11-07 17:24:04 +00:00
parent 6ac905f264
commit c52985d245
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -17,6 +17,8 @@
RED.workspaces = (function() { RED.workspaces = (function() {
const documentTitle = document.title;
var activeWorkspace = 0; var activeWorkspace = 0;
var workspaceIndex = 0; var workspaceIndex = 0;
@ -339,12 +341,18 @@ RED.workspaces = (function() {
$("#red-ui-workspace-chart").show(); $("#red-ui-workspace-chart").show();
activeWorkspace = tab.id; activeWorkspace = tab.id;
window.location.hash = 'flow/'+tab.id; window.location.hash = 'flow/'+tab.id;
if (tab.label) {
document.title = `${documentTitle} : ${tab.label}`
} else {
document.title = documentTitle
}
$("#red-ui-workspace").toggleClass("red-ui-workspace-disabled", !!tab.disabled); $("#red-ui-workspace").toggleClass("red-ui-workspace-disabled", !!tab.disabled);
$("#red-ui-workspace").toggleClass("red-ui-workspace-locked", !!tab.locked); $("#red-ui-workspace").toggleClass("red-ui-workspace-locked", !!tab.locked);
} else { } else {
$("#red-ui-workspace-chart").hide(); $("#red-ui-workspace-chart").hide();
activeWorkspace = 0; activeWorkspace = 0;
window.location.hash = ''; window.location.hash = '';
document.title = documentTitle
} }
event.workspace = activeWorkspace; event.workspace = activeWorkspace;
RED.events.emit("workspace:change",event); RED.events.emit("workspace:change",event);