Skip to content

Commit

Permalink
on scroll hide context item
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Aug 14, 2024
1 parent 6bf4635 commit 792de32
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 19 deletions.
4 changes: 3 additions & 1 deletion components/editor/command-k/command-editor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,6 @@ window.ide_clear_context_menu = () => {
ftd.set_value("ui.fifthtry.com/components/editor/vars#context-menu-path", "");
ftd.set_value("ui.fifthtry.com/components/editor/vars#context-menu-visible", "hidden");
update_context_menu_path("");
}
}


2 changes: 1 addition & 1 deletion components/editor/editor-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/editor/editor-bundle.js.map

Large diffs are not rendered by default.

47 changes: 34 additions & 13 deletions components/editor/panels/package/index.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $on-mouse-leave$: $ftd.set-bool($a=$package.hover, v=false)
width: fill-container
align-content: center

-- ftd.text: loading
-- ftd.text: loading

-- end: ftd.column

Expand Down Expand Up @@ -107,11 +107,11 @@ boolean open: false

-- ftd.column:

-- file-context-menu:
if: { vars.context-menu-visible == "file" }
-- file-context-menu:
if: { vars.context-menu-visible == "file" }

-- folder-context-menu:
if: { vars.context-menu-visible == "folder" }
-- folder-context-menu:
if: { vars.context-menu-visible == "folder" }

-- end: ftd.column

Expand Down Expand Up @@ -144,21 +144,38 @@ border-color: #f5f5f5



-- component cm-item:
caption title:
string cmd:
boolean $hover: false

-- ftd.text: $cm-item.title
width: fill-container
padding.px: 4
border-width.px: 1
background.solid if { cm-item.hover }: #f5f5f5
$on-click$: $vars.open-command-k-with-context-item(cmd=$cm-item.cmd)
$on-mouse-enter$: $ftd.set-bool($a = $cm-item.hover, v = true)
$on-mouse-leave$: $ftd.set-bool($a = $cm-item.hover, v = false)

-- end: cm-item



-- component file-context-menu:

-- cm:

-- ftd.text: Push
if: { ftd.list_contains(vars.modified-files, vars.context-menu-path) }
$on-click$: $vars.open-command-k-with-current-file(cmd=push-file)
;; this is hidden because its causing a crash
/-- cm-item: Push
if: { ftd.list_contains(vars.modified-files, vars.context-menu-path) }
cmd: push-file

-- ftd.text: Delete
$on-click$: $vars.open-command-k-with-current-file(cmd=delete-file)
-- cm-item: Delete
cmd: delete-file

;; -- ftd.text: Rename
;; -- cm-item: Rename / Move
;; -- ftd.text: View History

-- end: cm

Expand All @@ -174,15 +191,19 @@ $on-click$: $vars.open-command-k-with-current-file(cmd=delete-file)

-- cm:

-- ftd.text: Add File
$on-click$: $vars.open-command-k-with-current-folder(cmd=add-file)
-- cm-item: Add File
cmd: add-file

;; -- cm-item: View History

-- end: cm

-- end: folder-context-menu





-- component package-name:
caption name:
string url:
Expand Down
4 changes: 4 additions & 0 deletions components/editor/panels/package/package-content.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ONLY_MODIFIED_FILES = "only-modified-files";

export function initialize_package_ui() {
let ftd_root = document.getElementById(ROOT_ID);
ftd_root.addEventListener("scroll", window.ide_clear_context_menu);
ftd2.render(show_package_content, {folders: [], files: [], ftd_root}, ftd_root);
}

Expand Down Expand Up @@ -324,3 +325,6 @@ const show_folder = ({
),
);
}



6 changes: 3 additions & 3 deletions components/editor/vars.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ string file: $current-file
ide_open_command_k(cmd + " " + file)


-- void open-command-k-with-current-folder(cmd):
-- void open-command-k-with-context-item(cmd):
string cmd:
string folder: $context-menu-path
string ctx: $context-menu-path

ide_open_command_k(cmd + " " + folder)
ide_open_command_k(cmd + " " + ctx)

-- void run-command():

Expand Down

0 comments on commit 792de32

Please sign in to comment.