Skip to content

Commit 87d934e

Browse files
committed
feat: implement off-canvas editor sidebar with enhanced UX
- Transform fixed sidebar into off-canvas overlay design - Sidebar slides in from right side with smooth animations - Main editor now takes full width for better content focus - Sidebar available in both normal and fullscreen modes - Add intuitive sidebar controls and navigation - Toggle button integrated into editor tabs (after Preview) - Sticky header with close button for easy access - Overlay backdrop and ESC key support for closing - Consistent positioning across normal and fullscreen modes - Implement keyboard shortcuts for improved workflow - Ctrl/Cmd+Shift+S: Toggle sidebar visibility - Ctrl/Cmd+S: Smart save with status-aware logic - ESC: Close sidebar when open - Enhance save functionality with intelligent behavior - Auto-detects content state (new vs existing) - Preserves published status for existing content - Validates title and slug before saving - Provides color-coded notifications for user feedback - Prevents duplicate slug creation with warnings - Improve scroll and focus management - Body scroll locked when sidebar open - Independent sidebar scrolling - Auto-focus first input when sidebar opens - Prevents background interaction on mobile - Add responsive design optimizations - Full-width sidebar on mobile devices - Proper z-index stacking for fullscreen compatibility - Touch-friendly button sizing and spacing This update significantly improves the editing experience by keeping users focused on content while providing easy access to all publishing options without scrolling away from the editor.
1 parent e789d37 commit 87d934e

7 files changed

Lines changed: 511 additions & 16 deletions

File tree

core/admin/static/css/admin.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ select:focus {
407407
width: 100%;
408408
height: 100%;
409409
background-color: rgba(0, 0, 0, 0.5);
410-
z-index: 1000;
410+
z-index: 10000;
411411
justify-content: center;
412412
align-items: center;
413413
}

core/admin/static/css/editor.css

Lines changed: 136 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
* Extension of admin.css for the content editor interface
44
*/
55

6+
/* Prevent body scroll when sidebar is open */
7+
body.editor-sidebar-open {
8+
overflow: hidden;
9+
}
10+
611
/* Editor Container */
712
.editor-container {
813
padding: 2rem;
@@ -31,14 +36,10 @@
3136
gap: 2rem;
3237
}
3338

39+
/* Main editor takes full width */
3440
.editor-main {
35-
flex: 1;
36-
min-width: 0; /* Fix for flexbox content overflow */
37-
}
38-
39-
.editor-sidebar {
40-
width: 300px;
41-
flex-shrink: 0;
41+
width: 100%;
42+
max-width: none;
4243
}
4344

4445
/* Main Editor Area */
@@ -143,6 +144,31 @@
143144
position: relative;
144145
}
145146

147+
/* Sidebar toggle button in tabs */
148+
.editor-sidebar-toggle-btn {
149+
background-color: transparent;
150+
border: none;
151+
padding: 6px 12px;
152+
cursor: pointer;
153+
transition: all 0.2s ease;
154+
border-radius: 4px;
155+
display: flex;
156+
align-items: center;
157+
justify-content: center;
158+
font-size: 1rem;
159+
color: #495057;
160+
}
161+
162+
.editor-sidebar-toggle-btn:hover {
163+
background-color: rgba(229, 231, 235, 0.5);
164+
color: #0066cc;
165+
}
166+
167+
.editor-sidebar-toggle-btn.active {
168+
background-color: #0066cc;
169+
color: white;
170+
}
171+
146172
.view-toggle-btn {
147173
background-color: transparent;
148174
border: none;
@@ -277,23 +303,85 @@
277303
margin: 10px 0;
278304
}
279305

306+
/* Transform existing sidebar into off-canvas */
307+
.editor-sidebar {
308+
position: fixed;
309+
top: 0;
310+
right: -320px; /* Hidden by default */
311+
width: 320px;
312+
height: 100vh;
313+
background-color: #fff;
314+
box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
315+
z-index: 10000;
316+
transition: right 0.3s ease;
317+
overflow-y: auto;
318+
border-left: 1px solid #e0e0e0;
319+
padding: 0;
320+
}
321+
322+
.editor-sidebar.open {
323+
right: 0;
324+
}
325+
326+
/* Sidebar sticky header with close button */
327+
.editor-sidebar-header {
328+
position: sticky;
329+
top: 0;
330+
display: flex;
331+
justify-content: space-between;
332+
align-items: center;
333+
background-color: #f8f9fa;
334+
padding: 1rem 1.5rem;
335+
border-bottom: 1px solid #e0e0e0;
336+
z-index: 10;
337+
}
338+
339+
.editor-sidebar-header h3 {
340+
margin: 0;
341+
font-weight: 600;
342+
font-size: 1.1rem;
343+
color: #333;
344+
}
345+
346+
.editor-sidebar-close-btn {
347+
background: none;
348+
border: none;
349+
cursor: pointer;
350+
color: #666;
351+
padding: 0;
352+
display: flex;
353+
align-items: center;
354+
justify-content: center;
355+
border-radius: 50%;
356+
transition: all 0.2s ease;
357+
font-size: 1rem;
358+
}
359+
360+
.editor-sidebar-close-btn:hover {
361+
background-color: #e9ecef;
362+
color: #333;
363+
}
364+
280365
/* Sidebar Sections */
281366
.sidebar-section {
282367
background-color: #fff;
283-
border-radius: 5px;
284-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
285-
margin-bottom: 1.5rem;
368+
margin-bottom: 0;
286369
padding: 1.5rem;
370+
border-bottom: 1px solid #bfbfbf;
287371
}
288372

289373
.sidebar-section h3 {
290-
border-bottom: 1px solid #eee;
291374
font-size: 1.1rem;
292375
margin-top: 0;
293376
margin-bottom: 1rem;
294377
padding-bottom: 0.5rem;
295378
}
296379

380+
.editor-sidebar .sidebar-section:last-child {
381+
border-bottom: none;
382+
padding-bottom: 2rem;
383+
}
384+
297385
/* Help Text */
298386
.help-text {
299387
color: #6c757d;
@@ -307,15 +395,18 @@
307395
}
308396

309397
/* Responsive Adjustments */
398+
@media (min-width: 1400px) {
399+
.editor-sidebar {
400+
width: 380px;
401+
right: -380px;
402+
}
403+
}
404+
310405
@media (max-width: 992px) {
311406
.editor-body {
312407
flex-direction: column;
313408
}
314409

315-
.editor-sidebar {
316-
width: 100%;
317-
}
318-
319410
.md-content-container.side-by-side {
320411
grid-template-columns: 1fr;
321412
}
@@ -340,6 +431,16 @@
340431
border-right: none;
341432
padding-right: 0;
342433
}
434+
435+
.editor-sidebar {
436+
width: 100%;
437+
right: -100%;
438+
}
439+
440+
.editor-sidebar-toggle-btn {
441+
font-size: 0.9rem;
442+
padding: 5px 10px;
443+
}
343444
}
344445

345446
/* Error State for Form Validation */
@@ -432,6 +533,7 @@
432533
padding: 2rem;
433534
font-size: 1.1rem;
434535
line-height: 1.7;
536+
max-height: 100%;
435537
}
436538

437539
.md-fullscreen-mode .md-preview {
@@ -1081,3 +1183,22 @@ input[type="datetime-local"] {
10811183
font-family: monospace;
10821184
font-size: 0.9em;
10831185
}
1186+
1187+
/* Overlay */
1188+
.editor-sidebar-overlay {
1189+
position: fixed;
1190+
top: 0;
1191+
left: 0;
1192+
width: 100%;
1193+
height: 100%;
1194+
background-color: rgba(0, 0, 0, 0.5);
1195+
z-index: 9999;
1196+
opacity: 0;
1197+
visibility: hidden;
1198+
transition: all 0.3s ease;
1199+
}
1200+
1201+
.editor-sidebar-overlay.active {
1202+
opacity: 1;
1203+
visibility: visible;
1204+
}

core/admin/static/js/editor/editor.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,15 @@ document.addEventListener("DOMContentLoaded", function () {
252252
})
253253
}
254254
}
255+
256+
document.addEventListener("keydown", (e) => {
257+
if ((e.ctrlKey || e.metaKey) && e.key === "s") {
258+
e.preventDefault()
259+
260+
// Use the ContentService method if available
261+
if (window.contentService) {
262+
window.contentService.handleKeyboardSave()
263+
}
264+
}
265+
})
255266
})

0 commit comments

Comments
 (0)