This commit is contained in:
Rizky 2024-01-26 08:54:20 +07:00
parent 89510dcb8c
commit 1e70d014ad
2 changed files with 8 additions and 8 deletions

View File

@ -9,15 +9,12 @@ import { EDGlobal } from "../../../logic/ed-global";
import {
iconChevronDown,
iconDownload,
iconLoading,
iconLog,
iconNewTab,
iconScrollOff,
iconScrollOn,
iconTrash,
iconUpload,
iconUpload
} from "./icons";
import { CodeNameItem, CodeNameList, codeName } from "./name-list";
import { CodeNameItem, CodeNameList } from "./name-list";
export const code = {
mode: "" as "" | "old" | "new",

View File

@ -59,14 +59,16 @@ export const FieldNumUnit: FC<{
}
if (!parseInt(val)) unt = "";
}
if (!local.focus) {
local.val_str = val;
}
local.val = parseInt(val) || 0;
if (positiveOnly && local.val < 0) {
local.val = Math.max(0, local.val);
}
local.unit = unit || unt || "px";
if (!local.focus) {
local.val_str = local.val + "";
}
local.render();
}, [value, unit]);
@ -166,6 +168,7 @@ export const FieldNumUnit: FC<{
}}
onBlur={() => {
local.focus = false;
local.val_str = local.val + "";
local.render();
}}
onChange={(e) => {