Skip to content

Agent Zero AI framework

Polish Editor toolbar actions

Alessandro8c6157301926
diff --git a/plugins/_editor/webui/editor-panel.html b/plugins/_editor/webui/editor-panel.html
index 318aed2e5..310a8f7a3 100644
--- a/plugins/_editor/webui/editor-panel.html
+++ b/plugins/_editor/webui/editor-panel.html
@@ -79,6 +79,16 @@
<div class="editor-toolbar" x-show="$store.editor.session" style="display: none;">
<div class="editor-toolbar-row">
+ <button
+ type="button"
+ class="editor-icon-button editor-mode-toggle"
+ :title="$store.editor.viewModeTitle()"
+ :aria-label="$store.editor.viewModeTitle()"
+ @click="$store.editor.toggleViewMode()"
+ >
+ <span class="material-symbols-outlined" aria-hidden="true" x-text="$store.editor.viewModeIcon()"></span>
+ </button>
+
<div class="editor-tool-group editor-source-tools" x-show="$store.editor.isMarkdown() && $store.editor.isSourceMode()" style="display: none;">
<button type="button" class="editor-icon-button" title="Undo" aria-label="Undo" :disabled="!$store.editor.canUndo()" @click="$store.editor.undo()">
<span class="material-symbols-outlined">undo</span>
@@ -127,12 +137,14 @@
<button
type="button"
- class="editor-icon-button editor-mode-toggle"
- :title="$store.editor.viewModeTitle()"
- :aria-label="$store.editor.viewModeTitle()"
- @click="$store.editor.toggleViewMode()"
+ class="editor-icon-button editor-save-button"
+ :class="{ 'is-primary': $store.editor.dirty || $store.editor.saving }"
+ :title="$store.editor.saving ? 'Saving' : 'Save'"
+ :aria-label="$store.editor.saving ? 'Saving' : 'Save'"
+ :disabled="$store.editor.saving"
+ @click="$store.editor.save()"
>
- <span class="material-symbols-outlined" aria-hidden="true" x-text="$store.editor.viewModeIcon()"></span>
+ <span class="material-symbols-outlined" :class="{ spinning: $store.editor.saving }" x-text="$store.editor.saving ? 'progress_activity' : 'save'"></span>
</button>
<div class="editor-file-actions" x-data="{ open: false }" @click.outside="open = false" @keydown.escape.window="open = false">
@@ -149,10 +161,6 @@
<span class="material-symbols-outlined">more_vert</span>
</button>
<div class="editor-new-menu editor-file-menu" role="menu" x-show="open" @click.stop>
- <button type="button" class="editor-new-menu-item" :class="{ 'is-emphasized': $store.editor.dirty }" role="menuitem" :disabled="$store.editor.saving" @click="open = false; $store.editor.save()">
- <span class="material-symbols-outlined" :class="{ spinning: $store.editor.saving }" x-text="$store.editor.saving ? 'progress_activity' : 'save'"></span>
- <span>Save</span>
- </button>
<button type="button" class="editor-new-menu-item" role="menuitem" :disabled="$store.editor.saving" @click="open = false; $store.editor.renameActiveFile()">
<span class="material-symbols-outlined" aria-hidden="true">edit</span>
<span>Rename</span>
diff --git a/tests/test_office_canvas_setup.py b/tests/test_office_canvas_setup.py
index b4c398a80..7ac4545b5 100644
--- a/tests/test_office_canvas_setup.py
+++ b/tests/test_office_canvas_setup.py
@@ -519,6 +519,31 @@ def test_editor_open_file_browser_prefers_context_home_before_workdir_fallback()
assert "workdirPath = response?.settings?.workdir_path || workdirPath;" in open_file_browser
+def test_editor_toolbar_places_preview_toggle_left_and_save_on_right():
+ editor_panel = read("plugins", "_editor", "webui", "editor-panel.html")
+ toolbar_start = editor_panel.index('<div class="editor-toolbar"')
+ toolbar_end = editor_panel.index('<div class="editor-search-bar"', toolbar_start)
+ toolbar = editor_panel[toolbar_start:toolbar_end]
+
+ mode_toggle = toolbar.index("editor-mode-toggle")
+ source_tools = toolbar.index("editor-source-tools")
+ preview_tools = toolbar.index("editor-preview-tools")
+ spacer = toolbar.index("editor-toolbar-spacer")
+ save_button = toolbar.index("editor-save-button")
+ file_actions = toolbar.index("editor-file-actions")
+ file_menu = toolbar.index("editor-file-menu")
+
+ assert mode_toggle < source_tools
+ assert mode_toggle < preview_tools
+ assert spacer < save_button < file_actions < file_menu
+ assert "@click=\"$store.editor.save()\"" in toolbar
+
+ file_menu_markup = toolbar[file_menu:]
+ assert "<span>Save</span>" not in file_menu_markup
+ assert "<span>Rename</span>" in file_menu_markup
+ assert "<span>Close File</span>" in file_menu_markup
+
+
def test_office_and_desktop_skills_are_rehomed_and_renamed():
office_skills = PROJECT_ROOT / "plugins" / "_office" / "skills"
desktop_skills = PROJECT_ROOT / "plugins" / "_desktop" / "skills"