diff --git a/package.json b/package.json index 0793860305..36a5ba9991 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "supertest": "^3.1.0", "tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3", "tc-ui": "^1.0.12", - "topcoder-react-lib": "1000.25.8", + "topcoder-react-lib": "1000.25.7", "topcoder-react-ui-kit": "2.0.1", "topcoder-react-utils": "0.7.8", "turndown": "^4.0.2", diff --git a/src/assets/images/settings/profile/work/tc-text-16-bold-active.svg b/src/assets/images/settings/profile/work/tc-text-16-bold-active.svg deleted file mode 100644 index 3aa72fbbae..0000000000 --- a/src/assets/images/settings/profile/work/tc-text-16-bold-active.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/images/settings/profile/work/tc-text-16-bold.svg b/src/assets/images/settings/profile/work/tc-text-16-bold.svg deleted file mode 100644 index 133a76cf16..0000000000 --- a/src/assets/images/settings/profile/work/tc-text-16-bold.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/images/settings/profile/work/tc-text-16-italic-active.svg b/src/assets/images/settings/profile/work/tc-text-16-italic-active.svg deleted file mode 100644 index 4be060733d..0000000000 --- a/src/assets/images/settings/profile/work/tc-text-16-italic-active.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/images/settings/profile/work/tc-text-16-italic.svg b/src/assets/images/settings/profile/work/tc-text-16-italic.svg deleted file mode 100644 index df5bb5e7be..0000000000 --- a/src/assets/images/settings/profile/work/tc-text-16-italic.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/images/settings/profile/work/tc-text-16-underline-active.svg b/src/assets/images/settings/profile/work/tc-text-16-underline-active.svg deleted file mode 100644 index 9586af3aa8..0000000000 --- a/src/assets/images/settings/profile/work/tc-text-16-underline-active.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/assets/images/settings/profile/work/tc-text-16-underline.svg b/src/assets/images/settings/profile/work/tc-text-16-underline.svg deleted file mode 100644 index 26d903b0fe..0000000000 --- a/src/assets/images/settings/profile/work/tc-text-16-underline.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/assets/images/settings/profile/work/text-16px_list-bullet-active.svg b/src/assets/images/settings/profile/work/text-16px_list-bullet-active.svg deleted file mode 100644 index 568ce8ffb3..0000000000 --- a/src/assets/images/settings/profile/work/text-16px_list-bullet-active.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/src/assets/images/settings/profile/work/text-16px_list-bullet.svg b/src/assets/images/settings/profile/work/text-16px_list-bullet.svg deleted file mode 100644 index df85bf388f..0000000000 --- a/src/assets/images/settings/profile/work/text-16px_list-bullet.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/src/assets/images/settings/profile/work/text-16px_list-numbers-active.svg b/src/assets/images/settings/profile/work/text-16px_list-numbers-active.svg deleted file mode 100644 index 302f06e53f..0000000000 --- a/src/assets/images/settings/profile/work/text-16px_list-numbers-active.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - diff --git a/src/assets/images/settings/profile/work/text-16px_list-numbers.svg b/src/assets/images/settings/profile/work/text-16px_list-numbers.svg deleted file mode 100644 index 9baebe060d..0000000000 --- a/src/assets/images/settings/profile/work/text-16px_list-numbers.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - diff --git a/src/shared/components/Editor/index.jsx b/src/shared/components/Editor/index.jsx index 58cc02b467..40762b3513 100644 --- a/src/shared/components/Editor/index.jsx +++ b/src/shared/components/Editor/index.jsx @@ -46,27 +46,30 @@ export default class EditorWrapper extends React.Component { this.customPlugin = createCustomPlugin({ editor: this, }); - - this.onBeforeInput = this.onBeforeInput.bind(this); - this.onPasteText = this.onPasteText.bind(this); } componentDidMount() { const { connector, initialContent } = this.props; connector.addEditor(this); - this.setInitialContent(initialContent); + if (initialContent) { + let editorState = convertFromHTML(initialContent); + editorState = ContentState.createFromBlockArray( + editorState.contentBlocks, + editorState.entityMap, + ); + editorState = EditorState.createWithContent(editorState); + this.initialContent = editorState.getCurrentContent(); + setImmediate(() => this.setState({ editor: editorState })); + } } - componentWillReceiveProps({ connector, id, initialContent }) { - const { connector: prevConnector, initialContent: prevInitialContent } = this.props; + componentWillReceiveProps({ connector, id }) { + const { connector: prevConnector } = this.props; this.id = id; if (connector !== prevConnector) { if (prevConnector) prevConnector.removeEditor(this); if (connector) connector.addEditor(this); } - if (initialContent !== prevInitialContent) { - this.setInitialContent(initialContent); - } } componentWillUnmount() { @@ -74,41 +77,6 @@ export default class EditorWrapper extends React.Component { connector.removeEditor(this); } - onBeforeInput() { // eslint-disable-line consistent-return - const { maxLength } = this.props; - const { editor: editorState } = this.state; - if (maxLength !== -1 && maxLength <= editorState.getCurrentContent().getPlainText('').length) { - return 'handled'; - } - } - - onPasteText(text) { // eslint-disable-line consistent-return - const { maxLength } = this.props; - const { editor: editorState } = this.state; - if (maxLength !== -1 && maxLength <= text.length + editorState.getCurrentContent().getPlainText('').length) { - return 'handled'; - } - } - - setInitialContent(content) { - if (content) { - let editorState = convertFromHTML(content); - if (editorState.contentBlocks) { - editorState = ContentState.createFromBlockArray( - editorState.contentBlocks, - editorState.entityMap, - ); - editorState = EditorState.createWithContent(editorState); - this.initialContent = editorState.getCurrentContent(); - setImmediate(() => this.setState({ editor: editorState })); - } - } else { - let { editor: editorState } = this.state; - editorState = EditorState.push(editorState, ContentState.createFromText('')); - this.setState({ editor: editorState }); - } - } - getHtml() { const { editor } = this.state; return editorStateToHTML(editor.getCurrentContent()); @@ -130,9 +98,10 @@ export default class EditorWrapper extends React.Component { * @param {String} type The new block style */ applyBlockStyle(type) { - let { editor: editorState } = this.state; + const { editor } = this.state; + let editorState = editor; editorState = RichUtils.toggleBlockType(editorState, type); - this.setState({ editor: editorState }); // eslint-disable-line + this.setState({ editorState }); // eslint-disable-line } /** @@ -262,16 +231,13 @@ export default class EditorWrapper extends React.Component { } render() { - const { connector, theme, placeholder } = this.props; + const { connector, theme } = this.props; const st = this.state; let containerStyles = style.container; if (st.editor.getSelection().getHasFocus()) { - containerStyles += ` ${style.focused} is-focused`; - } - if (st.editor.getCurrentContent().hasText() || /
    |