Sha256: 2189921c66eae168ef6dec4fad4687d8496584fa1259f1040823223ee79ec62b

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

<%= content_tag(:div, @content, @options) %>

<script type="text/javascript">
    document.addEventListener("pandaCmsRichTextEditorLoaded", function() {
      console.debug("[Panda CMS] Called event listener: pandaCmsRichTextEditorLoaded for <%= @options[:id] %>");

      // Allowing per-element toolbar configuration, if needed
      let quillOptions = {
        modules: {
          toolbar: [
            [{ header: [1, 2, 3, false] }],
            ["bold", "italic", "underline"],
            [{ list: "ordered" }, { list: "bullet" }],
            [{ script: "sub" }, { script: "super" }],
            [{ color: [] }, { background: [] }],
            [{ align: [] }],
            ["link", "image", "video", "code-block", "clean"],
          ],
          magicUrl: true,
          imageCompressor: {
            quality: 0.9,
            maxWidth: 2000,
            maxHeight: 2000,
            imageType: "image/png",
            keepImageTypes: ["image/jpeg", "image/jpg", "image/png"],
          },
        },
        theme: "snow",
      };

      let quillVar = "<%= @options[:id] %>";
      console.debug(`[Panda CMS] Enabling Quill editor: ${quillVar}`);
      console.debug(`[Panda CMS] Quill options for ${quillVar}: `, quillOptions);

      Quill.register("modules/imageCompressor", imageCompressor);
      quillVar = new Quill("#" + quillVar, quillOptions);
    });
  </script>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
panda_cms-0.5.10 app/components/panda_cms/rich_text_component.html.erb
panda_cms-0.5.9 app/components/panda_cms/rich_text_component.html.erb
panda_cms-0.5.8 app/components/panda_cms/rich_text_component.html.erb
panda_cms-0.5.7 app/components/panda_cms/rich_text_component.html.erb
panda_cms-0.5.6 app/components/panda_cms/rich_text_component.html.erb
panda_cms-0.5.5 app/components/panda_cms/rich_text_component.html.erb