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

Export MobiledocParser and utils functions to support extensibility #790

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukemelia
Copy link
Contributor

Our use case for these additional exports is as follows:

MobiledocParser: we use it in a "cleaning" service that processes mobiledoc before saving to remove cards that have been added but not configured and so are effectively empty and should be removed.

parsePostFromHTML: we use it to let users convert older HTML content to mobiledoc, and in our tests to allow succinct creation of mobiledoc from HTML

parsePostFromText: we use it to convert text from a CSV import into mobiledoc for further editing in our UI

detect: we use it to find link markups in a mobiledoc to facilitate selection expansion when replacing a link

@lukemelia
Copy link
Contributor Author

Looks like the build failure here is related to SauceLabs credentials.

@gpoitch
Copy link
Member

gpoitch commented Nov 14, 2024

Use cases sound good.

I believe you can do these with public api:

MobiledocParser:

const post = new Editor({ mobiledoc: { version: '0.3.2', atoms: [], cards: [], markups: [['strong']], sections: [[1, 'p', [[0, [], 0, 'Foo '], [0, [0], 1, 'bar'],],],],},}).loadPost()

parsePostFromHTML:

const post = new Editor({ html: '<p>Foo <b>bar</b></p>' }).loadPost()

parsePostFromText: could add a text option and perform like above.

detect: seems like a pretty basic utility to just copy

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.

2 participants