You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: