Blocks attributes
You can do this editor.Blocks.get('text').set({ attributes: { class: 'my-custom-class' } })
Read full answer below ↓Question
const blocktext = blockManager.get('text').set({ label: 'Modified text', attributes: { } })
I want to add an attribute to the original text block, I want the attribute to give the user the option of giving the component, time to appear and disappear at another time.
My question is, what are the attributes that I can make use of? and does it work if I refer in the attribute to a javascript that allows him to do this function?
Answers (1)
You can do this editor.Blocks.get('text').set({ attributes: { class: 'my-custom-class' } })
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2417
API in Component not working after Deployment
Block.js => Component.js => We are able to call the API and it works in Deployment when we are passing the whole html with script, body, st...
Issue #894
Add a custom attribute
Hi everyone, I am creating new blocks, when I use the following method: editor.BlockManager.add(blockId, { label: blockLabel, content: {......
Issue #3207
Form is not submitting
I am trying to create as custom block. But the form is not submitting when i use components inside content. I am able to get all the form d...
Issue #1545
[Question] How I Get ID From Block?
Hi, i have my block and I get print in Div id results from my javascript class component... How i get ID from my block ??? editor.BlockMana...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Embed GrapesJS in Your SaaS: A Weekend Guide
Embed GrapesJS in your SaaS and ship a white-label page builder over a weekend. Honest tradeoffs, real code, and the plugins that close the UX gap.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins — TinyMCE Inline Text Editor and Placeholder.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.