drafts: getSelection to differentiate clicks from drags.

We can use getSelection to distinguish between clicks and drags while
accessing the body of a saved draft.  Previously, the draft would be
restored when trying to select draft text to copy/paste.

Fixes #14447.
This commit is contained in:
Pranav
2020-04-10 17:27:52 +05:30
committed by Tim Abbott
parent 04d55f04ab
commit d2cf2ba93f

View File

@@ -334,6 +334,10 @@ exports.launch = function () {
function setup_event_handlers() {
$(".restore-draft").on("click", function (e) {
if (document.getSelection().type === "Range") {
return;
}
e.stopPropagation();
const draft_row = $(this).closest(".draft-row");