コンテンツ編集可能な要素によってトリガーされたイベントをEmber.Viewでリッスンしようとしていますが、少し問題があります。
私が目指している最終結果は、コンテンツ編集可能な変更をEmberObjectプロパティにバインドすることです。
この回答に示されているように、イベントはjQueryを直接使用して正しくバインドされます:contenteditablechangeevents
$(function () {
$(document).on('focus', '[contenteditable]', function(event) {
var $this = $(this);
console.log("$" + event.type);
return $this;
});
$(document).on('blur keyup paste', '[contenteditable]', function(event) {
var $this = $(this);
console.log("$" + event.type);
return $this;
});
});
ただし、Ember.Viewで指定されたイベントハンドラーは呼び出されません。
App.ContentEditable = Ember.View.extend({
item: App.Item.create({name:"Editable content"}),
tagName: "span",
contenteditable:"true",
attributeBindings: ["contenteditable"],
// Only event that gets triggered
click: function(){ console.log("click") },
// None of these events are triggered
focusin: function(){ console.log("focusin") },
focusout: function(){ console.log("focusout") },
keyup: function(){ console.log("keyup") },
blur: function(){ console.log("blur") },
paste: function(){ console.log("paste") },
});
.on()
イベントがコンソールに記録されていることを示すjsfiddleをまとめましたが、Ember.Viewのイベントはそうではありません:http: //jsfiddle.net/chrisconley/RqSn4/