/* mk.editablespan - v1.0.0 - 2014-01-03 */ var mod = angular.module("mk.editablespan", []); mod.directive("editablespan", function () { return { restrict: "E", template: '
{{text}}
', scope: { text: "=model", onReady: "&", spanClass: "@", inputClass: "@", inputType: "@" }, replace: !0, link: function (a, b) { function c() { d(), h(!0), l[0].focus() } function d() { l.bind("blur", function () { f() }), l.bind("keyup", function (a) { i(a) && f() }), k.bind("submit", function () { l[0].value && e(), f() }) } function e() { a.text = l[0].value, a.$apply(), a.onReady() } function f() { g(), h(!1) } function g() { l.unbind(), k.unbind() } function h(b) { a.editing = b, a.$apply() } function i(a) { return a && 27 == a.keyCode } a.getInputType = function () { return a.inputType || "text" }; var j = angular.element(b.children()[0]), k = angular.element(b.children()[1]), l = angular.element(b.children()[1][0]); j.bind("click", function () { l[0].value = a.text, c() }) } } });