-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudioWorkspace.html
More file actions
38 lines (38 loc) · 1.89 KB
/
Copy pathStudioWorkspace.html
File metadata and controls
38 lines (38 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script>
(function () {
'use strict';
if (!window.HTMLStudioPlus) return;
function $(id) { return document.getElementById(id); }
function qsa(selector) { return Array.prototype.slice.call(document.querySelectorAll(selector)); }
function show(view) {
qsa('.library-tab').forEach(function (tab) {
var active = tab.getAttribute('data-library-view') === view;
tab.classList.toggle('active', active);
tab.setAttribute('aria-selected', active ? 'true' : 'false');
});
var notesLauncher = document.getElementById('notesLauncherBtn');
if (notesLauncher) {
notesLauncher.classList.toggle('active', view === 'notes');
notesLauncher.setAttribute('aria-pressed', view === 'notes' ? 'true' : 'false');
}
var addPage = document.getElementById('addPageBtn');
if (addPage) addPage.classList.toggle('hidden', view !== 'pages');
qsa('[data-library-panel]').forEach(function (panel) {
panel.classList.toggle('hidden', panel.getAttribute('data-library-panel') !== view);
});
var title = $('libraryPanelTitle');
if (title) title.textContent = view === 'layers' ? 'Layers' : view === 'elements' ? 'Elements' : view === 'media' ? 'Media' : view === 'notes' ? 'Notes' : 'Pages';
var add = $('addPageBtn');
if (add) add.classList.toggle('hidden', view !== 'pages');
}
try {
qsa('.library-tab').forEach(function (tab) { tab.addEventListener('click', function () { show(tab.getAttribute('data-library-view')); }); });
var notesLauncher = document.getElementById('notesLauncherBtn');
if (notesLauncher) notesLauncher.addEventListener('click', function () { show('notes'); });
document.documentElement.setAttribute('data-html-studio-workspace', 'ready');
} catch (error) {
document.documentElement.setAttribute('data-html-studio-workspace', 'error');
console.error('[HTML Studio] Workspace extension failed:', error);
}
})();
</script>