Skip to content

Commit

Permalink
Merge pull request jpuri#895 from pdandradeb/master
Browse files Browse the repository at this point in the history
Renaming componentWillMount and componentWillReceiveProps method to t…
  • Loading branch information
jpuri authored Dec 10, 2019
2 parents 71185a2 + 977c290 commit 94ecf73
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class WysiwygEditor extends Component {
this.customStyleMap = this.getStyleMap(props);
}

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
this.compositeDecorator = this.getCompositeDecorator();
const editorState = this.createEditorState(this.compositeDecorator);
extractInlineStyle(editorState);
Expand All @@ -134,7 +134,7 @@ export default class WysiwygEditor extends Component {
}
// todo: change decorators depending on properties recceived in componentWillReceiveProps.

componentWillReceiveProps(props) {
UNSAFE_componentWillReceiveProps(props) {
const newState = {};
if (this.props.toolbar !== props.toolbar) {
const toolbar = mergeRecursive(defaultToolbar, props.toolbar);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dropdown/Dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Dropdown extends Component {
highlighted: -1,
};

componentWillReceiveProps(props) {
UNSAFE_componentWillReceiveProps(props) {
if (this.props.expanded && !props.expanded) {
this.setState({
highlighted: -1,
Expand Down
2 changes: 1 addition & 1 deletion src/controls/BlockType/Component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LayoutComponent extends Component {
};
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (this.props.translations !== properties.translations) {
this.setState({
blockTypes: this.getBlockTypes(properties.translations),
Expand Down
4 changes: 2 additions & 2 deletions src/controls/BlockType/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BlockType extends Component {
currentBlockType: 'unstyled',
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -31,7 +31,7 @@ class BlockType extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion src/controls/ColorPicker/Component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LayoutComponent extends Component {
currentStyle: 'color',
};

componentWillReceiveProps(props) {
UNSAFE_componentWillReceiveProps(props) {
if (!this.props.expanded && props.expanded) {
this.setState({
currentStyle: 'color',
Expand Down
4 changes: 2 additions & 2 deletions src/controls/ColorPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ColorPicker extends Component {
currentBgColor: undefined,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -35,7 +35,7 @@ class ColorPicker extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
const newState = {};
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Embedded/Component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LayoutComponent extends Component {
width: this.props.config.defaultSize.width,
};

componentWillReceiveProps(props) {
UNSAFE_componentWillReceiveProps(props) {
if (this.props.expanded && !props.expanded) {
const { height, width } = this.props.config.defaultSize;
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Embedded/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Embedded extends Component {
expanded: false,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { modalHandler } = this.props;
modalHandler.registerCallBack(this.expandCollapse);
}
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Emoji/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class Emoji extends Component {
expanded: false,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { modalHandler } = this.props;
modalHandler.registerCallBack(this.expandCollapse);
}
Expand Down
4 changes: 2 additions & 2 deletions src/controls/FontFamily/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class FontFamily extends Component {
currentFontFamily: undefined,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -33,7 +33,7 @@ export default class FontFamily extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
this.setState({
Expand Down
4 changes: 2 additions & 2 deletions src/controls/FontSize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class FontSize extends Component {
currentFontSize: undefined,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -34,7 +34,7 @@ export default class FontSize extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
this.setState({
Expand Down
4 changes: 2 additions & 2 deletions src/controls/History/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class History extends Component {
redoDisabled: false,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -32,7 +32,7 @@ export default class History extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Image/Component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class LayoutComponent extends Component {
alt: '',
};

componentWillReceiveProps(props: Object): void {
UNSAFE_componentWillReceiveProps(props: Object): void {
if (this.props.expanded && !props.expanded) {
this.setState({
imgSrc: '',
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ImageControl extends Component {
expanded: false,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { modalHandler } = this.props;
modalHandler.registerCallBack(this.expandCollapse);
}
Expand Down
4 changes: 2 additions & 2 deletions src/controls/Inline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class Inline extends Component {
currentStyles: {},
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -31,7 +31,7 @@ export default class Inline extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Link/Component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LayoutComponent extends Component {
linkTargetOption: this.props.config.defaultTargetOption,
};

componentWillReceiveProps(props) {
UNSAFE_componentWillReceiveProps(props) {
if (this.props.expanded && !props.expanded) {
this.setState({
showModal: false,
Expand Down
4 changes: 2 additions & 2 deletions src/controls/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Link extends Component {
selectionText: undefined
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({
Expand All @@ -43,7 +43,7 @@ class Link extends Component {
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
const newState = {};
if (
properties.editorState &&
Expand Down
4 changes: 2 additions & 2 deletions src/controls/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export default class List extends Component {
currentBlock: undefined,
};

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { editorState, modalHandler } = this.props;
if (editorState) {
this.setState({ currentBlock: getSelectedBlock(editorState) });
}
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties: Object): void {
UNSAFE_componentWillReceiveProps(properties: Object): void {
if (properties.editorState &&
this.props.editorState !== properties.editorState) {
const currentBlock = getSelectedBlock(properties.editorState);
Expand Down
2 changes: 1 addition & 1 deletion src/controls/Remove/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class Remove extends Component {
expanded: false,
}

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { modalHandler } = this.props;
modalHandler.registerCallBack(this.expandCollapse);
}
Expand Down
4 changes: 2 additions & 2 deletions src/controls/TextAlign/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export default class TextAlign extends Component {
currentTextAlignment: undefined,
}

componentWillMount(): void {
UNSAFE_componentWillMount(): void {
const { modalHandler } = this.props;
modalHandler.registerCallBack(this.expandCollapse);
}

componentWillReceiveProps(properties) {
UNSAFE_componentWillReceiveProps(properties) {
if (properties.editorState !== this.props.editorState) {
this.setState({
currentTextAlignment: getSelectedBlocksMetadata(properties.editorState).get('text-align'),
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/Mention/Suggestion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function getSuggestionComponent() {
this.filterSuggestions(this.props);
}

componentWillReceiveProps(props) {
UNSAFE_componentWillReceiveProps(props) {
if (this.props.children !== props.children) {
this.filterSuggestions(props);
this.setState({
Expand Down

0 comments on commit 94ecf73

Please sign in to comment.