editor-js / header

Header Tool for Editor.js 2.0
MIT License
96 stars 122 forks source link

Fix issue where using the same object causes issues with Build optimisers #25

Closed tanepiper closed 5 years ago

tanepiper commented 5 years ago

The existing code does not work with Angular, and possibly other Webpack bundlers where they optimize code.

The issue is that this code gets generated:

key: 'normalizeData', value: function(t) {
  return 'object' !== r(t) && (t = {}), t.text = t.text || '', t.level = parseInt(t.level) || this.defaultLevel.number, t;
}

When running this, t's existing properties are readonly so it cannot overwrite them, this patch fixes it.

tanepiper commented 5 years ago

Hi @talyguryn @gohabereg sorry to ping you, but this PR has been open for two weeks.

Would it be possible to merge this change? In my code to fix this, I extend the class but it's currently breaking my tests and this quick fix would resolve that.

Thanks

gohabereg commented 5 years ago

Hi @tanepiper , Sorry for delay! Fix is ok, could you please patch the version, build the package using yarn build and include build files to PR.

Thanks!

tanepiper commented 5 years ago

@gohabereg No problem, done - but it looks like there is a conflict to resolve

gohabereg commented 5 years ago

There are conflicting files, I guess you need to pull the master and rebuild the package