nmrium icon indicating copy to clipboard operation
nmrium copied to clipboard

NMRium component props

Open lpatiny opened this issue 2 years ago • 3 comments

Currently we have only one prop in NMRium: data and it allows only to change the data part of the state.

The state contains in reality 3 props (that can be reloaded from a .nmrium file):

  • data
  • settings
  • view

I would like to be able to change those props from outside the component. I see 3 possibilities:

  1. Keep the data NMRium props but send an object {data: {}, view: {}, settings: {}}

  2. Rename this property to state (or something else) and send as object {data: {}, view: {}, settings: {}}

  3. Have 3 properties: data, view and settings

For information there is only one callback onChange.

@targos What would you suggest ?

lpatiny avatar Mar 28 '23 10:03 lpatiny

I suggest 3.

targos avatar Mar 28 '23 10:03 targos

I think the options number 1 or 2, I can not see the advantage of separating them into three properties

hamed-musallam avatar Mar 28 '23 10:03 hamed-musallam

I recommend the solution 2. nmr-load-save (discontinued), and nmrium-core / nmrium-core-plugins manage NmriumState. It would be more simple to put the state as is, instead having to spread it, or forgot props.

tpoisseau avatar May 15 '25 14:05 tpoisseau