Skip to content

V0.35.5 #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 13, 2019
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
4 changes: 2 additions & 2 deletions 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.4",
"version": "0.35.5",
"author": "Plotly, Inc.",
"bugs": {
"url": "https://github.com/plotly/react-chart-editor/issues"
Expand All @@ -15,7 +15,7 @@
"fast-isnumeric": "^1.1.1",
"immutability-helper": "^2.7.1",
"plotly-icons": "1.2.3",
"plotly.js": "1.44.3",
"plotly.js": "1.44.4",
"prop-types": "^15.5.10",
"raf": "^3.4.0",
"react-color": "^2.13.8",
Expand Down
21 changes: 15 additions & 6 deletions src/components/containers/AnnotationAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@ import {PanelMessage} from './PanelEmpty';
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {connectAnnotationToLayout} from 'lib';
import {templateString} from 'plotly.js/src/lib';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


const AnnotationFold = connectAnnotationToLayout(PlotlyFold);

class AnnotationAccordion extends Component {
render() {
const {
layout: {annotations = []},
layout: {annotations = [], meta = []},
localize: _,
} = this.context;
const {canAdd, children} = this.props;

const content =
annotations.length &&
annotations.map((ann, i) => (
<AnnotationFold key={i} annotationIndex={i} name={ann.text} canDelete={canAdd}>
{children}
</AnnotationFold>
));
annotations.map((ann, i) => {
const textPostTemplate = templateString(ann.text, {meta});
return (
<AnnotationFold
key={i}
annotationIndex={i}
name={textPostTemplate === '' ? ann.text : textPostTemplate}
canDelete={canAdd}
>
{children}
</AnnotationFold>
);
});

const addAction = {
label: _('Annotation'),
Expand Down
14 changes: 13 additions & 1 deletion src/components/fields/TextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class UnconnectedTextEditor extends Component {

let fullValue = this.getAdjustedFullValue(this.props.fullValue);

let placeholder;
let placeholder = this.props.placeholder;

if (multiValued || (fullValue && (!container || !nestedProperty(container, attr)))) {
placeholder = fullValue;
fullValue = '';
Expand Down Expand Up @@ -118,16 +119,27 @@ UnconnectedTextEditor.propTypes = {
latexOnly: PropTypes.bool,
richTextOnly: PropTypes.bool,
updatePlot: PropTypes.func,
placeholder: PropTypes.string,
};

UnconnectedTextEditor.contextTypes = {
localize: PropTypes.func,
fullLayout: PropTypes.object,
};

export default connectToContainer(UnconnectedTextEditor, {
modifyPlotProps: (props, context, plotProps) => {
if (plotProps.isVisible && plotProps.multiValued) {
plotProps.isVisible = false;
}

if (
context.fullLayout &&
context.fullLayout._dfltTitle &&
Object.values(context.fullLayout._dfltTitle).includes(plotProps.fullValue)
) {
plotProps.placeholder = plotProps.fullValue;
plotProps.fullValue = '';
}
},
});
7 changes: 5 additions & 2 deletions src/default_panels/StyleLayoutPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ const StyleLayoutPanel = (props, {localize: _}) => (
{_(
'You can refer to the items in this column in any text fields of the editor like so: '
)}
<p style={{letterSpacing: '1px', fontStyle: 'italic'}}>
{_("Ex: 'My custom title %{meta[1]}.' ")}
<p>
{_('Ex: ')}
<span style={{letterSpacing: '1px', fontStyle: 'italic', userSelect: 'text'}}>
{_('My custom title %{meta[1]}')}
</span>
</p>
</p>
</Info>
Expand Down