PLT-3201 Code Theme Saves Upon Update (#3414)
* Ensured code theme saves properly
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
1c8962cf99
Коммит
3dea2b0e3f
@@ -108,15 +108,24 @@ class CustomThemeChooser extends React.Component {
|
|||||||
this.onPickerChange = this.onPickerChange.bind(this);
|
this.onPickerChange = this.onPickerChange.bind(this);
|
||||||
this.pasteBoxChange = this.pasteBoxChange.bind(this);
|
this.pasteBoxChange = this.pasteBoxChange.bind(this);
|
||||||
this.toggleContent = this.toggleContent.bind(this);
|
this.toggleContent = this.toggleContent.bind(this);
|
||||||
|
this.onCodeThemeChange = this.onCodeThemeChange.bind(this);
|
||||||
|
|
||||||
this.state = {};
|
this.state = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
$('.color-picker').colorpicker({
|
$('.color-picker').colorpicker({
|
||||||
format: 'hex'
|
format: 'hex'
|
||||||
});
|
});
|
||||||
$('.color-picker').on('changeColor', this.onPickerChange);
|
$('.color-picker').on('changeColor', this.onPickerChange);
|
||||||
|
$('.group--code').on('change', this.onCodeThemeChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
$('.color-picker').off('changeColor', this.onPickerChange);
|
||||||
|
$('.group--code').off('change', this.onCodeThemeChange);
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const theme = this.props.theme;
|
const theme = this.props.theme;
|
||||||
Constants.THEME_ELEMENTS.forEach((element) => {
|
Constants.THEME_ELEMENTS.forEach((element) => {
|
||||||
@@ -126,6 +135,7 @@ class CustomThemeChooser extends React.Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onPickerChange(e) {
|
onPickerChange(e) {
|
||||||
const inputBox = e.target.childNodes[0];
|
const inputBox = e.target.childNodes[0];
|
||||||
if (document.activeElement === inputBox && inputBox.value.length !== HEX_CODE_LENGTH) {
|
if (document.activeElement === inputBox && inputBox.value.length !== HEX_CODE_LENGTH) {
|
||||||
@@ -137,6 +147,7 @@ class CustomThemeChooser extends React.Component {
|
|||||||
theme.type = 'custom';
|
theme.type = 'custom';
|
||||||
this.props.updateTheme(theme);
|
this.props.updateTheme(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
pasteBoxChange(e) {
|
pasteBoxChange(e) {
|
||||||
const text = e.target.value;
|
const text = e.target.value;
|
||||||
|
|
||||||
@@ -162,6 +173,7 @@ class CustomThemeChooser extends React.Component {
|
|||||||
|
|
||||||
this.props.updateTheme(theme);
|
this.props.updateTheme(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleContent(e) {
|
toggleContent(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if ($(e.target).hasClass('theme-elements__header')) {
|
if ($(e.target).hasClass('theme-elements__header')) {
|
||||||
@@ -172,6 +184,13 @@ class CustomThemeChooser extends React.Component {
|
|||||||
$(e.target).closest('.theme-elements__header').toggleClass('open');
|
$(e.target).closest('.theme-elements__header').toggleClass('open');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCodeThemeChange(e) {
|
||||||
|
const theme = this.props.theme;
|
||||||
|
theme.codeTheme = e.target.value;
|
||||||
|
this.props.updateTheme(theme);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {formatMessage} = this.props.intl;
|
const {formatMessage} = this.props.intl;
|
||||||
const theme = this.props.theme;
|
const theme = this.props.theme;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user