editorjs-html icon indicating copy to clipboard operation
editorjs-html copied to clipboard

Stop Unnecessary Calls to List Recursor on Empty Nested Items Array

Open Luzefiru opened this issue 1 year ago • 0 comments

Resolves #53.

Tests

Tests pass as shown below:

MINGW64 ~/Desktop/Programming/work/editorjs-html (master)
$ npm run test

> [email protected] test
> npm run build && node test/test


> [email protected] build
> rollup --config


src/app.ts → build/edjsHTML.js, build/edjsHTML.node.js, build/edjsHTML.browser.js...
created build/edjsHTML.js, build/edjsHTML.node.js, build/edjsHTML.browser.js in 1.5s
[
  '<h2>Editor.js</h2>',
  '<p style="text-align:justify;">Hey. Meet the new Editor. On this page you can see it in action — try to edit this text.</p>',
  '<h3>Key features</h3>',
  '<ul><li>It is a block-styled editor</li><li>It returns clean data output in JSON</li><li>Designed to be extendable and pluggable with a simple API</li></ul>',
  '<h3>What does it mean «block-styled editor»</h3>',
  `<p style="text-align:right;">Workspace in classic editors is made of a single contenteditable element, used to create different HTML markups. Editor.js 
<mark class="cdx-marker">workspace consists of separate Blocks: paragraphs, headings, images, lists, quotes, etc</mark>. Each of them is an independent contenteditable element (or more complex structure) provided by Plugin and united by Editor's Core.</p>`,
  '<p style="text-align:left;">There are dozens of <a href="https://github.com/editor-js">ready-to-use Blocks</a> and the <a href="https://editorjs.io/creating-a-block-tool">simple API</a> for creation any Block you need. For example, you can implement Blocks for Tweets, Instagram posts, surveys and polls, CTA-buttons and even games.</p>',
  '<h3>What does it mean clean data output</h3>',
  '<p style="text-align:center;">Classic WYSIWYG-editors produce raw HTML-markup with both content data and content appearance. On the contrary, Editor.js 
outputs JSON object with data of each Block. You can see an example below</p>',
  '<p>Given data can be used as you want: render with HTML for <code class="inline-code">Web clients</code>, render natively for <code class="inline-code">mobile apps</code>, create markup for <code class="inline-code">Facebook Instant Articles</code> or <code class="inline-code">Google AMP</code>, generate an <code class="inline-code">audio version</code> and so on.</p>',
  '<p style="text-align:center;">Clean data is useful to sanitize, validate and process on the backend.</p>',
  '<br/>',
  "<p>We have been working on this project more than three years. Several large media projects help us to test and debug the Editor, to make it's core more stable. At the same time we significantly improved the API. Now, it can be used to create any plugin for any task. Hope you enjoy. 😏</p>",
  '<img src="https://codex.so/public/app/img/external/codex2x.png" alt="Image" />',
  '<iframe width="580" height="320" src="https://www.youtube.com/embed/v7eMYQCNWeE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
  '<iframe src="https://player.vimeo.com/video/165206543?title=0&byline=0" height="320" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>',
  '<ol><li>jbduiwd</li><li>klweodhw</li><li>oiweiowhe</li><li>&nbsp;</li></ol>',
  '<ol><li> List 1 Header 1 <ol><li> List 1 Sub header 1  </li><li> List 1 Sub header 2 <ol><li> List 1 Sub header 1 Sub Sub header 1  </li><li> List 1 Sub header 1 Sub Sub header 2  </li></ol> </li></ol> </li></ol>'
]
[]
[ '<custom>success</custom>' ]
[
  '<h2>Editor.js</h2>',
  '<p>override test</p>',
  '<h3>Key features</h3>',
  '<ul><li>It is a block-styled editor</li><li>It returns clean data output in JSON</li><li>Designed to be extendable and pluggable with a simple API</li></ul>',
  '<h3>What does it mean «block-styled editor»</h3>',
  '<p>override test</p>',
  '<p>override test</p>',
  '<h3>What does it mean clean data output</h3>',
  '<p>override test</p>',
  '<p>override test</p>',
  '<p>override test</p>',
  '<br/>',
  '<p>override test</p>',
  '<img src="https://codex.so/public/app/img/external/codex2x.png" alt="Image" />',
  '<iframe width="580" height="320" src="https://www.youtube.com/embed/v7eMYQCNWeE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
  '<iframe src="https://player.vimeo.com/video/165206543?title=0&byline=0" height="320" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>',
  '<ol><li>jbduiwd</li><li>klweodhw</li><li>oiweiowhe</li><li>&nbsp;</li></ol>',
  '<ol><li> List 1 Header 1 <ol><li> List 1 Sub header 1  </li><li> List 1 Sub header 2 <ol><li> List 1 Sub header 1 Sub Sub header 1  </li><li> List 1 Sub header 1 Sub Sub header 2  </li></ol> </li></ol> </li></ol>'
]
[]
true
true
true
true
true
true
true
true
true
true
true

Luzefiru avatar Mar 21 '24 16:03 Luzefiru