Skip to content

Commit d1ccd5a

Browse files
committed
Merge branch 'hotfix/taas-job-editor-improvements' into hotfix/taas-intake-form-remove-2-roles
2 parents ebf3523 + 314a621 commit d1ccd5a

File tree

7 files changed

+72
-12
lines changed

7 files changed

+72
-12
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ workflows:
136136
- build-dev
137137
filters:
138138
branches:
139-
only: ['feature/taas-jobs-2']
139+
only: ['hotfix/taas-job-editor-improvements']
140140

141141
- deployProd:
142142
context : org-global

src/components/TuiEditor/TuiEditor.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
all: revert;
99
font-size: 24px;
1010
}
11-
}
11+
}
1212

13-
b,
13+
b,
1414
i,
15-
s,
15+
s,
1616
hr,
1717
blockquote,
1818
ul,
@@ -33,7 +33,7 @@
3333
// add style for heading list in headings selection popup, because 'all:revert' has been setted before
3434
.te-heading-add ul {
3535
list-style: none;
36-
}
36+
}
3737

3838
// hide uplodd file
3939
.tui-editor-popup{

src/components/TuiEditor/index.jsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* TuiEditor
2+
* TuiEditor
33
* wrap toast-ui editor with react and support react 15
44
*/
55

@@ -33,6 +33,12 @@ class TuiEditor extends React.Component {
3333
this.editorInst.off(eventName)
3434
this.editorInst.on(eventName, props[key])
3535
})
36+
37+
// always add `https` to the links if link was added without `http` or `https`
38+
this.editorInst.on('convertorAfterHtmlToMarkdownConverted', (inputMarkdown) => {
39+
const outputMarkdown = inputMarkdown.replace(/\[([^\]]*)\]\((?!https?)([^)]+)\)/g, '[$1](https://$2)')
40+
return outputMarkdown
41+
})
3642
}
3743

3844
componentDidMount() {
@@ -47,6 +53,17 @@ class TuiEditor extends React.Component {
4753
this.bindEventHandlers(props)
4854
}
4955

56+
componentWillUnmount() {
57+
Object.keys(this.props)
58+
.filter((key) => /^on[A-Z][a-zA-Z]+/.test(key))
59+
.forEach((key) => {
60+
const eventName = key[2].toLowerCase() + key.slice(3)
61+
this.editorInst.off(eventName)
62+
})
63+
64+
this.editorInst.off('convertorAfterHtmlToMarkdownConverted')
65+
}
66+
5067
handleValueChange(){
5168
if (this.props.onChange) {
5269
this.props.onChange(this.getInstance().getMarkdown())
@@ -68,7 +85,11 @@ class TuiEditor extends React.Component {
6885
if (this.props.className !== className) {
6986
return true
7087
}
71-
// this.bindEventHandlers(nextProps, this.props)
88+
89+
// this looks like a bed idea to re-subscribe all the event on each re-render
90+
// also, note, that we had to disable this.editorInst.off(eventName);
91+
// otherwise popup for choosing Headings never closes
92+
// this.bindEventHandlers(nextProps, this.props);
7293

7394
return false
7495
}
@@ -132,7 +153,7 @@ TuiEditor.propTypes = {
132153
// use default htmlSanitizer
133154
useDefaultHTMLSanitizer: PropTypes.bool,
134155
// toolbar items.
135-
toolbarItems: PropTypes.arrayOf(PropTypes.object),
156+
toolbarItems: PropTypes.arrayOf(PropTypes.oneOfType(PropTypes.object, PropTypes.string)),
136157
// Array of plugins. A plugin can be either a function or an array in the form of [function, options].
137158
plugins: PropTypes.arrayOf(PropTypes.object),
138159
// Using extended Autolinks specified in GFM spec

src/projects/detail/components/BillingAccountField/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {HOC as hoc} from 'formsy-react'
33

44
import Select from '../../../../components/Select/Select'
55
import {fetchBillingAccounts} from '../../../../api/billingAccounts'
6-
import {SALESFORCE_PROJECT_LEAD_LINK} from '../../../../config/constants'
6+
// import {SALESFORCE_PROJECT_LEAD_LINK} from '../../../../config/constants'
77

88
import styles from './styles.module.scss'
99

@@ -90,7 +90,8 @@ class BillingAccountField extends React.Component {
9090
options={this.state.billingAccounts}
9191
isDisabled={this.state.billingAccounts.length === 0}
9292
/>
93-
<div className={styles.manageBillingAccountLinkWrapper}>
93+
{/* Hide this link because we haven't implemented a required page in SFDC yet */}
94+
{/* <div className={styles.manageBillingAccountLinkWrapper}>
9495
<a
9596
className={styles.manageBillingAccountLink}
9697
href={`${SALESFORCE_PROJECT_LEAD_LINK}${this.props.projectId}`}
@@ -99,7 +100,7 @@ class BillingAccountField extends React.Component {
99100
>
100101
Manage the billing account in Salesforce
101102
</a>
102-
</div>
103+
</div> */}
103104
</div>
104105
)
105106
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@import '~tc-ui/src/styles/tc-includes';
2+
3+
.description-editor {
4+
:global {
5+
.tui-editor-contents {
6+
code {
7+
background-color: transparent;
8+
color: inherit;
9+
}
10+
11+
pre {
12+
background-color: transparent;
13+
color: inherit;
14+
padding: 0;
15+
}
16+
}
17+
}
18+
}

src/projects/detail/components/DescriptionField/index.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,30 @@ import React from 'react'
66
import PropTypes from 'prop-types'
77

88
import TuiEditor from '../../../../components/TuiEditor'
9+
import './DescriptionField.scss'
910

1011
const DescriptionField = (props) => (
1112
<TuiEditor
1213
{...props}
14+
toolbarItems={[
15+
'heading',
16+
'bold',
17+
'italic',
18+
'strike',
19+
'code',
20+
'divider',
21+
'quote',
22+
'codeblock',
23+
'hr',
24+
'divider',
25+
'ul',
26+
'ol',
27+
'divider',
28+
'image',
29+
'link',
30+
]}
31+
plugins={[]}
32+
styleName="description-editor"
1333
previewStyle="vertical"
1434
height="400px"
1535
hideModeSwitch

src/projects/detail/components/NDAField/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { PropTypes } from 'react'
22
import { HOC as hoc } from 'formsy-react'
33
import _ from 'lodash'
44
import RadioGroup from 'appirio-tech-react-components/components/Formsy/RadioGroup'
5-
import { DEFAULT_NDA_UUID } from '../../../../../config/constants'
5+
import { DEFAULT_NDA_UUID } from '../../../../config/constants'
66

77
class NDAField extends React.Component {
88
constructor(props) {

0 commit comments

Comments
 (0)