Medium.js icon indicating copy to clipboard operation
Medium.js copied to clipboard

Alternative outer-level tags

Open bonfish opened this issue 10 years ago • 5 comments

On the docs page there is an example of how to create some tags other than

on the root level of an edited element. Bu this works only with tags: null, i.e. no additional control upon tag usage. But is there a way to implement the former and still keep the latter? In particular, I would like to have forced paragraph and line break tags, limiting inner-level tags and such other cool stuff, but with the ability to occasionally insert some h1, h2, ul>li, blockquote, etc.

Or, to put it in another way, how to apply the tags,that are allowed in tags.outerLevel?


Sorry, accidentally doubleposted this, https://github.com/jakiestfu/Medium.js/issues/147.

bonfish avatar Apr 06 '15 07:04 bonfish

I was having a problem inserting custom tags (h1, h2, h3, center), and this helped.

arielsvn avatar Apr 08 '15 18:04 arielsvn

/me high fives arielsvn

robertleeplummerjr avatar Apr 08 '15 18:04 robertleeplummerjr

Although this doesn't solve the problem, when you use invokeElement it seems to add an inline element, instead of adding the h1 or h2 tags as root elements.

When you execute el.medium.invokeElement('h1', {}) and el.medium.invokeElement('h2', {}) the resulting HTML is like this, check this fiddle:

<h1 class="medium-h1">
  <h2 class="medium-h2">title</h2>
</h1>

When the expected behaviour should only contain either h1 or h2. This seems like a very common use case, so there must be something we're missing. And I can't find any docs about this.

arielsvn avatar Apr 08 '15 20:04 arielsvn

You guys are right. There is a separate thread on this, I need to implement block detection, I've just been very busy. I will take a look at this tomorrow.

robertleeplummerjr avatar Apr 08 '15 20:04 robertleeplummerjr

@robertleeplummerjr Hi :) I have the same problems, were there any improvement concerning this issue since Apr 2015 ?

n457 avatar Aug 04 '16 10:08 n457