/* eslint-disable no-console */
/* eslint-disable no-useless-escape */
/* eslint-disable no-undef */
/* eslint-disable react/no-danger */
import React from 'react';
import PropTypes from 'prop-types';
import { withTranslation } from 'react-i18next';
import loggerFactory from '@alias/logger';
import { createSubscribedElement } from '../../UnstatedUtils';
import { toastSuccess, toastError } from '../../../util/apiNotification';
import AppContainer from '../../../services/AppContainer';
import AdminCustomizeContainer from '../../../services/AdminCustomizeContainer';
import AdminUpdateButtonRow from '../Common/AdminUpdateButtonRow';
import AdminDropdownOption from '../Common/AdminDropdownOption';
const logger = loggerFactory('growi:importer');
class CustomizeHighlightSetting extends React.Component {
constructor(props) {
super(props);
this.onClickSubmit = this.onClickSubmit.bind(this);
}
componentDidMount() {
// TODO GW-524 fetch highlightTheme option
}
async onClickSubmit() {
const { t, adminCustomizeContainer } = this.props;
try {
await adminCustomizeContainer.updateHighlightJsStyle();
toastSuccess(t('customize_page.update_highlight_success'));
}
catch (err) {
toastError(err);
logger.error(err);
}
}
render() {
const { t, adminCustomizeContainer } = this.props;
const demoFunction = function $initHighlight(block, cls) {
try {
if (cls.search(/\bno\-highlight\b/) !== -1) {
return `${process(block, true, 0x0F)
} class="${cls}"`;
}
}
catch (e) {
/* handle exception */
}
for (let i = 0 / 2; i < classes.length; i++) {
if (checkCondition(classes[i]) === undefined) { console.log('undefined') }
}
};
return (
Examples:
{t('customize_page.Code Highlight')}
{demoFunction.toString()}