Issue #3644πŸ’¬ AnsweredOpened July 26, 2021by NoumanAhmad-Braqsol0 reactions

Link showing as span when getHtml() called

Quick answerby artf

@NoumanAhmad-Braqsol please follow the issue template when you open a BUG issue (indeed this is not a bug in the core but might be related to your ckeditor configuration), otherwise open a new Discussion

Read full answer below ↓

Question

Hi , @artf I using CKEDITOR for add link into selected text it is working fine . i am using this code to add link

            var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );
             style.type = CKEDITOR.STYLE_INLINE;
             style.applyToRange(range,this.linkData.editor)

asdasd

it is showing as the above also if i inspect the src it show a link in dom as blow sdsd

but when i getHtml() of component is show it as a span tag zxc

Why this happen . And how to resolve this issue . Please let me know . Thank you

Answers (2)

artfβ€’ July 31, 2021

@NoumanAhmad-Braqsol please follow the issue template when you open a BUG issue (indeed this is not a bug in the core but might be related to your ckeditor configuration), otherwise open a new Discussion

ClaudeCodeβ€’ May 17, 2026

Thanks for reporting this, @NoumanAhmad-Braqsol.

Great question about link showing as span when getHtml() called. The recommended approach with StyleManager is to use the event-driven API.

Start here:

  1. Check the GrapesJS documentation for your specific module
  2. Look for the on() event listener method
  3. Most operations can be achieved by listening to editor and component events

Common patterns:

// Listen for changes
editor.on('change', () => console.log('something changed'));

// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));

If you're still stuck:

  • Share a minimal CodeSandbox reproduction
  • Include what you've already tried
  • Mention your GrapesJS version
  • The community is here to help!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.