mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Sync panel props to editing element (#470)
* ensure panel props are sync to editing elem * ensure we don't create empty-text elements (fixes #468) * remove dead code Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
This commit is contained in:
parent
ff7a340d2f
commit
2340dddaad
7 changed files with 159 additions and 100 deletions
|
@ -12,7 +12,7 @@ const Picker = function({
|
|||
onChange
|
||||
}: {
|
||||
colors: string[];
|
||||
color: string | undefined;
|
||||
color: string | null;
|
||||
onChange: (color: string) => void;
|
||||
}) {
|
||||
return (
|
||||
|
@ -55,7 +55,7 @@ function ColorInput({
|
|||
color,
|
||||
onChange
|
||||
}: {
|
||||
color: string | undefined;
|
||||
color: string | null;
|
||||
onChange: (color: string) => void;
|
||||
}) {
|
||||
const colorRegex = /^([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8}|transparent)$/;
|
||||
|
@ -93,7 +93,7 @@ export function ColorPicker({
|
|||
onChange
|
||||
}: {
|
||||
type: "canvasBackground" | "elementBackground" | "elementStroke";
|
||||
color: string | undefined;
|
||||
color: string | null;
|
||||
onChange: (color: string) => void;
|
||||
}) {
|
||||
const [isActive, setActive] = React.useState(false);
|
||||
|
@ -119,7 +119,7 @@ export function ColorPicker({
|
|||
<Popover onCloseRequest={() => setActive(false)}>
|
||||
<Picker
|
||||
colors={colors[type]}
|
||||
color={color || undefined}
|
||||
color={color || null}
|
||||
onChange={changedColor => {
|
||||
onChange(changedColor);
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue