[Question] Update Traits properties on a plugin
Question
Hi,
is it possible to change easily some properties in the Traits configuration of a plugin ? I"m trying to translate some strings in the grapesjs-echarts plugin, and i kindy stucked after reading your documentation and looking for the functions to do so...
Could please tell me if it's possible to change some options plugins when it's not implemented by default ?
Regards
Answers (3)
You should be able to do it via i18n module
editor.I18n.addMessages({
en: {
traitManager: {
labels: {
title: 'My Title', // `title` is the name of the trait
}
},
}
});
Hi,
thank you for the answer. I agree with you, it changes indeed the default labels on Traits (.
But what about a plugin, or a component not added in the i18n module ? For example, the type "map" include in your initial javascript, how can i update without override your plugin it's properties defined below : type: 'map', src: '', void: 0, mapUrl: 'https://maps.google.com/maps', tagName: 'iframe', mapType: 'q', address: '', zoom: '1', attributes: { frameborder: 0 }, toolbar: Component__WEBPACK_IMPORTED_MODULE_2_["default"].prototype.defaults.toolbar, traits: [{ label: 'Address', name: 'address', placeholder: 'eg. London, UK', changeProp: 1 }, { type: 'select', label: 'Map type', name: 'mapType', changeProp: 1, options: [{ value: 'q', name: 'Roadmap' }, { value: 'w', name: 'Satellite' }] }, { label: 'Zoom', name: 'zoom', type: 'range', min: '1', max: '20', changeProp: 1 }]
Basically, i would like to update some properties for any type of component after the editor initialization. I know there is a function editor.DomComponents.addType to implement a new type or completely replace the component with it's ID. Is there a editor.DomComponents.updateType where i could juste change label name ?
Regards
Hi again,
any idea to help me to update traits default properties after the plugin initialization ? In my previous sampe, i have a hard coded type 'map' in my grapes.js , i would like to update some traits properties in my html page with some translation and custom values.
Best regards
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2337
[BUG / QUESTION] Deleting default styles does not work
Hello, i'm trying to delete some of the default styles of the blocks. I wrote everything I changed in a plugin. I used this function to upd...
Issue #2850
[QUESTION] Add Dropdown to block using Traits
Hi @artf , I hope that you are well, I was wondering whether you could help me with some simple issue that I am having (I have recently sta...
Issue #930
[Question] Update resizer after asset changed
Hi! I trying to change default assets manager with ours custom manager. On double click the selected image is replaced with a new one with...
Issue #906
[Question]How to change custom component content (html) from ajax?
Hi @artf, First of all thanks for this awesome plugin. Can you please let me know how i can update/change block content? I created custom b...
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.