Skip to content

Commit

Permalink
Merge pull request #558 from highcharts/master
Browse files Browse the repository at this point in the history
4.0.2
  • Loading branch information
cvasseng authored Aug 5, 2024
2 parents 999c504 + 0497b27 commit 93d225f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 4.0.2

_Fixes:_

- Made chart userOptions available within `customCode` as variable `options` [(#551)](https://github.com/highcharts/node-export-server/issues/551).

# 4.0.1

_Hotfix_:
Expand Down
10 changes: 5 additions & 5 deletions lib/highcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ export async function triggerExport(chartOptions, options, displayErrors) {
// prevent from polluting other exports that can happen on the same page
Highcharts.setOptionsObj = merge(false, {}, getOptions());

// Trigger custom code
if (options.customLogic.customCode) {
new Function(options.customLogic.customCode)();
}

// By default animation is disabled
const chart = {
animation: false
Expand Down Expand Up @@ -100,6 +95,11 @@ export async function triggerExport(chartOptions, options, displayErrors) {
const userOptions = options.export.strInj
? new Function(`return ${options.export.strInj}`)()
: chartOptions;

// Trigger custom code
if (options.customLogic.customCode) {
new Function('options', options.customLogic.customCode)(userOptions);
}

// Merge the globalOptions, themeOptions, options from the wrapped
// setOptions function and user options to create the final options object
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
"require": "./dist/index.cjs"
}
},
"files": ["dist", "bin", "templates", "install.js", "lib"],
"files": [
"dist",
"bin",
"templates",
"install.js",
"lib",
"msg",
"public"
],
"repository": {
"url": "https://github.com/highcharts/node-export-server",
"type": "git"
Expand Down

0 comments on commit 93d225f

Please sign in to comment.