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

Notes on a Facets Component for Leaf #13

Open
zicklag opened this issue Oct 1, 2024 · 0 comments
Open

Notes on a Facets Component for Leaf #13

zicklag opened this issue Oct 1, 2024 · 0 comments
Labels
leaf Related to the Leaf Protocol specification

Comments

@zicklag
Copy link
Collaborator

zicklag commented Oct 1, 2024

I think facets, as described by BluSky ( https://www.pfrazee.com/blog/why-facets ) are a really good idea and should be the default rich text format for Leaf apps where appropriate.

In the blusky docs they say that facets should not overlap ( https://docs.bsky.app/docs/advanced-guides/post-richtext ).

At first this seemed odd to me and I figured we would just ignore that. I was thinking "what about bold and Italic on the same text?"

I just recently started working with ProseMirror, though, and found this in their docs ( https://prosemirror.net/docs/guide/#doc.structure ).

in ProseMirror, the inline content is modeled as a flat sequence, with the markup attached as metadata to the nodes. This more closely matches the way we tend to think about and work with such text. It allows us to represent positions in a paragraph using a character offset rather than a path in a tree, and makes it easier to perform operations like splitting or changing the style of the content without performing awkward tree manipulation.

This also means each document has one valid representation. Adjacent text nodes with the same set of marks are always combined together, and empty text nodes are not allowed.

This makes a lot of sense, and works in the context of Leaf where each facet can have multiple components, such as an Italic and a Bold component.

So I'm on board with non-overlapping facets with multiple components. 👍

@zicklag zicklag added the leaf Related to the Leaf Protocol specification label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leaf Related to the Leaf Protocol specification
Projects
None yet
Development

No branches or pull requests

1 participant