ember-content-editable
Advanced tools
Comparing version 0.2.4 to 0.3.0
@@ -8,2 +8,3 @@ import Ember from 'ember'; | ||
contenteditable: true, | ||
isText: false, | ||
@@ -14,4 +15,8 @@ setup: Ember.on('didInsertElement', function() { | ||
_observeValue: true, | ||
valueChanged: Ember.observer('value', function() { | ||
this.setValue(); | ||
console.log("Value changed triggered"); | ||
if (this.get('_observeValue')) { | ||
this.setValue(); | ||
} | ||
}), | ||
@@ -28,3 +33,20 @@ | ||
updateValue: Ember.on('keyUp', function(event) { | ||
this.set('value', this.stringInterpolator(this.$().text())); | ||
this.set('_observeValue', false); | ||
let val; | ||
if (this.get('isText')) { | ||
val = this.element.innerText || this.element.textContent; | ||
} else { | ||
val = this.$().html(); | ||
} | ||
val = this.stringInterpolator(val); | ||
if (!this.get('isText')) { | ||
val = Ember.String.htmlSafe(val); | ||
} | ||
this.set('value', val); | ||
this.set('_observeValue', true); | ||
this.handleKeyUp(event); | ||
@@ -31,0 +53,0 @@ }), |
{ | ||
"name": "ember-content-editable", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"description": "A content-editable component for ember-cli that just works.", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -29,2 +29,13 @@ [![npm version](https://badge.fury.io/js/ember-content-editable.svg)](http://badge.fury.io/js/ember-content-editable) | ||
### Options | ||
Option Name | Description | Default | ||
---------------------|------------------------------------------------|--------- | ||
value | The value to be edited | `""` | ||
placeholder | Placeholder displayed when value is blank | `""` | ||
isText | Is the value HTML or plaintext? | `true` | ||
stringInterpolator | Function which processes any updated value. | `none` | ||
| Takes a string and returns a string. | | ||
extraClass | String with any extra css class. | `null` | ||
### Events | ||
@@ -31,0 +42,0 @@ You can also provide actions to handle the following events |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9091
121
74