ferngully-aurelia-tools
Version:
Ferngully Tools for Aurelia
78 lines • 3.73 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { customElement, bindable, autoinject, containerless } from "aurelia-framework";
import { EditableInputElementService } from "../editable-input-element-service";
import "./editable-inline-textarea.css";
import { BrowserService } from "../../../services/browser-service";
var EditableInlineTextArea = (function () {
function EditableInlineTextArea(editableInputElementService, browserService) {
this.editableInputElementService = editableInputElementService;
this.browserService = browserService;
this.classEx = null;
this.encode = true;
}
EditableInlineTextArea.prototype.bind = function () {
this.editableInputElementService.editor = $(this.textbox);
if (this.classEx) {
this.editableInputElementService.editor.addClass(this.classEx);
}
};
EditableInlineTextArea.prototype.show = function (element, config, currentValue, onKeyPress, onSave) {
var textbox = $(this.textbox);
this.encode = config.Encode;
textbox.attr("rows", config.Rows);
this.textbox.value = this.browserService.unEscapeHtml(currentValue);
this.editableInputElementService._show(element);
textbox.focus();
textbox.select();
textbox.on("keydown.editable-inline-textarea", onKeyPress);
textbox.on("blur.editable-inline-textarea", onSave);
};
EditableInlineTextArea.prototype.hide = function () {
this.editableInputElementService._hide();
var textbox = $(this.textbox);
textbox.off("keydown.editable-inline-textarea");
textbox.off("blur.editable-inline-textarea");
};
Object.defineProperty(EditableInlineTextArea.prototype, "value", {
get: function () {
return this.browserService.escapeHtml(this.textbox.value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(EditableInlineTextArea.prototype, "maxLength", {
get: function () {
return this.editableInputElementService.maxLength;
},
enumerable: true,
configurable: true
});
EditableInlineTextArea.prototype.detached = function () {
this.editableInputElementService.detached();
};
EditableInlineTextArea.prototype.attached = function () {
this.editableInputElementService.attached();
};
__decorate([
bindable,
__metadata("design:type", Object)
], EditableInlineTextArea.prototype, "classEx", void 0);
EditableInlineTextArea = __decorate([
containerless,
autoinject,
customElement('editable-inline-textarea'),
__metadata("design:paramtypes", [EditableInputElementService,
BrowserService])
], EditableInlineTextArea);
return EditableInlineTextArea;
}());
export { EditableInlineTextArea };
//# sourceMappingURL=editable-inline-textarea.js.map