From 0dc6d3db27afccffdf3bf1b50e9a79877a23f9fb Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sat, 26 Mar 2022 16:40:09 +0100 Subject: [PATCH] update editorjs code block view --- assets/css/admin.scss | 47 +++++++++++++++++++++++ config/packages/app.yaml | 1 + templates/blog/post_admin/_show.html.twig | 8 ++-- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/assets/css/admin.scss b/assets/css/admin.scss index 54e2d8b..95f0cbc 100644 --- a/assets/css/admin.scss +++ b/assets/css/admin.scss @@ -4,3 +4,50 @@ .CodeMirror-fullscreen, .editor-toolbar.fullscreen { z-index: 2000; } + +.ejs-link { + margin: 10px auto; + max-width: 80%; + border: 2px solid #333; + border-radius: 5px; + + &--anchor { + display: block; + padding: 30px; + } + + &-content { + display: inline-block; + vertical-align: top; + + &--title { + font-weight: bold; + } + + &--description { + font-size: 15px; + } + + &--link { + padding-top: 10px; + font-size: 14px; + line-height: 20px; + } + } + + $image-size: 85px; + + &--anchor--with-image &-content { + width: calc(100% - $image-size - 5px); + padding-right: 25px; + } + + &--image { + display: inline-block; + width: $image-size; + height: $image-size; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + } +} diff --git a/config/packages/app.yaml b/config/packages/app.yaml index c0c7b2f..77db520 100644 --- a/config/packages/app.yaml +++ b/config/packages/app.yaml @@ -71,6 +71,7 @@ core: editor_js: blocks: link: 'editorjs/link.html.twig' + code: 'editorjs/code.html.twig' file_manager: mimes: diff --git a/templates/blog/post_admin/_show.html.twig b/templates/blog/post_admin/_show.html.twig index 0f46ebb..428bfbb 100644 --- a/templates/blog/post_admin/_show.html.twig +++ b/templates/blog/post_admin/_show.html.twig @@ -71,9 +71,11 @@
Contenu
{% if entity.contentFormat == 'html' %} - {{ entity.content|raw|nl2br }} - {% else %} - {{ entity.content|markdown('post') }} + {{- entity.content|murph_url|file_attributes|post -}} + {% elseif entity.contentFormat == 'markdown' %} + {{- entity.content|murph_url|file_attributes|markdown('post') -}} + {% elseif entity.contentFormat == 'editorjs' %} + {{- entity.content|murph_url|file_attributes|editorjs_to_html|raw -}} {% endif %} {% if entity.notebook %}