(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[249,5,7,10],{
/***/ "+NIl":
/*!***************************************************!*\
!*** ./node_modules/codemirror/mode/stex/stex.js ***!
\***************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
* Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
* Licence: MIT
*/
(function(mod) {
if (true) // CommonJS
mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/"));
else {}
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("stex", function(_config, parserConfig) {
"use strict";
function pushCommand(state, command) {
state.cmdState.push(command);
}
function peekCommand(state) {
if (state.cmdState.length > 0) {
return state.cmdState[state.cmdState.length - 1];
} else {
return null;
}
}
function popCommand(state) {
var plug = state.cmdState.pop();
if (plug) {
plug.closeBracket();
}
}
// returns the non-default plugin closest to the end of the list
function getMostPowerful(state) {
var context = state.cmdState;
for (var i = context.length - 1; i >= 0; i--) {
var plug = context[i];
if (plug.name == "DEFAULT") {
continue;
}
return plug;
}
return { styleIdentifier: function() { return null; } };
}
function addPluginPattern(pluginName, cmdStyle, styles) {
return function () {
this.name = pluginName;
this.bracketNo = 0;
this.style = cmdStyle;
this.styles = styles;
this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
this.styleIdentifier = function() {
return this.styles[this.bracketNo - 1] || null;
};
this.openBracket = function() {
this.bracketNo++;
return "bracket";
};
this.closeBracket = function() {};
};
}
var plugins = {};
plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]);
plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]);
plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]);
plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]);
plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]);
plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]);
plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
plugins["DEFAULT"] = function () {
this.name = "DEFAULT";
this.style = "tag";
this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
};
function setState(state, f) {
state.f = f;
}
// called when in a normal (no environment) context
function normal(source, state) {
var plug;
// Do we look like '\command' ? If so, attempt to apply the plugin 'command'
if (source.match(/^\\[a-zA-Z@]+/)) {
var cmdName = source.current().slice(1);
plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
plug = new plug();
pushCommand(state, plug);
setState(state, beginParams);
return plug.style;
}
// escape characters
if (source.match(/^\\[$&%#{}_]/)) {
return "tag";
}
// white space control characters
if (source.match(/^\\[,;!\/\\]/)) {
return "tag";
}
// find if we're starting various math modes
if (source.match("\\[")) {
setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
return "keyword";
}
if (source.match("\\(")) {
setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
return "keyword";
}
if (source.match("$$")) {
setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
return "keyword";
}
if (source.match("$")) {
setState(state, function(source, state){ return inMathMode(source, state, "$"); });
return "keyword";
}
var ch = source.next();
if (ch == "%") {
source.skipToEnd();
return "comment";
} else if (ch == '}' || ch == ']') {
plug = peekCommand(state);
if (plug) {
plug.closeBracket(ch);
setState(state, beginParams);
} else {
return "error";
}
return "bracket";
} else if (ch == '{' || ch == '[') {
plug = plugins["DEFAULT"];
plug = new plug();
pushCommand(state, plug);
return "bracket";
} else if (/\d/.test(ch)) {
source.eatWhile(/[\w.%]/);
return "atom";
} else {
source.eatWhile(/[\w\-_]/);
plug = getMostPowerful(state);
if (plug.name == 'begin') {
plug.argument = source.current();
}
return plug.styleIdentifier();
}
}
function inMathMode(source, state, endModeSeq) {
if (source.eatSpace()) {
return null;
}
if (endModeSeq && source.match(endModeSeq)) {
setState(state, normal);
return "keyword";
}
if (source.match(/^\\[a-zA-Z@]+/)) {
return "tag";
}
if (source.match(/^[a-zA-Z]+/)) {
return "variable-2";
}
// escape characters
if (source.match(/^\\[$&%#{}_]/)) {
return "tag";
}
// white space control characters
if (source.match(/^\\[,;!\/]/)) {
return "tag";
}
// special math-mode characters
if (source.match(/^[\^_&]/)) {
return "tag";
}
// non-special characters
if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
return null;
}
if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
return "number";
}
var ch = source.next();
if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
return "bracket";
}
if (ch == "%") {
source.skipToEnd();
return "comment";
}
return "error";
}
function beginParams(source, state) {
var ch = source.peek(), lastPlug;
if (ch == '{' || ch == '[') {
lastPlug = peekCommand(state);
lastPlug.openBracket(ch);
source.eat(ch);
setState(state, normal);
return "bracket";
}
if (/[ \t\r]/.test(ch)) {
source.eat(ch);
return null;
}
setState(state, normal);
popCommand(state);
return normal(source, state);
}
return {
startState: function() {
var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal;
return {
cmdState: [],
f: f
};
},
copyState: function(s) {
return {
cmdState: s.cmdState.slice(),
f: s.f
};
},
token: function(stream, state) {
return state.f(stream, state);
},
blankLine: function(state) {
state.f = normal;
state.cmdState.length = 0;
},
lineComment: "%"
};
});
CodeMirror.defineMIME("text/x-stex", "stex");
CodeMirror.defineMIME("text/x-latex", "stex");
});
/***/ }),
/***/ "19Vz":
/*!**************************************************************!*\
!*** ./node_modules/codemirror/addon/display/placeholder.js ***!
\**************************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (true) // CommonJS
mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/"));
else {}
})(function(CodeMirror) {
CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
var prev = old && old != CodeMirror.Init;
if (val && !prev) {
cm.on("blur", onBlur);
cm.on("change", onChange);
cm.on("swapDoc", onChange);
CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() { onComposition(cm) })
onChange(cm);
} else if (!val && prev) {
cm.off("blur", onBlur);
cm.off("change", onChange);
cm.off("swapDoc", onChange);
CodeMirror.off(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose)
clearPlaceholder(cm);
var wrapper = cm.getWrapperElement();
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
}
if (val && !cm.hasFocus()) onBlur(cm);
});
function clearPlaceholder(cm) {
if (cm.state.placeholder) {
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
cm.state.placeholder = null;
}
}
function setPlaceholder(cm) {
clearPlaceholder(cm);
var elt = cm.state.placeholder = document.createElement("pre");
elt.style.cssText = "height: 0; overflow: visible";
elt.style.direction = cm.getOption("direction");
elt.className = "CodeMirror-placeholder CodeMirror-line-like";
var placeHolder = cm.getOption("placeholder")
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
elt.appendChild(placeHolder)
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
}
function onComposition(cm) {
setTimeout(function() {
var empty = false, input = cm.getInputField()
if (input.nodeName == "TEXTAREA")
empty = !input.value
else if (cm.lineCount() == 1)
empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
if (empty) setPlaceholder(cm)
else clearPlaceholder(cm)
}, 20)
}
function onBlur(cm) {
if (isEmpty(cm)) setPlaceholder(cm);
}
function onChange(cm) {
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
if (empty) setPlaceholder(cm);
else clearPlaceholder(cm);
}
function isEmpty(cm) {
return (cm.lineCount() === 1) && (cm.getLine(0) === "");
}
});
/***/ }),
/***/ "1eCo":
/*!*************************************************!*\
!*** ./node_modules/codemirror/mode/xml/xml.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (true) // CommonJS
mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/"));
else {}
})(function(CodeMirror) {
"use strict";
var htmlConfig = {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
'track': true, 'wbr': true, 'menuitem': true},
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
'th': true, 'tr': true},
contextGrabbers: {
'dd': {'dd': true, 'dt': true},
'dt': {'dd': true, 'dt': true},
'li': {'li': true},
'option': {'option': true, 'optgroup': true},
'optgroup': {'optgroup': true},
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
'rp': {'rp': true, 'rt': true},
'rt': {'rp': true, 'rt': true},
'tbody': {'tbody': true, 'tfoot': true},
'td': {'td': true, 'th': true},
'tfoot': {'tbody': true},
'th': {'td': true, 'th': true},
'thead': {'tbody': true, 'tfoot': true},
'tr': {'tr': true}
},
doNotIndent: {"pre": true},
allowUnquoted: true,
allowMissing: true,
caseFold: true
}
var xmlConfig = {
autoSelfClosers: {},
implicitlyClosed: {},
contextGrabbers: {},
doNotIndent: {},
allowUnquoted: false,
allowMissing: false,
allowMissingTagName: false,
caseFold: false
}
CodeMirror.defineMode("xml", function(editorConf, config_) {
var indentUnit = editorConf.indentUnit
var config = {}
var defaults = config_.htmlMode ? htmlConfig : xmlConfig
for (var prop in defaults) config[prop] = defaults[prop]
for (var prop in config_) config[prop] = config_[prop]
// Return variables for tokenizers
var type, setStyle;
function inText(stream, state) {
function chain(parser) {
state.tokenize = parser;
return parser(stream, state);
}
var ch = stream.next();
if (ch == "<") {
if (stream.eat("!")) {
if (stream.eat("[")) {
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
else return null;
} else if (stream.match("--")) {
return chain(inBlock("comment", "-->"));
} else if (stream.match("DOCTYPE", true, true)) {
stream.eatWhile(/[\w\._\-]/);
return chain(doctype(1));
} else {
return null;
}
} else if (stream.eat("?")) {
stream.eatWhile(/[\w\._\-]/);
state.tokenize = inBlock("meta", "?>");
return "meta";
} else {
type = stream.eat("/") ? "closeTag" : "openTag";
state.tokenize = inTag;
return "tag bracket";
}
} else if (ch == "&") {
var ok;
if (stream.eat("#")) {
if (stream.eat("x")) {
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
} else {
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
}
} else {
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
}
return ok ? "atom" : "error";
} else {
stream.eatWhile(/[^&<]/);
return null;
}
}
inText.isInText = true;
function inTag(stream, state) {
var ch = stream.next();
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
state.tokenize = inText;
type = ch == ">" ? "endTag" : "selfcloseTag";
return "tag bracket";
} else if (ch == "=") {
type = "equals";
return null;
} else if (ch == "<") {
state.tokenize = inText;
state.state = baseState;
state.tagName = state.tagStart = null;
var next = state.tokenize(stream, state);
return next ? next + " tag error" : "tag error";
} else if (/[\'\"]/.test(ch)) {
state.tokenize = inAttribute(ch);
state.stringStartCol = stream.column();
return state.tokenize(stream, state);
} else {
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
return "word";
}
}
function inAttribute(quote) {
var closure = function(stream, state) {
while (!stream.eol()) {
if (stream.next() == quote) {
state.tokenize = inTag;
break;
}
}
return "string";
};
closure.isInAttribute = true;
return closure;
}
function inBlock(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
state.tokenize = inText;
break;
}
stream.next();
}
return style;
}
}
function doctype(depth) {
return function(stream, state) {
var ch;
while ((ch = stream.next()) != null) {
if (ch == "<") {
state.tokenize = doctype(depth + 1);
return state.tokenize(stream, state);
} else if (ch == ">") {
if (depth == 1) {
state.tokenize = inText;
break;
} else {
state.tokenize = doctype(depth - 1);
return state.tokenize(stream, state);
}
}
}
return "meta";
};
}
function Context(state, tagName, startOfLine) {
this.prev = state.context;
this.tagName = tagName;
this.indent = state.indented;
this.startOfLine = startOfLine;
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
this.noIndent = true;
}
function popContext(state) {
if (state.context) state.context = state.context.prev;
}
function maybePopContext(state, nextTagName) {
var parentTagName;
while (true) {
if (!state.context) {
return;
}
parentTagName = state.context.tagName;
if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
return;
}
popContext(state);
}
}
function baseState(type, stream, state) {
if (type == "openTag") {
state.tagStart = stream.column();
return tagNameState;
} else if (type == "closeTag") {
return closeTagNameState;
} else {
return baseState;
}
}
function tagNameState(type, stream, state) {
if (type == "word") {
state.tagName = stream.current();
setStyle = "tag";
return attrState;
} else if (config.allowMissingTagName && type == "endTag") {
setStyle = "tag bracket";
return attrState(type, stream, state);
} else {
setStyle = "error";
return tagNameState;
}
}
function closeTagNameState(type, stream, state) {
if (type == "word") {
var tagName = stream.current();
if (state.context && state.context.tagName != tagName &&
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
popContext(state);
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
setStyle = "tag";
return closeState;
} else {
setStyle = "tag error";
return closeStateErr;
}
} else if (config.allowMissingTagName && type == "endTag") {
setStyle = "tag bracket";
return closeState(type, stream, state);
} else {
setStyle = "error";
return closeStateErr;
}
}
function closeState(type, _stream, state) {
if (type != "endTag") {
setStyle = "error";
return closeState;
}
popContext(state);
return baseState;
}
function closeStateErr(type, stream, state) {
setStyle = "error";
return closeState(type, stream, state);
}
function attrState(type, _stream, state) {
if (type == "word") {
setStyle = "attribute";
return attrEqState;
} else if (type == "endTag" || type == "selfcloseTag") {
var tagName = state.tagName, tagStart = state.tagStart;
state.tagName = state.tagStart = null;
if (type == "selfcloseTag" ||
config.autoSelfClosers.hasOwnProperty(tagName)) {
maybePopContext(state, tagName);
} else {
maybePopContext(state, tagName);
state.context = new Context(state, tagName, tagStart == state.indented);
}
return baseState;
}
setStyle = "error";
return attrState;
}
function attrEqState(type, stream, state) {
if (type == "equals") return attrValueState;
if (!config.allowMissing) setStyle = "error";
return attrState(type, stream, state);
}
function attrValueState(type, stream, state) {
if (type == "string") return attrContinuedState;
if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
setStyle = "error";
return attrState(type, stream, state);
}
function attrContinuedState(type, stream, state) {
if (type == "string") return attrContinuedState;
return attrState(type, stream, state);
}
return {
startState: function(baseIndent) {
var state = {tokenize: inText,
state: baseState,
indented: baseIndent || 0,
tagName: null, tagStart: null,
context: null}
if (baseIndent != null) state.baseIndent = baseIndent
return state
},
token: function(stream, state) {
if (!state.tagName && stream.sol())
state.indented = stream.indentation();
if (stream.eatSpace()) return null;
type = null;
var style = state.tokenize(stream, state);
if ((style || type) && style != "comment") {
setStyle = null;
state.state = state.state(type || style, stream, state);
if (setStyle)
style = setStyle == "error" ? style + " error" : setStyle;
}
return style;
},
indent: function(state, textAfter, fullLine) {
var context = state.context;
// Indent multi-line strings (e.g. css).
if (state.tokenize.isInAttribute) {
if (state.tagStart == state.indented)
return state.stringStartCol + 1;
else
return state.indented + indentUnit;
}
if (context && context.noIndent) return CodeMirror.Pass;
if (state.tokenize != inTag && state.tokenize != inText)
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
// Indent the starts of attribute names.
if (state.tagName) {
if (config.multilineTagIndentPastTag !== false)
return state.tagStart + state.tagName.length + 2;
else
return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
}
if (config.alignCDATA && /$/,
blockCommentStart: "",
configuration: config.htmlMode ? "html" : "xml",
helperType: config.htmlMode ? "html" : "xml",
skipAttribute: function(state) {
if (state.state == attrValueState)
state.state = attrState
},
xmlCurrentTag: function(state) {
return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
},
xmlCurrentContext: function(state) {
var context = []
for (var cx = state.context; cx; cx = cx.prev)
if (cx.tagName) context.push(cx.tagName)
return context.reverse()
}
};
});
CodeMirror.defineMIME("text/xml", "xml");
CodeMirror.defineMIME("application/xml", "xml");
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
});
/***/ }),
/***/ "55Ip":
/*!***************************************************************!*\
!*** ./node_modules/react-router-dom/esm/react-router-dom.js ***!
\***************************************************************/
/*! exports provided: MemoryRouter, Prompt, Redirect, Route, Router, StaticRouter, Switch, generatePath, matchPath, useHistory, useLocation, useParams, useRouteMatch, withRouter, BrowserRouter, HashRouter, Link, NavLink */
/*! exports used: Link, NavLink */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export BrowserRouter */
/* unused harmony export HashRouter */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Link; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NavLink; });
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-router */ "Ty5D");
/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "dI71");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! history */ "YS25");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! prop-types */ "17x9");
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "wx14");
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "zLVn");
/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! tiny-invariant */ "9R94");
/**
* The public API for a ".concat(code, ""];
var renderer = new marked_default.a.Renderer();
var headingRegex = /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;
function cleanToc() {
toc.length = 0;
ctx = ["
"];
}
var lines = {
overflow: "hidden",
WebkitBoxOrient: "vertical",
display: "-webkit-box",
WebkitLineClamp: 2
};
function buildToc(coll, k, level, ctx) {
if (k >= coll.length || coll[k].level <= level) {
return k;
}
var node = coll[k];
ctx.push("
");
return ctx.join("");
}
var tokenizer = {
heading: function heading(src) {
var cap = headingRegex.exec(src);
if (cap) {
return {
type: 'heading',
raw: cap[0],
depth: cap[1].length,
text: cap[2]
};
}
},
fences: function fences(src) {
var cap = this.rules.block.fences.exec(src);
if (cap) {
var raw = cap[0];
var text = indentCodeCompensation(raw, cap[3] || '');
var lang = cap[2] ? cap[2].trim() : cap[2];
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
var id = next_id();
var expression = text;
text = id;
marked_math_expressions[id] = {
type: 'block',
expression: expression
};
}
return {
type: 'code',
raw: raw,
lang: lang,
text: text
};
}
}
};
var latexRegex = /(?:\${2})([^\n`]+?)(?:\${2})/gi;
var katex_count = 0;
var next_id = function next_id() {
return "__special_katext_id_".concat(katex_count++, "__");
};
var marked_math_expressions = {};
function getMathExpressions() {
return marked_math_expressions;
}
function resetMathExpressions() {
katex_count = 0;
marked_math_expressions = {};
}
function replace_math_with_ids(text) {
text = text.replace(latexRegex, function (_match, expression) {
var id = next_id();
marked_math_expressions[id] = {
type: 'inline',
expression: expression
};
return id;
});
return text;
}
var original_listitem = renderer.listitem;
renderer.listitem = function (text) {
return original_listitem(replace_math_with_ids(text));
};
var original_paragraph = renderer.paragraph;
renderer.paragraph = function (text) {
return original_paragraph(replace_math_with_ids(text));
};
var original_tablecell = renderer.tablecell;
renderer.tablecell = function (content, flags) {
return original_tablecell(replace_math_with_ids(content), flags);
};
renderer.code = function (code, infostring, escaped) {
var lang = (infostring || '').match(/\S*/)[0];
if (!lang) {
return '");
childCtx.forEach(function (idm) {
ctx.push(idm);
});
ctx.push("
");
}
ctx.push("
';
}
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
return "' + (escaped ? code : Object(helpers["escape"])(code, true)) + '
\n");
}
};
renderer.heading = function (text, level, raw) {
var anchor = this.options.headerPrefix + raw.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g, '-');
toc.push({
anchor: anchor,
level: level,
text: text
});
return '").concat(escaped ? code : Object(helpers["escape"])(code, true), "]*>/g;
function _unescape(str) {
var div = document.createElement('div');
div.innerHTML = str;
return div.childNodes.length === 0 ? '' : div.childNodes[0].nodeValue;
}
/* harmony default export */ var RenderHtml = __webpack_exports__["a"] = (function (_ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? '' : _ref$value,
className = _ref.className,
showTextOnly = _ref.showTextOnly,
showLines = _ref.showLines,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$stylesPrev = _ref.stylesPrev,
stylesPrev = _ref$stylesPrev === void 0 ? {} : _ref$stylesPrev;
var str = String(value);
var _useState = Object(external_window_React_["useState"])(""),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
var html = Object(external_window_React_["useMemo"])(function () {
try {
var reg = /\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g;
var reg2 = /\"\/api\/attachments\/|\"\/attachments\/download\//g;
var reg3 = /\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;
str = str.replace(reg, "(" + env["a" /* default */].API_SERVER + "/api/attachments/").replace(reg2, '"' + env["a" /* default */].API_SERVER + "/api/attachments/").replace(reg3, '"' + env["a" /* default */].API_SERVER + "/files/uploads/").replaceAll("http://video.educoder", "https://video.educoder").replaceAll("http://www.educoder.net/api", "https://data.educoder.net/api").replaceAll("https://www.educoder.net/api", "https://data.educoder.net/api").replace(/\r\n/g, "\n");
str = str.replace(new RegExp("(?[TOC]
' + (escaped ? _code : escape$1(_code, true)) + '\n';
}
return '' + (escaped ? _code : escape$1(_code, true)) + '\n';
};
_proto.blockquote = function blockquote(quote) {
return '\n' + quote + '\n'; }; _proto.html = function html(_html) { return _html; }; _proto.heading = function heading(text, level, raw, slugger) { if (this.options.headerIds) { return '
' + text + '
\n'; }; _proto.table = function table(header, body) { if (body) body = '' + body + ''; return '' + text + '';
};
_proto.br = function br() {
return this.options.xhtml ? 'An error occurred:
' + escape$2(e.message + '', true) + ''; } throw e; } } /** * Options */ marked.options = marked.setOptions = function (opt) { merge$2(marked.defaults, opt); changeDefaults(marked.defaults); return marked; }; marked.getDefaults = getDefaults; marked.defaults = defaults$5; /** * Use Extension */ marked.use = function (extension) { var opts = merge$2({}, extension); if (extension.renderer) { (function () { var renderer = marked.defaults.renderer || new Renderer_1(); var _loop = function _loop(prop) { var prevRenderer = renderer[prop]; renderer[prop] = function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var ret = extension.renderer[prop].apply(renderer, args); if (ret === false) { ret = prevRenderer.apply(renderer, args); } return ret; }; }; for (var prop in extension.renderer) { _loop(prop); } opts.renderer = renderer; })(); } if (extension.tokenizer) { (function () { var tokenizer = marked.defaults.tokenizer || new Tokenizer_1(); var _loop2 = function _loop2(prop) { var prevTokenizer = tokenizer[prop]; tokenizer[prop] = function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var ret = extension.tokenizer[prop].apply(tokenizer, args); if (ret === false) { ret = prevTokenizer.apply(tokenizer, args); } return ret; }; }; for (var prop in extension.tokenizer) { _loop2(prop); } opts.tokenizer = tokenizer; })(); } if (extension.walkTokens) { var walkTokens = marked.defaults.walkTokens; opts.walkTokens = function (token) { extension.walkTokens(token); if (walkTokens) { walkTokens(token); } }; } marked.setOptions(opts); }; /** * Run callback for every token */ marked.walkTokens = function (tokens, callback) { for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) { var token = _step.value; callback(token); switch (token.type) { case 'table': { for (var _iterator2 = _createForOfIteratorHelperLoose(token.tokens.header), _step2; !(_step2 = _iterator2()).done;) { var cell = _step2.value; marked.walkTokens(cell, callback); } for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) { var row = _step3.value; for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) { var _cell = _step4.value; marked.walkTokens(_cell, callback); } } break; } case 'list': { marked.walkTokens(token.items, callback); break; } default: { if (token.tokens) { marked.walkTokens(token.tokens, callback); } } } } }; /** * Expose */ marked.Parser = Parser_1; marked.parser = Parser_1.parse; marked.Renderer = Renderer_1; marked.TextRenderer = TextRenderer_1; marked.Lexer = Lexer_1; marked.lexer = Lexer_1.lex; marked.Tokenizer = Tokenizer_1; marked.Slugger = Slugger_1; marked.parse = marked; var marked_1 = marked; return marked_1; }))); /***/ }), /***/ "ELLl": /*!*************************************************************!*\ !*** ./node_modules/codemirror/addon/edit/closebrackets.js ***! \*************************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (true) // CommonJS mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/")); else {} })(function(CodeMirror) { var defaults = { pairs: "()[]{}''\"\"", closeBefore: ")]}'\":;>", triples: "", explode: "[]{}" }; var Pos = CodeMirror.Pos; CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { if (old && old != CodeMirror.Init) { cm.removeKeyMap(keyMap); cm.state.closeBrackets = null; } if (val) { ensureBound(getOption(val, "pairs")) cm.state.closeBrackets = val; cm.addKeyMap(keyMap); } }); function getOption(conf, name) { if (name == "pairs" && typeof conf == "string") return conf; if (typeof conf == "object" && conf[name] != null) return conf[name]; return defaults[name]; } var keyMap = {Backspace: handleBackspace, Enter: handleEnter}; function ensureBound(chars) { for (var i = 0; i < chars.length; i++) { var ch = chars.charAt(i), key = "'" + ch + "'" if (!keyMap[key]) keyMap[key] = handler(ch) } } ensureBound(defaults.pairs + "`") function handler(ch) { return function(cm) { return handleChar(cm, ch); }; } function getConfig(cm) { var deflt = cm.state.closeBrackets; if (!deflt || deflt.override) return deflt; var mode = cm.getModeAt(cm.getCursor()); return mode.closeBrackets || deflt; } function handleBackspace(cm) { var conf = getConfig(cm); if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; var pairs = getOption(conf, "pairs"); var ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { if (!ranges[i].empty()) return CodeMirror.Pass; var around = charsAround(cm, ranges[i].head); if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; } for (var i = ranges.length - 1; i >= 0; i--) { var cur = ranges[i].head; cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete"); } } function handleEnter(cm) { var conf = getConfig(cm); var explode = conf && getOption(conf, "explode"); if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass; var ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { if (!ranges[i].empty()) return CodeMirror.Pass; var around = charsAround(cm, ranges[i].head); if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; } cm.operation(function() { var linesep = cm.lineSeparator() || "\n"; cm.replaceSelection(linesep + linesep, null); cm.execCommand("goCharLeft"); ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { var line = ranges[i].head.line; cm.indentLine(line, null, true); cm.indentLine(line + 1, null, true); } }); } function contractSelection(sel) { var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0; return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)), head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))}; } function handleChar(cm, ch) { var conf = getConfig(cm); if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; var pairs = getOption(conf, "pairs"); var pos = pairs.indexOf(ch); if (pos == -1) return CodeMirror.Pass; var closeBefore = getOption(conf,"closeBefore"); var triples = getOption(conf, "triples"); var identical = pairs.charAt(pos + 1) == ch; var ranges = cm.listSelections(); var opening = pos % 2 == 0; var type; for (var i = 0; i < ranges.length; i++) { var range = ranges[i], cur = range.head, curType; var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); if (opening && !range.empty()) { curType = "surround"; } else if ((identical || !opening) && next == ch) { if (identical && stringStartsAfter(cm, cur)) curType = "both"; else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) curType = "skipThree"; else curType = "skip"; } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 && cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch) { if (cur.ch > 2 && /\bstring/.test(cm.getTokenTypeAt(Pos(cur.line, cur.ch - 2)))) return CodeMirror.Pass; curType = "addFour"; } else if (identical) { var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur) if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both"; else return CodeMirror.Pass; } else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) { curType = "both"; } else { return CodeMirror.Pass; } if (!type) type = curType; else if (type != curType) return CodeMirror.Pass; } var left = pos % 2 ? pairs.charAt(pos - 1) : ch; var right = pos % 2 ? ch : pairs.charAt(pos + 1); cm.operation(function() { if (type == "skip") { cm.execCommand("goCharRight"); } else if (type == "skipThree") { for (var i = 0; i < 3; i++) cm.execCommand("goCharRight"); } else if (type == "surround") { var sels = cm.getSelections(); for (var i = 0; i < sels.length; i++) sels[i] = left + sels[i] + right; cm.replaceSelections(sels, "around"); sels = cm.listSelections().slice(); for (var i = 0; i < sels.length; i++) sels[i] = contractSelection(sels[i]); cm.setSelections(sels); } else if (type == "both") { cm.replaceSelection(left + right, null); cm.triggerElectric(left + right); cm.execCommand("goCharLeft"); } else if (type == "addFour") { cm.replaceSelection(left + left + left + left, "before"); cm.execCommand("goCharRight"); } }); } function charsAround(cm, pos) { var str = cm.getRange(Pos(pos.line, pos.ch - 1), Pos(pos.line, pos.ch + 1)); return str.length == 2 ? str : null; } function stringStartsAfter(cm, pos) { var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1)) return /\bstring/.test(token.type) && token.start == pos.ch && (pos.ch == 0 || !/\bstring/.test(cm.getTokenTypeAt(pos))) } }); /***/ }), /***/ "FOrL": /*!********************************************!*\ !*** ./src/assets/images/icons/nodata.png ***! \********************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__.p + "static/nodata.a6b3f948.png"; /***/ }), /***/ "HmJG": /*!****************************************************************!*\ !*** ./src/components/markdown-editor/upload-image/index.less ***! \****************************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "LdHM": /*!********************************************************!*\ !*** ./node_modules/rc-select/es/index.js + 6 modules ***! \********************************************************/ /*! exports provided: Option, OptGroup, default */ /*! exports used: OptGroup, Option, default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ es_Option; }); __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ es_OptGroup; }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js var classCallCheck = __webpack_require__("1OyB"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js var createClass = __webpack_require__("vuIU"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js var inherits = __webpack_require__("Ji7U"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules var createSuper = __webpack_require__("LK+K"); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__("rePB"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js var objectWithoutProperties = __webpack_require__("Ff2n"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("ODXe"); // EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js var KeyCode = __webpack_require__("4IlW"); // EXTERNAL MODULE: ./node_modules/rc-util/es/pickAttrs.js var pickAttrs = __webpack_require__("bX4T"); // EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMemo.js var useMemo = __webpack_require__("YrtM"); // EXTERNAL MODULE: ./node_modules/classnames/index.js var classnames = __webpack_require__("TSYQ"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // EXTERNAL MODULE: ./node_modules/rc-virtual-list/es/index.js + 19 modules var es = __webpack_require__("+nKL"); // EXTERNAL MODULE: ./node_modules/rc-select/es/TransBtn.js var TransBtn = __webpack_require__("8OUc"); // CONCATENATED MODULE: ./node_modules/rc-select/es/OptionList.js /** * Using virtual list of option display. * Will fallback to dom if use customize render. */ var OptionList_OptionList = function OptionList(_ref, ref) { var prefixCls = _ref.prefixCls, id = _ref.id, flattenOptions = _ref.flattenOptions, childrenAsData = _ref.childrenAsData, values = _ref.values, searchValue = _ref.searchValue, multiple = _ref.multiple, defaultActiveFirstOption = _ref.defaultActiveFirstOption, height = _ref.height, itemHeight = _ref.itemHeight, notFoundContent = _ref.notFoundContent, open = _ref.open, menuItemSelectedIcon = _ref.menuItemSelectedIcon, virtual = _ref.virtual, onSelect = _ref.onSelect, onToggleOpen = _ref.onToggleOpen, onActiveValue = _ref.onActiveValue, onScroll = _ref.onScroll, onMouseEnter = _ref.onMouseEnter; var itemPrefixCls = "".concat(prefixCls, "-item"); var memoFlattenOptions = Object(useMemo["a" /* default */])(function () { return flattenOptions; }, [open, flattenOptions], function (prev, next) { return next[0] && prev[1] !== next[1]; }); // =========================== List =========================== var listRef = external_window_React_["useRef"](null); var onListMouseDown = function onListMouseDown(event) { event.preventDefault(); }; var scrollIntoView = function scrollIntoView(index) { if (listRef.current) { listRef.current.scrollTo({ index: index }); } }; // ========================== Active ========================== var getEnabledActiveIndex = function getEnabledActiveIndex(index) { var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var len = memoFlattenOptions.length; for (var i = 0; i < len; i += 1) { var current = (index + i * offset + len) % len; var _memoFlattenOptions$c = memoFlattenOptions[current], group = _memoFlattenOptions$c.group, data = _memoFlattenOptions$c.data; if (!group && !data.disabled) { return current; } } return -1; }; var _React$useState = external_window_React_["useState"](function () { return getEnabledActiveIndex(0); }), _React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2), activeIndex = _React$useState2[0], setActiveIndex = _React$useState2[1]; var setActive = function setActive(index) { setActiveIndex(index); // Trigger active event var flattenItem = memoFlattenOptions[index]; if (!flattenItem) { onActiveValue(null, -1); return; } onActiveValue(flattenItem.data.value, index); }; // Auto active first item when list length or searchValue changed external_window_React_["useEffect"](function () { setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1); }, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode external_window_React_["useEffect"](function () { /** * React will skip `onChange` when component update. * `setActive` function will call root accessibility state update which makes re-render. * So we need to delay to let Input component trigger onChange first. */ var timeoutId = setTimeout(function () { if (!multiple && open && values.size === 1) { var value = Array.from(values)[0]; var index = memoFlattenOptions.findIndex(function (_ref2) { var data = _ref2.data; return data.value === value; }); setActive(index); scrollIntoView(index); } }); return function () { return clearTimeout(timeoutId); }; }, [open]); // ========================== Values ========================== var onSelectValue = function onSelectValue(value) { if (value !== undefined) { onSelect(value, { selected: !values.has(value) }); } // Single mode should always close by select if (!multiple) { onToggleOpen(false); } }; // ========================= Keyboard ========================= external_window_React_["useImperativeHandle"](ref, function () { return { onKeyDown: function onKeyDown(event) { var which = event.which; switch (which) { // >>> Arrow keys case KeyCode["a" /* default */].UP: case KeyCode["a" /* default */].DOWN: { var offset = 0; if (which === KeyCode["a" /* default */].UP) { offset = -1; } else if (which === KeyCode["a" /* default */].DOWN) { offset = 1; } if (offset !== 0) { var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset); scrollIntoView(nextActiveIndex); setActive(nextActiveIndex); } break; } // >>> Select case KeyCode["a" /* default */].ENTER: { // value var item = memoFlattenOptions[activeIndex]; if (item && !item.data.disabled) { onSelectValue(item.data.value); } else { onSelectValue(undefined); } if (open) { event.preventDefault(); } break; } // >>> Close case KeyCode["a" /* default */].ESC: { onToggleOpen(false); } } }, onKeyUp: function onKeyUp() {}, scrollTo: function scrollTo(index) { scrollIntoView(index); } }; }); // ========================== Render ========================== if (memoFlattenOptions.length === 0) { return external_window_React_["createElement"]("div", { role: "listbox", id: "".concat(id, "_list"), className: "".concat(itemPrefixCls, "-empty"), onMouseDown: onListMouseDown }, notFoundContent); } function renderItem(index) { var item = memoFlattenOptions[index]; if (!item) return null; var itemData = item.data || {}; var value = itemData.value, label = itemData.label, children = itemData.children; var attrs = Object(pickAttrs["a" /* default */])(itemData, true); var mergedLabel = childrenAsData ? children : label; return item ? external_window_React_["createElement"]("div", Object.assign({ "aria-label": typeof mergedLabel === 'string' ? mergedLabel : null }, attrs, { key: index, role: "option", id: "".concat(id, "_list_").concat(index), "aria-selected": values.has(value) }), value) : null; } return external_window_React_["createElement"](external_window_React_["Fragment"], null, external_window_React_["createElement"]("div", { role: "listbox", id: "".concat(id, "_list"), style: { height: 0, width: 0, overflow: 'hidden' } }, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), external_window_React_["createElement"](es["a" /* default */], { itemKey: "key", ref: listRef, data: memoFlattenOptions, height: height, itemHeight: itemHeight, fullHeight: false, onMouseDown: onListMouseDown, onScroll: onScroll, virtual: virtual, onMouseEnter: onMouseEnter }, function (_ref3, itemIndex) { var _classNames; var group = _ref3.group, groupOption = _ref3.groupOption, data = _ref3.data; var label = data.label, key = data.key; // Group if (group) { return external_window_React_["createElement"]("div", { className: classnames_default()(itemPrefixCls, "".concat(itemPrefixCls, "-group")) }, label !== undefined ? label : key); } var disabled = data.disabled, value = data.value, title = data.title, children = data.children, style = data.style, className = data.className, otherProps = Object(objectWithoutProperties["a" /* default */])(data, ["disabled", "value", "title", "children", "style", "className"]); // Option var selected = values.has(value); var optionPrefixCls = "".concat(itemPrefixCls, "-option"); var optionClassName = classnames_default()(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames)); var mergedLabel = childrenAsData ? children : label; var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected; return external_window_React_["createElement"]("div", Object.assign({}, otherProps, { "aria-selected": selected, className: optionClassName, title: title, onMouseMove: function onMouseMove() { if (activeIndex === itemIndex || disabled) { return; } setActive(itemIndex); }, onClick: function onClick() { if (!disabled) { onSelectValue(value); } }, style: style }), external_window_React_["createElement"]("div", { className: "".concat(optionPrefixCls, "-content") }, mergedLabel || value), external_window_React_["isValidElement"](menuItemSelectedIcon) || selected, iconVisible && external_window_React_["createElement"](TransBtn["a" /* default */], { className: "".concat(itemPrefixCls, "-option-state"), customizeIcon: menuItemSelectedIcon, customizeIconProps: { isSelected: selected } }, selected ? '✓' : null)); })); }; var RefOptionList = external_window_React_["forwardRef"](OptionList_OptionList); RefOptionList.displayName = 'OptionList'; /* harmony default export */ var es_OptionList = (RefOptionList); // CONCATENATED MODULE: ./node_modules/rc-select/es/Option.js /** This is a placeholder, not real render in dom */ var Option = function Option() { return null; }; Option.isSelectOption = true; /* harmony default export */ var es_Option = (Option); // CONCATENATED MODULE: ./node_modules/rc-select/es/OptGroup.js /** This is a placeholder, not real render in dom */ var OptGroup = function OptGroup() { return null; }; OptGroup.isSelectOptGroup = true; /* harmony default export */ var es_OptGroup = (OptGroup); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js var objectSpread2 = __webpack_require__("VTBJ"); // EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js var toArray = __webpack_require__("Zm9Q"); // CONCATENATED MODULE: ./node_modules/rc-select/es/utils/legacyUtil.js function convertNodeToOption(node) { var key = node.key, _node$props = node.props, children = _node$props.children, value = _node$props.value, restProps = Object(objectWithoutProperties["a" /* default */])(_node$props, ["children", "value"]); return Object(objectSpread2["a" /* default */])({ key: key, value: value !== undefined ? value : key, children: children }, restProps); } function convertChildrenToData(nodes) { var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return Object(toArray["a" /* default */])(nodes).map(function (node, index) { if (!external_window_React_["isValidElement"](node) || !node.type) { return null; } var isSelectOptGroup = node.type.isSelectOptGroup, key = node.key, _node$props2 = node.props, children = _node$props2.children, restProps = Object(objectWithoutProperties["a" /* default */])(_node$props2, ["children"]); if (optionOnly || !isSelectOptGroup) { return convertNodeToOption(node); } return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({ key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"), label: key }, restProps), {}, { options: convertChildrenToData(children) }); }).filter(function (data) { return data; }); } // EXTERNAL MODULE: ./node_modules/rc-select/es/utils/valueUtil.js var valueUtil = __webpack_require__("2Qr1"); // EXTERNAL MODULE: ./node_modules/rc-select/es/generate.js + 11 modules var generate = __webpack_require__("qNPg"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js var esm_typeof = __webpack_require__("U8pU"); // EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js var warning = __webpack_require__("Kwbf"); // EXTERNAL MODULE: ./node_modules/rc-select/es/utils/commonUtil.js var commonUtil = __webpack_require__("WKfj"); // CONCATENATED MODULE: ./node_modules/rc-select/es/utils/warningPropsUtil.js function warningProps(props) { var mode = props.mode, options = props.options, children = props.children, backfill = props.backfill, allowClear = props.allowClear, placeholder = props.placeholder, getInputElement = props.getInputElement, showSearch = props.showSearch, onSearch = props.onSearch, defaultOpen = props.defaultOpen, autoFocus = props.autoFocus, labelInValue = props.labelInValue, value = props.value, inputValue = props.inputValue, optionLabelProp = props.optionLabelProp; var multiple = mode === 'multiple' || mode === 'tags'; var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox'; var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled Object(warning["a" /* default */])(mode !== 'tags' || mergedOptions.every(function (opt) { return !opt.disabled; }), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type if (mode === 'tags' || mode === 'combobox') { var hasNumberValue = mergedOptions.some(function (item) { if (item.options) { return item.options.some(function (opt) { return typeof ('value' in opt ? opt.value : opt.key) === 'number'; }); } return typeof ('value' in item ? item.value : item.key) === 'number'; }); Object(warning["a" /* default */])(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.'); } // `combobox` should not use `optionLabelProp` Object(warning["a" /* default */])(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill` Object(warning["a" /* default */])(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement` Object(warning["a" /* default */])(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder` Object(warning["b" /* noteOnce */])(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch` if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') { Object(warning["a" /* default */])(false, '`onSearch` should work with `showSearch` instead of use alone.'); } Object(warning["b" /* noteOnce */])(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.'); if (value !== undefined && value !== null) { var values = Object(commonUtil["d" /* toArray */])(value); Object(warning["a" /* default */])(!labelInValue || values.every(function (val) { return Object(esm_typeof["a" /* default */])(val) === 'object' && ('key' in val || 'value' in val); }), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`'); Object(warning["a" /* default */])(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`'); } // Syntactic sugar should use correct children type if (children) { var invalidateChildType = null; Object(toArray["a" /* default */])(children).some(function (node) { if (!external_window_React_["isValidElement"](node) || !node.type) { return false; } var type = node.type; if (type.isSelectOption) { return false; } if (type.isSelectOptGroup) { var allChildrenValid = Object(toArray["a" /* default */])(node.props.children).every(function (subNode) { if (!external_window_React_["isValidElement"](subNode) || !node.type || subNode.type.isSelectOption) { return true; } invalidateChildType = subNode.type; return false; }); if (allChildrenValid) { return false; } return true; } invalidateChildType = type; return true; }); if (invalidateChildType) { Object(warning["a" /* default */])(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`.")); } Object(warning["a" /* default */])(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.'); } } /* harmony default export */ var warningPropsUtil = (warningProps); // CONCATENATED MODULE: ./node_modules/rc-select/es/Select.js /** * To match accessibility requirement, we always provide an input in the component. * Other element will not set `tabIndex` to avoid `onBlur` sequence problem. * For focused select, we set `aria-live="polite"` to update the accessibility content. * * ref: * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions * * New api: * - listHeight * - listItemHeight * - component * * Remove deprecated api: * - multiple * - tags * - combobox * - firstActiveValue * - dropdownMenuStyle * - openClassName (Not list in api) * * Update: * - `backfill` only support `combobox` mode * - `combobox` mode not support `labelInValue` since it's meaningless * - `getInputElement` only support `combobox` mode * - `onChange` return OptionData instead of ReactNode * - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode * - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option * - `combobox` mode not support `optionLabelProp` */ var RefSelect = Object(generate["a" /* default */])({ prefixCls: 'rc-select', components: { optionList: es_OptionList }, convertChildrenToData: convertChildrenToData, flattenOptions: valueUtil["d" /* flattenOptions */], getLabeledValue: valueUtil["e" /* getLabeledValue */], filterOptions: valueUtil["b" /* filterOptions */], isValueDisabled: valueUtil["g" /* isValueDisabled */], findValueOption: valueUtil["c" /* findValueOption */], warningProps: warningPropsUtil, fillOptionsWithMissingValue: valueUtil["a" /* fillOptionsWithMissingValue */] }); /** * Typescript not support generic with function component, * we have to wrap an class component to handle this. */ var Select_Select = /*#__PURE__*/function (_React$Component) { Object(inherits["a" /* default */])(Select, _React$Component); var _super = Object(createSuper["a" /* default */])(Select); function Select() { var _this; Object(classCallCheck["a" /* default */])(this, Select); _this = _super.apply(this, arguments); _this.selectRef = external_window_React_["createRef"](); _this.focus = function () { _this.selectRef.current.focus(); }; _this.blur = function () { _this.selectRef.current.blur(); }; return _this; } Object(createClass["a" /* default */])(Select, [{ key: "render", value: function render() { return external_window_React_["createElement"](RefSelect, Object.assign({ ref: this.selectRef }, this.props)); } }]); return Select; }(external_window_React_["Component"]); Select_Select.Option = es_Option; Select_Select.OptGroup = es_OptGroup; /* harmony default export */ var es_Select = (Select_Select); // CONCATENATED MODULE: ./node_modules/rc-select/es/index.js /* harmony default export */ var rc_select_es = __webpack_exports__["c"] = (es_Select); /***/ }), /***/ "M8RZ": /*!**********************************!*\ !*** ./src/components/modal.tsx ***! \**********************************/ /*! exports provided: default */ /*! exports used: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Dialog; }); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/classCallCheck */ "fWQN"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createClass */ "mtLc"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/inherits */ "yKVA"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createSuper */ "879j"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "cDcd"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-dom */ "faye"); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_5__); var Dialog = /*#__PURE__*/function (_React$Component) { Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(Dialog, _React$Component); var _super = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(Dialog); function Dialog(props) { var _this; Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, Dialog); _this = _super.call(this, props); var doc = window.document; _this.node = doc.createElement('div'); doc.body.appendChild(_this.node); return _this; } Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Dialog, [{ key: "render", value: function render() { var children = this.props.children; return /*#__PURE__*/Object(react_dom__WEBPACK_IMPORTED_MODULE_5__["createPortal"])(children, this.node); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.document.body.removeChild(this.node); } }]); return Dialog; }(react__WEBPACK_IMPORTED_MODULE_4___default.a.Component); /***/ }), /***/ "NcEG": /*!****************************************************************************!*\ !*** ./src/pages/User/Detail/Topics/Exercise/Detail/index.tsx + 6 modules ***! \****************************************************************************/ /*! exports provided: default */ /*! all exports used */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./src/pages/User/Detail/Topics/Exercise/Detail/components/editor.less?modules (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./src/pages/User/Detail/Topics/Exercise/Detail/index.less?modules (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./src/.umi-production/core/umiExports.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/Editor/NullChildEditor/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/Editor/NullMDEditor.js */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/NoData/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/pages/User/Detail/Topics/components/SendToClassModal.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/service/exercise.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./src/service/polls.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./src/service/user.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./src/utils/util.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/breadcrumb/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/breadcrumb/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/checkbox/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/checkbox/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/divider/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/divider/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/layout/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/layout/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/menu/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tabs/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tabs/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tooltip/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/tooltip/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router-dom/esm/react-router-dom.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router/esm/react-router.js */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js var style = __webpack_require__("+L6B"); // EXTERNAL MODULE: ./node_modules/antd/es/button/index.js var es_button = __webpack_require__("2/Rp"); // EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js var input_style = __webpack_require__("5NDa"); // EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 3 modules var input = __webpack_require__("5rEg"); // EXTERNAL MODULE: ./node_modules/antd/es/tabs/style/index.js var tabs_style = __webpack_require__("Znn+"); // EXTERNAL MODULE: ./node_modules/antd/es/tabs/index.js var tabs = __webpack_require__("ZTPi"); // EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js var modal_style = __webpack_require__("2qtc"); // EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules var modal = __webpack_require__("kLXV"); // EXTERNAL MODULE: ./node_modules/antd/es/row/style/index.js var row_style = __webpack_require__("14J3"); // EXTERNAL MODULE: ./node_modules/antd/es/row/index.js var row = __webpack_require__("BMrR"); // EXTERNAL MODULE: ./node_modules/antd/es/col/style/index.js var col_style = __webpack_require__("jCWc"); // EXTERNAL MODULE: ./node_modules/antd/es/col/index.js var col = __webpack_require__("kPKH"); // EXTERNAL MODULE: ./node_modules/antd/es/breadcrumb/style/index.js var breadcrumb_style = __webpack_require__("sPJy"); // EXTERNAL MODULE: ./node_modules/antd/es/breadcrumb/index.js + 3 modules var breadcrumb = __webpack_require__("bE4q"); // EXTERNAL MODULE: ./node_modules/antd/es/divider/style/index.js var divider_style = __webpack_require__("/zsF"); // EXTERNAL MODULE: ./node_modules/antd/es/divider/index.js var divider = __webpack_require__("PArb"); // EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js var message_style = __webpack_require__("miYZ"); // EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules var message = __webpack_require__("tsqr"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js var asyncToGenerator = __webpack_require__("9og8"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js var objectSpread2 = __webpack_require__("k1fw"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules var toConsumableArray = __webpack_require__("oBTY"); // EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js var form_style = __webpack_require__("y8nQ"); // EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 11 modules var es_form = __webpack_require__("Vl3Y"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("tJVT"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules var objectWithoutProperties = __webpack_require__("PpiC"); // EXTERNAL MODULE: ./node_modules/antd/es/layout/style/index.js var layout_style = __webpack_require__("B9cy"); // EXTERNAL MODULE: ./node_modules/antd/es/layout/index.js var layout = __webpack_require__("Ol7k"); // EXTERNAL MODULE: ./node_modules/antd/es/menu/style/index.js var menu_style = __webpack_require__("lUTK"); // EXTERNAL MODULE: ./node_modules/antd/es/menu/index.js + 3 modules var menu = __webpack_require__("BvKs"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js var regenerator = __webpack_require__("WmNS"); var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_); // EXTERNAL MODULE: ./node_modules/react-router/esm/react-router.js var react_router = __webpack_require__("Ty5D"); // EXTERNAL MODULE: ./node_modules/react-router-dom/esm/react-router-dom.js var react_router_dom = __webpack_require__("55Ip"); // EXTERNAL MODULE: ./src/.umi-production/core/umiExports.ts + 17 modules var umiExports = __webpack_require__("9kvl"); // EXTERNAL MODULE: ./src/service/polls.ts var service_polls = __webpack_require__("tgas"); // EXTERNAL MODULE: ./src/service/user.ts var service_user = __webpack_require__("jb+D"); // EXTERNAL MODULE: ./src/components/NoData/index.tsx var NoData = __webpack_require__("BdwD"); // EXTERNAL MODULE: ./node_modules/antd/es/input-number/style/index.js var input_number_style = __webpack_require__("giR+"); // EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js var input_number = __webpack_require__("fyUT"); // EXTERNAL MODULE: ./node_modules/antd/es/checkbox/style/index.js var checkbox_style = __webpack_require__("sRBo"); // EXTERNAL MODULE: ./node_modules/antd/es/checkbox/index.js + 2 modules var es_checkbox = __webpack_require__("kaz8"); // EXTERNAL MODULE: ./node_modules/antd/es/tooltip/style/index.js var tooltip_style = __webpack_require__("5Dmo"); // EXTERNAL MODULE: ./node_modules/antd/es/tooltip/index.js + 1 modules var tooltip = __webpack_require__("3S7+"); // EXTERNAL MODULE: ./src/service/exercise.ts var exercise = __webpack_require__("V0Rq"); // EXTERNAL MODULE: ./src/components/markdown-editor/index.tsx + 6 modules var markdown_editor = __webpack_require__("Ot1p"); // EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules var RenderHtml = __webpack_require__("9Bee"); // EXTERNAL MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/editor.less?modules var editormodules = __webpack_require__("xvzu"); var editormodules_default = /*#__PURE__*/__webpack_require__.n(editormodules); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/MultipleEditor/index.tsx var tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var MultipleEditor_SingleEditor = function SingleEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"]); var _useState = Object(external_window_React_["useState"])([]), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), questionChoiceList = _useState2[0], setQuestionChoiceList = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), activeEditor = _useState4[0], setActiveEditor = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])([]), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), activeAnswer = _useState6[0], setActiveAnswer = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(''), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), title = _useState8[0], setTitle = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(5), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), score = _useState10[0], setScore = _useState10[1]; var _useState11 = Object(external_window_React_["useState"])(false), _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), isEdit = _useState12[0], setIsEdit = _useState12[1]; var params = Object(react_router["i" /* useParams */])(); Object(external_window_React_["useEffect"])(function () { setQuestionChoiceList(['', '', '', '']); }, []); Object(external_window_React_["useEffect"])(function () { if (!(editData !== null && editData !== void 0 && editData.question_choices)) { setIsEdit(true); return; } setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title); setScore(parseInt(editData === null || editData === void 0 ? void 0 : editData.question_score)); setQuestionChoiceList(editData === null || editData === void 0 ? void 0 : editData.question_choices.map(function (item) { return item.choice_text; })); var answerIndexs = []; editData === null || editData === void 0 ? void 0 : editData.standard_answer.map(function (item, index) { answerIndexs.push(item - 1); }); setActiveAnswer(answerIndexs); }, [editData]); Object(external_window_React_["useImperativeHandle"])(ref, function () { return { onSave: onSave, isEdit: isEdit }; }); var onSave = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var findNotAnswerIndex, choices, res; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (title) { _context.next = 3; break; } message["b" /* default */].info("请您输入题目"); return _context.abrupt("return", false); case 3: findNotAnswerIndex = questionChoiceList.findIndex(function (item) { return !item; }); if (!(findNotAnswerIndex > -1)) { _context.next = 7; break; } message["b" /* default */].info("\u8BF7\u5148\u8F93\u5165 ".concat(tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9")); return _context.abrupt("return", false); case 7: if (activeAnswer.length) { _context.next = 10; break; } message["b" /* default */].info("请设置本题的正确答案,点击选项A/B...即可完成设置"); return _context.abrupt("return", false); case 10: if (!(activeAnswer.length < 1)) { _context.next = 13; break; } message["b" /* default */].info("请选择答案"); return _context.abrupt("return", false); case 13: choices = questionChoiceList.map(function (item, index) { return { choice_text: item, is_answer: activeAnswer.includes(index) ? index + 1 : 0 }; }); if (!editData.question_id) { _context.next = 20; break; } _context.next = 17; return dispatch({ type: "exercise/editExerciseQuestion", payload: { "id": editData.question_id, "question_title": title, "question_type": 1, "question_score": "5.0", "question_choices": choices.map(function (item) { return item.choice_text; }), "standard_answers": choices.filter(function (item) { return item.is_answer; }).map(function (item) { return item.is_answer; }) } }); case 17: res = _context.sent; _context.next = 23; break; case 20: _context.next = 22; return dispatch({ type: "exercise/addExerciseQuestion", payload: { "categoryId": params.categoryId, "question_title": title, "question_type": 1, "question_score": "5.0", "question_choices": choices.map(function (item) { return item.choice_text; }), "standard_answers": choices.filter(function (item) { return item.is_answer; }).map(function (item) { return item.is_answer; }) } }); case 22: res = _context.sent; case 23: if (res.status === 0) { message["b" /* default */].success("保存成功"); setIsEdit(false); dispatch({ type: "exercise/editExercise", payload: Object(objectSpread2["a" /* default */])({}, params) }); } case 24: case "end": return _context.stop(); } } }, _callee); })); return function onSave() { return _ref2.apply(this, arguments); }; }(); var actionArr = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(item) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11; break; case 3: modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return Object(exercise["m" /* exeriseQuestionDelete */])({ id: editData.question_id }); case 2: dispatch({ type: "exercise/editExercise", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 3: case "end": return _context2.stop(); } } }, _callee2); }))(); } }); return _context3.abrupt("break", 11); case 5: _context3.next = 7; return dispatch({ type: "exercise/exeriseMoveUpDown", payload: { id: editData.question_id, opr: item.id } }); case 7: dispatch({ type: "exercise/editExercise", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context3.abrupt("break", 11); case 9: setIsEdit(true); return _context3.abrupt("break", 11); case 11: case "end": return _context3.stop(); } } }, _callee3); })); return function actionClick(_x) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$question_ch; return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, editData.key, "\u3001\u591A\u9009\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { key: index, placement: "bottom", title: item.name }, /*#__PURE__*/external_window_React_default.a.createElement("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon })); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt5" }, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: editData.question_title })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionChoices }, editData === null || editData === void 0 ? void 0 : (_editData$question_ch = editData.question_choices) === null || _editData$question_ch === void 0 ? void 0 : _editData$question_ch.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(es_checkbox["a" /* default */], { key: index, checked: editData.standard_answer.includes(index + 1), disabled: true }, tagList[index], ".")), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], { flex: "1" }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "c-black font14" }, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: item.choice_text })))); }))); }; var showEdit = function showEdit() { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, "\u9009\u62E9\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.required }, "*"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u9898\u5E72\uFF1A")), /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-title", watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72", defaultValue: title, onChange: function onChange(value) { return setTitle(value); } }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.required }, "*"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u7B54\u6848\u9009\u9879\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.colorGray }, "\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))), questionChoiceList.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.choiceWrap, key: index }, /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { title: "\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848", placement: "left" }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "".concat(editormodules_default.a.answer, " ").concat(activeAnswer.includes(index) ? editormodules_default.a.activeAnswer : ''), onClick: function onClick() { if (activeAnswer.includes(index)) { setActiveAnswer(activeAnswer.filter(function (item) { return item !== index; })); } else { setActiveAnswer([].concat(Object(toConsumableArray["a" /* default */])(activeAnswer), [index])); } } }, tagList[index])), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.editorWrap }, activeEditor === index ? /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-option-".concat(index), watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879", defaultValue: item, onChange: function onChange(value) { questionChoiceList[index] = value; setQuestionChoiceList(questionChoiceList); } }) : /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.htmlWrap, onClick: function onClick() { return setActiveEditor(index); } }, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: item }))), index > 1 && /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { title: "\u5220\u9664" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "".concat(editormodules_default.a.deleteIcon, " iconfont icon-htmal5icon19"), onClick: function onClick() { return setQuestionChoiceList(questionChoiceList.filter(function (_, key) { return key !== index; })); } })), index < 7 && index === questionChoiceList.length - 1 && /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "".concat(editormodules_default.a.addIcon, " iconfont icon-roundaddfill ml6"), onClick: function onClick() { return setQuestionChoiceList([].concat(Object(toConsumableArray["a" /* default */])(questionChoiceList), [''])); } }))); }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "c-orange" }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], { value: score, max: 10000, min: -1, onChange: function onChange(value) { setScore(value); } }), " \u5206"), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "tr" }, editData.question_id && /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "default", onClick: function onClick() { return setIsEdit(false); } }, "\u53D6\u6D88"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); } }, "\u4FDD\u5B58"))); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: editormodules_default.a.wrap }, !isEdit && showList(), isEdit && showEdit()); }; /* harmony default export */ var MultipleEditor = (Object(umiExports["a" /* connect */])(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/Object(external_window_React_["forwardRef"])(MultipleEditor_SingleEditor))); // EXTERNAL MODULE: ./node_modules/antd/es/radio/style/index.js var radio_style = __webpack_require__("7Kak"); // EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 4 modules var es_radio = __webpack_require__("9yH6"); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/SingleEditor/index.tsx var SingleEditor_tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var SingleEditor_SingleEditor = function SingleEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"]); var _useState = Object(external_window_React_["useState"])([]), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), questionChoiceList = _useState2[0], setQuestionChoiceList = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), activeEditor = _useState4[0], setActiveEditor = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])([]), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), activeAnswer = _useState6[0], setActiveAnswer = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(''), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), title = _useState8[0], setTitle = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(0), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), score = _useState10[0], setScore = _useState10[1]; var _useState11 = Object(external_window_React_["useState"])(false), _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), isEdit = _useState12[0], setIsEdit = _useState12[1]; var params = Object(react_router["i" /* useParams */])(); Object(external_window_React_["useEffect"])(function () { setQuestionChoiceList(['', '', '', '']); }, []); Object(external_window_React_["useEffect"])(function () { if (!(editData !== null && editData !== void 0 && editData.question_choices)) { setIsEdit(true); return; } setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title); setScore(parseInt(editData === null || editData === void 0 ? void 0 : editData.question_score)); setQuestionChoiceList(editData === null || editData === void 0 ? void 0 : editData.question_choices.map(function (item) { return item.choice_text; })); var answerIndexs = []; editData === null || editData === void 0 ? void 0 : editData.standard_answer.map(function (item, index) { answerIndexs.push(item - 1); }); setActiveAnswer(answerIndexs); }, [editData]); Object(external_window_React_["useImperativeHandle"])(ref, function () { return { onSave: onSave, isEdit: isEdit }; }); var onSave = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var findNotAnswerIndex, choices, res; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (title) { _context.next = 3; break; } message["b" /* default */].info("请您输入题目"); return _context.abrupt("return", false); case 3: findNotAnswerIndex = questionChoiceList.findIndex(function (item) { return !item; }); if (!(findNotAnswerIndex > -1)) { _context.next = 7; break; } message["b" /* default */].info("\u8BF7\u5148\u8F93\u5165 ".concat(SingleEditor_tagList[findNotAnswerIndex], " \u9009\u9879\u7684\u5185\u5BB9")); return _context.abrupt("return", false); case 7: if (activeAnswer.length) { _context.next = 10; break; } message["b" /* default */].info("请设置本题的正确答案,点击选项A/B...即可完成设置"); return _context.abrupt("return", false); case 10: if (!(activeAnswer.length < 1)) { _context.next = 13; break; } message["b" /* default */].info("请选择答案"); return _context.abrupt("return", false); case 13: choices = questionChoiceList.map(function (item, index) { return { choice_text: item, is_answer: activeAnswer.includes(index) ? index + 1 : 0 }; }); if (!editData.question_id) { _context.next = 20; break; } _context.next = 17; return Object(service_polls["u" /* putExerciseBankQuestions */])({ "id": editData.question_id, "question_title": title, "question_type": 1, "question_score": score, "question_choices": choices.map(function (item) { return item.choice_text; }), "standard_answers": choices.filter(function (item) { return item.is_answer; }).map(function (item) { return item.is_answer; }) }); case 17: res = _context.sent; _context.next = 23; break; case 20: _context.next = 22; return Object(service_polls["a" /* addExerciseBankQuestions */])({ "exercise_bank_id": params.topicId, "question_title": title, "question_type": 1, "question_score": "5.0", "question_choices": choices.map(function (item) { return item.choice_text; }), "standard_answers": choices.filter(function (item) { return item.is_answer; }).map(function (item) { return item.is_answer; }) }); case 22: res = _context.sent; case 23: if (res.status === 0) { message["b" /* default */].success("保存成功"); setIsEdit(false); } _context.next = 26; return dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 26: case "end": return _context.stop(); } } }, _callee); })); return function onSave() { return _ref2.apply(this, arguments); }; }(); var actionArr = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(item) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11; break; case 3: modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return Object(service_polls["e" /* deleteExerciseBanksQuestion */])({ pollsId: editData.question_id }); case 2: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 3: case "end": return _context2.stop(); } } }, _callee2); }))(); } }); return _context3.abrupt("break", 11); case 5: _context3.next = 7; return Object(service_polls["j" /* exercisesBanksMoveUpDown */])({ exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id, opr: item.id }); case 7: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context3.abrupt("break", 11); case 9: setIsEdit(true); return _context3.abrupt("break", 11); case 11: case "end": return _context3.stop(); } } }, _callee3); })); return function actionClick(_x) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$question_ch; return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, editData.key, "\u3001\u5355\u9009\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { key: index, placement: "bottom", title: item.name }, /*#__PURE__*/external_window_React_default.a.createElement("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon })); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt5" }, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: editData.question_title })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionChoices }, editData === null || editData === void 0 ? void 0 : (_editData$question_ch = editData.question_choices) === null || _editData$question_ch === void 0 ? void 0 : _editData$question_ch.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { key: index, checked: editData.standard_answer.includes(index + 1), disabled: true }, SingleEditor_tagList[index], ".")), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], { flex: "1" }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "c-black font14" }, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: item.choice_text })))); }))); }; var showEdit = function showEdit() { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, "\u9009\u62E9\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09")), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.required }, "*"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u9898\u5E72\uFF1A")), /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-title", watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72", defaultValue: title, onChange: function onChange(value) { return setTitle(value); } }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.required }, "*"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u7B54\u6848\u9009\u9879\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.colorGray }, "\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))), questionChoiceList.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.choiceWrap, key: index }, /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { title: "\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848", placement: "left" }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "".concat(editormodules_default.a.answer, " ").concat(activeAnswer.includes(index) ? editormodules_default.a.activeAnswer : ''), onClick: function onClick() { if (activeAnswer.includes(index)) { setActiveAnswer(activeAnswer.filter(function (item) { return item !== index; })); } else { setActiveAnswer([].concat(Object(toConsumableArray["a" /* default */])(activeAnswer), [index])); } } }, SingleEditor_tagList[index])), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.editorWrap }, activeEditor === index ? /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-option-".concat(index), watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9009\u9879", defaultValue: item, onChange: function onChange(value) { questionChoiceList[index] = value; setQuestionChoiceList(questionChoiceList); } }) : /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.htmlWrap, onClick: function onClick() { return setActiveEditor(index); } }, /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: item }))), index > 1 && /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { title: "\u5220\u9664" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "".concat(editormodules_default.a.deleteIcon, " iconfont icon-htmal5icon19"), onClick: function onClick() { return setQuestionChoiceList(questionChoiceList.filter(function (_, key) { return key !== index; })); } })), index < 7 && index === questionChoiceList.length - 1 && /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { title: "\u65B0\u589E\u53C2\u8003\u7B54\u6848" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "".concat(editormodules_default.a.addIcon, " iconfont icon-roundaddfill ml6"), onClick: function onClick() { return setQuestionChoiceList([].concat(Object(toConsumableArray["a" /* default */])(questionChoiceList), [''])); } }))); }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "c-orange" }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\u8F93\u5165\u6846\u53EF\u8BBE\u7F6E\u7B54\u6848\uFF1B\u9009\u4E2D\u7684\u9009\u9879\u5373\u4E3A\u6B63\u786E\u7B54\u6848\uFF0C\u9009\u62E9\u591A\u4E2A\u7B54\u6848\u5373\u4E3A\u591A\u9009\u9898"), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], { value: score, max: 10000, min: -1, onChange: function onChange(value) { setScore(value); } }), " \u5206"), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "tr" }, editData.question_id && /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "default", onClick: function onClick() { return setIsEdit(false); } }, "\u53D6\u6D88"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); } }, "\u4FDD\u5B58"))); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: editormodules_default.a.wrap }, !isEdit && showList(), isEdit && showEdit()); }; /* harmony default export */ var components_SingleEditor = (Object(umiExports["a" /* connect */])(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/Object(external_window_React_["forwardRef"])(SingleEditor_SingleEditor))); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/JudgmentEditor/index.tsx var JudgmentEditor_tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var JudgmentEditor_JudgmentEditor = function JudgmentEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"]); var _useState = Object(external_window_React_["useState"])(), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), activeAnswer = _useState2[0], setActiveAnswer = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(''), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), title = _useState4[0], setTitle = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])(false), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), isEdit = _useState6[0], setIsEdit = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(5), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), score = _useState8[0], setScore = _useState8[1]; var params = Object(react_router["i" /* useParams */])(); Object(external_window_React_["useEffect"])(function () { if (!(editData !== null && editData !== void 0 && editData.question_choices)) { setIsEdit(true); return; } setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title); setScore(editData === null || editData === void 0 ? void 0 : editData.question_score); // const answer = editData?.question_choices.find(item => item.is_answer); setActiveAnswer(editData.standard_answer[0] + ''); }, [editData]); Object(external_window_React_["useImperativeHandle"])(ref, function () { return { onSave: onSave, isEdit: isEdit }; }); var onSave = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var choices, res; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (title) { _context.next = 3; break; } message["b" /* default */].info("请您输入题干"); return _context.abrupt("return", false); case 3: if (activeAnswer) { _context.next = 6; break; } message["b" /* default */].info("请先点击选择本选择题的正确选项"); return _context.abrupt("return", false); case 6: choices = [{ choice_text: "正确", is_answer: activeAnswer === "1" ? 1 : 0 }, { choice_text: "错误", is_answer: activeAnswer === "2" ? 2 : 0 }]; if (!editData.question_id) { _context.next = 13; break; } _context.next = 10; return Object(service_polls["u" /* putExerciseBankQuestions */])({ "id": editData.question_id, "question_title": title, "question_type": 2, "question_score": score, "question_choices": choices.map(function (item) { return item.choice_text; }), "standard_answers": choices.filter(function (item) { return item.is_answer; }).map(function (item) { return item.is_answer; }) }); case 10: res = _context.sent; _context.next = 16; break; case 13: _context.next = 15; return Object(service_polls["a" /* addExerciseBankQuestions */])({ "exercise_bank_id": params.topicId, "question_title": title, "question_type": 2, "question_score": score, "question_choices": choices.map(function (item) { return item.choice_text; }), "standard_answers": choices.filter(function (item) { return item.is_answer; }).map(function (item) { return item.is_answer; }) }); case 15: res = _context.sent; case 16: if (res.status === 0) { message["b" /* default */].success("保存成功"); setIsEdit(false); } dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context.abrupt("return", { name: title, choices: choices }); case 19: case "end": return _context.stop(); } } }, _callee); })); return function onSave() { return _ref2.apply(this, arguments); }; }(); var actionArr = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(item) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11; break; case 3: modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return Object(service_polls["e" /* deleteExerciseBanksQuestion */])({ pollsId: editData.question_id }); case 2: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 3: case "end": return _context2.stop(); } } }, _callee2); }))(); } }); return _context3.abrupt("break", 11); case 5: _context3.next = 7; return Object(service_polls["j" /* exercisesBanksMoveUpDown */])({ exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id, opr: item.id }); case 7: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context3.abrupt("break", 11); case 9: setIsEdit(true); return _context3.abrupt("break", 11); case 11: case "end": return _context3.stop(); } } }, _callee3); })); return function actionClick(_x) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$question_ch; return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, editData.key, "\u3001\u5224\u65AD\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { key: index, placement: "bottom", title: item.name }, /*#__PURE__*/external_window_React_default.a.createElement("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon })); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt5" }, editData.question_title), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionChoices }, editData === null || editData === void 0 ? void 0 : (_editData$question_ch = editData.question_choices) === null || _editData$question_ch === void 0 ? void 0 : _editData$question_ch.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { key: index, checked: editData.standard_answer.includes(index + 1), disabled: true }, JudgmentEditor_tagList[index], ". ", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "c-black font14" }, item.choice_text)); }))); }; var showEdit = function showEdit() { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, "\u5224\u65AD\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848\uFF09"), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.required }, "*"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u9898\u5E72\uFF1A")), /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-title", watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72", defaultValue: title, onChange: function onChange(value) { return setTitle(value); } }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.required }, "*"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u7B54\u6848\u9009\u9879\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.colorGray }, "\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */].Group, { buttonStyle: "solid", value: activeAnswer, onChange: function onChange(e) { return setActiveAnswer(e.target.value); } }, /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */].Button, { value: "1", className: "".concat(editormodules_default.a.radio, " mr40") }, "\u6B63\u786E"), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */].Button, { value: "2", className: editormodules_default.a.radio }, "\u9519\u8BEF")), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "c-orange" }, "\u6E29\u99A8\u63D0\u793A\uFF1A\u70B9\u51FB\u9009\u9879\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848"), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], { value: score, max: 10000, min: -1, onChange: function onChange(value) { setScore(value); } }), " \u5206"), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "tr" }, editData.question_id && /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "default", onClick: function onClick() { return setIsEdit(false); } }, "\u53D6\u6D88"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); } }, "\u4FDD\u5B58"))); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: editormodules_default.a.wrap }, !isEdit && showList(), isEdit && showEdit()); }; /* harmony default export */ var components_JudgmentEditor = (Object(umiExports["a" /* connect */])(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/Object(external_window_React_["forwardRef"])(JudgmentEditor_JudgmentEditor))); // EXTERNAL MODULE: ./src/components/Editor/NullMDEditor.js var NullMDEditor = __webpack_require__("kqOp"); // EXTERNAL MODULE: ./src/components/Editor/NullChildEditor/index.js var NullChildEditor = __webpack_require__("7qnI"); // EXTERNAL MODULE: ./src/utils/util.tsx + 1 modules var util = __webpack_require__("1vsH"); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/CompletionEditor/index.tsx var CompletionEditor_tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var CompletionEditor_CompletionEditor = function CompletionEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, editData = _ref.editData, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["problemset", "globalSetting", "loading", "dispatch", "editData"]); var _useState = Object(external_window_React_["useState"])(''), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), title = _useState2[0], setTitle = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(''), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), analysis = _useState4[0], setAnalysis = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])([]), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), answerList = _useState6[0], setAnswerList = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(''), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), activeOptionErrorIndex = _useState8[0], setActiveOptionErrorIndex = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), checked = _useState10[0], setChecked = _useState10[1]; var _useState11 = Object(external_window_React_["useState"])(false), _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), firstSetAnswerFlag = _useState12[0], setFirstSetAnswerFlag = _useState12[1]; var _useState13 = Object(external_window_React_["useState"])(5), _useState14 = Object(slicedToArray["a" /* default */])(_useState13, 2), score = _useState14[0], setScore = _useState14[1]; var _useState15 = Object(external_window_React_["useState"])(false), _useState16 = Object(slicedToArray["a" /* default */])(_useState15, 2), isEdit = _useState16[0], setIsEdit = _useState16[1]; var params = Object(react_router["i" /* useParams */])(); Object(external_window_React_["useEffect"])(function () { if (!(editData !== null && editData !== void 0 && editData.question_title)) { setIsEdit(true); return; } setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title); setChecked(editData === null || editData === void 0 ? void 0 : editData.is_ordered); setScore(editData === null || editData === void 0 ? void 0 : editData.question_score); var answer = editData === null || editData === void 0 ? void 0 : editData.standard_answer.map(function (item) { return item.answer_text; }); setAnswerList(answer); }, [problemset.editData]); Object(external_window_React_["useEffect"])(function () { setFirstSetAnswerFlag(false); }, [isEdit]); Object(external_window_React_["useImperativeHandle"])(ref, function () { return { onSave: onSave, isEdit: isEdit }; }); var onSave = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var answerArray, isEmpty, res; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: answerArray = []; isEmpty = false; answerList.forEach(function (answers, index) { answerArray.push({ choice_id: index + 1, answer_text: [] }); answers.forEach(function (item, itemIndex) { answerArray[index].answer_text.push(item); if (!item || !Object(util["bb" /* validateLength */])(item, 10000)) { setActiveOptionErrorIndex("".concat(index, "-").concat(itemIndex)); message["b" /* default */].info(!item ? "\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A" : "答案不能超过10000字符"); isEmpty = true; } }); }); if (!isEmpty) { _context.next = 5; break; } return _context.abrupt("return", false); case 5: if (!editData.question_id) { _context.next = 11; break; } _context.next = 8; return Object(service_polls["u" /* putExerciseBankQuestions */])({ "id": editData.question_id, "question_title": title, "question_type": 3, "question_score": score, "is_ordered": checked, "standard_answers": answerArray }); case 8: res = _context.sent; _context.next = 14; break; case 11: _context.next = 13; return Object(service_polls["a" /* addExerciseBankQuestions */])({ "exercise_bank_id": params.topicId, "question_title": title, "question_type": 3, "question_score": score, "is_ordered": checked, "standard_answers": answerArray }); case 13: res = _context.sent; case 14: if (res.status === 0) { message["b" /* default */].success("保存成功"); setIsEdit(false); } dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context.abrupt("return", { name: title, analysis: analysis, standard_answers: answerArray, is_ordered: checked }); case 17: case "end": return _context.stop(); } } }, _callee); })); return function onSave() { return _ref2.apply(this, arguments); }; }(); var handlePlaceholderChange = function handlePlaceholderChange(placeholderCountBefore, placeholderCountInRange, totalPlaceholderCount) { var newStandardAnswers = answerList.slice(); if (placeholderCountInRange) { newStandardAnswers.splice(placeholderCountBefore, placeholderCountInRange); } if (totalPlaceholderCount && firstSetAnswerFlag) { for (var i = 0; i < totalPlaceholderCount; i++) { newStandardAnswers.splice(placeholderCountBefore + i, 0, [""]); } } setFirstSetAnswerFlag(true); setAnswerList(newStandardAnswers); }; var handleAnswerChange = function handleAnswerChange(index, itemIndex, val) { setActiveOptionErrorIndex(''); var newStandardAnswers = answerList.slice(); newStandardAnswers[index][itemIndex] = val; setAnswerList(newStandardAnswers); }; var handleAddChildAnswer = function handleAddChildAnswer(index) { var newStandardAnswers = answerList.slice(); newStandardAnswers[index] = [].concat(Object(toConsumableArray["a" /* default */])(newStandardAnswers[index]), ['']); setAnswerList(newStandardAnswers); }; var handleDeleteChildAnswer = function handleDeleteChildAnswer(index, childIndex) { var newStandardAnswers = answerList.slice(); if (!newStandardAnswers[index][childIndex]) { newStandardAnswers[index] = newStandardAnswers[index].filter(function (_, key) { return key !== childIndex; }); setAnswerList(newStandardAnswers); return; } modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '提示', content: '确认要删除这个参考答案吗?', className: editormodules_default.a.modal, onOk: function onOk() { newStandardAnswers[index] = newStandardAnswers[index].filter(function (_, key) { return key !== childIndex; }); setAnswerList(newStandardAnswers); } }); }; var handleDeleteChildAnswermain = function handleDeleteChildAnswermain(index) { modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '提示', content: '确认要删除这个参考答案吗?', className: editormodules_default.a.modal, onOk: function onOk() { var newStandardAnswers = answerList.slice(); newStandardAnswers = answerList.filter(function (_, key) { return index !== key; }); setAnswerList(newStandardAnswers); } }); }; var showEdit = function showEdit() { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, "\u586B\u7A7A\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF0C\u8BF7\u8BBE\u7F6E\u6807\u51C6\u7B54\u6848 \uFF1B\u652F\u6301\u6700\u591A5\u4E2A\u7A7A\uFF0C\u6BCF\u7A7A\u5F97\u5206\u6309\u7167\u672C\u9898\u7684\u603B\u5206\u5E73\u5747\u8BA1\u7B97\uFF09")), /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement(NullMDEditor["a" /* default */], { id: "completion-question-tittle", placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u76EE", height: 155, defaultValue: title, onChange: function onChange(value) { return setTitle(value); }, showNullButton: true, onPlaceholderChange: handlePlaceholderChange })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt20" }, answerList.map(function (answers, index) { return /*#__PURE__*/external_window_React_default.a.createElement(NullChildEditor["a" /* default */], { key: index, answers: answers, index: index, is_md: true, activeOptionErrorIndex: activeOptionErrorIndex, onAnswerChange: handleAnswerChange, addChildAnswer: handleAddChildAnswer, deleteChildAnswer: handleDeleteChildAnswer, deleteChildAnswermain: handleDeleteChildAnswermain }); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt20" }, answerList.length > 1 && /*#__PURE__*/external_window_React_default.a.createElement("span", null, /*#__PURE__*/external_window_React_default.a.createElement(es_checkbox["a" /* default */], { checked: checked, onChange: function onChange(e) { return setChecked(e.target.checked); }, className: "".concat(editormodules_default.a.color333, " font14") }, "\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "".concat(editormodules_default.a.color999, " font12") }, "\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], { value: score, max: 10000, min: -1, onChange: function onChange(value) { setScore(value); } }), " \u5206"), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "tr" }, editData.question_id && /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "default", onClick: function onClick() { return setIsEdit(false); } }, "\u53D6\u6D88"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); } }, "\u4FDD\u5B58"))); }; var actionArr = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(item) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11; break; case 3: modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return Object(service_polls["e" /* deleteExerciseBanksQuestion */])({ pollsId: editData.question_id }); case 2: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 3: case "end": return _context2.stop(); } } }, _callee2); }))(); } }); return _context3.abrupt("break", 11); case 5: _context3.next = 7; return Object(service_polls["j" /* exercisesBanksMoveUpDown */])({ exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id, opr: item.id }); case 7: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context3.abrupt("break", 11); case 9: setIsEdit(true); return _context3.abrupt("break", 11); case 11: case "end": return _context3.stop(); } } }, _callee3); })); return function actionClick(_x) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$standard_an; return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, editData.key, "\u3001\u586B\u7A7A\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { key: index, placement: "bottom", title: item.name }, /*#__PURE__*/external_window_React_default.a.createElement("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon })); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt5" }, editData.question_title), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionChoices }, editData === null || editData === void 0 ? void 0 : (_editData$standard_an = editData.standard_answer) === null || _editData$standard_an === void 0 ? void 0 : _editData$standard_an.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, "\u7B54\u6848\uFF08\u586B\u7A7A", item.choice_id, "\uFF09\uFF1A"), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], { flex: "1" }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { key: index, checked: editData.standard_answer.includes(index), disabled: true, value: item.answer_text }))); }))); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: editormodules_default.a.wrap }, !isEdit && showList(), isEdit && showEdit()); }; /* harmony default export */ var components_CompletionEditor = (Object(umiExports["a" /* connect */])(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/Object(external_window_React_["forwardRef"])(CompletionEditor_CompletionEditor))); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/SubjectiveEditor/index.tsx var SubjectiveEditor_tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var SubjectiveEditor_SubjectiveEditor = function SubjectiveEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, _ref$onRef = _ref.onRef, onRef = _ref$onRef === void 0 ? function () {} : _ref$onRef, editData = _ref.editData, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["problemset", "globalSetting", "loading", "dispatch", "onRef", "editData"]); var _useState = Object(external_window_React_["useState"])(''), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), title = _useState2[0], setTitle = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(''), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), analysis = _useState4[0], setAnalysis = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])(''), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), answer = _useState6[0], setAnswer = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(5), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), score = _useState8[0], setScore = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(false), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), isEdit = _useState10[0], setIsEdit = _useState10[1]; var params = Object(react_router["i" /* useParams */])(); Object(external_window_React_["useEffect"])(function () { var _editData$standard_an; if (!(editData !== null && editData !== void 0 && editData.question_title)) { setIsEdit(true); return; } setTitle(editData === null || editData === void 0 ? void 0 : editData.question_title); setAnswer(editData === null || editData === void 0 ? void 0 : (_editData$standard_an = editData.standard_answer) === null || _editData$standard_an === void 0 ? void 0 : _editData$standard_an[0]); setScore(editData === null || editData === void 0 ? void 0 : editData.question_score); }, [problemset.editData]); Object(external_window_React_["useImperativeHandle"])(ref, function () { return { onSave: onSave, isEdit: isEdit }; }); var onSave = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var res; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (title) { _context.next = 3; break; } message["b" /* default */].info("请您输入题干"); return _context.abrupt("return", false); case 3: if (!editData.question_id) { _context.next = 9; break; } _context.next = 6; return Object(service_polls["u" /* putExerciseBankQuestions */])({ "id": editData.question_id, "question_title": title, "question_type": 4, "question_score": score, "standard_answers": [answer] }); case 6: res = _context.sent; _context.next = 12; break; case 9: _context.next = 11; return Object(service_polls["a" /* addExerciseBankQuestions */])({ "exercise_bank_id": params.topicId, "question_title": title, "question_type": 4, "question_score": score, "standard_answers": [answer] }); case 11: res = _context.sent; case 12: if (res.status === 0) { message["b" /* default */].success("保存成功"); setIsEdit(false); dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); } return _context.abrupt("return", { name: title, answer_texts: [answer], analysis: analysis }); case 14: case "end": return _context.stop(); } } }, _callee); })); return function onSave() { return _ref2.apply(this, arguments); }; }(); var showEdit = function showEdit() { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, "\u7B80\u7B54\u9898"), "\uFF08\u4E3B\u89C2\u9898\uFF0C\u672A\u4F5C\u7B54\u7684\u60C5\u51B5\u4E0B\u81EA\u52A8\u8BC4\u4E3A\u96F6\u5206\uFF09")), /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-title", watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u9898\u5E72", defaultValue: title, onChange: function onChange(value) { return setTitle(value); } }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: editormodules_default.a.titleWrap }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: editormodules_default.a.title }, "\u53C2\u8003\u7B54\u6848\uFF1A")), /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-reference-answer", watch: true, height: 155, placeholder: "\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848", defaultValue: answer, onChange: function onChange(value) { return setAnswer(value); } }), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "" }, "\u5206\u503C\uFF1A", /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], { value: score, max: 10000, min: -1, onChange: function onChange(value) { setScore(value); } }), " \u5206"), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "tr" }, editData.question_id && /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "default", onClick: function onClick() { return setIsEdit(false); } }, "\u53D6\u6D88"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); } }, "\u4FDD\u5B58"))); }; var actionArr = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(item) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11; break; case 3: modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return Object(service_polls["e" /* deleteExerciseBanksQuestion */])({ pollsId: editData.question_id }); case 2: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 3: case "end": return _context2.stop(); } } }, _callee2); }))(); } }); return _context3.abrupt("break", 11); case 5: _context3.next = 7; return Object(service_polls["j" /* exercisesBanksMoveUpDown */])({ exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id, opr: item.id }); case 7: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context3.abrupt("break", 11); case 9: setIsEdit(true); return _context3.abrupt("break", 11); case 11: case "end": return _context3.stop(); } } }, _callee3); })); return function actionClick(_x) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, editData.key, "\u3001\u7B80\u7B54\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), !editData.hideAction && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { key: index, placement: "bottom", title: item.name }, /*#__PURE__*/external_window_React_default.a.createElement("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon })); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt5" }, editData.question_title), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionChoices }, /*#__PURE__*/external_window_React_default.a.createElement("p", null, /*#__PURE__*/external_window_React_default.a.createElement("strong", null, "\u53C2\u8003\u7B54\u6848\uFF1A")), /*#__PURE__*/external_window_React_default.a.createElement(RenderHtml["a" /* default */], { value: answer }))); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: editormodules_default.a.wrap }, !isEdit && showList(), isEdit && showEdit()); }; /* harmony default export */ var components_SubjectiveEditor = (Object(umiExports["a" /* connect */])(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/Object(external_window_React_["forwardRef"])(SubjectiveEditor_SubjectiveEditor))); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/components/ShixunEditor/index.tsx var ShixunEditor_tagList = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var ShixunEditor_ShixunEditor = function ShixunEditor(_ref, ref) { var problemset = _ref.problemset, globalSetting = _ref.globalSetting, loading = _ref.loading, dispatch = _ref.dispatch, editData = _ref.editData, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["problemset", "globalSetting", "loading", "dispatch", "editData"]); var _useState = Object(external_window_React_["useState"])(''), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), name = _useState2[0], setName = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(''), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), title = _useState4[0], setTitle = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])(''), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), analysis = _useState6[0], setAnalysis = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])([]), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), answerList = _useState8[0], setAnswerList = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(''), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), activeOptionErrorIndex = _useState10[0], setActiveOptionErrorIndex = _useState10[1]; var _useState11 = Object(external_window_React_["useState"])(), _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), checked = _useState12[0], setChecked = _useState12[1]; var _useState13 = Object(external_window_React_["useState"])(false), _useState14 = Object(slicedToArray["a" /* default */])(_useState13, 2), firstSetAnswerFlag = _useState14[0], setFirstSetAnswerFlag = _useState14[1]; var _useState15 = Object(external_window_React_["useState"])([]), _useState16 = Object(slicedToArray["a" /* default */])(_useState15, 2), score = _useState16[0], setScore = _useState16[1]; var _useState17 = Object(external_window_React_["useState"])(false), _useState18 = Object(slicedToArray["a" /* default */])(_useState17, 2), isEdit = _useState18[0], setIsEdit = _useState18[1]; var params = Object(react_router["i" /* useParams */])(); Object(external_window_React_["useEffect"])(function () { var _editData$shixun; if (editData.edit) { setIsEdit(true); } setName(editData.shixun_name); setTitle(editData.question_title); var arr = []; (_editData$shixun = editData.shixun) === null || _editData$shixun === void 0 ? void 0 : _editData$shixun.map(function (item) { arr.push(item.challenge_score); }); setScore(arr); }, [editData]); Object(external_window_React_["useEffect"])(function () { setFirstSetAnswerFlag(false); }, [isEdit]); Object(external_window_React_["useImperativeHandle"])(ref, function () { return { onSave: onSave, isEdit: isEdit }; }); var onSave = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var answerArray, isEmpty, res; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: answerArray = []; isEmpty = false; if (!isEmpty) { _context.next = 4; break; } return _context.abrupt("return", false); case 4: if (!editData.question_id) { _context.next = 10; break; } _context.next = 7; return Object(service_polls["u" /* putExerciseBankQuestions */])({ "id": editData.question_id, "question_title": title, "shixun_name": name, "shixun_id": editData.shixun_id, "question_type": 5, "question_scores": score }); case 7: res = _context.sent; _context.next = 13; break; case 10: _context.next = 12; return Object(service_polls["a" /* addExerciseBankQuestions */])({ "exercise_bank_id": params.topicId, "question_title": title, "shixun_name": name, "shixun_id": editData.shixun_id, "question_type": 5, "question_scores": score }); case 12: res = _context.sent; case 13: if (res.status === 0) { message["b" /* default */].success("保存成功"); setIsEdit(false); } _context.next = 16; return dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 16: return _context.abrupt("return", { name: title, analysis: analysis, standard_answers: answerArray, is_ordered: checked }); case 17: case "end": return _context.stop(); } } }, _callee); })); return function onSave() { return _ref2.apply(this, arguments); }; }(); var showEdit = function showEdit() { var _editData$shixun2; return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, "\u5B9E\u8BAD\u9898"), "\uFF08\u5BA2\u89C2\u9898\uFF0C\u7531\u7CFB\u7EDF\u81EA\u52A8\u8BC4\u5206\uFF0C\u5141\u8BB8\u624B\u52A8\u8C03\u5206\uFF09")), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt10" }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { defaultValue: name, onChange: function onChange(e) { ; setName(e.target.value); } })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt10" }, /*#__PURE__*/external_window_React_default.a.createElement(markdown_editor["a" /* default */], { id: "single-question-option-0", height: 155, placeholder: "\u8BF7\u8F93\u5165\u5B9E\u8BAD\u9898\u5B8C\u6210\u8981\u6C42", defaultValue: title, onChange: function onChange(value) { setTitle(value); } })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt20" }, (_editData$shixun2 = editData.shixun) === null || _editData$shixun2 === void 0 ? void 0 : _editData$shixun2.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], { gutter: [20, 20] }, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], { flex: "1" }, index + 1, ".", item.challenge_name), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], { defaultValue: score[index], onChange: function onChange(value) { score[index] = value; setScore(score); console.log("srore:L", score[index]); } }))); })), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt20" }, answerList.length > 1 && /*#__PURE__*/external_window_React_default.a.createElement("span", null, /*#__PURE__*/external_window_React_default.a.createElement(es_checkbox["a" /* default */], { checked: checked, onChange: function onChange(e) { return setChecked(e.target.checked); }, className: "".concat(editormodules_default.a.color333, " font14") }, "\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "".concat(editormodules_default.a.color999, " font12") }, "\uFF08\u9009\u4E2D\uFF0C\u6BCF\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u987A\u5E8F\u5FC5\u987B\u4E0E\u53C2\u8003\u7B54\u6848\u4E00\u81F4\uFF09"))), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "tr" }, !(editData !== null && editData !== void 0 && editData.edit) && /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "default", onClick: function onClick() { return setIsEdit(false); } }, "\u53D6\u6D88"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { className: "ml20", type: "primary", onClick: function onClick() { return onSave(); } }, "\u4FDD\u5B58"))); }; var actionArr = [{ name: "删除", icon: "iconfont c-light-black ml30 icon-shanchu", id: "del" }, { name: "上移", icon: "iconfont c-green ml30 icon-shangyi_Hover", id: "up" }, { name: "下移", icon: "iconfont c-green ml30 icon-xiayi_moren", id: "down" }, { name: "编辑", icon: "iconfont c-green ml30 icon-bianjishijuan3x", id: "edit" }]; var actionClick = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(item) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.t0 = item.id; _context3.next = _context3.t0 === "del" ? 3 : _context3.t0 === "up" ? 5 : _context3.t0 === "down" ? 5 : _context3.t0 === "edit" ? 9 : 11; break; case 3: modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: '确认要删除这个问题吗?', onOk: function onOk() { return Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2() { return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return Object(service_polls["e" /* deleteExerciseBanksQuestion */])({ pollsId: editData.question_id }); case 2: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 3: case "end": return _context2.stop(); } } }, _callee2); }))(); } }); return _context3.abrupt("break", 11); case 5: _context3.next = 7; return Object(service_polls["j" /* exercisesBanksMoveUpDown */])({ exerciseId: editData === null || editData === void 0 ? void 0 : editData.question_id, opr: item.id }); case 7: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); return _context3.abrupt("break", 11); case 9: setIsEdit(true); return _context3.abrupt("break", 11); case 11: case "end": return _context3.stop(); } } }, _callee3); })); return function actionClick(_x) { return _ref3.apply(this, arguments); }; }(); var showList = function showList() { var _editData$shixun3; return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: editormodules_default.a.questionType }, /*#__PURE__*/external_window_React_default.a.createElement("div", null, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 c-blue" }, editData.key, "\u3001\u5B9E\u8BAD\u9898"), "\uFF08", editData.question_score, "\u5206\uFF09"), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "tr" }, /*#__PURE__*/external_window_React_default.a.createElement(react_router_dom["a" /* Link */], { target: "_blank", to: "/shixuns/".concat(editData.shixun_identifier, "/challenges") }, "\u5B9E\u8BAD\u8BE6\u60C5"), !editData.hideAction && actionArr.map(function (item, index) { if (item.id === "up" && editData.key === 1) return null; if (item.id === "down" && editData.key === editData.len) return null; return /*#__PURE__*/external_window_React_default.a.createElement(tooltip["a" /* default */], { key: index, placement: "bottom", title: item.name }, /*#__PURE__*/external_window_React_default.a.createElement("span", { onClick: function onClick() { return actionClick(item); }, className: item.icon })); }))), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "font16" }, editData.shixun_name), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "mt30" }), (_editData$shixun3 = editData.shixun) === null || _editData$shixun3 === void 0 ? void 0 : _editData$shixun3.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement("div", { key: index }, "\u7B2C", index + 1, "\u5173 ", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml10" }, item.challenge_name), " ", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml10" }, item.challenge_score)); })); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: editormodules_default.a.wrap }, !isEdit && showList(), isEdit && showEdit()); }; // export default connect( // ({ // problemset, // loading, // globalSetting, // }: { // problemset: ProblemsetModelState; // loading: Loading; // globalSetting: GlobalSettingModelState; // }) => ({ // problemset, // globalSetting, // loading: loading.effects, // }), // )(ShixunEditor); /* harmony default export */ var components_ShixunEditor = (Object(umiExports["a" /* connect */])(function (_ref4) { var problemset = _ref4.problemset, loading = _ref4.loading, globalSetting = _ref4.globalSetting; return { problemset: problemset, globalSetting: globalSetting, loading: loading.effects }; }, null, null, { forwardRef: true })( /*#__PURE__*/Object(external_window_React_["forwardRef"])(ShixunEditor_ShixunEditor))); // EXTERNAL MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/index.less?modules var Detailmodules = __webpack_require__("UU91"); var Detailmodules_default = /*#__PURE__*/__webpack_require__.n(Detailmodules); // EXTERNAL MODULE: ./src/pages/User/Detail/Topics/components/SendToClassModal.tsx var SendToClassModal = __webpack_require__("fJjg"); // CONCATENATED MODULE: ./src/pages/User/Detail/Topics/Exercise/Detail/index.tsx var SubMenu = menu["a" /* default */].SubMenu; var Content = layout["a" /* default */].Content, Sider = layout["a" /* default */].Sider; var Detail_ShixunsListPage = function ShixunsListPage(_ref) { var _polls$exerciseBanks9, _polls$exerciseBanks10, _polls$exerciseBanks11, _polls$exerciseBanks12, _polls$exerciseBanks13, _polls$exerciseBanks14, _polls$exerciseBanks15, _polls$exerciseBanks16, _polls$exerciseBanks17, _polls$exerciseBanks18, _polls$exerciseBanks19, _polls$exerciseBanks20, _polls$exerciseBanks21, _polls$exerciseBanks22, _polls$exerciseBanks23, _polls$exerciseBanks24, _polls$exerciseBanks25, _polls$exerciseBanks26, _polls$exerciseBanks27, _polls$exerciseBanks28, _polls$exerciseBanks29, _polls$exerciseBanks30, _polls$exerciseBanks31, _polls$exerciseBanks32, _polls$exerciseBanks33, _polls$exerciseBanks34, _polls$exerciseBanks35, _polls$exerciseBanks36, _polls$exerciseBanks37, _polls$exerciseBanks38, _polls$exerciseBanks39, _polls$exerciseBanks40, _polls$exerciseBanks41, _polls$exerciseBanks42, _polls$exerciseBanks43, _polls$exerciseBanks44, _polls$exerciseBanks45, _polls$exerciseBanks46, _polls$exerciseBanks47, _polls$exerciseBanks48, _polls$exerciseBanks49, _polls$exerciseBanks50, _polls$exerciseBanks51, _polls$exerciseBanks52, _polls$exerciseBanks53, _polls$exerciseBanks54, _polls$exerciseBanks55, _polls$exerciseBanks56, _polls$exerciseBanks57, _polls$exerciseBanks58, _polls$exerciseBanks59, _polls$exerciseBanks60, _polls$exerciseBanks61, _polls$exerciseBanks62, _polls$exerciseBanks63, _polls$exerciseBanks64, _polls$exerciseBanks65; var polls = _ref.polls, globalSetting = _ref.globalSetting, loading = _ref.loading, user = _ref.user, dispatch = _ref.dispatch, props = Object(objectWithoutProperties["a" /* default */])(_ref, ["polls", "globalSetting", "loading", "user", "dispatch"]); var params = Object(react_router["i" /* useParams */])(); var location = Object(react_router["h" /* useLocation */])(); var userInfo = user.userInfo; var _Form$useForm = es_form["a" /* default */].useForm(), _Form$useForm2 = Object(slicedToArray["a" /* default */])(_Form$useForm, 1), form = _Form$useForm2[0]; var _useState = Object(external_window_React_["useState"])([]), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), editData = _useState2[0], setEditData = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(false), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), isEdit = _useState4[0], setIsEdit = _useState4[1]; var questionType = [{ name: "选择题", id: 0 }, { name: "判断题", id: 2 }, { name: "填空题", id: 3 }, { name: "简答题", id: 4 }, { name: "实训题", id: 5 }]; var childrenRef = Object(external_window_React_["useRef"])(); Object(external_window_React_["useEffect"])(function () { var _polls$exerciseBanks; if ((_polls$exerciseBanks = polls.exerciseBanks) !== null && _polls$exerciseBanks !== void 0 && _polls$exerciseBanks.exercise_questions) { var _polls$exerciseBanks2, _polls$exerciseBanks3, _polls$exerciseBanks4, _polls$exerciseBanks5, _polls$exerciseBanks6; setEditData(Object(toConsumableArray["a" /* default */])((_polls$exerciseBanks2 = polls.exerciseBanks) === null || _polls$exerciseBanks2 === void 0 ? void 0 : _polls$exerciseBanks2.exercise_questions)); form.setFieldsValue({ exercise_name: (_polls$exerciseBanks3 = polls.exerciseBanks) === null || _polls$exerciseBanks3 === void 0 ? void 0 : (_polls$exerciseBanks4 = _polls$exerciseBanks3.exercise) === null || _polls$exerciseBanks4 === void 0 ? void 0 : _polls$exerciseBanks4.exercise_name, exercise_description: (_polls$exerciseBanks5 = polls.exerciseBanks) === null || _polls$exerciseBanks5 === void 0 ? void 0 : (_polls$exerciseBanks6 = _polls$exerciseBanks5.exercise) === null || _polls$exerciseBanks6 === void 0 ? void 0 : _polls$exerciseBanks6.exercise_description }); } }, [polls.exerciseBanks]); Object(external_window_React_["useEffect"])(function () { dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); }, [params.categoryId]); var save = /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee() { var _polls$exerciseBanks7, _polls$exerciseBanks8; var value; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return form.validateFields(); case 2: value = form.getFieldValue(); value.is_md = true; value.topicId = (_polls$exerciseBanks7 = polls.exerciseBanks) === null || _polls$exerciseBanks7 === void 0 ? void 0 : (_polls$exerciseBanks8 = _polls$exerciseBanks7.exercise) === null || _polls$exerciseBanks8 === void 0 ? void 0 : _polls$exerciseBanks8.id; setIsEdit(false); _context.next = 8; return Object(service_polls["v" /* putExerciseBanks */])(Object(objectSpread2["a" /* default */])({}, value)); case 8: dispatch({ type: "polls/getExerciseBanks", payload: Object(objectSpread2["a" /* default */])({}, params) }); case 9: case "end": return _context.stop(); } } }, _callee); })); return function save() { return _ref2.apply(this, arguments); }; }(); var addQuestion = /*#__PURE__*/function () { var _ref3 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2(type) { var d; return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return childrenRef === null || childrenRef === void 0 ? void 0 : childrenRef.current; case 2: d = _context2.sent; if (!(d !== null && d !== void 0 && d.isEdit)) { _context2.next = 6; break; } message["b" /* default */].error("不能同时编辑两题"); return _context2.abrupt("return"); case 6: if (type === 5) { dispatch({ type: "classroomList/setActionTabs", payload: { key: "选用实践项目" } }); } else { setEditData([].concat(Object(toConsumableArray["a" /* default */])(editData), [{ question_type: type }])); } case 7: case "end": return _context2.stop(); } } }, _callee2); })); return function addQuestion(_x) { return _ref3.apply(this, arguments); }; }(); var handleSend = function handleSend() { dispatch({ type: 'userDetail/setActionTabs', payload: { key: 'UserDetail-SendToClass', params: { object_id: [params.topicId], object_type: 'exercise' } } }); }; var renderQuestion = function renderQuestion() { return editData === null || editData === void 0 ? void 0 : editData.map(function (v, k) { v.key = k + 1; v.len = editData.length; if (v.question_type === 0) { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(components_SingleEditor, { ref: childrenRef, editData: v }), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null)); } if (v.question_type === 1) { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(MultipleEditor, { ref: childrenRef, editData: v }), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null)); } if (v.question_type === 2) { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(components_JudgmentEditor, { ref: childrenRef, editData: v }), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null)); } if (v.question_type === 3) { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(components_CompletionEditor, { editData: v }), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null)); } if (v.question_type === 4) { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(components_SubjectiveEditor, { editData: v }), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null)); } if (v.question_type === 5) { return /*#__PURE__*/external_window_React_default.a.createElement("aside", null, /*#__PURE__*/external_window_React_default.a.createElement(components_ShixunEditor, { editData: v }), /*#__PURE__*/external_window_React_default.a.createElement(divider["a" /* default */], null)); } }); }; return /*#__PURE__*/external_window_React_default.a.createElement("section", { className: "edu-container" }, /*#__PURE__*/external_window_React_default.a.createElement("section", { className: "animated fadeIn" }, /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: "mt10" }, userInfo && /*#__PURE__*/external_window_React_default.a.createElement(breadcrumb["a" /* default */], { separator: ">" }, /*#__PURE__*/external_window_React_default.a.createElement(breadcrumb["a" /* default */].Item, null, /*#__PURE__*/external_window_React_default.a.createElement(react_router_dom["a" /* Link */], { to: "/users/".concat(params.username, "/").concat(params.topictype === 'personal' ? 'topics' : 'topicbank', "/").concat(params.topictype) }, params.topictype === 'personal' ? '我的题库' : '公共题库')), /*#__PURE__*/external_window_React_default.a.createElement(breadcrumb["a" /* default */].Item, null, "\u8BE6\u60C5"))), /*#__PURE__*/external_window_React_default.a.createElement("aside", { className: [Detailmodules_default.a.title, 'mt20'].join(' ') }, /*#__PURE__*/external_window_React_default.a.createElement(row["a" /* default */], { style: { width: "100%" }, align: "middle" }, /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], { flex: "1" }, /*#__PURE__*/external_window_React_default.a.createElement("strong", { className: "font20 ml5" }, (_polls$exerciseBanks9 = polls.exerciseBanks) === null || _polls$exerciseBanks9 === void 0 ? void 0 : (_polls$exerciseBanks10 = _polls$exerciseBanks9.exercise) === null || _polls$exerciseBanks10 === void 0 ? void 0 : _polls$exerciseBanks10.exercise_name), /*#__PURE__*/external_window_React_default.a.createElement(util["k" /* StatusClassroomsTags */], { status: [(_polls$exerciseBanks11 = polls.exerciseBanks) !== null && _polls$exerciseBanks11 !== void 0 && (_polls$exerciseBanks12 = _polls$exerciseBanks11.exercise) !== null && _polls$exerciseBanks12 !== void 0 && _polls$exerciseBanks12.is_public ? "公开" : "私有"] })), /*#__PURE__*/external_window_React_default.a.createElement(col["a" /* default */], null, /*#__PURE__*/external_window_React_default.a.createElement(react_router_dom["a" /* Link */], { className: "font16 c-light-black", to: "/users/".concat(userInfo.login, "/topics/").concat(params.topictype) }, "\u8FD4\u56DE"))))), /*#__PURE__*/external_window_React_default.a.createElement("section", { className: [Detailmodules_default.a.bg, 'pl30', 'pr30', 'pb30', 'mt20 relative'].join(' ') }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: Detailmodules_default.a.export }, ((_polls$exerciseBanks13 = polls.exerciseBanks) === null || _polls$exerciseBanks13 === void 0 ? void 0 : _polls$exerciseBanks13.authorize) && /*#__PURE__*/external_window_React_default.a.createElement(external_window_React_default.a.Fragment, null, /*#__PURE__*/external_window_React_default.a.createElement("a", { onClick: function onClick(e) { e.preventDefault(); modal["a" /* default */].confirm({ centered: true, okText: '确定', cancelText: '取消', title: "提示", content: "是否确认删除?", onOk: function () { var _onOk = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3() { var res; return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return Object(service_user["g" /* deleteQuestionBanks */])({ object_type: "normal", object_id: [params.topicId] }); case 2: res = _context3.sent; if (res.status === 0) { umiExports["d" /* history */].push("/users/".concat(params.username, "/topics/personal")); } case 4: case "end": return _context3.stop(); } } }, _callee3); })); function onOk() { return _onOk.apply(this, arguments); } return onOk; }() }); } }, "\u5220\u9664"), /*#__PURE__*/external_window_React_default.a.createElement(react_router_dom["a" /* Link */], { to: "/users/".concat(userInfo.login, "/topics/").concat(params.topicId, "/").concat(params.topictype, "/exercise/edit") }, "\u7F16\u8F91")), /*#__PURE__*/external_window_React_default.a.createElement("a", { onClick: function onClick(e) { e.preventDefault(); handleSend(); } }, "\u53D1\u9001")), /*#__PURE__*/external_window_React_default.a.createElement(tabs["a" /* default */], { className: Detailmodules_default.a.tabs }, /*#__PURE__*/external_window_React_default.a.createElement(tabs["a" /* default */].TabPane, { tab: /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "font16 pt10 pb12" }, "\u5185\u5BB9\u8BE6\u60C5"), key: "1" }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "c-light-black" }, (_polls$exerciseBanks14 = polls.exerciseBanks) === null || _polls$exerciseBanks14 === void 0 ? void 0 : (_polls$exerciseBanks15 = _polls$exerciseBanks14.exercise) === null || _polls$exerciseBanks15 === void 0 ? void 0 : _polls$exerciseBanks15.exercise_description))), isEdit && /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], { layout: "vertical", form: form }, /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "exercise_name", label: "\u8BD5\u5377\u6807\u9898\uFF1A", rules: [{ required: true, message: "请填写试卷标题" }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { maxLength: 60, placeholder: "\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26" })), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u8BD5\u5377\u987B\u77E5\uFF1A", name: "exercise_description" }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */].TextArea, { rows: 6, placeholder: "\u8BF7\u5728\u6B64\u8F93\u5165\u672C\u6B21\u8BD5\u5377\u7B54\u9898\u7684\u76F8\u5173\u8BF4\u660E\uFF0C\u6700\u5927\u9650\u5236100\u4E2A\u5B57\u7B26" })), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { className: "tr" }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", onClick: function onClick() { save(); } }, "\u4FDD\u5B58")))), /*#__PURE__*/external_window_React_default.a.createElement("p", { className: "mt10", style: { display: 'flex' } }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "fl", style: { flex: '1' } }, !!((_polls$exerciseBanks16 = polls.exerciseBanks) !== null && _polls$exerciseBanks16 !== void 0 && (_polls$exerciseBanks17 = _polls$exerciseBanks16.exercise_types) !== null && _polls$exerciseBanks17 !== void 0 && _polls$exerciseBanks17.q_singles) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u5355\u9009\u9898", (_polls$exerciseBanks18 = polls.exerciseBanks) === null || _polls$exerciseBanks18 === void 0 ? void 0 : (_polls$exerciseBanks19 = _polls$exerciseBanks18.exercise_types) === null || _polls$exerciseBanks19 === void 0 ? void 0 : _polls$exerciseBanks19.q_singles, "\u9898\uFF0C\u5171", (_polls$exerciseBanks20 = polls.exerciseBanks) === null || _polls$exerciseBanks20 === void 0 ? void 0 : (_polls$exerciseBanks21 = _polls$exerciseBanks20.exercise_types) === null || _polls$exerciseBanks21 === void 0 ? void 0 : _polls$exerciseBanks21.q_singles_scores, "\u5206"), !!((_polls$exerciseBanks22 = polls.exerciseBanks) !== null && _polls$exerciseBanks22 !== void 0 && (_polls$exerciseBanks23 = _polls$exerciseBanks22.exercise_types) !== null && _polls$exerciseBanks23 !== void 0 && _polls$exerciseBanks23.q_doubles) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u591A\u9009\u9898", (_polls$exerciseBanks24 = polls.exerciseBanks) === null || _polls$exerciseBanks24 === void 0 ? void 0 : (_polls$exerciseBanks25 = _polls$exerciseBanks24.exercise_types) === null || _polls$exerciseBanks25 === void 0 ? void 0 : _polls$exerciseBanks25.q_doubles, "\u9898\uFF0C\u5171", (_polls$exerciseBanks26 = polls.exerciseBanks) === null || _polls$exerciseBanks26 === void 0 ? void 0 : (_polls$exerciseBanks27 = _polls$exerciseBanks26.exercise_types) === null || _polls$exerciseBanks27 === void 0 ? void 0 : _polls$exerciseBanks27.q_doubles_scores, "\u5206"), !!((_polls$exerciseBanks28 = polls.exerciseBanks) !== null && _polls$exerciseBanks28 !== void 0 && (_polls$exerciseBanks29 = _polls$exerciseBanks28.exercise_types) !== null && _polls$exerciseBanks29 !== void 0 && _polls$exerciseBanks29.q_judges) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u5224\u65AD\u9898", (_polls$exerciseBanks30 = polls.exerciseBanks) === null || _polls$exerciseBanks30 === void 0 ? void 0 : (_polls$exerciseBanks31 = _polls$exerciseBanks30.exercise_types) === null || _polls$exerciseBanks31 === void 0 ? void 0 : _polls$exerciseBanks31.q_judges, "\u9898\uFF0C\u5171", (_polls$exerciseBanks32 = polls.exerciseBanks) === null || _polls$exerciseBanks32 === void 0 ? void 0 : (_polls$exerciseBanks33 = _polls$exerciseBanks32.exercise_types) === null || _polls$exerciseBanks33 === void 0 ? void 0 : _polls$exerciseBanks33.q_judges_scores, "\u5206"), !!((_polls$exerciseBanks34 = polls.exerciseBanks) !== null && _polls$exerciseBanks34 !== void 0 && (_polls$exerciseBanks35 = _polls$exerciseBanks34.exercise_types) !== null && _polls$exerciseBanks35 !== void 0 && _polls$exerciseBanks35.q_nulls) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u586B\u7A7A\u9898", (_polls$exerciseBanks36 = polls.exerciseBanks) === null || _polls$exerciseBanks36 === void 0 ? void 0 : (_polls$exerciseBanks37 = _polls$exerciseBanks36.exercise_types) === null || _polls$exerciseBanks37 === void 0 ? void 0 : _polls$exerciseBanks37.q_nulls, "\u9898\uFF0C\u5171", (_polls$exerciseBanks38 = polls.exerciseBanks) === null || _polls$exerciseBanks38 === void 0 ? void 0 : (_polls$exerciseBanks39 = _polls$exerciseBanks38.exercise_types) === null || _polls$exerciseBanks39 === void 0 ? void 0 : _polls$exerciseBanks39.q_nulls_scores, "\u5206"), !!((_polls$exerciseBanks40 = polls.exerciseBanks) !== null && _polls$exerciseBanks40 !== void 0 && (_polls$exerciseBanks41 = _polls$exerciseBanks40.exercise_types) !== null && _polls$exerciseBanks41 !== void 0 && _polls$exerciseBanks41.q_mains) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u7B80\u7B54\u9898", (_polls$exerciseBanks42 = polls.exerciseBanks) === null || _polls$exerciseBanks42 === void 0 ? void 0 : (_polls$exerciseBanks43 = _polls$exerciseBanks42.exercise_types) === null || _polls$exerciseBanks43 === void 0 ? void 0 : _polls$exerciseBanks43.q_mains, "\u9898\uFF0C\u5171", (_polls$exerciseBanks44 = polls.exerciseBanks) === null || _polls$exerciseBanks44 === void 0 ? void 0 : (_polls$exerciseBanks45 = _polls$exerciseBanks44.exercise_types) === null || _polls$exerciseBanks45 === void 0 ? void 0 : _polls$exerciseBanks45.q_mains_scores, "\u5206"), !!((_polls$exerciseBanks46 = polls.exerciseBanks) !== null && _polls$exerciseBanks46 !== void 0 && (_polls$exerciseBanks47 = _polls$exerciseBanks46.exercise_types) !== null && _polls$exerciseBanks47 !== void 0 && _polls$exerciseBanks47.q_shixuns) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u5B9E\u8BAD\u9898", (_polls$exerciseBanks48 = polls.exerciseBanks) === null || _polls$exerciseBanks48 === void 0 ? void 0 : (_polls$exerciseBanks49 = _polls$exerciseBanks48.exercise_types) === null || _polls$exerciseBanks49 === void 0 ? void 0 : _polls$exerciseBanks49.q_shixuns, "\u9898\uFF0C\u5171", (_polls$exerciseBanks50 = polls.exerciseBanks) === null || _polls$exerciseBanks50 === void 0 ? void 0 : (_polls$exerciseBanks51 = _polls$exerciseBanks50.exercise_types) === null || _polls$exerciseBanks51 === void 0 ? void 0 : _polls$exerciseBanks51.q_shixuns_scores, "\u5206"), !!((_polls$exerciseBanks52 = polls.exerciseBanks) !== null && _polls$exerciseBanks52 !== void 0 && (_polls$exerciseBanks53 = _polls$exerciseBanks52.exercise_types) !== null && _polls$exerciseBanks53 !== void 0 && _polls$exerciseBanks53.q_pros) && /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "ml20" }, "\u7F16\u7A0B\u9898", (_polls$exerciseBanks54 = polls.exerciseBanks) === null || _polls$exerciseBanks54 === void 0 ? void 0 : (_polls$exerciseBanks55 = _polls$exerciseBanks54.exercise_types) === null || _polls$exerciseBanks55 === void 0 ? void 0 : _polls$exerciseBanks55.q_pros, "\u9898\uFF0C\u5171", (_polls$exerciseBanks56 = polls.exerciseBanks) === null || _polls$exerciseBanks56 === void 0 ? void 0 : (_polls$exerciseBanks57 = _polls$exerciseBanks56.exercise_types) === null || _polls$exerciseBanks57 === void 0 ? void 0 : _polls$exerciseBanks57.q_pros_scores, "\u5206")), /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "fr" }, !!((_polls$exerciseBanks58 = polls.exerciseBanks) !== null && _polls$exerciseBanks58 !== void 0 && (_polls$exerciseBanks59 = _polls$exerciseBanks58.exercise_types) !== null && _polls$exerciseBanks59 !== void 0 && _polls$exerciseBanks59.q_counts) && /*#__PURE__*/external_window_React_default.a.createElement("span", null, "\u5408\u8BA1 ", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "color-blue" }, (_polls$exerciseBanks60 = polls.exerciseBanks) === null || _polls$exerciseBanks60 === void 0 ? void 0 : (_polls$exerciseBanks61 = _polls$exerciseBanks60.exercise_types) === null || _polls$exerciseBanks61 === void 0 ? void 0 : _polls$exerciseBanks61.q_counts), " \u9898\uFF0C \u5171 ", /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "".concat(((_polls$exerciseBanks62 = polls.exerciseBanks) === null || _polls$exerciseBanks62 === void 0 ? void 0 : (_polls$exerciseBanks63 = _polls$exerciseBanks62.exercise_types) === null || _polls$exerciseBanks63 === void 0 ? void 0 : _polls$exerciseBanks63.q_scores) > 100 ? 'color-red font-bd' : 'color-orange') }, (_polls$exerciseBanks64 = polls.exerciseBanks) === null || _polls$exerciseBanks64 === void 0 ? void 0 : (_polls$exerciseBanks65 = _polls$exerciseBanks64.exercise_types) === null || _polls$exerciseBanks65 === void 0 ? void 0 : _polls$exerciseBanks65.q_scores), " \u5206"))), /*#__PURE__*/external_window_React_default.a.createElement("section", { className: [Detailmodules_default.a.bg, 'pt30', 'pl20', 'pr20', 'pb20', 'mt20'].join(' ') }, editData != '' && renderQuestion(), editData == '' && /*#__PURE__*/external_window_React_default.a.createElement(NoData["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement(SendToClassModal["a" /* default */], null)); }; /* harmony default export */ var Detail = __webpack_exports__["default"] = (Object(umiExports["a" /* connect */])(function (_ref4) { var polls = _ref4.polls, loading = _ref4.loading, user = _ref4.user, globalSetting = _ref4.globalSetting; return { polls: polls, globalSetting: globalSetting, user: user, loading: loading.effects }; })(Detail_ShixunsListPage)); /***/ }), /***/ "Nska": /*!*******************************************************************************!*\ !*** ./src/pages/User/Detail/Topics/components/SendToClassModal.less?modules ***! \*******************************************************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin module.exports = {"wrap":"wrap___1qNoS","title":"title___18s87","radioWrap":"radioWrap___3ZobS","radio":"radio___19YEl","colorFF0000":"colorFF0000___2BuLq","pagination":"pagination___18hXH"}; /***/ }), /***/ "O2Wb": /*!******************************************************************!*\ !*** ./src/components/Editor/NullChildEditor/index.less?modules ***! \******************************************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin module.exports = {"flex":"flex___2gmSR","flex1":"flex1___3Tu1g","color666":"color666___2uyGL","error":"error___yJ86W","deleteIcon":"deleteIcon___1D2tg","addIcon":"addIcon___2VIYB"}; /***/ }), /***/ "Ot1p": /*!**************************************************************!*\ !*** ./src/components/markdown-editor/index.tsx + 6 modules ***! \**************************************************************/ /*! exports provided: default */ /*! exports used: default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/code-block/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/modal.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/useInterval.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/pages/tasks/util.js because of ./src/pages/tasks/index.jsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/codemirror/lib/codemirror.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js var modal_style = __webpack_require__("2qtc"); // EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules var modal = __webpack_require__("kLXV"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js var createForOfIteratorHelper = __webpack_require__("rAM+"); // EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js var message_style = __webpack_require__("miYZ"); // EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules var message = __webpack_require__("tsqr"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("tJVT"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__("jrin"); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_); // EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.js var codemirror = __webpack_require__("VrN/"); var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror); // EXTERNAL MODULE: ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js var ResizeObserver_es = __webpack_require__("bdgK"); // EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.css var lib_codemirror = __webpack_require__("p77/"); // EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/closetag.js var closetag = __webpack_require__("Bd2K"); // EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/closebrackets.js var closebrackets = __webpack_require__("ELLl"); // EXTERNAL MODULE: ./node_modules/codemirror/addon/display/placeholder.js var display_placeholder = __webpack_require__("19Vz"); // EXTERNAL MODULE: ./node_modules/codemirror/mode/markdown/markdown.js var markdown = __webpack_require__("lZu9"); // EXTERNAL MODULE: ./node_modules/codemirror/mode/stex/stex.js var stex = __webpack_require__("+NIl"); // EXTERNAL MODULE: ./src/components/markdown-editor/index.less var markdown_editor = __webpack_require__("kSUc"); // EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules var RenderHtml = __webpack_require__("9Bee"); // CONCATENATED MODULE: ./src/components/RenderHtml/stex.tsx // const latexjs = require('latex-l.js/dist/latex.js'); // import "latex-l.js/dist/css/base.css" /* harmony default export */ var RenderHtml_stex = (function (_ref) { var _ref$value = _ref.value, value = _ref$value === void 0 ? '' : _ref$value, className = _ref.className, showTextOnly = _ref.showTextOnly, showLines = _ref.showLines, _ref$style = _ref.style, style = _ref$style === void 0 ? {} : _ref$style; var html = Object(external_window_React_["useMemo"])(function () { // try { // const latex = value || 'This is some text'; // let generator = new latexjs.default.HtmlGenerator({ hyphenate: true }) // let doc = latexjs.default.parse(latex, { generator: generator }).htmlDocument() // return doc.body.innerHTML // }catch(e){ // console.log("e:",e) // return "错误的latex语法,请检查" // } return ""; }, [value]); return /*#__PURE__*/external_window_React_default.a.createElement(external_window_React_default.a.Fragment, null, /*#__PURE__*/external_window_React_default.a.createElement("div", { dangerouslySetInnerHTML: { __html: html } })); }); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("0Owb"); // EXTERNAL MODULE: ./src/components/markdown-editor/toolbar/index.less var toolbar = __webpack_require__("dejd"); // EXTERNAL MODULE: ./src/components/markdown-editor/css/iconfont.css var iconfont = __webpack_require__("C+DQ"); // CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx var DEFAULTICONS = [{ title: '粗体', icon: 'icon-bold', actionName: 'bold' }, { title: '斜体', icon: 'icon-italic', actionName: 'italic' }, '|', { title: '无序列表', icon: 'icon-unorder-list', actionName: 'list-ul' }, { title: '有序列表', icon: 'icon-order-list', actionName: 'list-ol' }, '|', { title: '行内代码', icon: 'icon-code', actionName: 'code' }, { title: '代码块(多语言风格)', icon: 'icon-file-code', actionName: 'code-block' }, { title: '链接', icon: 'icon-link', actionName: 'link' }, '|', { title: '行内公式', icon: 'icon-sum', actionName: 'inline-latex' }, { title: '多行公式', icon: 'icon-formula', actionName: 'latex' }, '|', { title: '添加图片', icon: 'icon-picture', actionName: 'upload-image' }, { title: '表格', icon: 'icon-table', actionName: 'add-table' }, '|', { title: '换行', icon: 'icon-minus', actionName: 'line-break' }, { title: '清空', icon: 'icon-eraser', actionName: 'eraser' }]; function AButton(_ref) { var onActionCallback = _ref.onActionCallback, title = _ref.title, icon = _ref.icon, actionName = _ref.actionName, _ref$className = _ref.className, className = _ref$className === void 0 ? '' : _ref$className, children = _ref.children; function onAction() { onActionCallback(actionName); } return /*#__PURE__*/external_window_React_default.a.createElement("a", { title: title, className: className, onClick: onAction }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "md-iconfont ".concat(icon) }), children); } /* harmony default export */ var markdown_editor_toolbar = (function (_ref2) { var watch = _ref2.watch, showNullButton = _ref2.showNullButton, onActionCallback = _ref2.onActionCallback, fullScreen = _ref2.fullScreen, insertTemp = _ref2.insertTemp, hidetoolBar = _ref2.hidetoolBar; var icons = [].concat(DEFAULTICONS, [{ title: "".concat(watch ? '关闭实时预览' : '开启实时预览'), icon: "".concat(watch ? 'icon-eye-slash' : 'icon-eye'), actionName: 'trigger-watch' }]); return /*#__PURE__*/external_window_React_default.a.createElement("ul", { className: "markdown-toolbar-container" }, !hidetoolBar && icons.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement("li", { key: index }, item.actionName ? /*#__PURE__*/external_window_React_default.a.createElement(AButton, Object(esm_extends["a" /* default */])({}, item, { onActionCallback: onActionCallback })) : /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "v-line" })); }), showNullButton ? /*#__PURE__*/external_window_React_default.a.createElement("li", null, /*#__PURE__*/external_window_React_default.a.createElement(AButton, { icon: "icon-edit", className: "btn-null", title: "\u589E\u52A0\u586B\u7A7A", actionName: "add-null-ch", onActionCallback: onActionCallback }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "fill-tip" }, "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))) : null, insertTemp && /*#__PURE__*/external_window_React_default.a.createElement("li", null, /*#__PURE__*/external_window_React_default.a.createElement(AButton, { icon: "icon-edit", className: "btn-null", title: "\u63D2\u5165\u6A21\u677F", actionName: "inster-template-".concat(insertTemp), onActionCallback: onActionCallback }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "fill-tip" }, "\u63D2\u5165\u6A21\u677F"))), /*#__PURE__*/external_window_React_default.a.createElement("li", { className: "btn-full-screen" }, /*#__PURE__*/external_window_React_default.a.createElement(AButton, { icon: "".concat(fullScreen ? 'icon-shrink' : 'icon-enlarge'), title: fullScreen ? '关闭全屏' : '开启全屏', actionName: "trigger-full-screen", onActionCallback: onActionCallback }))); }); // EXTERNAL MODULE: ./src/components/modal.tsx var components_modal = __webpack_require__("M8RZ"); // EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js var button_style = __webpack_require__("+L6B"); // EXTERNAL MODULE: ./node_modules/antd/es/button/index.js var es_button = __webpack_require__("2/Rp"); // EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js var form_style = __webpack_require__("y8nQ"); // EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 11 modules var es_form = __webpack_require__("Vl3Y"); // EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js var input_style = __webpack_require__("5NDa"); // EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 3 modules var input = __webpack_require__("5rEg"); // CONCATENATED MODULE: ./src/components/markdown-editor/link/index.tsx var formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 20 } }; /* harmony default export */ var markdown_editor_link = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; function onSubmit(values) { callback(values); } return /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], Object(esm_extends["a" /* default */])({}, formItemLayout, { initialValues: { link: 'http://', title: '' }, className: "link-panel", onFinish: onSubmit }), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u94FE\u63A5\u5730\u5740", name: "link", rules: [{ required: true, message: '请输入链接地址' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u94FE\u63A5\u6807\u9898", name: "title", rules: [{ required: true, message: '请输入链接标题' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container flex-end" }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); // EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx var code_block = __webpack_require__("7ahc"); // EXTERNAL MODULE: ./src/components/markdown-editor/upload-image/index.less var upload_image = __webpack_require__("HmJG"); // EXTERNAL MODULE: ./src/pages/tasks/util.js var util = __webpack_require__("BjJ7"); // CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx var useForm = es_form["a" /* default */].useForm; var upload_image_style = { width: 280, marginRight: 10 }; var upload_image_formItemLayout = { labelCol: { span: 5 }, wrapperCol: { span: 19 } }; /* harmony default export */ var markdown_editor_upload_image = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; var _useForm = useForm(), _useForm2 = Object(slicedToArray["a" /* default */])(_useForm, 1), form = _useForm2[0]; function onSubmit(values) { callback(values); } function onAddUrl(data, file) { form.setFieldsValue({ src: "/api/attachments/".concat(data.id), type: file.type }); } function onFileChange(e) { var file = e.target.files[0]; uploadImage(file, onAddUrl); } return /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], Object(esm_extends["a" /* default */])({ form: form }, upload_image_formItemLayout, { className: "upload-image-panel", onFinish: onSubmit }), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u56FE\u7247\u5730\u5740", required: true }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container" }, /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { noStyle: true, name: "src", rules: [{ required: true, message: '请输入图片地址' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { style: upload_image_style })), /*#__PURE__*/external_window_React_default.a.createElement(UploadButton, { onFileChange: onFileChange }))), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u56FE\u7247\u63CF\u8FF0", name: "alt", rules: [{ required: true, message: '请输入图片描述' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { style: { width: 264 } })), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { style: { textAlign: "right" } }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); function UploadButton(_ref2) { var onFileChange = _ref2.onFileChange; return /*#__PURE__*/external_window_React_default.a.createElement("a", { className: "upload-button" }, "\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/external_window_React_default.a.createElement("input", { type: "file", onChange: onFileChange })); } function uploadImage(file, callback) { if (!file) { throw new String('没有文件'); return; } var formData = new FormData(); formData.append('editormd-image-file', file); formData.append('file_param_name', 'editormd-image-file'); formData.append('byxhr', 'true'); var xhr = new window.XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('load', function (response) { callback(JSON.parse(response.target.responseText), file); }, false); xhr.addEventListener('error', function (error) { console.error(error); }, false); xhr.open('POST', "".concat(util["a" /* apiPref */], "/api/attachments.json")); xhr.send(formData); } // EXTERNAL MODULE: ./node_modules/antd/es/input-number/style/index.js var input_number_style = __webpack_require__("giR+"); // EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js var input_number = __webpack_require__("fyUT"); // EXTERNAL MODULE: ./node_modules/antd/es/radio/style/index.js var radio_style = __webpack_require__("7Kak"); // EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 4 modules var es_radio = __webpack_require__("9yH6"); // CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx var RadioGroup = es_radio["a" /* default */].Group; var add_table_panel_style = { margin: '0 8px' }; /* harmony default export */ var add_table_panel = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; function onSubmit(values) { callback(values); } return /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], { className: "add-table-panel", initialValues: { row: 3, col: 2, align: 'default' }, onFinish: onSubmit }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container" }, /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u5355\u5143\u683C\u6570\uFF1A"), /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u884C\u6570"), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "row", rules: [{ required: true, message: '请输入行数' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u5217\u6570"), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "col", rules: [{ required: true, message: '请输入列数' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], null))), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container", style: { marginTop: 12 } }, /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "align" }, /*#__PURE__*/external_window_React_default.a.createElement(RadioGroup, null, /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "default" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-justify" })), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "left" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-left" })), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "center" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-center" })), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "right" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-right" }))))), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container flex-end" }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); // EXTERNAL MODULE: ./src/utils/env.ts + 1 modules var env = __webpack_require__("m3rI"); // CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts var LINK = 'link'; var UPLOAD_IMAGE = 'upload-image'; var CODE_BLOCK = 'code-block'; var ADD_TABLE = 'add-table'; var HRLINE = '------------'; var ALIGNSIGN = { default: HRLINE, left: ":".concat(HRLINE), center: ":".concat(HRLINE, ":"), right: "".concat(HRLINE, ":") }; // EXTERNAL MODULE: ./src/components/useInterval.tsx var useInterval = __webpack_require__("9VGf"); // CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx var _DEFAULTKEYMAP, _TitleDesc; function noop() {} var pending = 0; var StorageTimeTicket = 10000; var NULL_CH = '▁'; var TEMP1 = '\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作'; //课程须知模板 function processSize(size) { return !/^\d+$/.test(size) ? size : "".concat(size, "px"); } var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0; var key = isMac ? 'Cmd' : 'Ctrl'; var DEFAULTKEYMAP = (_DEFAULTKEYMAP = {}, Object(defineProperty["a" /* default */])(_DEFAULTKEYMAP, key + '-B', 'bold'), Object(defineProperty["a" /* default */])(_DEFAULTKEYMAP, key + '-I', 'italic'), _DEFAULTKEYMAP); var TitleDesc = (_TitleDesc = {}, Object(defineProperty["a" /* default */])(_TitleDesc, LINK, '添加链接'), Object(defineProperty["a" /* default */])(_TitleDesc, CODE_BLOCK, '添加代码块'), Object(defineProperty["a" /* default */])(_TitleDesc, UPLOAD_IMAGE, '添加图片'), Object(defineProperty["a" /* default */])(_TitleDesc, ADD_TABLE, '添加表格'), _TitleDesc); //https://codemirror.net/demo //The height can be set through CSS (by giving the .CodeMirror class a height property), or by calling the cm's setSize method. /* harmony default export */ var components_markdown_editor = __webpack_exports__["a"] = (function (_ref) { var _ref$defaultValue = _ref.defaultValue, defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue, onChange = _ref.onChange, _ref$width = _ref.width, width = _ref$width === void 0 ? '100%' : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? 400 : _ref$height, _ref$miniToolbar = _ref.miniToolbar, miniToolbar = _ref$miniToolbar === void 0 ? false : _ref$miniToolbar, _ref$isFocus = _ref.isFocus, isFocus = _ref$isFocus === void 0 ? false : _ref$isFocus, watch = _ref.watch, insertTemp = _ref.insertTemp, _ref$mode = _ref.mode, mode = _ref$mode === void 0 ? "markdown" : _ref$mode, _ref$id = _ref.id, id = _ref$id === void 0 ? 'markdown-editor-id' : _ref$id, _ref$showResizeBar = _ref.showResizeBar, showResizeBar = _ref$showResizeBar === void 0 ? false : _ref$showResizeBar, _ref$noStorage = _ref.noStorage, noStorage = _ref$noStorage === void 0 ? false : _ref$noStorage, _ref$showNullButton = _ref.showNullButton, showNullButton = _ref$showNullButton === void 0 ? false : _ref$showNullButton, _ref$hidetoolBar = _ref.hidetoolBar, hidetoolBar = _ref$hidetoolBar === void 0 ? false : _ref$hidetoolBar, _ref$fullScreen = _ref.fullScreen, fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen, onBlur = _ref.onBlur, onCMBeforeChange = _ref.onCMBeforeChange, onFullScreen = _ref.onFullScreen, _ref$className = _ref.className, className = _ref$className === void 0 ? '' : _ref$className, _ref$disablePaste = _ref.disablePaste, disablePaste = _ref$disablePaste === void 0 ? false : _ref$disablePaste, _ref$placeholder = _ref.placeholder, placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder, _ref$values = _ref.values, values = _ref$values === void 0 ? '' : _ref$values; var _useState = Object(external_window_React_["useState"])(null), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), cm = _useState2[0], setCm = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(defaultValue), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), value = _useState4[0], setValue = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])(watch), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), preview = _useState6[0], setPreview = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(fullScreen), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), isFull = _useState8[0], setIsFull = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(''), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), action = _useState10[0], setAction = _useState10[1]; var _useState11 = Object(external_window_React_["useState"])(0), _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), lastedUpdateTime = _useState12[0], setLastedUpdateTime = _useState12[1]; var _useState13 = Object(external_window_React_["useState"])(height), _useState14 = Object(slicedToArray["a" /* default */])(_useState13, 2), h = _useState14[0], setH = _useState14[1]; var _useState15 = Object(external_window_React_["useState"])(false), _useState16 = Object(slicedToArray["a" /* default */])(_useState15, 2), tip = _useState16[0], setTip = _useState16[1]; var cmEl = Object(external_window_React_["useRef"])(); var containerEl = Object(external_window_React_["useRef"])(); var resizeBarEl = Object(external_window_React_["useRef"])(); var previewEl = Object(external_window_React_["useRef"])(); // useEffect(() => { // setValue(defaultValue) // cm?.setValue(defaultValue) // },[]) Object(external_window_React_["useEffect"])(function () { setValue(values); cm === null || cm === void 0 ? void 0 : cm.setValue(values); }, [values]); Object(external_window_React_["useEffect"])(function () { onFullScreen === null || onFullScreen === void 0 ? void 0 : onFullScreen(isFull); }, [isFull]); Object(external_window_React_["useEffect"])(function () { if (cmEl.current) { var instance = codemirror_default.a.fromTextArea(cmEl.current, { mode: mode, // inputStyle: 'contenteditable', lineNumbers: miniToolbar ? false : true, lineWrapping: true, value: defaultValue, autoCloseTags: true, autoCloseBrackets: true }); isFocus && instance.focus(); function onPaste(_, e) { if (disablePaste) { e.preventDefault(); return; } var clipboardData = e.clipboardData; if (clipboardData) { var types = clipboardData.types.toString(); var items = clipboardData.items; var officeSix = ["pptm", "pptx", "ppt", "pot", "pps", "ppa", "potx", "ppsx", "ppam", "pptm", "potm", "ppsm", "doc", "docx", "dot", "dotx", "docm", "dotm", "xls", "xlsx", "csv", "xlt", "xla", "xltx", "xlsm", "xltm", "xlam", "xlsb"]; if (types === 'Files' || clipboardData.types.indexOf("Files") > -1) { e.preventDefault(); if (mode == "stex") return; try { var _items$; var item = items[1]; if (((_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.kind) === 'file') { item = items[0]; } var file = item.getAsFile(); var fileSix = file.name.split(".").pop(); // console.log("item:", item, file, item?.type?.match(/^video\//i)) uploadImage(file, function (data) { if (data.id) { var _file$type, _file$type2, _file$type3; if ((file === null || file === void 0 ? void 0 : (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) { instance.replaceSelection(".concat(data.content_type, ")")); } else if ((file === null || file === void 0 ? void 0 : (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) { instance.replaceSelection("")); } else if ((file === null || file === void 0 ? void 0 : (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) { instance.replaceSelection("").concat(file.name, "")); } else if (officeSix.includes(fileSix)) { instance.replaceSelection("").concat(file.name, "")); } else { instance.replaceSelection("[".concat(file.name, "](").concat(env["a" /* default */].API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")")); } } else { if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login'; } }); } catch (e) { message["b" /* default */].warn("请使用chrome浏览器粘贴"); } return true; } else { //toMarkdown ? // let html = clipboardData.getData('text/html') return true; } } return true; } instance.on('paste', onPaste); setCm(instance); return function () { instance.off('paste', onPaste); }; } }, []); var resizeEditorBodyHeight = Object(external_window_React_["useCallback"])(function () { if (containerEl.current) { try {// let toolH = containerEl.current.getElementsByClassName('markdown-toolbar-container')[0].offsetHeight // let mdBody = containerEl.current.getElementsByClassName('markdown-editor-body')[0] // if (!isFull) { // mdBody.style.height = `${h - toolH}px` // } else { // mdBody.style.height = `calc(100vh - ${toolH}px)` // } } catch (error) { console.log(error, '---- to set md editor body height'); } } }, [h, containerEl, isFull]); Object(external_window_React_["useEffect"])(function () { function onLayout() { var ro = new ResizeObserver_es["default"](function (entries) { var _iterator = Object(createForOfIteratorHelper["a" /* default */])(entries), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var entry = _step.value; if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) { resizeEditorBodyHeight(); cm.setSize('100%', '100%'); cm.refresh(); } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } }); ro.observe(cmEl.current.parentElement); return ro; } if (cm) { var ro = onLayout(); return function () { ro.unobserve(cmEl.current.parentElement); }; } }, [cm, resizeEditorBodyHeight]); //keymap Object(external_window_React_["useEffect"])(function () { if (cm) { var keymap = []; var _loop = function _loop() { var _ref2 = _Object$entries[_i]; _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 2); var k = _ref3[0]; var value = _ref3[1]; var map = Object(defineProperty["a" /* default */])({}, k, function () { onActionCallback(value); }); keymap.push(map); cm.addKeyMap(map); }; for (var _i = 0, _Object$entries = Object.entries(DEFAULTKEYMAP); _i < _Object$entries.length; _i++) { var _ref3; _loop(); } return function () { var _iterator2 = Object(createForOfIteratorHelper["a" /* default */])(keymap), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var m = _step2.value; cm.removeKeyMap(m); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } }; } }, [cm]); Object(external_window_React_["useEffect"])(function () { if (fullScreen !== isFull) { setIsFull(fullScreen); } }, [fullScreen]); Object(useInterval["a" /* default */])(function () { if (!noStorage && lastedUpdateTime > 0) { var currentTime = new Date().getTime(); var lastedValue = window.sessionStorage.getItem(id); if (currentTime >= lastedUpdateTime + StorageTimeTicket && (!lastedValue || lastedValue !== value)) { window.sessionStorage.setItem(id, value); setTip(true); } } }, StorageTimeTicket); Object(external_window_React_["useEffect"])(function () { setPreview(watch); }, [cm, watch]); Object(external_window_React_["useEffect"])(function () { if (cm) { isFocus && cm.focus(); } }, [cm, isFocus]); Object(external_window_React_["useEffect"])(function () { if (preview && cm) { var scrollEl = cm.getScrollerElement(); function syncScroll(e) { var target = e.target; if (previewEl.current) { var ratio = target.scrollTop / target.scrollHeight; previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio; } } scrollEl.addEventListener('scroll', syncScroll); return function () { scrollEl.removeEventListener('scroll', syncScroll); }; } }, [cm, preview]); Object(external_window_React_["useEffect"])(function () { if (cm && onCMBeforeChange) { function onChangeHandler(cm, change) { onCMBeforeChange(cm, change); } cm.on('beforeChange', onChangeHandler); return function () { cm.off('beforeChange', onChangeHandler); }; } }, [cm, onCMBeforeChange]); Object(external_window_React_["useEffect"])(function () { if (cm && onBlur) { function onBlurHandler() { onBlur(cm.getValue()); } cm.on('blur', onBlurHandler); return function () { cm.off('blur', onBlurHandler); }; } }, [cm, onBlur]); Object(external_window_React_["useEffect"])(function () { if (cm) { function onChangeHandler(cm) { var content = cm.getValue(); setValue(content); setLastedUpdateTime(new Date().getTime()); cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll')); onChange && onChange(content); } cm.on('change', onChangeHandler); return function () { cm.off('change', onChangeHandler); }; } }, [cm, onChange]); Object(external_window_React_["useEffect"])(function () { if (cm) { // isFocus && cm.focus() if (defaultValue === null || defaultValue === undefined) { cm.setValue(''); setValue(''); } else { if (defaultValue !== cm.getValue()) { cm.setValue(defaultValue); setValue(defaultValue); cm.setCursor(cm.lineCount(), 0); } } } }, [cm, defaultValue]); var onActionCallback = Object(external_window_React_["useCallback"])(function (actionName) { var cursor = cm.getCursor(); var selection = cm.getSelection(); var selectionText = selection.split('\n'); switch (actionName) { case 'bold': cm.replaceSelection('**' + selection + '**'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 2); } return cm.focus(); case 'italic': cm.replaceSelection('*' + selection + '*'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 1); } return cm.focus(); case 'code': cm.replaceSelection('`' + selection + '`'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 1); } return cm.focus(); case 'inline-latex': cm.replaceSelection('`$$' + selection + '$$`'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 3); } return cm.focus(); case 'latex': cm.replaceSelection("```latex\n" + selection + "\n```"); cm.setCursor(cursor.line + 1, selection.length + 1); return cm.focus(); case 'line-break': cm.replaceSelection('
* For a fairly comprehensive set of languages see the * README * file that came with this source. At a minimum, the lexer should work on a * number of languages including C and friends, Java, Python, Bash, SQL, HTML, * XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk * and a subset of Perl, but, because of commenting conventions, doesn't work on * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class. *
* Usage:
} and {@code } tags in your source with
* {@code class=prettyprint.}
* You can also use the (html deprecated) {@code } tag, but the pretty
* printer needs to do more substantial DOM manipulations to support that, so
* some css styles may not be preserved.
* } or {@code } element to specify the
* language, as in {@code }. Any class that
* starts with "lang-" followed by a file extension, specifies the file type.
* See the "lang-*.js" files in this directory for code that implements
* per-language file handlers.
*
* Change log:
* cbeust, 2006/08/22
*
* Java annotations (start with "@") are now captured as literals ("lit")
*
* @requires console
*/
// JSLint declarations
/*global console, document, navigator, setTimeout, window, define */
/**
* @typedef {!Array.}
* Alternating indices and the decorations that should be inserted there.
* The indices are monotonically increasing.
*/
var DecorationsT;
/**
* @typedef {!{
* sourceNode: !Element,
* pre: !(number|boolean),
* langExtension: ?string,
* numberLines: ?(number|boolean),
* sourceCode: ?string,
* spans: ?(Array.),
* basePos: ?number,
* decorations: ?DecorationsT
* }}
*
* - sourceNode
- the element containing the source
*
- sourceCode
- source as plain text
*
- pre
- truthy if white-space in text nodes
* should be considered significant.
*
- spans
- alternating span start indices into source
* and the text node or element (e.g. {@code
}) corresponding to that
* span.
* - decorations
- an array of style classes preceded
* by the position at which they start in job.sourceCode in order
*
- basePos
- integer position of this.sourceCode in the larger chunk of
* source.
*
*/
var JobT;
/**
* @typedef {!{
* sourceCode: string,
* spans: !(Array.)
* }}
*
* - sourceCode
- source as plain text
*
- spans
- alternating span start indices into source
* and the text node or element (e.g. {@code
}) corresponding to that
* span.
*
*/
var SourceSpansT;
/** @define {boolean} */
var IN_GLOBAL_SCOPE = false;
var HACK_TO_FIX_JS_INCLUDE_PL;
/**
* {@type !{
* 'createSimpleLexer': function (Array, Array): (function (JobT)),
* 'registerLangHandler': function (function (JobT), Array.),
* 'PR_ATTRIB_NAME': string,
* 'PR_ATTRIB_NAME': string,
* 'PR_ATTRIB_VALUE': string,
* 'PR_COMMENT': string,
* 'PR_DECLARATION': string,
* 'PR_KEYWORD': string,
* 'PR_LITERAL': string,
* 'PR_NOCODE': string,
* 'PR_PLAIN': string,
* 'PR_PUNCTUATION': string,
* 'PR_SOURCE': string,
* 'PR_STRING': string,
* 'PR_TAG': string,
* 'PR_TYPE': string,
* 'prettyPrintOne': function (string, string, number|boolean),
* 'prettyPrint': function (?function, ?(HTMLElement|HTMLDocument))
* }}
* @const
*/
var PR;
/**
* Split {@code prettyPrint} into multiple timeouts so as not to interfere with
* UI events.
* If set to {@code false}, {@code prettyPrint()} is synchronous.
*/
window['PR_SHOULD_USE_CONTINUATION'] = true;
/**
* Pretty print a chunk of code.
* @param {string} sourceCodeHtml The HTML to pretty print.
* @param {string} opt_langExtension The language name to use.
* Typically, a filename extension like 'cpp' or 'java'.
* @param {number|boolean} opt_numberLines True to number lines,
* or the 1-indexed number of the first line in sourceCodeHtml.
* @return {string} code as html, but prettier
*/
var prettyPrintOne;
/**
* Find all the {@code } and {@code } tags in the DOM with
* {@code class=prettyprint} and prettify them.
*
* @param {Function} opt_whenDone called when prettifying is done.
* @param {HTMLElement|HTMLDocument} opt_root an element or document
* containing all the elements to pretty print.
* Defaults to {@code document.body}.
*/
var prettyPrint;
(function () {
var win = window;
// Keyword lists for various languages.
// We use things that coerce to strings to make them compact when minified
// and to defeat aggressive optimizers that fold large string constants.
var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," +
"double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed," +
"sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];
var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
"new,operator,private,protected,public,this,throw,true,try,typeof"];
var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignas,alignof,align_union,asm,axiom,bool," +
"concept,concept_map,const_cast,constexpr,decltype,delegate," +
"dynamic_cast,explicit,export,friend,generic,late_check," +
"mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert," +
"static_cast,template,typeid,typename,using,virtual,where"];
var JAVA_KEYWORDS = [COMMON_KEYWORDS,
"abstract,assert,boolean,byte,extends,finally,final,implements,import," +
"instanceof,interface,null,native,package,strictfp,super,synchronized," +
"throws,transient"];
var CSHARP_KEYWORDS = [COMMON_KEYWORDS,
"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending," +
"dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface," +
"internal,into,is,join,let,lock,null,object,out,override,orderby,params," +
"partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong," +
"unchecked,unsafe,ushort,value,var,virtual,where,yield"];
var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
"for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
"throw,true,try,unless,until,when,while,yes";
var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
"abstract,async,await,constructor,debugger,enum,eval,export,function," +
"get,implements,instanceof,interface,let,null,set,undefined,var,with," +
"yield,Infinity,NaN"];
var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
"goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
"sub,undef,unless,until,use,wantarray,while,BEGIN,END";
var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
"elif,except,exec,finally,from,global,import,in,is,lambda," +
"nonlocal,not,or,pass,print,raise,try,with,yield," +
"False,True,None"];
var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
"def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
"rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
"BEGIN,END"];
var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
"function,in,local,set,then,until"];
var ALL_KEYWORDS = [
CPP_KEYWORDS, CSHARP_KEYWORDS, JAVA_KEYWORDS, JSCRIPT_KEYWORDS,
PERL_KEYWORDS, PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
var C_TYPES = /^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
// token style names. correspond to css classes
/**
* token style for a string literal
* @const
*/
var PR_STRING = 'str';
/**
* token style for a keyword
* @const
*/
var PR_KEYWORD = 'kwd';
/**
* token style for a comment
* @const
*/
var PR_COMMENT = 'com';
/**
* token style for a type
* @const
*/
var PR_TYPE = 'typ';
/**
* token style for a literal value. e.g. 1, null, true.
* @const
*/
var PR_LITERAL = 'lit';
/**
* token style for a punctuation string.
* @const
*/
var PR_PUNCTUATION = 'pun';
/**
* token style for plain text.
* @const
*/
var PR_PLAIN = 'pln';
/**
* token style for an sgml tag.
* @const
*/
var PR_TAG = 'tag';
/**
* token style for a markup declaration such as a DOCTYPE.
* @const
*/
var PR_DECLARATION = 'dec';
/**
* token style for embedded source.
* @const
*/
var PR_SOURCE = 'src';
/**
* token style for an sgml attribute name.
* @const
*/
var PR_ATTRIB_NAME = 'atn';
/**
* token style for an sgml attribute value.
* @const
*/
var PR_ATTRIB_VALUE = 'atv';
/**
* A class that indicates a section of markup that is not code, e.g. to allow
* embedding of line numbers within code listings.
* @const
*/
var PR_NOCODE = 'nocode';
/**
* A set of tokens that can precede a regular expression literal in
* javascript
* http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
* has the full list, but I've removed ones that might be problematic when
* seen in languages that don't support regular expression literals.
*
* Specifically, I've removed any keywords that can't precede a regexp
* literal in a syntactically legal javascript program, and I've removed the
* "in" keyword since it's not a keyword in many languages, and might be used
* as a count of inches.
*
*
The link above does not accurately describe EcmaScript rules since
* it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
* very well in practice.
*
* @private
* @const
*/
var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
// CAVEAT: this does not properly handle the case where a regular
// expression immediately follows another since a regular expression may
// have flags for case-sensitivity and the like. Having regexp tokens
// adjacent is not valid in any language I'm aware of, so I'm punting.
// TODO: maybe style special characters inside a regexp as punctuation.
/**
* Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
* matches the union of the sets of strings matched by the input RegExp.
* Since it matches globally, if the input strings have a start-of-input
* anchor (/^.../), it is ignored for the purposes of unioning.
* @param {Array.} regexs non multiline, non-global regexs.
* @return {RegExp} a global regex.
*/
function combinePrefixPatterns(regexs) {
var capturedGroupIndex = 0;
var needToFoldCase = false;
var ignoreCase = false;
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
if (regex.ignoreCase) {
ignoreCase = true;
} else if (/[a-z]/i.test(regex.source.replace(
/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
needToFoldCase = true;
ignoreCase = false;
break;
}
}
var escapeCharToCodeUnit = {
'b': 8,
't': 9,
'n': 0xa,
'v': 0xb,
'f': 0xc,
'r': 0xd
};
function decodeEscape(charsetPart) {
var cc0 = charsetPart.charCodeAt(0);
if (cc0 !== 92 /* \\ */) {
return cc0;
}
var c1 = charsetPart.charAt(1);
cc0 = escapeCharToCodeUnit[c1];
if (cc0) {
return cc0;
} else if ('0' <= c1 && c1 <= '7') {
return parseInt(charsetPart.substring(1), 8);
} else if (c1 === 'u' || c1 === 'x') {
return parseInt(charsetPart.substring(2), 16);
} else {
return charsetPart.charCodeAt(1);
}
}
function encodeEscape(charCode) {
if (charCode < 0x20) {
return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
}
var ch = String.fromCharCode(charCode);
return (ch === '\\' || ch === '-' || ch === ']' || ch === '^')
? "\\" + ch : ch;
}
function caseFoldCharset(charSet) {
var charsetParts = charSet.substring(1, charSet.length - 1).match(
new RegExp(
'\\\\u[0-9A-Fa-f]{4}'
+ '|\\\\x[0-9A-Fa-f]{2}'
+ '|\\\\[0-3][0-7]{0,2}'
+ '|\\\\[0-7]{1,2}'
+ '|\\\\[\\s\\S]'
+ '|-'
+ '|[^-\\\\]',
'g'));
var ranges = [];
var inverse = charsetParts[0] === '^';
var out = ['['];
if (inverse) { out.push('^'); }
for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
var p = charsetParts[i];
if (/\\[bdsw]/i.test(p)) { // Don't muck with named groups.
out.push(p);
} else {
var start = decodeEscape(p);
var end;
if (i + 2 < n && '-' === charsetParts[i + 1]) {
end = decodeEscape(charsetParts[i + 2]);
i += 2;
} else {
end = start;
}
ranges.push([start, end]);
// If the range might intersect letters, then expand it.
// This case handling is too simplistic.
// It does not deal with non-latin case folding.
// It works for latin source code identifiers though.
if (!(end < 65 || start > 122)) {
if (!(end < 65 || start > 90)) {
ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
}
if (!(end < 97 || start > 122)) {
ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
}
}
}
}
// [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
// -> [[1, 12], [14, 14], [16, 17]]
ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
var consolidatedRanges = [];
var lastRange = [];
for (var i = 0; i < ranges.length; ++i) {
var range = ranges[i];
if (range[0] <= lastRange[1] + 1) {
lastRange[1] = Math.max(lastRange[1], range[1]);
} else {
consolidatedRanges.push(lastRange = range);
}
}
for (var i = 0; i < consolidatedRanges.length; ++i) {
var range = consolidatedRanges[i];
out.push(encodeEscape(range[0]));
if (range[1] > range[0]) {
if (range[1] + 1 > range[0]) { out.push('-'); }
out.push(encodeEscape(range[1]));
}
}
out.push(']');
return out.join('');
}
function allowAnywhereFoldCaseAndRenumberGroups(regex) {
// Split into character sets, escape sequences, punctuation strings
// like ('(', '(?:', ')', '^'), and runs of characters that do not
// include any of the above.
var parts = regex.source.match(
new RegExp(
'(?:'
+ '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
+ '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
+ '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
+ '|\\\\[0-9]+' // a back-reference or octal escape
+ '|\\\\[^ux0-9]' // other escape sequence
+ '|\\(\\?[:!=]' // start of a non-capturing group
+ '|[\\(\\)\\^]' // start/end of a group, or line start
+ '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
+ ')',
'g'));
var n = parts.length;
// Maps captured group numbers to the number they will occupy in
// the output or to -1 if that has not been determined, or to
// undefined if they need not be capturing in the output.
var capturedGroups = [];
// Walk over and identify back references to build the capturedGroups
// mapping.
for (var i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
// groups are 1-indexed, so max group index is count of '('
++groupIndex;
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
if (decimalValue) {
if (decimalValue <= groupIndex) {
capturedGroups[decimalValue] = -1;
} else {
// Replace with an unambiguous escape sequence so that
// an octal escape sequence does not turn into a backreference
// to a capturing group from an earlier regex.
parts[i] = encodeEscape(decimalValue);
}
}
}
}
// Renumber groups and reduce capturing groups to non-capturing groups
// where possible.
for (var i = 1; i < capturedGroups.length; ++i) {
if (-1 === capturedGroups[i]) {
capturedGroups[i] = ++capturedGroupIndex;
}
}
for (var i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
++groupIndex;
if (!capturedGroups[groupIndex]) {
parts[i] = '(?:';
}
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
if (decimalValue && decimalValue <= groupIndex) {
parts[i] = '\\' + capturedGroups[decimalValue];
}
}
}
// Remove any prefix anchors so that the output will match anywhere.
// ^^ really does mean an anchored match though.
for (var i = 0; i < n; ++i) {
if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
}
// Expand letters to groups to handle mixing of case-sensitive and
// case-insensitive patterns if necessary.
if (regex.ignoreCase && needToFoldCase) {
for (var i = 0; i < n; ++i) {
var p = parts[i];
var ch0 = p.charAt(0);
if (p.length >= 2 && ch0 === '[') {
parts[i] = caseFoldCharset(p);
} else if (ch0 !== '\\') {
// TODO: handle letters in numeric escapes.
parts[i] = p.replace(
/[a-zA-Z]/g,
function (ch) {
var cc = ch.charCodeAt(0);
return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
});
}
}
}
return parts.join('');
}
var rewritten = [];
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
if (regex.global || regex.multiline) { throw new Error('' + regex); }
rewritten.push(
'(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
}
return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
}
/**
* Split markup into a string of source code and an array mapping ranges in
* that string to the text nodes in which they appear.
*
*
* The HTML DOM structure:
*
* (Element "p"
* (Element "b"
* (Text "print ")) ; #1
* (Text "'Hello '") ; #2
* (Element "br") ; #3
* (Text " + 'World';")) ; #4
*
*
* corresponds to the HTML
* {@code
print 'Hello '
+ 'World';
}.
*
*
* It will produce the output:
*
* {
* sourceCode: "print 'Hello '\n + 'World';",
* // 1 2
* // 012345678901234 5678901234567
* spans: [0, #1, 6, #2, 14, #3, 15, #4]
* }
*
*
* where #1 is a reference to the {@code "print "} text node above, and so
* on for the other text nodes.
*
*
*
* The {@code} spans array is an array of pairs. Even elements are the start
* indices of substrings, and odd elements are the text nodes (or BR elements)
* that contain the text for those substrings.
* Substrings continue until the next index or the end of the source.
*
*
* @param {Node} node an HTML DOM subtree containing source-code.
* @param {boolean|number} isPreformatted truthy if white-space in
* text nodes should be considered significant.
* @return {SourceSpansT} source code and the nodes in which they occur.
*/
function extractSourceSpans(node, isPreformatted) {
var nocode = /(?:^|\s)nocode(?:\s|$)/;
var chunks = [];
var length = 0;
var spans = [];
var k = 0;
function walk(node) {
var type = node.nodeType;
if (type == 1) { // Element
if (nocode.test(node.className)) { return; }
for (var child = node.firstChild; child; child = child.nextSibling) {
walk(child);
}
var nodeName = node.nodeName.toLowerCase();
if ('br' === nodeName || 'li' === nodeName) {
chunks[k] = '\n';
spans[k << 1] = length++;
spans[(k++ << 1) | 1] = node;
}
} else if (type == 3 || type == 4) { // Text
var text = node.nodeValue;
if (text.length) {
if (!isPreformatted) {
text = text.replace(/[ \t\r\n]+/g, ' ');
} else {
text = text.replace(/\r\n?/g, '\n'); // Normalize newlines.
}
// TODO: handle tabs here?
chunks[k] = text;
spans[k << 1] = length;
length += text.length;
spans[(k++ << 1) | 1] = node;
}
}
}
walk(node);
return {
sourceCode: chunks.join('').replace(/\n$/, ''),
spans: spans
};
}
/**
* Apply the given language handler to sourceCode and add the resulting
* decorations to out.
* @param {!Element} sourceNode
* @param {number} basePos the index of sourceCode within the chunk of source
* whose decorations are already present on out.
* @param {string} sourceCode
* @param {function(JobT)} langHandler
* @param {DecorationsT} out
*/
function appendDecorations(
sourceNode, basePos, sourceCode, langHandler, out) {
if (!sourceCode) { return; }
/** @type {JobT} */
var job = {
sourceNode: sourceNode,
pre: 1,
langExtension: null,
numberLines: null,
sourceCode: sourceCode,
spans: null,
basePos: basePos,
decorations: null
};
langHandler(job);
out.push.apply(out, job.decorations);
}
var notWs = /\S/;
/**
* Given an element, if it contains only one child element and any text nodes
* it contains contain only space characters, return the sole child element.
* Otherwise returns undefined.
*
* This is meant to return the CODE element in {@code
} when
* there is a single child element that contains all the non-space textual
* content, but not to return anything where there are multiple child elements
* as in {@code ......
} or when there
* is textual content.
*/
function childContentWrapper(element) {
var wrapper = undefined;
for (var c = element.firstChild; c; c = c.nextSibling) {
var type = c.nodeType;
wrapper = (type === 1) // Element Node
? (wrapper ? element : c)
: (type === 3) // Text Node
? (notWs.test(c.nodeValue) ? element : wrapper)
: wrapper;
}
return wrapper === element ? undefined : wrapper;
}
/** Given triples of [style, pattern, context] returns a lexing function,
* The lexing function interprets the patterns to find token boundaries and
* returns a decoration list of the form
* [index_0, style_0, index_1, style_1, ..., index_n, style_n]
* where index_n is an index into the sourceCode, and style_n is a style
* constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
* all characters in sourceCode[index_n-1:index_n].
*
* The stylePatterns is a list whose elements have the form
* [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
*
* Style is a style constant like PR_PLAIN, or can be a string of the
* form 'lang-FOO', where FOO is a language extension describing the
* language of the portion of the token in $1 after pattern executes.
* E.g., if style is 'lang-lisp', and group 1 contains the text
* '(hello (world))', then that portion of the token will be passed to the
* registered lisp handler for formatting.
* The text before and after group 1 will be restyled using this decorator
* so decorators should take care that this doesn't result in infinite
* recursion. For example, the HTML lexer rule for SCRIPT elements looks
* something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
* '