Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

feat(directives): Added two way databind for html5 contenteditable attri... #412

Closed
wants to merge 1 commit into from

Conversation

giovannicandido
Copy link
Contributor

Hi guys,
This is a simple implementation for data bind between html5 contentenditable atributes. First I find this thread in stack overflow: http://stackoverflow.com/questions/15108602/two-way-binding-of-contenteditable-item-inside-ng-list
It uses AngularJs.
My first try was translate the code in stack overflow to Dart. But after I read the code on _InputTextlikeDirective in the same file, I realize that it do more checks and make the same think, so I just override the get and set for the value be the innerHtml instead of value

I also open this thread for angular dart: http://stackoverflow.com/questions/21055252/how-to-enable-databind-in-contenteditable-on-angular-dart

@mhevery
Copy link
Contributor

mhevery commented Jan 11, 2014

Thanks for your contribution! In order for us to be able to accept it, we ask you to sign our CLA (contributor's license agreement). CLA is important for us to be able to avoid legal troubles down the road.

For individuals (a simple click-through form): http://code.google.com/legal/individual-cla-v1.0.html

@mhevery
Copy link
Contributor

mhevery commented Jan 11, 2014

needs tests

* `null`, it is treated as equivalent to the empty string for rendering
* purposes.
*/
@NgDirective(selector: '[contenteditable=true][ng-model]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true is not exactly right, see ContentEditable spec - it could also be empty or inherit. You should probably check el.isContentEditable in the code when the attribute is present whatever its value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Vitor, you are right. I will check this later.

On Jan 18, 2014, at 6:47 AM, Victor Berchet notifications@github.com wrote:

In lib/directive/ng_model.dart:

@@ -325,3 +325,25 @@ class InputRadioDirective {
});
}
}
+
+/**

  • * Usage (span could be replaced with any element like p):
  • *
  • * This creates a two way databinding between the expression specified in
  • * ng-model and the html element in the DOM. If the ng-model value is
  • * null, it is treated as equivalent to the empty string for rendering
  • * purposes.
  • */
    +@ngdirective(selector: '[contenteditable=true][ng-model]')
    true is not exactly right, see ContentEditable spec - it could also be empty or inherit. You should probably check el.isContentEditable in the code when the attribute is present whatever its value.


Reply to this email directly or view it on GitHub.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this to just say [contenteditable]

@mhevery
Copy link
Contributor

mhevery commented Jan 22, 2014

It looks like you still have not signed the CLA: http://code.google.com/legal/individual-cla-v1.0.html

@mhevery
Copy link
Contributor

mhevery commented Jan 22, 2014

I see you signed it with a different email address. It breaks the automated system. :-) OK, will change the status manually.

@mhevery
Copy link
Contributor

mhevery commented Jan 22, 2014

MERGED

@mhevery mhevery closed this Jan 22, 2014
@vicb
Copy link
Contributor

vicb commented Jan 22, 2014

@mhevery what about my comment above, worth a fix PR ?

@giovannicandido
Copy link
Contributor Author

Hi @vicb I'm working with that, it's a simple solution but the test architecture is beating me in the face :-) The tests now run but fail without good reason. Apparent the browser is not working as the spec says. Soon I will pull the code

@mhevery
Copy link
Contributor

mhevery commented Jan 23, 2014

looking forward to the fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

3 participants