Skip to content

Commit

Permalink
feat(dashboard): enable edit mode for text widget by default
Browse files Browse the repository at this point in the history
  • Loading branch information
square-li authored and diehbria committed Mar 30, 2023
1 parent 31b8361 commit 2b4db27
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { DashboardState } from '~/store/state';
const TextWidgetComponent: React.FC<TextWidget> = (widget) => {
const readOnly = useSelector((state: DashboardState) => state.readOnly);
const isSelected = useIsSelected(widget);
const { isUrl } = widget.properties;
const { isUrl, value } = widget.properties;

const dispatch = useDispatch();
const [isEditing, setIsEditing] = useState(false);
Expand All @@ -27,6 +27,11 @@ const TextWidgetComponent: React.FC<TextWidget> = (widget) => {
setIsEditing(editing);
};

useEffect(() => {
// allow immediate edit if no value on widget creation
if (!value) handleSetEdit(true);
}, []);

useEffect(() => {
return () => {
/**
Expand Down

0 comments on commit 2b4db27

Please sign in to comment.