1
0
Fork 0

fix(react): Allow bookmark title to be edited (#366)

Currently it isn't possible to edit the title of a bookmark (for example, when bookmarking a Measurements Set) for 2 reasons:
1. The modal closes as soon as you click in the title text edit box.
2. The created bookmark uses the original title, ignoring edits made to it.

This PR fixes both issues.

Co-authored-by: Benjamin Fan <ben-git@swinglonga.com>
Reviewed-on: https://codeberg.org/freesewing/freesewing/pulls/366
Reviewed-by: Joost De Cock <joostdecock@noreply.codeberg.org>
Co-authored-by: Benjamin Fan <benjamesben@noreply.codeberg.org>
Co-committed-by: Benjamin Fan <benjamesben@noreply.codeberg.org>
This commit is contained in:
Benjamin Fan 2025-05-19 08:02:56 +02:00 committed by Joost De Cock
parent b864574e87
commit a7eb3e0072

View file

@ -259,7 +259,12 @@ export const BookmarkButton = ({ slug, type, title }) => {
className={`tw:daisy-btn tw:daisy-btn-secondary tw:daisy-btn-outline ${horFlexClasses}`}
onClick={() =>
setModal(
<ModalWrapper flex="col" justify="top lg:justify-center" slideFrom="right">
<ModalWrapper
flex="col"
justify="top lg:justify-center"
slideFrom="right"
keepOpenOnClick="true"
>
<CreateBookmark {...{ type, title, slug }} />
</ModalWrapper>
)
@ -291,6 +296,7 @@ export const CreateBookmark = ({ type, title, slug }) => {
const bookmark = async (evt) => {
evt.stopPropagation()
setLoadingStatus([true, 'Contacting backend'])
let title = name
const [status] = await backend.createBookmark({ type, title, url })
if (status === 201) {
setLoadingStatus([true, 'Bookmark created', true, true])