diff --git a/README.md b/README.md
index 92efe30..04a0b4f 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,7 @@ Package | Key | Main CSS Class
(with default prefix) | Additional / modificat
`@editorjs/simple-image` | `simpleImage` | `.prs-image` | additional:
`.prs_withborder`
`.prs_withbackground`
`.prs_stretched`
`@editorjs/embed` | `embed` | `.prs-embed` | additional:
`.prs_youtube`
`.prs_codepen`
`.prs_vimeo`
`@editorjs/link` | `linkTool` | `.prs-linktool` | additional:
`.prs_title`
`.prs_description`
`.prs_sitename`
+`@editorjs/simple-video-editorjs` | `SimpleVideo` | `.prs-video` | additional:
`stretched`
`autoplay`
`muted`
`controls`
`@editorjs/delimiter` | `delimiter` | `.prs-delimiter` |
`editorjs-alert` | `alert` | `.prs-alert` | alignment:
`.prs_left`
`.prs_right`
`.prs_center`
additional:
`.prs_primary`
`.prs_secondary`
`.prs_info`
`.prs_success`
`.prs_warning`
`.prs_danger`
`.prs_light`
`.prs_dark`
`@editorjs/warning` | `warning` | `.prs-warning` |
@@ -141,6 +142,14 @@ Return Editor.js content blocks
```
+##### Video
+
+```html
+
+
+
+```
+
##### Code
```html
diff --git a/src/HtmlParser.php b/src/HtmlParser.php
index 3916934..d2a5dd4 100644
--- a/src/HtmlParser.php
+++ b/src/HtmlParser.php
@@ -471,6 +471,30 @@ private function parseQuote($node, $styles) {
return $block;
}
+ /**
+ * Video Parser
+ *
+ * @param object $node
+ * @param array $styles
+ * @return array
+ */
+ private function parseVideo($node, $styles) {
+
+$withBorder = in_array('withborder', $styles) ? true : false;
+ $withBackground = in_array('withbackground', $styles) ? true : false;
+ $stretched = in_array('stretched', $styles) ? true : false;
+
+ $block['type'] = 'video';
+ $block['data']['url'] = $node->getElementsByTagName('video')->item(0)->getAttribute('src');
+ $block['data']['caption'] = $this->setInnerHtml($node->getElementsByTagName('figcaption')->item(0));
+ $block['data']['withBorder'] = $withBorder;
+ $block['data']['withBackground'] = $withBackground;
+ $block['data']['stretched'] = $stretched;
+
+ return $block;
+
+ }
+
/**
* Embed Parser
*
diff --git a/src/Parser.php b/src/Parser.php
index bfc60a8..60e2ae0 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -238,6 +238,47 @@ private function createIframe(array $attrs)
return $iframe;
}
+ private function parseVideo($block)
+ {
+
+ $figure = $this->dom->createElement('div');
+
+ $attrs = [];
+
+ $caption = (!empty($block->data->caption)) ? $block->data->caption : '';
+
+ if ($block->data->withBorder) $attrs[] = "withborder";
+ if ($block->data->withBackground) $attrs[] = "withbackground";
+ if ($block->data->stretched) $attrs[] = "stretched";
+
+ $style = (count($attrs) > 0) ? implode(' ', $attrs) : false;
+
+ $class = $this->addClass($block->type, false, $style);
+
+ $figure->setAttribute('class', $class);
+
+ $video = $this->dom->createElement('video');
+
+ $video->setAttribute('src', $block->data->url);
+ $video->setAttribute('controls', $block->data->controls);
+ $video->setAttribute('autoplay', $block->data->autoplay);
+ $video->setAttribute('muted', $block->data->muted);
+ $video->setAttribute('stretched', $block->data->stretched);
+
+ $figure->appendChild($video);
+
+ $video->appendChild($this->html5->parseFragment($block->data->url));
+
+ if (!empty($caption)) {
+ $figCaption = $this->dom->createElement('figcaption');
+ $figCaption->appendChild($this->html5->loadHTMLFragment($caption));
+ $figure->appendChild($figCaption);
+ }
+
+ $this->dom->appendChild($figure);
+ }
+
+
private function parseRaw($block)
{
$class = $this->addClass($block->type);