Extend Image Traits
Hi again, here is the final solution to create a a href image : Now i have to found how to check the URL integrity when you want to update the href variable Best regards
Read full answer below ↓Question
Hello, i would like to extend the image type with some options, specially with a redirect option on click. I tried this solution after the editor initialization (i precise that i work in full javascript and non Node.js environment) : editor.DomComponents.addType('image', { isComponent: el => el.tagName == 'img', model: { defaults: { traits: [ // Strings are automatically converted to text types 'alt', 'title', // Same as: { type: 'text', name: 'name' } { type: 'url', name: 'href', placeholder:'https://google.com', changeProp: 1 } ], // As by default, traits are binded to attributes, so to def...
Answers (3)
Hi again, here is the final solution to create a a href image : Now i have to found how to check the URL integrity when you want to update the href variable Best regards
I have the same need in my project. I tried creating a block, but I couldn't get the initial popup to "pop". I tried creating a component with a plugin, but there's too much work that I can't understand how it can connect to each other. Any hints or clues on what we both can do would be great! Than...
You've added this listener change:url but the name of the trait is name: 'href', so just change it with change:href
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1605
Can we implement Paste as Rich text editor options in Rte?
hi @artf I've gone through this Drag and Drop Editor and what an amazing work. I also read your docs and I tried to extend rich text editor...
Issue #1522
Is it possible to add some text to content body where the cursor is ?
I'd like to have a button that is outside the editor and if i click this button, some text should be generated in the body where my cursor...
Issue #3194
How do I repurpose the Spectrum Color Picker?
I would like to repurpose the color picker used in GrapesJS. I have to use a color picker for some project level settings. These settings a...
Issue #2381
Is it possible to add info modal on the editor
Hi, I would like to add on the grapejs editor a clickable questionmark we can click so we could give information on what does this specific...
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
Vanilla GrapesJS vs GrapesJS With Plugins: What You Actually Get Out of the Box (2026)
New to GrapesJS? See exactly what the stock editor gives you, where it falls short, and which plugins close the gaps — a beginner-friendly 2026 comparison
Tutorial
Introducing GJS.Market Services: ship your GrapesJS editor without the integration risk
It's everything that usually eats weeks of engineering time, scoped and priced up front. No open-ended hourly surprises.
Tutorial
How to integrate GrapesJS into a Django app (complete guide 2026)
Embed GrapesJS in a Django project: render the editor in a template, persist content to a view with CSRF, store the project JSON, and export HTML/CSS.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.