load tester beta
This commit is contained in:
@@ -16,9 +16,9 @@ class EditableInputModel {
|
||||
}
|
||||
|
||||
class EditableInputView {
|
||||
constructor(model, editableInput) {
|
||||
constructor(model, controller) {
|
||||
this.model = model;
|
||||
this.editableInput = editableInput;
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
render(element) {
|
||||
@@ -39,9 +39,9 @@ class EditableInputView {
|
||||
|
||||
attachEventListeners() {
|
||||
this.editableDiv.addEventListener('input', (event) => {
|
||||
this.editableInput.controller.handleInput(this.editableDiv);
|
||||
if (this.editableInput.controller.additionalCallback) {
|
||||
this.editableInput.controller.additionalCallback(this.model.getValue());
|
||||
this.controller.handleInput(this.editableDiv);
|
||||
if (this.controller.additionalCallback) {
|
||||
this.controller.additionalCallback(this.model.getValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -99,9 +99,9 @@ class EditableInputView {
|
||||
|
||||
|
||||
class EditableInputController {
|
||||
constructor(model, view) {
|
||||
constructor(model) {
|
||||
this.model = model;
|
||||
this.view = view;
|
||||
this.view = new EditableInputView(this.model, this);
|
||||
}
|
||||
|
||||
init(element, callback) {
|
||||
@@ -208,16 +208,17 @@ class EditableInputController {
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
|
||||
updateUI() {
|
||||
this.view.updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
class EditableInput {
|
||||
constructor(options = {}) {
|
||||
// Initialize the model with the value
|
||||
this.model = new EditableInputModel(options.value || '');
|
||||
|
||||
// Create the view and controller, passing the model to them
|
||||
this.view = new EditableInputView(this.model, this);
|
||||
this.controller = new EditableInputController(this.model, this.view);
|
||||
this.controller = new EditableInputController(this.model);
|
||||
|
||||
// Additional properties as required
|
||||
this.name = options.name || '';
|
||||
@@ -239,7 +240,7 @@ class EditableInput {
|
||||
setValue(newValue) {
|
||||
// Delegate to the model and update the view
|
||||
this.model.setValue(newValue);
|
||||
this.view.updateUI();
|
||||
this.controller.updateUI();
|
||||
}
|
||||
|
||||
// Any additional methods required for interaction with this component
|
||||
|
||||
Reference in New Issue
Block a user