Skip to content

Revert "fix for job description new PR" #5186

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 1 commit into from
Nov 10, 2020
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/images/settings/profile/work/tc-text-16-bold.svg

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

77 changes: 18 additions & 59 deletions src/shared/components/Editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,69 +46,37 @@ 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() {
const { connector } = this.props;
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());
Expand All @@ -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
}

/**
Expand Down Expand Up @@ -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() || /<ol>|<ul>/.test(this.getHtml())) {
containerStyles += ' has-user-input';
containerStyles += ` ${style.focused}`;
}
if (theme.container) {
containerStyles += ` ${theme.container}`;
Expand All @@ -287,7 +253,6 @@ export default class EditorWrapper extends React.Component {
tabIndex={0}
>
<Editor
placeholder={placeholder}
editorState={st.editor}
handleKeyCommand={(command, state) => {
const editorState = RichUtils.handleKeyCommand(state, command);
Expand Down Expand Up @@ -318,8 +283,6 @@ export default class EditorWrapper extends React.Component {
]}
ref={(node) => { this.node = node; }}
spellCheck
handleBeforeInput={this.onBeforeInput}
handlePastedText={this.onPasteText}
/>
</div>
);
Expand All @@ -329,17 +292,13 @@ export default class EditorWrapper extends React.Component {
EditorWrapper.defaultProps = {
connector: new Connector(),
id: null,
initialContent: '',
initialContent: null,
theme: {},
placeholder: '',
maxLength: -1,
};

EditorWrapper.propTypes = {
connector: PT.instanceOf(Connector),
id: PT.string,
initialContent: PT.string,
theme: PT.shape(),
placeholder: PT.string,
maxLength: PT.number,
};

This file was deleted.

Loading