mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-15 07:34:42 -04:00
fix(frontend): make note details in redux optional
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
118f158ad1
commit
6698450461
50 changed files with 278 additions and 135 deletions
|
@ -31,8 +31,13 @@ export const useSetCheckboxInEditor = () => {
|
|||
|
||||
return useCallback(
|
||||
({ lineInMarkdown, newCheckedState }: TaskCheckedEventPayload): void => {
|
||||
const noteDetails = store.getState().noteDetails
|
||||
if (!noteDetails) {
|
||||
return
|
||||
}
|
||||
|
||||
changeEditorContent?.(({ markdownContent }) => {
|
||||
const correctedLineIndex = lineInMarkdown + store.getState().noteDetails.startOfContentLineOffset
|
||||
const correctedLineIndex = lineInMarkdown + noteDetails.startOfContentLineOffset
|
||||
const edits = findCheckBox(markdownContent, correctedLineIndex)
|
||||
.map(([startIndex, endIndex]) => createCheckboxContentEdit(startIndex, endIndex, newCheckedState))
|
||||
.orElse([])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue