diff --git a/mod/ovis-composer/main.js b/mod/ovis-composer/main.js index 4273e77..1be5018 100644 --- a/mod/ovis-composer/main.js +++ b/mod/ovis-composer/main.js @@ -2191,6 +2191,12 @@ export default class Composer extends View { pick: (key, cx) => this.panelPickKey(key, cx), toggle: (key, cx) => this.panelToggleKey(key, cx), clear: (cx) => this.panelClear(cx), + // The close button: what Esc does - the field gets the keyboard, the + // caret and the height of the block back. + close: (cx) => { + this.closePanel(); + cx.notify(); + }, }), ); } diff --git a/mod/ovis-composer/panel.js b/mod/ovis-composer/panel.js index 70f7aab..ddc7ef5 100644 --- a/mod/ovis-composer/panel.js +++ b/mod/ovis-composer/panel.js @@ -43,6 +43,7 @@ const TEXT_HEIGHT = 34; * pick: (key:string, cx:any) => void, * toggle: (key:string, cx:any) => void, * clear: (cx:any) => void, + * close: (cx:any) => void, * }} on */ export function renderPanel(t, view, on) { @@ -114,6 +115,21 @@ function renderTop(t, view, on) { .child("✕"), ), ), + // Close the panel - the same road as Esc. + div() + .id("composer-panel-close") + .size(28) + .flex_none() + .flex() + .items_center() + .justify_center() + .rounded(6) + .text_size(13) + .text_color(t.dim) + .cursor_pointer() + .hover((s) => s.bg(t.hover).text_color(t.foreground)) + .on_click((event, cx) => on.close(cx)) + .child("✕"), ]); }