[Help Wanted] How to easily override existing component ?
See original GitHub issueFor example, I want to add a double click event handler on the default video component to open the assets manager.
let v = editor. DomComponents.getType('video')
let view = v.view()
My basic idea was to get the view definition of the video component and add events
+ handler.
At last, set it back to the video component.
Unfortunately, this idea failed in the first step. v.View()
gives me an error
TypeError: this._ensureElement is not a function
at Object.e.View (grapes.min.js?e1c1:2)
at Object.r (grapes.min.js?e1c1:2)
at Object.r (grapes.min.js?e1c1:2)
at Object.r (grapes.min.js?e1c1:2)
at VueComponent.configVideo (HelloWorld.vue?18db:218)
at VueComponent.mounted (HelloWorld.vue?18db:88)
at invokeWithErrorHandling (vue.esm.js:formatted:1729)
at callHook (vue.esm.js:formatted:3882)
at Object.insert (vue.esm.js:formatted:2877)
at invokeInsertHook (vue.esm.js:formatted:5887)
I am new to this project and barely know about Backbone.js. Would you please offer me some suggestions?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
How to Override Existing React Components | Pluralsight
Read this guide to learn how to override existing React.js class. ... hinder the straightforward employment of existing components:.
Read more >Apply overrides to instances - Components - Figma Help Center
It's not possible to make changes to the underlying structure of an instance. You can't override: The order, or z-index, of any layers...
Read more >In Castle Windsor 3, override an existing component ...
There are two things that you have to do to create an overriding instance: Assign it a unique name; Call the IsDefault method....
Read more >Better Reusable React Components with the Overrides Pattern
We wanted to come up with a unified API across our components that ... we created a component override for Tag which rendered...
Read more >Overriding Built-in Components - Builder.io
You can override Builder-provided components by registering a custom component with the same name. By overriding a component, you can add extra features...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks a lot! I missed that part in the docs. I’ll try to figure it out
@archerbj here’s a demo of what you’re looking for: https://codesandbox.io/s/sharp-easley-3hrdn?file=/index.js
You want to attach the functionality to the
component type
itself rather than trying to find all instances of that component and add it on some change. So to do that, create a newComponent Type
that extends thevideo
type then add thedblclick
event handler to the view. Once you’ve got that, then you create a block that uses your new component type.Here is some documentation on how to extend component types and here’s the guide on creating a custom block
Hope this helps.
Josh