fix: allow returning from resource tabs
This commit is contained in:
@@ -3044,6 +3044,17 @@ pub(crate) fn render_editor_island_adapter_script() -> &'static str {
|
||||
});
|
||||
};
|
||||
|
||||
const bindMainEditorPageTab = () => {
|
||||
const nodes = resourceTabHostNodes();
|
||||
if (!(nodes.pageTab instanceof HTMLElement)) return;
|
||||
if (nodes.pageTab.getAttribute('data-mnote-page-tab-bound') === 'true') return;
|
||||
nodes.pageTab.setAttribute('data-mnote-page-tab-bound', 'true');
|
||||
nodes.pageTab.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
activateMainEditorTab('');
|
||||
});
|
||||
};
|
||||
|
||||
const closeResourceTab = (objectIdentity) => {
|
||||
const key = String(objectIdentity || '').trim();
|
||||
const entry = resourceTabRegistry.get(key);
|
||||
@@ -3206,6 +3217,7 @@ pub(crate) fn render_editor_island_adapter_script() -> &'static str {
|
||||
};
|
||||
|
||||
const openResourceInActiveTab = async (input = {}) => {
|
||||
bindMainEditorPageTab();
|
||||
const objectIdentity = String(input.objectIdentity || input.assetId || input.href || '').trim();
|
||||
if (!objectIdentity) return false;
|
||||
const existing = resourceTabRegistry.get(objectIdentity);
|
||||
@@ -3317,6 +3329,8 @@ pub(crate) fn render_editor_island_adapter_script() -> &'static str {
|
||||
},
|
||||
};
|
||||
|
||||
bindMainEditorPageTab();
|
||||
|
||||
window.addEventListener('pagehide', () => {
|
||||
Array.from(documentSessionRegistry.values()).forEach((session) => {
|
||||
sessionViews(session).forEach((view) => {
|
||||
|
||||
Reference in New Issue
Block a user