A simple video insertion tool for EditorJS

I really like EditorJS. It’s let me create a very simple web-hosted interface for my static Hugo blog.
EditorJS has most of what I need in a simple block-based editor. It has a plugin for headers, code, and even a simple way to add images to the editor without requiring hosting infrastructure. It doesn’t have a simple way to add video’s to the editor, until now.
I took the simple-image plugin repository and changed it up (just a tad) to create a simple-video plugin (npm module).


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan

<p>I really like <a href="https://editorjs.io/">EditorJS</a>. It's let me create a very simple web-hosted interface for my static Hugo blog.</p> <p>EditorJS has most of what I need in a simple block-based editor. It has a plugin for headers, code, and even a simple way to add images to the editor without requiring hosting infrastructure. It doesn't have a simple way to add video's to the editor, until now.</p> <p>I took the <a href="https://github.com/editor-js/simple-image">simple-image</a> plugin repository and changed it up (just a tad) to create a <a href="https://github.com/PaulKinlan/simple-video">simple-video</a> plugin (<a href="https://www.npmjs.com/package/simple-video-editorjs">npm module</a>). Now I can include videos easily in this blog.</p> <p>If you are familar with EditorJS, it's rather simple to include in your projects. Just install it as follows</p> <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-fallback" data-lang="fallback">npm i simple-video-editorjs </code></pre></div><p>And then just include it in your project as you see fit.</p> <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-fallback" data-lang="fallback">const SimpleVideo = require('simple-video-editorjs'); var editor = EditorJS({ ... tools: { ... video: SimpleVideo, } ... }); </code></pre></div><p>The editor has some simple options that let you configure how the video should be hosted in the page:</p> <ol> <li>Autoplay - will the video play automatically when the page loads</li> <li>muted - will the video not have sound on by default (needed for autoplay)</li> <li>controls - will the video have the default HTML controls.</li> </ol> <p>Below is a quick example of a video that is embedded (and showing some of the options).</p> <figure><video src="https://paul.kinlan.me/videos/2019-11-06-a-simple-video-insertion-tool-for-editorjs-0.mp4" alt="Showing Options for EditorJS simple video." autoplay muted></video></figure> <p>Anyway, I had fun creating this little plugin - it was not too hard to create and about the only thing that I did was defer the conversion to base64 which simple-images uses and instead just use the Blob URLs.</p>


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan


Print Share Comment Cite Upload Translate Updates
APA

Paul Kinlan | Sciencx (2019-11-05T00:48:57+00:00) A simple video insertion tool for EditorJS. Retrieved from https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/

MLA
" » A simple video insertion tool for EditorJS." Paul Kinlan | Sciencx - Tuesday November 5, 2019, https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/
HARVARD
Paul Kinlan | Sciencx Tuesday November 5, 2019 » A simple video insertion tool for EditorJS., viewed ,<https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/>
VANCOUVER
Paul Kinlan | Sciencx - » A simple video insertion tool for EditorJS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/
CHICAGO
" » A simple video insertion tool for EditorJS." Paul Kinlan | Sciencx - Accessed . https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/
IEEE
" » A simple video insertion tool for EditorJS." Paul Kinlan | Sciencx [Online]. Available: https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/. [Accessed: ]
rf:citation
» A simple video insertion tool for EditorJS | Paul Kinlan | Sciencx | https://www.scien.cx/2019/11/05/a-simple-video-insertion-tool-for-editorjs/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.