Always update body text when editing, it could be changed server-side due to merging
This commit is contained in:
parent
0f835fa312
commit
07c3f4204f
3 changed files with 8 additions and 7 deletions
|
@ -78,10 +78,8 @@ function openEditor() {
|
||||||
// Update body:
|
// Update body:
|
||||||
rendered.innerHTML = result.rendered;
|
rendered.innerHTML = result.rendered;
|
||||||
|
|
||||||
if (result.conflict) {
|
form.elements.title.value = result.title;
|
||||||
form.elements.title.value = result.title;
|
shadow.value = textarea.value = result.body;
|
||||||
form.elements.body.value = result.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update form:
|
// Update form:
|
||||||
form.elements.base_revision.value = result.revision;
|
form.elements.base_revision.value = result.revision;
|
||||||
|
@ -94,6 +92,7 @@ function openEditor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea.disabled = false;
|
textarea.disabled = false;
|
||||||
|
autosizeTextarea(textarea, shadow);
|
||||||
|
|
||||||
if (result.conflict) {
|
if (result.conflict) {
|
||||||
alert("Your edit came into conflict with another change and has not been saved.\n" +
|
alert("Your edit came into conflict with another change and has not been saved.\n" +
|
||||||
|
|
|
@ -137,7 +137,7 @@ impl Resource for ArticleResource {
|
||||||
slug: &'a str,
|
slug: &'a str,
|
||||||
revision: i32,
|
revision: i32,
|
||||||
title: &'a str,
|
title: &'a str,
|
||||||
body: Option<&'a str>,
|
body: &'a str,
|
||||||
rendered: &'a str,
|
rendered: &'a str,
|
||||||
last_updated: &'a str,
|
last_updated: &'a str,
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ impl Resource for ArticleResource {
|
||||||
slug: &updated.slug,
|
slug: &updated.slug,
|
||||||
revision: updated.revision,
|
revision: updated.revision,
|
||||||
title: &updated.title,
|
title: &updated.title,
|
||||||
body: None,
|
body: &updated.body,
|
||||||
rendered: &Template {
|
rendered: &Template {
|
||||||
title: &updated.title,
|
title: &updated.title,
|
||||||
rendered: render_markdown(&updated.body),
|
rendered: render_markdown(&updated.body),
|
||||||
|
@ -187,7 +187,7 @@ impl Resource for ArticleResource {
|
||||||
slug: &base_article.slug,
|
slug: &base_article.slug,
|
||||||
revision: base_article.revision,
|
revision: base_article.revision,
|
||||||
title: &title,
|
title: &title,
|
||||||
body: Some(&body),
|
body: &body,
|
||||||
rendered: &Template {
|
rendered: &Template {
|
||||||
title: &title,
|
title: &title,
|
||||||
rendered: render_markdown(&body),
|
rendered: render_markdown(&body),
|
||||||
|
|
|
@ -120,6 +120,7 @@ impl Resource for NewArticleResource {
|
||||||
article_id: i32,
|
article_id: i32,
|
||||||
revision: i32,
|
revision: i32,
|
||||||
title: &'a str,
|
title: &'a str,
|
||||||
|
body: &'a str,
|
||||||
rendered: &'a str,
|
rendered: &'a str,
|
||||||
last_updated: &'a str,
|
last_updated: &'a str,
|
||||||
}
|
}
|
||||||
|
@ -146,6 +147,7 @@ impl Resource for NewArticleResource {
|
||||||
article_id: updated.article_id,
|
article_id: updated.article_id,
|
||||||
revision: updated.revision,
|
revision: updated.revision,
|
||||||
title: &updated.title,
|
title: &updated.title,
|
||||||
|
body: &updated.body,
|
||||||
rendered: &Template {
|
rendered: &Template {
|
||||||
title: &updated.title,
|
title: &updated.title,
|
||||||
rendered: render_markdown(&updated.body),
|
rendered: render_markdown(&updated.body),
|
||||||
|
|
Loading…
Reference in a new issue