image reverted to original size after resized
Question
hi, i got a strange issue with component: i got 2 types, image and icon
domComponents.addType('icon', {
model: imageModel.extend({
defaults: Object.assign({}, imageModel.prototype.defaults, {
traits: [{
type: 'text',
label: 'icon URL',
name: 'src',
changeProp: 1
}],
removable: false,
draggable: false,
droppable: false,
badgable: false,
stylable: false,
highlightable: true,
copyable: false,
resizable: false,
editable: true,
selectable: true
})
}, {
isComponent: function(el) {
if (el.getAttribute !== undefined && el.getAttribute('deletable') == '0' && el.tagName == 'IMG') {
return {
type: 'icon'
};
}
}
}),
view: imageView.extend({
initialize: function() {
var defaultClickEventHandler = this.events.click || function() {};
var defaultDblClickEventHandler = this.events.dblclick || function() {};
defaultView.prototype.initialize.apply(this, arguments);
this.events.dblclick = function() {
console.log('dblclick');
};
}
}),
onValueChange: function() {
this.target.set('src', this.model.get('value'));
}
});
domComponents.addType('image', {
model: imageModel.extend({
defaults: Object.assign({}, imageModel.prototype.defaults, {
traits: [{
type: 'text',
label: 'Image URL',
name: 'src',
changeProp: 1
}]
})
}, {
isComponent: function(el) {
if (el.tagName == 'IMG') {
return {
type: 'image'
};
}
}
}),
view: imageView,
onValueChange: function() {
this.target.set('src', this.model.get('value'));
}
});
the issue is when i first drag and drop the image component, i'm able to resize and save it, but when i load the template again, i'm not able to resize the image again. i can adjust the image size but after couple of second it will be reverted. i noticed there are component:update and component:styleUpdate event fired. is this have anything to do with the angularjs digest cycle? i'm using with angular 1.3
Answers (3)
Are you sure there are no strange styles loaded which forces img style? Try to inspect and see if style actually changes
yes, i can see it change in the local storage. but after some short time it changed back
Are you able to reproduce it with a live example?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #852
[QUESTION] How to change <a> content in traits?
I'm re-declaring a link type like this: When my button (<a>) is created, it is creating like this: <a class="btn botao-roxo">Botão</a> I wo...
Issue #1959
[Question] Edit innerHTML in a custom button
Hi All, I am trying to change the text in a button component, but I am not able to edit it. I added this type: I included the editable: tru...
Issue #709
isComponent is not returning trait
Happy new year! I am having an issue with isComponent(). Here is my code: For some reason the only time the trait shows up in component set...
Issue #2405
[QUESTIONS] ckeditor is not initialized when replace trait text
why when i change the ckeditor trait text it is not initialized my trait <pre> domComps.addType('text',{ model: dModel.extend({ defaults: O...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.