-
Notifications
You must be signed in to change notification settings - Fork 657
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
Passing DOM element to Factory's renderer.elementId param #580
Comments
wouldn't it be best to add a new option "element" to make it more explicit (while keeping the possibility to give element as |
I also would like to use (rely on) this option so would appreciate a formal acknowledgment in the API. Even the ability to pass a // Factory 'renderer' config accepts an 'element' property as a DOM element
const vf = new Vex.Flow.Factory({renderer: { element: vexElementRef.current }}); // Factory 'renderer' option accepts a vex renderer instance
const renderer = new Renderer(vexElementRef.current, Renderer.Backends.SVG);
const vf = new Vex.Flow.Factory({renderer}); |
Looking into that we do have a inconsistency between the parameter used by:
It would make sense to accept the same possibilities in |
The `renderer` field of `FactoryOptions` was changed to also be an instance of `Renderer` via an union. The other way of initializing a `Factory` remains unaffected. A test-case had to be slightly modified since it didn't account for the union I created. This fixes 0xfe#580 since an instance of `Renderer` can be created with DOM elements and `Factory` can now be created with an instance of `Renderer`.
The `renderer` field of `FactoryOptions` was changed to also be an instance of `Renderer` via an union. The other way of initializing a `Factory` remains unaffected. A test-case had to be slightly modified since it didn't account for the union I created. This fixes 0xfe#580 since an instance of `Renderer` can be created with DOM elements and `Factory` can now be created with an instance of `Renderer`.
I am wondering about the EasyScore example, and how you configure the renderer by means of the Factory.
Because I am using React I don't want to use
getElementById
, but get the DOM element with React Component'sref
attributeAlthough the Factory explicitly asks for a
elementId
, I see in Renderer that it is still ok to pass the element itself.Can I safely assume this option will remain available in the future?
The text was updated successfully, but these errors were encountered: