Don’t follow links when they are contenteditable

This commit is contained in:
Philipp Markovics 2019-01-28 12:59:50 +01:00
parent 71e83818b1
commit 88a13ba2f8

View file

@ -2,7 +2,8 @@
(:require [reitit.core :as reitit]
[reitit.core :as r]
[reitit.frontend :as rf]
[goog.events :as gevents])
[goog.events :as gevents]
[goog.dom :as gdom])
(:import goog.Uri))
(defprotocol History
@ -75,7 +76,8 @@
(not (contains? #{"_blank" "self"} (.getAttribute el "target")))
;; Left button
(= 0 (.-button e))
(reitit/match-by-path router (.getPath uri)))
(reitit/match-by-path router (.getPath uri))
(not (gdom/getAncestor el (fn [node] (.isContentEditable node)))))
(.preventDefault e)
(let [path (str (.getPath uri)
(if (seq (.getQuery uri))