|
1 | 1 | // ui/toolbar.js |
2 | 2 | // |
3 | | -// Full Snail IDE–style top toolbar for TurtleMod (SnailMod-Green theme) |
4 | | -// Includes: |
5 | | -// - File / Edit / Addons / Settings menus (left) |
6 | | -// - Project name input (center) |
7 | | -// - See Project Page / Upload / Block Counter / Sign in-Join (right) |
8 | | -// - Sign in-Join uses TurtleMod-green gradient (dark → light) |
| 3 | +// SnailMod-Green Toolbar |
| 4 | +// Corrected to attach inside #editor-root (your actual HTML structure) |
| 5 | +// No dependency on #tm-topbar |
9 | 6 | // |
10 | 7 |
|
11 | 8 | window.TurtleModToolbar = (() => { |
12 | 9 | const Toolbar = {}; |
13 | 10 |
|
14 | 11 | Toolbar.init = function () { |
15 | | - const topbar = document.getElementById("tm-topbar"); |
16 | | - if (!topbar) { |
17 | | - console.error("TurtleModToolbar: #tm-topbar not found"); |
| 12 | + const root = document.getElementById("editor-root"); |
| 13 | + if (!root) { |
| 14 | + console.error("TurtleModToolbar: #editor-root not found"); |
18 | 15 | return; |
19 | 16 | } |
20 | 17 |
|
21 | | - // Main toolbar container |
| 18 | + // Create toolbar container |
22 | 19 | const bar = document.createElement("div"); |
23 | 20 | bar.id = "tm-toolbar"; |
24 | 21 |
|
25 | 22 | Object.assign(bar.style, { |
| 23 | + width: "100%", |
| 24 | + height: "56px", |
| 25 | + background: "#1f7a3a", |
| 26 | + color: "white", |
26 | 27 | display: "flex", |
27 | 28 | alignItems: "center", |
28 | 29 | justifyContent: "space-between", |
29 | | - width: "100%", |
30 | | - height: "100%", |
31 | 30 | padding: "0 16px", |
32 | 31 | boxSizing: "border-box", |
33 | | - color: "white", |
34 | | - fontSize: "14px", |
| 32 | + fontFamily: "Inter, sans-serif", |
35 | 33 | userSelect: "none" |
36 | 34 | }); |
37 | 35 |
|
@@ -167,7 +165,9 @@ window.TurtleModToolbar = (() => { |
167 | 165 | bar.appendChild(left); |
168 | 166 | bar.appendChild(middle); |
169 | 167 | bar.appendChild(right); |
170 | | - topbar.appendChild(bar); |
| 168 | + |
| 169 | + // Insert toolbar at the top of editor-root |
| 170 | + root.prepend(bar); |
171 | 171 |
|
172 | 172 | // ----------------------------- |
173 | 173 | // Actions |
|
0 commit comments