Skip to content

Commit

Permalink
Enforce readonly mode for uri-cell (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasMasuch committed Feb 2, 2024
1 parent 3be3011 commit f30193b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/core/src/cells/uri-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export const uriCellRenderer: InternalCellRenderer<UriCell> = {
const { onChange, value, forceEditMode, validatedSelection } = p;
return (
<UriOverlayEditor
forceEditMode={forceEditMode || (cell.hoverEffect === true && cell.onClickUri !== undefined)}
forceEditMode={
value.readonly !== true &&
(forceEditMode || (cell.hoverEffect === true && cell.onClickUri !== undefined))
}
uri={value.data}
preview={value.displayData ?? value.data}
validatedSelection={validatedSelection}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Props {
const UriOverlayEditor: React.FunctionComponent<Props> = p => {
const { uri, onChange, forceEditMode, readonly, validatedSelection, preview } = p;

const [editMode, setEditMode] = React.useState<boolean>(uri === "" || forceEditMode);
const [editMode, setEditMode] = React.useState<boolean>(!readonly && (uri === "" || forceEditMode));

const onEditClick = React.useCallback(() => {
setEditMode(true);
Expand Down

0 comments on commit f30193b

Please sign in to comment.