|
|
@@ -63,9 +63,9 @@
|
|
|
//taken directly from ko.bindingHandlers['options']
|
|
|
function applyToObject(object, predicate, defaultValue) {
|
|
|
var predicateType = typeof predicate;
|
|
|
- if (predicateType == "function") // Given a function; run it against the data value
|
|
|
+ if (predicateType === "function") // Given a function; run it against the data value
|
|
|
return predicate(object);
|
|
|
- else if (predicateType == "string") // Given a string; treat it as a property name on the data value
|
|
|
+ else if (predicateType === "string") // Given a string; treat it as a property name on the data value
|
|
|
return object[predicate];
|
|
|
else // Given no optionsText arg; use the data value itself
|
|
|
return defaultValue;
|
|
|
@@ -96,10 +96,21 @@
|
|
|
if (editableOptions.inlineEditAction.editClass) {
|
|
|
$editAction.addClass(editableOptions.inlineEditAction.editClass);
|
|
|
}
|
|
|
+ $editAction.on('click', function () {
|
|
|
+ $editable.editable('toggle');
|
|
|
+ });
|
|
|
$editAction.appendTo($container);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ var addPlaceHolder = function ($container) {
|
|
|
+ if (editableOptions.placeholder) {
|
|
|
+ $('<div>').addClass('editable-inline-empty').text(editableOptions.placeholder).click(function () {
|
|
|
+ $editable.editable('toggle');
|
|
|
+ }).appendTo($container);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
var multiLineEllipsisHandler;
|
|
|
if (editableOptions.multiLineEllipsis) {
|
|
|
editableOptions.display = function (value) {
|
|
|
@@ -109,9 +120,7 @@
|
|
|
}
|
|
|
var $container = $(this);
|
|
|
$container.empty();
|
|
|
- if (editableOptions.placeholder) {
|
|
|
- $('<div>').addClass('editable-inline-empty').text(editableOptions.placeholder).appendTo($container);
|
|
|
- }
|
|
|
+ addPlaceHolder($container);
|
|
|
if (onActionRender) {
|
|
|
onActionRender($container);
|
|
|
}
|
|
|
@@ -139,8 +148,8 @@
|
|
|
} else if (onActionRender) {
|
|
|
editableOptions.display = function (value) {
|
|
|
var $container = $(this);
|
|
|
- if (!value && editableOptions.placeholder) {
|
|
|
- $('<div>').addClass('editable-inline-empty').text(editableOptions.placeholder).appendTo($container);
|
|
|
+ if (!value) {
|
|
|
+ addPlaceHolder($container);
|
|
|
} else {
|
|
|
$('<span>').html(value).appendTo($container);
|
|
|
}
|