Skip to content
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

Merged

Conversation

wimleers
Copy link
Contributor

@wimleers wimleers commented Aug 6, 2012

… a 'smart-content-changed' event.

@ghost ghost assigned deliminator Aug 7, 2012
@@ -1087,6 +1087,7 @@ define([
if (attributeChanged && !suppressEvents) {
this._update();
this.trigger('change');
Aloha.activeEditable.smartContentChange( { type: 'block-change' } );
}
Copy link
Contributor

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

Copy link
Contributor Author

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'});

Copy link
Contributor

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

Copy link
Contributor Author

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.

@wimleers
Copy link
Contributor Author

Rebased; tested. Still works fine for me. Both in Drupal and in src/demo/boilerplate/captioned-image.html.

@evo42
Copy link
Member

evo42 commented Aug 22, 2012

can you please add a note regarding your changes to +build/dev-changelog.md+ and +doc/guides/source/events.textile+

@wimleers
Copy link
Contributor Author

wimleers commented Oct 4, 2012

5040bd1 is still identical to the changes I proposed 2 months ago.

I simply added the notes @evo42 requested.

@deliminator deliminator merged commit f70255d into alohaeditor:dev Oct 4, 2012
@deliminator
Copy link
Contributor

There was an API change. I fixed it in bf4033b. Please update your code.

@wimleers
Copy link
Contributor Author

My apologies.

@deliminator
Copy link
Contributor

@wimleers no apologies necessary :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants