Home

Awesome

Editorjs plugin

Editor.js plugin for Cotonti CMF - Modern block-style editor

Content editor and 2 way parser plugin:

Plugin markups created HTML content with special classes. This classes described in table.

Currently supported Editor.js Tools:

PackageKeyMain CSS Class<br>(with default prefix)Additional / modificator CSS classes<br>(with default prefix)
@editorjs/header<br>editorjs-header-with-alignmentheader.prs-headeralignment:<br>.prs_left<br>.prs_right<br>.prs_center<br>.prs_justify
@editorjs/paragraph<br>editorjs-paragraph-with-alignmentparagraph.prs-paragraphalignment:<br>.prs_left<br>.prs_right<br>.prs_center<br>.prs_justify
@editorjs/inline-code
@editorjs/marker
@editorjs/underline
@editorjs/listlist.prs-listadditional:<br>.prs_ordered
@editorjs/rawraw
@editorjs/simple-imagesimpleImage.prs-imageadditional:<br>.prs_withborder<br>.prs_withbackground<br>.prs_stretched
@editorjs/embedembed.prs-embedadditional:<br>.prs_youtube<br>.prs_codepen<br>.prs_vimeo
@editorjs/linklinkTool.prs-linktooladditional:<br>.prs_title<br>.prs_description<br>.prs_sitename
@editorjs/delimiterdelimiter.prs-delimiter
editorjs-alertalert.prs-alertalignment:<br>.prs_left<br>.prs_right<br>.prs_center<br>additional:<br>.prs_primary<br>.prs_secondary<br>.prs_info<br>.prs_success<br>.prs_warning<br>.prs_danger<br>.prs_light<br>.prs_dark
@editorjs/warningwarning.prs-warning
@editorjs/tabletable.prs-tableadditional:<br>.prs_withheadings
@editorjs/quotequote.prs-quotealignment:<br>.prs_left<br>.prs_center
@editorjs/codecode.prs-code

Installation

  1. Unpack to plugins directory
  2. Enable plugin from admin panel
  3. Run composer install inside src directory plugin (Composer must be installed)
  4. Set Editorjs markup parser in configurations Pages module

Configuration

  1. You can turn off unnecessary tools in editorjs.editor.php
  2. Set sanitize data from client with HTML Purifier rules in sanitize-blocks-config.json
  3. Set custom prefix (default is prs) for generated classes in plugin configuration

For more information on cleaning rules, see: https://github.com/editor-js/editorjs-php

Generated HTML

Header

<h2 class="prs-header prs_center">Lorem</h2>

Paragraph

<p class="prs-paragraph prs_center">
    <code class="inline-code">Pellentesque</code> 
    <i>malesuada fames</i> 
    <mark class="cdx-marker">tempus</mark>
</p>

Ordered List

<ol class="prs-list prs_ordered">
    <li></li>
</ol>

Unordered List

<ul class="prs-list">
    <li></li>
</ul>

Table

<table class="prs-table prs_withheadings">
    <thead>
        <tr>
            <th>1</th><th>2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>a</td><td>b</td>
        </tr>
    </tbody>
</table>

Code

<pre class="prs-code">
    <code></code>
</pre>

Embed

(Actually working with Youtube)
<figure class="prs-embed prs_youtube">
    <iframe width="580" height="320" src="https://www.youtube.com/embed/CwXOrWvPBPk" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="1"></iframe>
    <figcaption>Shrek (2001) Trailer</figcaption>
</figure>

Delimiter

<hr class="prs-delimiter">

LinkTool

<figure class="prs-linkTool">
    <a href="https://github.com/" target="_blank">
       <img src="https://example.com/cat.png" alt="">
       <p class="prs_title">Title</p>
       <p class="prs_description">Description</p>
       <p class="prs_sitename">example.com</p>
    </a>
</figure>

Image

<figure class="prs-image prs_withborder prs_withbackground prs_stretched">
    <img src="" alt="">
    <figcaption></figcaption>
</figure>

Quote

<figure class="prs-quote prs_center">
    <blockquote></blockquote>
    <figcaption></figcaption>
</figure>

Warning

<div class="prs-warning">
    <i></i>
    <h4>Title</h4>
    <p>Message</p>
</div>

Alert

<p class="prs-alert prs_center prs_success">
    Alert!
</p>

Raw

<div class="prs-raw">
    Raw HTML ...
</div>

For more information about parser, see: https://github.com/editor-js/editorjs-php