Merge pull request #4490 from BrokenEagle/fix-embedded-notes

Fix embedded notes not being re-editable after note creation
This commit is contained in:
evazion
2020-05-29 11:29:12 -05:00
committed by GitHub

View File

@@ -602,7 +602,7 @@ let Note = {
resize: "none", resize: "none",
}); });
if ($note_body.html() !== "<em>Click to edit</em>") { if (!$note_body.hasClass("new-note")) {
$textarea.val($note_body.data("original-body")); $textarea.val($note_body.data("original-body"));
} }
@@ -680,6 +680,7 @@ let Note = {
$note_box = Note.Box.find(data.html_id); $note_box = Note.Box.find(data.html_id);
$note_body.data("id", String(data.id)).attr("data-id", data.id); $note_body.data("id", String(data.id)).attr("data-id", data.id);
$note_box.data("id", String(data.id)).attr("data-id", data.id); $note_box.data("id", String(data.id)).attr("data-id", data.id);
$note_box.removeClass("new-note");
$note_box.removeClass("unsaved"); $note_box.removeClass("unsaved");
$note_box.removeClass("movable"); $note_box.removeClass("movable");
} else { } else {
@@ -955,7 +956,7 @@ let Note = {
Note.Box.scale($note_box); Note.Box.scale($note_box);
if (Note.embed) { if (Note.embed) {
Note.Body.display_text($note_box.children("div.note-box-inner-border"), sanitized_body); Note.Body.display_text($note_box.children("div.note-box-inner-border"), sanitized_body);
Note.Body.display_text($note_body, "Click to edit."); Note.Body.display_text($note_body, "<em>Click to edit</em>");
} else { } else {
Note.Body.display_text($note_body, sanitized_body); Note.Body.display_text($note_body, sanitized_body);
} }
@@ -971,6 +972,7 @@ let Note = {
height: h height: h
}); });
Note.Box.update_data_attributes($note_box); Note.Box.update_data_attributes($note_box);
$note_box.addClass("new-note");
$note_box.addClass("unsaved"); $note_box.addClass("unsaved");
$note_body.html("<em>Click to edit</em>"); $note_body.html("<em>Click to edit</em>");
$(".note-container").append($note_box); $(".note-container").append($note_box);