getkirby / editor

A new type of WYSIWYG editor for Kirby
https://getkirby.com
205 stars 28 forks source link

use blocks class markdown function to render the html #96

Closed bnomei closed 5 years ago

bnomei commented 5 years ago

would it be possible or even simpler to reuse the image kirbytag to render the html in the snippet? https://github.com/getkirby/editor/blob/master/snippets/image.php

<?= kirby()->kirbytags($block->markdown(), ['parent' => $page]) ?>

this should work since its defined here, right? https://github.com/getkirby/editor/blob/master/lib/ImageBlock.php#L34

bnomei commented 5 years ago

the original usecase is that i am trying to use my custom kirbytag 'srcset'. i dont want to rebuild all html. reusing the kribytag and markdown is more DRY.

https://github.com/bnomei/kirby3-srcset/blob/2ed1d7e38c131c6545f793d74b236ae2844ef489/snippets/srcset.php#L6

bastianallgeier commented 5 years ago

You can do that in your block, but for the native blocks it doesn't really make sense.

bnomei commented 5 years ago

like i said above the editors php implementation of the image tag currently recreates the code the core kirbytag for image can already do. all you need to do is forward the props to the kirbytag helper. i do not understand your reasoning why having a less complete code this is better than reusing existing code - but its your call in the end. 🤷‍♂