Skip to content

Commit 30520b9

Browse files
committed
feat: media toolbar button group for video/embed insertion
- Added Media toolbar group (▶ Video, 🎬 Embed Grid, ▶ YouTube) - Rose/pink accent to differentiate from other toolbar groups - One-click insert of video tags, embed grids, and YouTube embeds - Registered media templates in coding-blocks.js
1 parent 8442426 commit 30520b9

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Media Toolbar Button — Insert Media Tags
2+
3+
- Added Media toolbar button group (▶ Video, 🎬 Embed Grid, ▶ YouTube)
4+
- Rose/pink accent (#f472b6) to differentiate from AI (teal), API (orange), Linux (green), Coding (indigo)
5+
- ▶ Video inserts `![My Video](https://www.w3schools.com/html/mov_bbb.mp4)` example
6+
- 🎬 Embed Grid inserts a 2-column embed grid template with YouTube, video, and website examples
7+
- ▶ YouTube inserts `![YouTube Video](https://www.youtube.com/watch?v=...)` example
8+
- Media actions registered via `M.registerFormattingAction()` in `coding-blocks.js`
9+
- Group uses shared `fmt-coding-group` base styles with `.fmt-media-group` accent override
10+
11+
---
12+
13+
## Summary
14+
Adds a "Media" toolbar button group with three insert actions for video playback and embed grids, following the existing toolbar pattern.
15+
16+
---
17+
18+
## 1. Media Toolbar Buttons
19+
**Files:** `index.html`, `js/coding-blocks.js`
20+
**What:** Added Media button group with `data-action` attributes (media-video, media-embed-grid, media-youtube). Registered templates via `MEDIA_TEMPLATES` object and `M.registerFormattingAction()`.
21+
**Impact:** Users can insert video/embed markdown with one click — no need to remember syntax.
22+
23+
## 2. Media Group Styling
24+
**Files:** `css/ai-docgen.css`
25+
**What:** Rose accent CSS for `.fmt-media-group` and `.fmt-media-btn` with dark/light mode support.
26+
**Impact:** Visual consistency with other toolbar groups (AI=teal, API=orange, Linux=green, Coding=indigo, Media=rose).
27+
28+
---
29+
30+
## Files Changed (3 total)
31+
32+
| File | Lines Changed | Type |
33+
|------|:---:|------|
34+
| `index.html` | +15 | Media button group HTML |
35+
| `js/coding-blocks.js` | +13 | Media template registration |
36+
| `css/ai-docgen.css` | +42 | Media group rose accent CSS |

css/ai-docgen.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,6 +1901,48 @@
19011901
background: rgba(99, 102, 241, 0.12);
19021902
}
19031903

1904+
/* ============================================
1905+
Media Group — Video / Embed Grid / YouTube
1906+
Uses rose accent (#f472b6) to differentiate
1907+
from AI (teal), API (orange), Linux (green),
1908+
Coding (indigo)
1909+
============================================ */
1910+
1911+
.fmt-media-group {
1912+
border-color: rgba(244, 114, 182, 0.25) !important;
1913+
background: rgba(244, 114, 182, 0.05) !important;
1914+
}
1915+
1916+
.fmt-media-group .fmt-coding-group-label {
1917+
color: rgba(244, 114, 182, 0.7) !important;
1918+
}
1919+
1920+
.fmt-media-btn {
1921+
color: #f472b6 !important;
1922+
font-weight: 500;
1923+
}
1924+
1925+
.fmt-media-btn:hover {
1926+
background: rgba(244, 114, 182, 0.15) !important;
1927+
}
1928+
1929+
[data-theme="light"] .fmt-media-group {
1930+
border-color: rgba(219, 39, 119, 0.3) !important;
1931+
background: rgba(219, 39, 119, 0.04) !important;
1932+
}
1933+
1934+
[data-theme="light"] .fmt-media-group .fmt-coding-group-label {
1935+
color: rgba(190, 24, 93, 0.7) !important;
1936+
}
1937+
1938+
[data-theme="light"] .fmt-media-btn {
1939+
color: #db2777 !important;
1940+
}
1941+
1942+
[data-theme="light"] .fmt-media-btn:hover {
1943+
background: rgba(219, 39, 119, 0.12) !important;
1944+
}
1945+
19041946
/* ============================================
19051947
Overflow Dropdown — "…" toggle for tag groups
19061948
Shared by AI Tags and Coding groups

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,21 @@ <h5>Menu</h5>
679679
</div>
680680
</div>
681681
<span class="fmt-separator"></span>
682+
<div class="fmt-coding-group fmt-media-group" title="Media Embedding">
683+
<span class="fmt-coding-group-label">Media</span>
684+
<button class="fmt-btn fmt-media-btn" data-action="media-video"
685+
title="Insert Video Player">▶ Video</button>
686+
<div class="fmt-group-overflow">
687+
<button class="fmt-btn fmt-group-more-btn" title="More media blocks"></button>
688+
<div class="fmt-group-dropdown">
689+
<button class="fmt-btn fmt-media-btn" data-action="media-embed-grid"
690+
title="Insert Embed Grid">🎬 Embed Grid</button>
691+
<button class="fmt-btn fmt-media-btn" data-action="media-youtube"
692+
title="Insert YouTube Video">▶ YouTube</button>
693+
</div>
694+
</div>
695+
</div>
696+
<span class="fmt-separator"></span>
682697
<button class="fmt-btn fmt-vars-btn" id="apply-vars-btn"
683698
title="Apply Variables — replace all $(varName) placeholders">
684699
<i class="bi bi-braces-asterisk"></i> <span>Vars</span>

js/coding-blocks.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
});
2222
});
2323

24+
// --- Media block templates ---
25+
var MEDIA_TEMPLATES = {
26+
'media-video': '![My Video](https://www.w3schools.com/html/mov_bbb.mp4)\n',
27+
'media-youtube': '![YouTube Video](https://www.youtube.com/watch?v=dQw4w9WgXcQ)\n',
28+
'media-embed-grid': '```embed cols=2 height=350\nhttps://www.youtube.com/watch?v=dQw4w9WgXcQ \"YouTube Video\"\nhttps://www.w3schools.com/html/mov_bbb.mp4 \"Sample Video\"\nhttps://wikipedia.org \"Wikipedia\"\nhttps://github.com \"GitHub\"\n```\n'
29+
};
30+
31+
Object.keys(MEDIA_TEMPLATES).forEach(function (action) {
32+
M.registerFormattingAction(action, function () {
33+
M.insertAtCursor('\n' + MEDIA_TEMPLATES[action]);
34+
});
35+
});
36+
2437
// --- Overflow "…" toggle for AI Tags / Coding groups ---
2538
document.querySelectorAll('.fmt-group-more-btn').forEach(function (btn) {
2639
btn.addEventListener('click', function (e) {

0 commit comments

Comments
 (0)