kirby icon indicating copy to clipboard operation
kirby copied to clipboard

Wrong code example in panel/drawer.js / needs confirmation

Open bezin opened this issue 5 months ago • 0 comments

Hi all,

why fiddling around with the Kirby 4 Drawer API I found some examples in panel/drawer.js to be not correct. https://github.com/getkirby/kirby/blob/main/panel/src/panel/drawer.js#L118-L125

I needed to wrap my listeners (submit, cancel) in an object.

// Instead of this (as in the example code):
panel.drawer.open({
  component: 'k-forms-drawer',
  submit: () => {},
  cancel: () => {}
});

// I needed to do this
panel.drawer.open({
  component: 'k-forms-drawer',
  // Wrap listeners in object with key on
  on: {
    submit: () => {},
    cancel: () => {}
  }
});

Can someone confirm this?

bezin avatar Aug 27 '24 10:08 bezin