fabianmichael / kirby-markdown-field

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

Field not initiated in collapsed builder field #77

Closed medienbaecker closed 4 years ago

medienbaecker commented 5 years ago

This happens when using the markdown field in a builder field and you're loading a page with collapsed fieldsets:

builder-markdown

To me it looks like the field "forgets" to initiate at the un-collapse event.

falkmueller commented 5 years ago

Hi,

here my solution:

Subscribe a event to refresh the editor: site/plugins/kirby-markdown-field/src/components/input/MarkdownInput.vue Line 102

  mounted() {
...
    window.addEventListener('kirby-bulder.expandBLock', () => {
            this.$nextTick(() => this.editor.refresh())
    });
}

Fire a event by open a tab in the kirby-builder: site/plugins/kirby-builder/src/components/BuilderBlock.vue Line 278

toggleExpand(expanded) {
...
      if(this.expanded){
        window.dispatchEvent(new Event('kirby-bulder.expandBLock'));
      }
}
sylvainjule commented 5 years ago

@medienbaecker is it still happening for you with Kirby 3.2.5+, the latest builder and the latest markdown field?

Seems fixed on my end.

medienbaecker commented 5 years ago

@sylvainjule I just reproduced it in Kirby 3.3.0-rc.3 with the latest builder and markdown field:

builder-markdown

It only works (or doesn't) when you load a page with already collapsed builder blocks.