Issue #2308šŸ’¬ AnsweredOpened October 5, 2019by rajasubburaj0 reactions

Image is not resizing after creating a link for image

Quick answerby artf

You're flattening the component by doing this selectedComponent.view.el['outerHTML'] and so you're removing all its properties. Read more about how Components work.

Read full answer below ↓

Question

let href = this.getHref();
let title = this.title;
let childHtml =`<a id="${selectedComponent.ccid}" title="${title}" href="${href}" target="_blank" class="gjs-comp-selected">${selectedComponent.view.el['outerHTML']}</a>`;
const coll = selectedComponent.collection;
const at = coll.indexOf(selectedComponent);
coll.remove(selectedComponent);
coll.add(childHtml, { at });
selectedComponent.view.render();```

Answers (1)

artf• October 6, 2019

You're flattening the component by doing this selectedComponent.view.el['outerHTML'] and so you're removing all its properties. Read more about how Components work.

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.