Replies: 2 comments
-
You could create a |
Beta Was this translation helpful? Give feedback.
0 replies
-
we have a hook we use that hook in a wrapper component to get the editor with the plugin config and then include it at the same level as things like the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
From the examples I've seen I can see how a single instance of an editor can be configured by passing config to a plugin or the editor at initialisation time. For example using an env variable for a openai key or calling
*Plugin.configure()
in the top-level array declaration ofeditorPlugins
in the provided project template.However I want to have configuration which is dynamic per editor instance, typically accessible within a plugin to adjust behaviour.
Eg. I want to instantiate an editor with different document ids allowing for both a) backend auto save api and b) backend export api called from a plugin, different ai api keys based on customer owning the document, and a callback which the auto save plugin can call.
I see a few options such as having a
useMemo
wrappedplugins
array or using theeditor.config
api however I don't get a sense of what is idiomatic.Both the mentioned options there seem a bit clunky. Ie. I can't imagine re-creating plugin instances between document loads is optimal (presuming this means I have to re-create the editor and re-mount?) and seems heavy handed to have to wrap up simple prop value changes with some imperative api when this is a react based framework.
Feel I'm missing something obvious 😅
Beta Was this translation helpful? Give feedback.
All reactions