mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🎉 Add comments to viewer.
This commit is contained in:
parent
e1db6d3a37
commit
64a6ba1949
45 changed files with 1629 additions and 1074 deletions
|
@ -35,3 +35,9 @@
|
|||
(.fillText context letters (/ size 2) (/ size 1.5))
|
||||
|
||||
(.toDataURL canvas)))
|
||||
|
||||
(defn assoc-profile-avatar
|
||||
[{:keys [photo fullname] :as profile}]
|
||||
(cond-> profile
|
||||
(or (nil? photo) (empty? photo))
|
||||
(assoc :photo (generate {:name fullname}))))
|
||||
|
|
|
@ -9,12 +9,11 @@
|
|||
|
||||
(ns app.util.dom
|
||||
(:require
|
||||
[goog.dom :as dom]
|
||||
[cuerdas.core :as str]
|
||||
[beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.util.transit :as ts]))
|
||||
[app.util.object :as obj]
|
||||
[cuerdas.core :as str]
|
||||
[goog.dom :as dom]))
|
||||
|
||||
;; --- Deprecated methods
|
||||
|
||||
|
@ -111,11 +110,11 @@
|
|||
|
||||
(defn select-text!
|
||||
[node]
|
||||
(.select node))
|
||||
(.select ^js node))
|
||||
|
||||
(defn ^boolean equals?
|
||||
[node-a node-b]
|
||||
(.isEqualNode node-a node-b))
|
||||
(.isEqualNode ^js node-a node-b))
|
||||
|
||||
(defn get-event-files
|
||||
"Extract the files from event instance."
|
||||
|
@ -162,6 +161,12 @@
|
|||
y (.-clientY event)]
|
||||
(gpt/point x y)))
|
||||
|
||||
(defn get-offset-position
|
||||
[event]
|
||||
(let [x (.-offsetX event)
|
||||
y (.-offsetY event)]
|
||||
(gpt/point x y)))
|
||||
|
||||
(defn get-client-size
|
||||
[node]
|
||||
{:width (.-clientWidth ^js node)
|
||||
|
@ -188,7 +193,16 @@
|
|||
|
||||
(defn fullscreen?
|
||||
[]
|
||||
(boolean (.-fullscreenElement js/document)))
|
||||
(cond
|
||||
(obj/in? js/document "webkitFullscreenElement")
|
||||
(boolean (.-webkitFullscreenElement js/document))
|
||||
|
||||
(obj/in? js/document "fullscreenElement")
|
||||
(boolean (.-fullscreenElement js/document))
|
||||
|
||||
:else
|
||||
(ex/raise :type :not-supported
|
||||
:hint "seems like the current browset does not support fullscreen api.")))
|
||||
|
||||
(defn ^boolean blob?
|
||||
[v]
|
||||
|
@ -219,6 +233,6 @@
|
|||
|
||||
(defn release-pointer [event]
|
||||
(-> event get-target (.releasePointerCapture (.-pointerId event))))
|
||||
|
||||
|
||||
(defn get-root []
|
||||
(query js/document "#app"))
|
||||
|
|
|
@ -76,3 +76,7 @@
|
|||
(defn clj->props
|
||||
[props]
|
||||
(clj->js props :keyword-fn props-key-fn))
|
||||
|
||||
(defn ^boolean in?
|
||||
[obj prop]
|
||||
(js* "~{} in ~{}" prop obj))
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
(ns app.util.webapi
|
||||
"HTML5 web api helpers."
|
||||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.util.object :as obj]
|
||||
[promesa.core :as p]
|
||||
[beicon.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
|
@ -97,8 +99,26 @@
|
|||
|
||||
(defn request-fullscreen
|
||||
[el]
|
||||
(.requestFullscreen el))
|
||||
(cond
|
||||
(obj/in? el "requestFullscreen")
|
||||
(.requestFullscreen el)
|
||||
|
||||
(obj/in? el "webkitRequestFullscreen")
|
||||
(.webkitRequestFullscreen el)
|
||||
|
||||
:else
|
||||
(ex/raise :type :not-supported
|
||||
:hint "seems like the current browset does not support fullscreen api.")))
|
||||
|
||||
(defn exit-fullscreen
|
||||
[]
|
||||
(.exitFullscreen js/document))
|
||||
(cond
|
||||
(obj/in? js/document "exitFullscreen")
|
||||
(.exitFullscreen js/document)
|
||||
|
||||
(obj/in? js/document "webkitExitFullscreen")
|
||||
(.webkitExitFullscreen js/document)
|
||||
|
||||
:else
|
||||
(ex/raise :type :not-supported
|
||||
:hint "seems like the current browset does not support fullscreen api.")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue