简体   繁体   中英

Clojurescript Re-frame site with quill editor integration

I am new in JS and clojurescript. I need for a project based on clojurescript re-frame to add an editor WYSIWYG. I did try to add Quill following the Quickstart.

From my index.html file I put as advised the:

<head>
    <link href="https://cdn.quilljs.com/1.0.0/quill.snow.css" rel="stylesheet" />
    <script src="https://cdn.quilljs.com/1.0.0/quill.js"></script>
</head>

<script src="https://cdn.quilljs.com/1.0.0/quill.js"></script>
<script>
  var editor = new Quill('#editor', {
    modules: { toolbar: '#toolbar' },
    theme: 'snow',
   });
</script>

and then in my page I set it up

(defn my-page []
  [:div
    [:div#toolbar 
     [:button.ql-bold "Bold"] [:button.ql-italic "Italic"]]
    [:div#editor [:p "Hello World!"]]])

It does not provide any editor as if the javascript was not working. Like if the editor anchor made no sense.

If any one did already set up Quill with clojurescript, thanks in advance for your help.

That quick start assumes that the relevant DOM node is available when the last <script> tag is evaluated, which is not the case when you're using React (or Reagent).

Unless you know very well what you're doing, you would be better off using some React wrapper for Quill, like https://www.npmjs.com/package/react-quill . But you should still consult Reagent documentation on how to use React components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM