[QUESTION] How can I set default tagName
Question
Hi !
I want to set tagName tr for all components(or specific component in use).
Is there any predefined function to set tagName ?
Answers (3)
You can change the tagName of any component, at any moment, in this way:
const component = editor.getSelected(); // I use a selected one just as an example
component.set('tagName', 'article');
// or on some group of components
const components = editor.DomComponents.getWrapper().find('div');
components.forEach(component => component.set('tagName', 'article'));
You can also change it at the component level, in this way any new one of its type will get it by definition. Read more about Components and how to extend them. Basically, you would create/extend a component with a custom tagName in this way:
comps.addType('you-component', {
model: defaultModel.extend({
defaults: { ...
tagName: 'tr'
},
...
}),
view: defaultView,
})
works great! thanks @artf
Is there any way to change wrapper's tagName also?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1336
[Question] Can I make everything unselectable by default?
Currently all components are selectable/hoverable by default. And if you want you can change that behavior by providing data-gjs-hoverable=...
Issue #1374
Default Component Properties
Is there any way I can change the default properties of components? I want almost everything to be copyable: false, resizable: false, dragg...
Issue #1868
How to enable functionality only for specific image component, not all
I've enabled the fa fa-pencil icon into my image components, but I want it to be enabled only in specific image components, not all of them...
Issue #858
[Question] How to extract html/css code in view code automatically?
I need the function to copy the html/css code in the view code component automatically. Is there a predefined function? or I must implement...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.