From 659858f8c4ccddcce46b44892518f1c1dc1733d9 Mon Sep 17 00:00:00 2001 From: Vera Zabeida Date: Thu, 7 Feb 2019 16:42:00 -0500 Subject: [PATCH] 0.35.4 --- package.json | 2 +- .../translationKeys/combined-translation-keys.txt | 4 ++-- scripts/translationKeys/translation-keys.txt | 4 ++-- src/components/fields/TextEditor.js | 12 ++++++++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 82261405b..f7a41e134 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/scripts/translationKeys/combined-translation-keys.txt b/scripts/translationKeys/combined-translation-keys.txt index 2a61de6d8..30c25bd46 100644 --- a/scripts/translationKeys/combined-translation-keys.txt +++ b/scripts/translationKeys/combined-translation-keys.txt @@ -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 diff --git a/scripts/translationKeys/translation-keys.txt b/scripts/translationKeys/translation-keys.txt index 20d547a4a..e90416b95 100644 --- a/scripts/translationKeys/translation-keys.txt +++ b/scripts/translationKeys/translation-keys.txt @@ -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 diff --git a/src/components/fields/TextEditor.js b/src/components/fields/TextEditor.js index cb10bb398..9d48d1a6d 100644 --- a/src/components/fields/TextEditor.js +++ b/src/components/fields/TextEditor.js @@ -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); } @@ -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; }); @@ -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; });