|
|
@@ -36,21 +36,26 @@ class CustomizeHighlightSetting extends React.Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- getDemoFunction() {
|
|
|
- return `function $initHighlight(block, cls) {
|
|
|
- try {
|
|
|
+ renderHljsDemo() {
|
|
|
+ const { adminCustomizeContainer } = this.props;
|
|
|
|
|
|
- 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') }
|
|
|
- }
|
|
|
- };`;
|
|
|
+ /* eslint-disable max-len */
|
|
|
+ const html = `<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">MersenneTwister</span>(<span class="hljs-params">seed</span>) </span>{
|
|
|
+ <span class="hljs-keyword">if</span> (<span class="hljs-built_in">arguments</span>.length == <span class="hljs-number">0</span>) {
|
|
|
+ seed = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>().getTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ <span class="hljs-keyword">this</span>._mt = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Array</span>(<span class="hljs-number">624</span>);
|
|
|
+ <span class="hljs-keyword">this</span>.setSeed(seed);
|
|
|
+}</span>`;
|
|
|
+ /* eslint-enable max-len */
|
|
|
+
|
|
|
+ return (
|
|
|
+ <pre className={`hljs ${!adminCustomizeContainer.state.isHighlightJsStyleBorderEnabled && 'hljs-no-border'}`}>
|
|
|
+ {/* eslint-disable-next-line react/no-danger */}
|
|
|
+ <code dangerouslySetInnerHTML={{ __html: html }}></code>
|
|
|
+ </pre>
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
@@ -115,11 +120,7 @@ class CustomizeHighlightSetting extends React.Component {
|
|
|
<div className="help-block">
|
|
|
<label>Examples:</label>
|
|
|
<div className="wiki">
|
|
|
- <pre className={`hljs ${!adminCustomizeContainer.state.isHighlightJsStyleBorderEnabled && 'hljs-no-border'}`}>
|
|
|
- <code className="highlightjs-demo">
|
|
|
- {this.getDemoFunction()}
|
|
|
- </code>
|
|
|
- </pre>
|
|
|
+ {this.renderHljsDemo()}
|
|
|
</div>
|
|
|
</div>
|
|
|
|