Fork me on GitHub
Muhammad Hamza Chippa08:07:56

Did anybody used recoil in the clojurescript project, and if yes what is your experience?

Tala Tarazi10:07:41

Hi all, I'm trying to implement this code in Clojurescript, can anyone help me convert it. Thanks!

const { root } = await room.getStorage();

  let todos = root.get("todos");


(.. room
    (then (fn [^js storage]
            (let [todos (.. storage -root (get "todos"))]

Tala Tarazi10:07:21

This works, but I want the todos value to be outside the let, so I can use it in other functions. Is there a way to save it in a global value?


I assume you're creating a Todo-App for the frontend and use something like reagent, re-frame, rum, om... for the rendering?

Tala Tarazi10:07:35

No Actually, I'm using a service and this is their example and I want to do something similar


> I want the todos value to be outside the let Impossible, both in CLJS and in JS. In JS, it seems like it's possible, because the outer function is an async one - you still have to await it somewhere or use .then on the returned promise. CLJS doesn't have await support, so you have to use .then. You can, however, pass the resulting promise anywhere you like - then the relevant functions would call .then on it themselves. Alternatively, you can rewrite the above code to use clojure.core.async - it can end up looking very similar to the JS code with async/`await`.

👍 3
M J12:07:43

Anyone know how can I copy a value to clipboard in clojurescript?


Exactly the same way you'd do it using JS.


But, of course, with some JS interop on top.


[:button {:on-click (fn [e]
                         (.writeText js/navigator.clipboard "wow"))}
    "Click me!"]
works for me

🙌 1
M J12:07:42

YES thanks alot!!

🍻 1

Not clojurescript related, but does anyone recommend a rich text editor to embed as a web-component in a page? If it looks/works like the one on slack, it is good enough.


if you’re using React maybe check out Lexical not sure if it’s as batteries included as what you’re looking for though


I've used TinyMCE before, seemed alright. Has a separate wrapper for React.


Quill worked quite well for us, but once you want to do complex things (like custom nodes) it becomes a bit cumbersome. we're currently using Tiptap (built upon ProseMirror) which is fantastic. definitely not batteries included but it makes adding custom functionality very simple


I was just shopping for one myself and found this article that I found useful: I decided to go with TipTap, though I haven't gotten very far into the project yet.


if you want any help or experience reports with TipTap feel free to let me know @U03NXD9TGBD 🙂


Thanks @U0HJ7CX6H! any land mines I should avoid? I'm probably going to build something close to a markdown editor that supports hash-tags and at-references


i'll pm you something now 🙂


Thanks for the answers, looking into them.