Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Richtexteditor formats #141

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open

Conversation

fbessou
Copy link
Contributor

@fbessou fbessou commented Jul 3, 2024

Related to #140.

When inline-block, a second cursor `slot` is created after the note node.
By not relying on regexps and by using DOM queries instead.
There is code duplication between this and DocumentNotes.
Otherwise titles containing fa icons are not rendered.
…ify keyboard navigation

There is a lot of stuff in there.

Main changes:

RichTextEditor is now initialized with its initial value props. After
that, it is not controlled and only sends its new value to its parent
component in the hierarchy.

NoteForm is updated so that the first time it is rendered, the
RichTextEditor value props is already defined. Before this change, the
editor was populated on second render, after the call to the mounted
lifecycle hook.

Components that take input data as propse now expect a single data
structure as prop. For example, NoteForm `inputData` prop could be
either {note: {id: number}} or {formats: {note: {id: number}}, leading
to big conditionals.

A lot of imperative logic is transformed into more functional logic by
using computed component state. This is the case for example for the
way the "activeness" of the buttons is computed. We remove the
`updateButtons` method from the RichTextEditor and instead compute the
buttons availability from the component's current state on render.

Notes and Page breaks are transformed into embeds to avoid hard to
maintain logic to ensure that their inner text are not modified.
This allow us to write specific keyboard and mouse handlers for these
elements the embeds are selected on click ot when navigating over them
with keyboard.

A new `remove format` button is added in the RichTextEditor which allows
to ensure that the text going to be typed will not be formatted. A new
icon should be chosen for this button as it is currently the same as
"stroked text"/"del" button.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant