-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whenever a block is changed (i.e. an attribute has changed), also trigger… #642
Whenever a block is changed (i.e. an attribute has changed), also trigger… #642
Conversation
@@ -1087,6 +1087,7 @@ define([ | |||
if (attributeChanged && !suppressEvents) { | |||
this._update(); | |||
this.trigger('change'); | |||
Aloha.activeEditable.smartContentChange( { type: 'block-change' } ); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't work. Causes errors.
Aloha: Error message: Uncaught TypeError: Cannot call method 'smartContentChange' of null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Here it works fine for e.g. CaptionedImage blocks in an Aloha editable, when you change their alignment.
This is also how it's used in the paste and undo plugins:
wim.leers at wimleers-acquia.local in ~/Work/Aloha-Editor/src/plugins on dev*
$ egrep -rn "\.smartContentChange" .
./common/paste/lib/paste-plugin.js:202: Aloha.activeEditable.smartContentChange( event );
./common/paste/lib/paste-plugin.js:216: Aloha.activeEditable.smartContentChange( event );
./common/paste/lib/paste-plugin.js:230: Aloha.activeEditable.smartContentChange( event );
./common/undo/lib/undo-plugin.js:102: this.editable.smartContentChange({type : 'blur'});
./common/undo/lib/undo-plugin.js:122: Aloha.getActiveEditable().smartContentChange({type : 'blur'});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that there is no active editable when the attributes are changed the first time (Aloha.activeEditable is null).
Maybe it's a recent change? Try to pull from dev and open the demo under /src/demo/boilerplate/captioned-image.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird.
It works fine on http://demo.sparkdrupal.com/node/1 (login instructions at http://demo.sparkdrupal.com/): enable edit mode, click the body field, click the image, left align it, the "Save" button on the field will become blue because you've made a change. This is leveraging the smartContentChanged
event of type block-change
.
I'll try with latest dev
, late today, else tomorrow.
Rebased; tested. Still works fine for me. Both in Drupal and in |
can you please add a note regarding your changes to +build/dev-changelog.md+ and +doc/guides/source/events.textile+ |
…gger a 'smart-content-changed' event.
There was an API change. I fixed it in bf4033b. Please update your code. |
My apologies. |
@wimleers no apologies necessary :-) |
… a 'smart-content-changed' event.