From 900452bfd26ae5cd452d3350031825aacdc985ae Mon Sep 17 00:00:00 2001 From: raphael Date: Mon, 20 Jul 2020 11:42:25 +0200 Subject: [PATCH] fix focus and better json file --- src/js/whiteboard.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/whiteboard.js b/src/js/whiteboard.js index 3947455..518d98a 100644 --- a/src/js/whiteboard.js +++ b/src/js/whiteboard.js @@ -952,7 +952,10 @@ const whiteboard = { return false; }); if (newLocalBox) { - textBox.find(".textContent").focus(); + //per https://stackoverflow.com/questions/2388164/set-focus-on-div-contenteditable-element + setTimeout(() => { + textBox.find(".textContent").focus(); + }, 0); } if (this.tool === "text") { textBox.addClass("active"); @@ -1326,7 +1329,7 @@ const whiteboard = { delete sendObj[i]["wid"]; delete sendObj[i]["drawId"]; } - return JSON.stringify(sendObj); + return JSON.stringify(sendObj, null, 2); }, loadData: function (content) { var _this = this;