1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-24 07:39:42 +02:00

chore(editor): update editor, add embed tool (#142)

* update editor

* add embed tool

* prod bundle
This commit is contained in:
Peter Savchenko 2021-12-01 19:56:12 +03:00 committed by GitHub
parent 3552105e38
commit 059cfb96f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 56 deletions

View file

@ -13,6 +13,7 @@ import Warning from '@editorjs/warning';
import Checklist from '@editorjs/checklist';
import LinkTool from '@editorjs/link';
import RawTool from '@editorjs/raw';
import Embed from '@editorjs/embed';
/**
* Inline Tools for the Editor
@ -110,6 +111,8 @@ export default class Editor {
},
raw: RawTool,
embed: Embed,
},
data: {
blocks: [

View file

@ -484,3 +484,17 @@
}
}
}
.block-embed {
margin: 0;
&__iframe {
width: 100%;
height: 450px;
border: 0;
@media (--mobile) {
height: 200px;
}
}
}

View file

@ -0,0 +1,12 @@
<figure class="block-embed">
<iframe
class="block-embed__iframe"
src="{{ embed }}"
frameborder="0"
></iframe>
{% if caption %}
<footer class="block-iframe__caption">
{{ caption }}
</footer>
{% endif %}
</figure>

View file

@ -35,7 +35,7 @@
{% for block in page.body.blocks %}
{# Skip first header, because it is already showed as a Title #}
{% if not (loop.first and block.type == 'header') %}
{% if block.type in ['paragraph', 'header', 'image', 'code', 'list', 'delimiter', 'table', 'warning', 'checklist', 'linkTool', 'raw'] %}
{% if block.type in ['paragraph', 'header', 'image', 'code', 'list', 'delimiter', 'table', 'warning', 'checklist', 'linkTool', 'raw', 'embed'] %}
{% include './blocks/' ~ block.type ~ '.twig' with block.data %}
{% endif %}
{% endif %}