summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-12 08:56:02 +0300
committerAndrew Dolgov <[email protected]>2018-12-12 08:56:02 +0300
commit4e41db7ed3ce5b0219488babd460077cb9ac5d79 (patch)
treec7974556cd4a6388811732c61159642d5fc1bbb9 /js
parenteda4ac2a2bb4bd96d06d0a2255dbc3d01cf16e31 (diff)
Article.unpack: add placeholder &nbsp; if data-content is empty
Diffstat (limited to 'js')
-rw-r--r--js/Article.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/js/Article.js b/js/Article.js
index e281ea5ae..b933ed716 100644
--- a/js/Article.js
+++ b/js/Article.js
@@ -169,7 +169,14 @@ define(["dojo/_base/declare"], function (declare) {
if (row.hasAttribute("data-content")) {
console.log("unpacking: " + row.id);
- row.select(".content-inner")[0].innerHTML = row.getAttribute("data-content");
+ const container = row.querySelector(".content-inner");
+
+ container.innerHTML = row.getAttribute("data-content").trim();
+
+ // blank content element might screw up onclick selection and keyboard moving
+ if (container.textContent.length == 0)
+ container.innerHTML += "&nbsp;";
+
row.removeAttribute("data-content");
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, row);