Skip to content

Commit

Permalink
fix: send an object to text renderer rather than the text itself (ela…
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson authored and Rashid Khan committed May 22, 2018
1 parent f51cef3 commit 273032f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion common/types/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ export const boolean = () => ({
string: n => String(n),
number: n => Number(n),
render: value => {
const text = `${value}`;
return {
type: 'render',
as: 'text',
value: `${value}`,
value: { text },
};
},
},
Expand Down
3 changes: 2 additions & 1 deletion common/types/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export const number = () => ({
to: {
string: n => String(n),
render: value => {
const text = `${value}`;
return {
type: 'render',
as: 'text',
value: `${value}`,
value: { text },
};
},
datatable: value => {
Expand Down
4 changes: 2 additions & 2 deletions common/types/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export const string = () => ({
},
to: {
number: n => Number(n),
render: value => {
render: text => {
return {
type: 'render',
as: 'text',
value,
value: { text },
};
},
},
Expand Down
4 changes: 2 additions & 2 deletions public/render_functions/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const text = () => ({
displayName: 'Plain Text',
help: 'Render output as plain text',
reuseDomNode: true,
render(domNode, config, handlers) {
ReactDOM.render(<div>{config}</div>, domNode, () => handlers.done());
render(domNode, { text }, handlers) {
ReactDOM.render(<div>{text}</div>, domNode, () => handlers.done());
handlers.onDestroy(() => ReactDOM.unmountComponentAtNode(domNode));
},
});

0 comments on commit 273032f

Please sign in to comment.