mirror of
https://github.com/metosin/reitit.git
synced 2025-12-20 09:31:11 +00:00
Don’t follow links when they are contenteditable
This commit is contained in:
parent
71e83818b1
commit
88a13ba2f8
1 changed files with 4 additions and 2 deletions
|
|
@ -2,7 +2,8 @@
|
||||||
(:require [reitit.core :as reitit]
|
(:require [reitit.core :as reitit]
|
||||||
[reitit.core :as r]
|
[reitit.core :as r]
|
||||||
[reitit.frontend :as rf]
|
[reitit.frontend :as rf]
|
||||||
[goog.events :as gevents])
|
[goog.events :as gevents]
|
||||||
|
[goog.dom :as gdom])
|
||||||
(:import goog.Uri))
|
(:import goog.Uri))
|
||||||
|
|
||||||
(defprotocol History
|
(defprotocol History
|
||||||
|
|
@ -75,7 +76,8 @@
|
||||||
(not (contains? #{"_blank" "self"} (.getAttribute el "target")))
|
(not (contains? #{"_blank" "self"} (.getAttribute el "target")))
|
||||||
;; Left button
|
;; Left button
|
||||||
(= 0 (.-button e))
|
(= 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)
|
(.preventDefault e)
|
||||||
(let [path (str (.getPath uri)
|
(let [path (str (.getPath uri)
|
||||||
(if (seq (.getQuery uri))
|
(if (seq (.getQuery uri))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue