fabianmichael / kirby-markdown-field

Super-sophisticated markdown editor for Kirby 3, community built.
Other
162 stars 14 forks source link

[Bug] Unable to Override 'buttons' Option from Field Blueprint #51

Closed luxlogica closed 5 years ago

luxlogica commented 5 years ago

Let's say I define a 'default_markdown.yml' field blueprint, which sets out all the buttons I normally want in my standard markdown fields - it looks something like this:

buttons: 
  - headlines
    - h2
    - h3
    - h4
  - bold
  - italic
  - strikethrough
  - horizontal-rule
  - ul
  - ol
  - blockquote
  - code
  - image 
  - file 
  - pagelink
  - link
  - email

Now, somewhere else in my site, I'm going to extend this blueprint, wanting to override the 'buttons' option, because I want to use less buttons. So, I'd do something like this:

byline:
  extends: fields/default_markdown
  buttons:
    - bold
    - italic
    - link
    - pagelink
    - email

Unfortunately, when I do this, I still get all the buttons from the original field blueprint - not the overridden, shorter list...

sylvainjule commented 5 years ago

Found the issue, the problem is that when extending the option, the plugin isn't replacing it but merging the two. So the first 5 buttons are correctly overwritten but the additional buttons of the original field are still appended. Doesn't happen with the textarea field. I'm looking into it.

sylvainjule commented 5 years ago

Nope, turns out the textarea field is behaving the same way. I tested it with italic overriding bold, italic, so ended up with a single italic button only because the field is checking for duplicates (which is a nice features btw, I added it: https://github.com/sylvainjule/kirby-markdown-field/commit/956182ae938bd419b580c18ba454ac1fa6e1457a)

I've opened an issue here: https://github.com/k-next/kirby/issues/1349 So I'm closing this one.