Grapesjs: Not allow selective Image resize

Created on 5 Jan 2018  路  3Comments  路  Source: artf/grapesjs

I do not want user to resize image on specific area of template, but want to allow anywhere on canvas.

I want user to just choose image and does not allow to resize for specific class/element.

outdated

Most helpful comment

You probably need to do something like this on render

const wrapper = editor.DomComponents.getWrapper();
wrapper.view.$el.find('#someid img').each((el, i, $els) => {
   const $el = $els.eq(i);
   const model = $el.data('model');
   model && model.set('resizable', 0);
});

All 3 comments

You probably need to do something like this on render

const wrapper = editor.DomComponents.getWrapper();
wrapper.view.$el.find('#someid img').each((el, i, $els) => {
   const $el = $els.eq(i);
   const model = $el.data('model');
   model && model.set('resizable', 0);
});

each((el, i, $els), it create error. Just replace by each( function(el, i, $els)

complete code:

var wrappers = editor.DomComponents.getWrapper();
wrappers.view.$el.find('.rm-editable img').each( function(el, i, $els) {
var $el = $els.eq(i);
var model = $el.data('model');
model && model.set('resizable', 0);
});

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andre2 picture andre2  路  3Comments

ionic666 picture ionic666  路  3Comments

mathiasbc picture mathiasbc  路  3Comments

kawika-connell picture kawika-connell  路  3Comments

tribulant picture tribulant  路  3Comments