/* eslint-disable no-useless-escape */ import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, } from 'reactstrap'; 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'; class CustomizeHighlightSetting extends React.Component { constructor(props) { super(props); this.state = { isDropdownOpen: false, }; this.onToggleDropdown = this.onToggleDropdown.bind(this); this.onClickSubmit = this.onClickSubmit.bind(this); } onToggleDropdown() { this.setState({ isDropdownOpen: !this.state.isDropdownOpen }); } async onClickSubmit() { const { t, adminCustomizeContainer } = this.props; try { await adminCustomizeContainer.updateHighlightJsStyle(); toastSuccess(t('toaster.update_successed', { target: t('admin:customize_setting.code_highlight') })); } catch (err) { toastError(err); } } renderHljsDemo() { const { adminCustomizeContainer } = this.props; /* eslint-disable max-len */ const html = `function MersenneTwister(seed) { if (arguments.length == 0) { seed = new Date().getTime(); } this._mt = new Array(624); this.setSeed(seed); }`; /* eslint-enable max-len */ return (
{/* eslint-disable-next-line react/no-danger */}
);
}
render() {
const { t, adminCustomizeContainer } = this.props;
const options = adminCustomizeContainer.state.highlightJsCssSelectorOptions;
const menuItem = [];
Object.entries(options).forEach((option) => {
const styleId = option[0];
const styleName = option[1].name;
const isBorderEnable = option[1].border;
menuItem.push(
{/* eslint-disable-next-line react/no-danger */}