To speed up random access to the tree we have this lookup table. The flow is like so:
To speed up random access to the tree we have this lookup table. The flow is like so: 1. User clicks on a dom node on which we have registered a mouse-click event handler. 2. The browser would have changed the cursor position which we get by calling the getSelection API. We store the selection in cursor/selection. 3. When the next key is pressed we get the DOM node's id which we independently track in our hiccup data structure.
The spec is our data structure to maintain editor state. spec is specified in hiccup. Note: Why we don't use zippers Zippers are neat. But they don't have a way to jump to a random node in the tree. We need to jump to a random node when the user clicks on a corresponding DOM element. For these cases, using zippers, we would have to search the tree for the given element, an O(log n) operation.
The spec is our data structure to maintain editor state. spec is specified in hiccup. Note: Why we don't use zippers Zippers are neat. But they don't have a way to jump to a random node in the tree. We need to jump to a random node when the user clicks on a corresponding DOM element. For these cases, using zippers, we would have to search the tree for the given element, an O(log n) operation.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close