diff --git a/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx b/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx index 80726638a..04f6ba3ff 100644 --- a/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx +++ b/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx @@ -5,11 +5,12 @@ import FormSelect from "../react/FormSelect"; import { TabContext } from "./ribbon-interface"; import { mapToKeyValueArray } from "../../services/utils"; import { useNoteLabel, useNoteLabelBoolean } from "../react/hooks"; -import { bookPropertiesConfig, BookProperty, ButtonProperty, CheckBoxProperty } from "../ribbon_widgets/book_properties_config"; +import { bookPropertiesConfig, BookProperty, ButtonProperty, CheckBoxProperty, NumberProperty } from "../ribbon_widgets/book_properties_config"; import Button from "../react/Button"; import { ParentComponent } from "../react/react_utils"; import FNote from "../../entities/fnote"; import FormCheckbox from "../react/FormCheckbox"; +import FormTextBox from "../react/FormTextBox"; const VIEW_TYPE_MAPPINGS: Record = { grid: t("book_properties.grid"), @@ -66,6 +67,8 @@ function mapPropertyView({ note, property }: { note: FNote, property: BookProper return case "checkbox": return + case "number": + return } } @@ -95,4 +98,23 @@ function CheckboxPropertyView({ note, property }: { note: FNote, property: Check currentValue={value} onChange={setValue} /> ) +} + +function NumberPropertyView({ note, property }: { note: FNote, property: NumberProperty }) { + const [ value, setValue ] = useNoteLabel(note, property.bindToLabel); + + return ( + <> + + + ) } \ No newline at end of file diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties.ts b/apps/client/src/widgets/ribbon_widgets/book_properties.ts index a6cf19f29..fb99477dd 100644 --- a/apps/client/src/widgets/ribbon_widgets/book_properties.ts +++ b/apps/client/src/widgets/ribbon_widgets/book_properties.ts @@ -56,27 +56,6 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget { return $container; } switch (property.type) { - case "number": - const $numberInput = $("", { - type: "number", - class: "form-control form-control-sm", - value: note.getLabelValue(property.bindToLabel) || "", - width: property.width ?? 100, - min: property.min ?? 0 - }); - $numberInput.on("change", () => { - const value = $numberInput.val(); - if (value === "") { - attributes.removeOwnedLabelByName(note, property.bindToLabel); - } else { - attributes.setLabel(note.noteId, property.bindToLabel, String(value)); - } - }); - $container.append($("