mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-11-11 22:51:43 +08:00
Disable add menu if file system is not writable
This commit is contained in:
parent
82b7432da5
commit
79cb0e1132
2 changed files with 4 additions and 2 deletions
|
|
@ -40,6 +40,7 @@ defmodule LivebookWeb.FileSelectComponent do
|
|||
# Component default attribute values
|
||||
inner_block: nil,
|
||||
file_system_select_disabled: false,
|
||||
writable: true,
|
||||
on_submit: nil,
|
||||
# State
|
||||
current_dir: nil,
|
||||
|
|
@ -119,11 +120,11 @@ defmodule LivebookWeb.FileSelectComponent do
|
|||
</div>
|
||||
<.menu
|
||||
id={"#{@id}-new-item-menu"}
|
||||
disabled={@file_system_select_disabled}
|
||||
disabled={@file_system_select_disabled or not @writable}
|
||||
position="bottom-right"
|
||||
>
|
||||
<:toggle>
|
||||
<.icon_button tabindex="-1" aria-label="add">
|
||||
<.icon_button disabled={not @writable} tabindex="-1" aria-label="add">
|
||||
<.remix_icon icon="add-line" />
|
||||
</.icon_button>
|
||||
</:toggle>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ defmodule LivebookWeb.OpenLive.FileComponent do
|
|||
file={@file}
|
||||
extnames={[LiveMarkdown.extension()]}
|
||||
running_files={files(@sessions)}
|
||||
writable={writable?(@file_info)}
|
||||
target={{__MODULE__, @id}}
|
||||
>
|
||||
<div class="flex justify-end space-x-2">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue