Browse Source

shouldn't hide the whole editor when loading because it removes dom

elements that are necessary to manipulate
pull/1/head
wes 8 years ago
parent
commit
9d5efd44da
  1. 6
      src/scripts/editor.tag

6
src/scripts/editor.tag

@ -1,6 +1,6 @@
<editor> <editor>
<loading if={this.loading}></loading> <loading if={this.loading}></loading>
<div if={!this.loading} class="centered container"> <div class="centered container">
<div class="columns"> <div class="columns">
<div class="column col-6"> <div class="column col-6">
<div> <div>
@ -163,6 +163,7 @@ newPost() {
} }
submit() { submit() {
self.update({"loading" : true});
var post = { var post = {
"title" : this.refs.title.value, "title" : this.refs.title.value,
"author" : this.refs.author.value, "author" : this.refs.author.value,
@ -191,6 +192,7 @@ submit() {
console.log("the post was successfully added"); console.log("the post was successfully added");
self.update({"loading" : false});
if (self.isNewPost) { if (self.isNewPost) {
/* only happen for new posts */ /* only happen for new posts */
post["_id"] = resp.data[0]; post["_id"] = resp.data[0];
@ -219,7 +221,6 @@ loadPost(_id) {
axios.get(`/blog/getpost/${_id}`) axios.get(`/blog/getpost/${_id}`)
.then(function(resp) { .then(function(resp) {
self.update({"loading" : false}); self.update({"loading" : false});
self.one("updated", function() {
self.refs.textarea.value = resp.data.content; self.refs.textarea.value = resp.data.content;
self.refs.title.value = resp.data.title; self.refs.title.value = resp.data.title;
self.refs.author.value = resp.data.author; self.refs.author.value = resp.data.author;
@ -230,7 +231,6 @@ loadPost(_id) {
self.update(); self.update();
self.echo(); self.echo();
});
}) })
.catch(function(err) { .catch(function(err) {
console.log(err); console.log(err);

Loading…
Cancel
Save