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

Allow creation of cards that display meta information #166

Open
chrisgame opened this issue Feb 4, 2019 · 0 comments
Open

Allow creation of cards that display meta information #166

chrisgame opened this issue Feb 4, 2019 · 0 comments

Comments

@chrisgame
Copy link
Contributor

chrisgame commented Feb 4, 2019

I'm trying to implement a dynamic table of contents as a card. I wanted users editing the doc to be able to choose if it should have a table of contents and allow them to configure how many heading levels are shown so I implemented a card with a button that inserts the card in edit mode. I wanted the contents of the card to update as the user added, removed or edited any headings from the document but at this point I ran into a problem.

  • Passing an updated mobiledoc back in to the editor does not cause the internal state of the component to be updated or the card to be re-rendered.

  • Card options are only read when the component is created so there is no option to do anything dynamic as the doc is updated.

  • Having the user click on the card to update also doesn't help because although the card in edit mode has access to the editor and exiting edit mode would cause the card to re-render the mobiledoc on that editor instance does not get updated with changes made after the editor was created so I still can't get access to current state of the edited mobiledoc.

I guess normally a table of contents could be built as a separate component that would parse the doc and extract the headings but for my use case I really want it to be configurable, optional and show within the editor as another WYSIWYG component.

As far as I can tell there is no way of getting this behaviour currently.
Am I missing something?
Do you know of a way this could be done?

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

No branches or pull requests

1 participant