diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | src/http.cc | 3 | ||||
-rw-r--r-- | src/ws/Makefile.am | 3 | ||||
m--------- | src/ws/marked | 0 | ||||
-rw-r--r-- | src/ws/munia.html | 1 | ||||
-rw-r--r-- | src/ws/node.js | 21 |
6 files changed, 15 insertions, 16 deletions
diff --git a/.gitmodules b/.gitmodules index d98be27..49cc647 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "hugin"] path = hugin url = http://git.drumgizmo.org/hugin.git +[submodule "src/ws/marked"] + path = src/ws/marked + url = https://github.com/markedjs/marked.git diff --git a/src/http.cc b/src/http.cc index ffd7912..e184114 100644 --- a/src/http.cc +++ b/src/http.cc @@ -101,7 +101,8 @@ int callback_http(struct lws *wsi, if(file == "proto.js" || file == "handler.js" || file == "node.js" || - file == "view.js") + file == "view.js" || + file == "marked.min.js") { return serveFile(wsi, file,"text/javascript"); } diff --git a/src/ws/Makefile.am b/src/ws/Makefile.am index 64d0540..c7252e5 100644 --- a/src/ws/Makefile.am +++ b/src/ws/Makefile.am @@ -11,4 +11,5 @@ ws_DATA = \ munia.html \ node.js \ proto.js \ - view.js + view.js \ + marked/marked.min.js diff --git a/src/ws/marked b/src/ws/marked new file mode 160000 +Subproject b198b55eb0bd02ba6209051c9c85a95e297353f diff --git a/src/ws/munia.html b/src/ws/munia.html index 4406afa..98ce8bd 100644 --- a/src/ws/munia.html +++ b/src/ws/munia.html @@ -29,6 +29,7 @@ <script type="text/javascript" charset="utf-8" src="node.js"></script> <script type="text/javascript" charset="utf-8" src="view.js"></script> <script type="text/javascript" charset="utf-8" src="handler.js"></script> +<script type="text/javascript" charset="utf-8" src="marked.min.js"></script> </body> </html> diff --git a/src/ws/node.js b/src/ws/node.js index 5ecfdac..16eb9cc 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -298,10 +298,12 @@ function makeClickthrough(e) var elements = e.getElementsByTagName("*"); for(let element of elements) { - if(element.tagName != "A") + if(element.tagName == "A") { - element.style.pointerEvents = "none"; // enable clickthrough to parent + element.style.pointerEvents = "initial"; // enable links + continue; } + element.style.pointerEvents = "none"; // enable clickthrough to parent } } @@ -325,18 +327,9 @@ Node.prototype.setAttribute = function(name, value) { this.description_element.removeChild(this.description_element.firstChild); } - if(checkHTML(value)) - { - // Insert as HTML - this.description_element.innerHTML = value; - makeClickthrough(this.description_element); - } - else - { - // Not valid HTML, insert as plain text to avoid breaking things - var description_txt = document.createTextNode(value); - this.description_element.appendChild(description_txt); - } + + this.description_element.innerHTML = marked(value); + makeClickthrough(this.description_element); } if(name == "dragged") |