|
|
@ -10,7 +10,6 @@ class Controller {
|
|
|
|
var settingsBtn = document.getElementsByClassName("settingsBtn")[0];
|
|
|
|
var settingsBtn = document.getElementsByClassName("settingsBtn")[0];
|
|
|
|
var settingsClose = document.getElementsByClassName("close");
|
|
|
|
var settingsClose = document.getElementsByClassName("close");
|
|
|
|
var settingsSubmit = document.getElementById("settingsSubmit");
|
|
|
|
var settingsSubmit = document.getElementById("settingsSubmit");
|
|
|
|
var textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
|
|
|
|
var saveBtn = document.getElementById("saveBtn");
|
|
|
|
var saveBtn = document.getElementById("saveBtn");
|
|
|
|
|
|
|
|
|
|
|
|
cloneBtn.addEventListener("click", this.cloneRep.bind(this));
|
|
|
|
cloneBtn.addEventListener("click", this.cloneRep.bind(this));
|
|
|
@ -20,17 +19,14 @@ class Controller {
|
|
|
|
settingsClose[i].addEventListener("click", view.closeSettings.bind(this));
|
|
|
|
settingsClose[i].addEventListener("click", view.closeSettings.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
settingsSubmit.addEventListener("click", this.saveSettings.bind(this));
|
|
|
|
settingsSubmit.addEventListener("click", this.saveSettings.bind(this));
|
|
|
|
textArea.addEventListener("keyup", this.saveButton.bind(this));
|
|
|
|
view.simplemde.codemirror.on("change", this.saveButton.bind(this));
|
|
|
|
saveBtn.addEventListener("click", this.saveFile.bind(this));
|
|
|
|
saveBtn.addEventListener("click", this.saveFile.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
saveButton() {
|
|
|
|
saveButton() {
|
|
|
|
var textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
if (textArea.value != this.openedFileValue) {
|
|
|
|
|
|
|
|
this.view.showSaveButton(true);
|
|
|
|
this.view.showSaveButton(textArea.value() == this.openedFileValue);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.view.showSaveButton(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wipeFS() {
|
|
|
|
wipeFS() {
|
|
|
@ -99,9 +95,9 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
saveFile() {
|
|
|
|
saveFile() {
|
|
|
|
var textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value);
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value());
|
|
|
|
this.openedFileValue = textArea.value;
|
|
|
|
this.openedFileValue = textArea.value();
|
|
|
|
this.saveButton();
|
|
|
|
this.saveButton();
|
|
|
|
|
|
|
|
|
|
|
|
this.updateFileStats();
|
|
|
|
this.updateFileStats();
|
|
|
|