플랫 전분 기본 처리 반영

This commit is contained in:
현성필
2024-05-07 13:43:48 +09:00
parent a2aecb03e7
commit ac88b6388e
17 changed files with 1415 additions and 300 deletions
+15 -5
View File
@@ -16,9 +16,10 @@ class EditableInputModel {
}
class EditableInputView {
constructor(model, controller) {
constructor(model, controller, options) {
this.model = model;
this.controller = controller;
this.options = options;
}
render(element) {
@@ -30,8 +31,17 @@ class EditableInputView {
generateInputHtml() {
let contentHtml = this.model.getValue() ? this.renderContent(this.parseContent(this.model.getValue())) : ZERO_WIDTH_SPACE;
let styleString = '';
if (this.options.style && typeof this.options.style === 'object') {
const styles = Object.entries(this.options.style);
styleString = styles.map(([prop, value]) => `${prop}: ${value};`).join(' ');
}
let style = styleString ? `style="${styleString}"` : '';
return `
<div contenteditable="true" class="editableInputContent form-control" data-value="${this.model.getValue()}">
<div contenteditable="true" ${style} class="editableInputContent form-control" data-value="${this.model.getValue()}">
${contentHtml}
</div>
`;
@@ -132,9 +142,9 @@ class EditableInputView {
class EditableInputController {
constructor(model) {
constructor(model, options) {
this.model = model;
this.view = new EditableInputView(this.model, this);
this.view = new EditableInputView(this.model, this, options);
}
init(element, callback) {
@@ -251,7 +261,7 @@ class EditableInput {
constructor(options = {}) {
// Initialize the model with the value
this.model = new EditableInputModel(options.value || '');
this.controller = new EditableInputController(this.model);
this.controller = new EditableInputController(this.model, options);
// Additional properties as required
this.name = options.name || '';