This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-06
Channels
- # adventofcode (1)
- # aleph (9)
- # announcements (22)
- # beginners (59)
- # boot (8)
- # calva (1)
- # cljdoc (7)
- # cljs-dev (10)
- # cljsrn (9)
- # clojars (10)
- # clojure (23)
- # clojure-dev (6)
- # clojure-europe (3)
- # clojure-italy (26)
- # clojure-nl (3)
- # clojure-seattle (1)
- # clojure-spec (46)
- # clojure-uk (85)
- # clojurescript (97)
- # core-async (13)
- # cursive (3)
- # data-science (10)
- # datomic (156)
- # duct (34)
- # emacs (37)
- # figwheel (3)
- # figwheel-main (9)
- # fulcro (59)
- # hyperfiddle (4)
- # immutant (1)
- # jackdaw (3)
- # jobs (1)
- # off-topic (112)
- # parinfer (1)
- # qlkit (2)
- # re-frame (1)
- # reagent (35)
- # ring-swagger (2)
- # shadow-cljs (104)
- # spacemacs (9)
- # speculative (12)
- # tools-deps (30)
- # yada (10)
Does anyone know if there is a way of catching the lack of a drop event when you drop a draggable outside a drop-target? I set some local-state when I start dragging and I want to revert it if I cancel the drag (or drop it elsewhere) but I cannot find a way to trigger it 😞
maybe something similar? https://github.com/metosin/komponentit/blob/master/src/cljs/komponentit/dropdown.cljs#L164
can you handle the event on window
or document
during the capture phase @tomayerst?
@mccraigmccraig thanks, I have investigated that (and it may be where I end up) but I was trying to avoid making everything a drop target as it makes the visual feedback on the drag confusing. Also l would like to pick up hitting the 'esc' key too.
that wouldn't be making everything a drop target @tomayerst - but handling the event during the capture phase rather than the more normal bubble phase
that technique has gotten me out of similar difficulties in the past - i've never tried it with drag/drop though, so ymmv
The thing is, as I understand it, if you are not over a drag target there is no drop event at all. But I am new to this so I may not understand.
ah, if there is no event then all bets are off
Yeah 😞. I believe I am not alone in finding the HTML5 drag and drop API a bit weird.
Google closure makes this a bit easier @tomayerst - you can use https://google.github.io/closure-library/api/goog.fx.DragDrop.html
What is the Reagent equivalent of this?
afaik, the json/ld stuff is not reagent (or react) specific. Do you want to dynamically inject that script into the head of your document? Does some lib depend on it being there?
If so, you could injected it with something along the lines of this:
(def ld "{ `{ \"@context\": \"\" }` }")
(defn inject-ld [ld]
(let [s (-> js/document (.createElement "script"))]
(-> s .-text (set! ld))
(-> js/document .-head (.appendChild s))))
It's taken from the React Helmet documentation. So you put it as a child of the Helmet
component
Would this work?
Part of my issue is I don't know how to view the resulting html. When viewing the page source it only shows the html before the injections
well, that clj-<js needs to be clj->js, but that might work. Not sure if you need the stringification. And you might be able to put those backticks in the string, per the example... But I'm not really sure how Helmut is interacting with all the react lifecycle stuff.
But unless you specifically need json/ld, I think you'd normally be inserting a regular javascript script text, in which case, cljs normally handles all that for you.
That was a typo
Unless I'm misunderstanding something the backticks are just because that's JS not CLJS so it's a JS literal
The resulting JS has to be what I first pasted
So the question is does what I last pasted transpile to that?
And usually in cljs development, when using reagent, we lean on stuff like hiccup:
(html5
[:head
[:title "Acme Corp"]
[:meta {:name "author"
:content "Acme Corp, Inc., LLC"}]
[:meta {:charset "utf-8"}]
[:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
[:meta {:name "viewport"
:content
"width=device-width, initial-scale=1.0, maximum-scale=1.0"}]
(include-js
"/js/extra-thing.js"
(bust-cache "/js/compiled/main.js"))
[:script
{:src (str "")
:type "text/javascript"}]
[:script google-analytics-string]
...])
Which is what I have
Still haven't resolved my issue so if anyone else can take a look I'd appreciate it
I can't tell if the Google Structured Data Testing Tool is caching the page so it isn't picking up the change or if it isn't working the way I think it is
The equivalent of that, yes
I'm pretty sure the tool is just using a cached copy
So basically Google is dumb
Is there a way to check if r/track
is cached without executing the function?