Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-chart-editor",
"description": "plotly.js chart editor react component UI",
"version": "0.35.3",
"version": "0.35.4",
"author": "Plotly, Inc.",
"bugs": {
"url": "https://github.com/plotly/react-chart-editor/issues"
Expand Down
4 changes: 2 additions & 2 deletions scripts/translationKeys/combined-translation-keys.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ Embed images in your figure to make the data more readable or to brand your cont
Enable // react-chart-editor: /default_panels/StyleAxesPanel.js:67
Enabled // react-chart-editor: /default_panels/GraphTransformsPanel.js:73
End Point // react-chart-editor: /default_panels/StyleShapesPanel.js:33
Enter LaTeX formatted text // react-chart-editor: /components/fields/TextEditor.js:71
Enter LaTeX formatted text // react-chart-editor: /components/fields/TextEditor.js:79
Enter Link URL // react-chart-editor: /components/widgets/text_editors/RichText/LinkEditor.js:89
Enter html formatted text // react-chart-editor: /components/fields/TextEditor.js:84
Enter html formatted text // react-chart-editor: /components/fields/TextEditor.js:92
Equirectangular // react-chart-editor: /default_panels/GraphSubplotsPanel.js:115
Error (+) // react-chart-editor: /components/fields/ErrorBars.js:146
Error (-) // react-chart-editor: /components/fields/ErrorBars.js:147
Expand Down
4 changes: 2 additions & 2 deletions scripts/translationKeys/translation-keys.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ Embed images in your figure to make the data more readable or to brand your cont
Enable // /default_panels/StyleAxesPanel.js:67
Enabled // /default_panels/GraphTransformsPanel.js:73
End Point // /default_panels/StyleShapesPanel.js:33
Enter LaTeX formatted text // /components/fields/TextEditor.js:71
Enter LaTeX formatted text // /components/fields/TextEditor.js:79
Enter Link URL // /components/widgets/text_editors/RichText/LinkEditor.js:89
Enter html formatted text // /components/fields/TextEditor.js:84
Enter html formatted text // /components/fields/TextEditor.js:92
Equirectangular // /default_panels/GraphSubplotsPanel.js:115
Error (+) // /components/fields/ErrorBars.js:146
Error (-) // /components/fields/ErrorBars.js:147
Expand Down
12 changes: 10 additions & 2 deletions src/components/fields/TextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const INDEX_IN_TEMPLATE_STRING_REGEX = /%{(meta(\[(\d+)]))}/;

export class UnconnectedTextEditor extends Component {
hasTemplateStrings(value) {
if (!value) {
return false;
}
return value.match(TEMPLATE_STRING_REGEX);
}

Expand All @@ -28,7 +31,9 @@ export class UnconnectedTextEditor extends Component {
const index = INDEX_IN_TEMPLATE_STRING_REGEX.exec(match);
if (index) {
const adjustedIndex = parseInt(index[3], 10) - 1;
return `%{meta[${adjustedIndex}]}`;
if (!isNaN(adjustedIndex)) {
return `%{meta[${adjustedIndex}]}`;
}
}
return match;
});
Expand All @@ -44,7 +49,10 @@ export class UnconnectedTextEditor extends Component {
const index = INDEX_IN_TEMPLATE_STRING_REGEX.exec(match);
if (index) {
const adjustedIndex = parseInt(index[3], 10) + 1;
return `%{meta[${adjustedIndex}]}`;
if (!isNaN(adjustedIndex)) {
return `%{meta[${adjustedIndex}]}`;
}
return match;
}
return match;
});
Expand Down