You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/16044.bfee460f.async.js

4541 lines
175 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(self["webpackChunk"] = self["webpackChunk"] || []).push([[16044],{
/***/ 8433:
/*!*********************************************************!*\
!*** ./src/components/MathematicalGraphics/js/index.js ***!
\*********************************************************/
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = (__webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/typeof.js */ 31468)["default"]);
(function () {
if (typeof window.GGBApplet == "function") {
console.warn("deployggb.js was loaded twice");
return;
}
var isRenderGGBElementEnabled = false;
var scriptLoadStarted = false;
var html5AppletsToProcess = null;
var ggbHTML5LoadedCodebaseIsWebSimple = false;
var ggbHTML5LoadedCodebaseVersion = null;
var ggbHTML5LoadedScript = null;
var GGBApplet = function GGBApplet() {
"use strict";
var applet = {};
var ggbVersion = "5.0";
var parameters = {};
var views = null;
var html5NoWebSimple = false;
var html5NoWebSimpleParamExists = false;
var appletID = null;
var initComplete = false;
var html5OverwrittenCodebaseVersion = null;
var html5OverwrittenCodebase = null;
for (var i = 0; i < arguments.length; i++) {
var p = arguments[i];
if (p !== null) {
switch (_typeof(p)) {
case "number":
ggbVersion = p.toFixed(1);
break;
case "string":
if (p.match(new RegExp("^[0-9]\\.[0-9]+$"))) {
ggbVersion = p;
} else {
appletID = p;
}
break;
case "object":
if (typeof p.is3D !== "undefined") {
views = p;
} else {
parameters = p;
}
break;
case "boolean":
html5NoWebSimple = p;
html5NoWebSimpleParamExists = true;
break;
}
}
}
if (views === null) {
views = {
is3D: false,
AV: false,
SV: false,
CV: false,
EV2: false,
CP: false,
PC: false,
DA: false,
FI: false,
PV: false,
macro: false
};
if (parameters.material_id !== undefined && !html5NoWebSimpleParamExists) {
html5NoWebSimple = true;
}
}
if (appletID !== null && parameters.id === undefined) {
parameters.id = appletID;
}
var jnlpFilePath = "";
var html5Codebase = "";
var isHTML5Offline = false;
var loadedAppletType = null;
var html5CodebaseVersion = null;
var html5CodebaseScript = null;
var html5CodebaseIsWebSimple = false;
var previewImagePath = null;
var previewLoadingPath = null;
var previewPlayPath = null;
var fonts_css_url = null;
var jnlpBaseDir = null;
if (parameters.height !== undefined) {
parameters.height = Math.round(parameters.height);
}
if (parameters.width !== undefined) {
parameters.width = Math.round(parameters.width);
}
var parseVersion = function parseVersion(d) {
return parseFloat(d) > 4 ? parseFloat(d) : 5;
};
applet.setHTML5Codebase = function (codebase, offline) {
html5OverwrittenCodebase = codebase;
setHTML5CodebaseInternal(codebase, offline);
};
applet.setJavaCodebase = applet.setJavaCodebaseVersion = applet.isCompiledInstalled = applet.setPreCompiledScriptPath = applet.setPreCompiledResourcePath = function () {};
applet.setHTML5CodebaseVersion = function (version, offline) {
var numVersion = parseFloat(version);
if (numVersion !== NaN && numVersion < 5) {
console.log("The GeoGebra HTML5 codebase version " + numVersion + " is deprecated. Using version latest instead.");
return;
}
html5OverwrittenCodebaseVersion = version;
setDefaultHTML5CodebaseForVersion(version, offline);
};
applet.getHTML5CodebaseVersion = function () {
return html5CodebaseVersion;
};
applet.getParameters = function () {
return parameters;
};
applet.setFontsCSSURL = function (url) {
fonts_css_url = url;
};
applet.setGiacJSURL = function (url) {};
applet.setJNLPFile = function (newJnlpFilePath) {
jnlpFilePath = newJnlpFilePath;
};
applet.setJNLPBaseDir = function (baseDir) {};
applet.inject = function () {
function isOwnIFrame() {
return window.frameElement && window.frameElement.getAttribute("data-singleton");
}
var type = "auto";
var container_ID = parameters.id;
var container;
var noPreview = false;
for (var i = 0; i < arguments.length; i++) {
var p = arguments[i];
if (typeof p === "string") {
p = p.toLowerCase();
if (p.match(/^(prefer)?(java|html5|compiled|auto|screenshot)$/)) {
type = p;
} else {
container_ID = arguments[i];
}
} else if (typeof p === "boolean") {
noPreview = p;
} else if (p instanceof HTMLElement) {
container = p;
}
}
continueInject();
function continueInject() {
if (!initComplete) {
setTimeout(continueInject, 200);
return;
}
type = detectAppletType(type);
var appletElem = container || document.getElementById(container_ID);
if (!appletElem) {
console.log("possibly bug on ajax loading? ");
return;
}
applet.removeExistingApplet(appletElem, false);
if (parameters.width === undefined && appletElem.clientWidth) {
parameters.width = appletElem.clientWidth;
}
if (parameters.height === undefined && appletElem.clientHeight) {
parameters.height = appletElem.clientHeight;
}
if (!(parameters.width && parameters.height) && type === "html5") {
delete parameters.width;
delete parameters.height;
}
loadedAppletType = type;
if (type === "screenshot") {
injectScreenshot(appletElem, parameters);
} else {
var playButton = false;
if (parameters.hasOwnProperty("playButton") && parameters.playButton || parameters.hasOwnProperty("clickToLoad") && parameters.clickToLoad) {
playButton = true;
} else if (parameters.hasOwnProperty("playButtonAutoDecide") && parameters.playButtonAutoDecide) {
playButton = (!isInIframe() || isOwnIFrame()) && isMobileDevice();
}
if (playButton) {
loadedAppletType = "screenshot";
injectPlayButton(appletElem, parameters, noPreview, type);
} else {
injectHTML5Applet(appletElem, parameters, noPreview);
}
}
}
return;
};
function isInIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
function isMobileDevice() {
if (parameters.hasOwnProperty("screenshotGenerator") && parameters.screenshotGenerator) {
return false;
}
return Math.max(screen.width, screen.height) < 800;
}
applet.getViews = function () {
return views;
};
applet.isJavaInstalled = function () {
return false;
};
var fetchParametersFromApi = function fetchParametersFromApi(successCallback) {
var onSuccess = function onSuccess(text) {
var jsonData = JSON.parse(text);
var isGeoGebra = function isGeoGebra(element) {
return element.type == "G" || element.type == "E";
};
var item = jsonData.elements ? jsonData.elements.filter(isGeoGebra)[0] : jsonData;
if (!item || !item.url) {
onError();
return;
}
parameters.fileName = item.url;
updateAppletSettings(item.settings || {});
views.is3D = true;
var imageDir = "https://www.geogebra.org/images/";
applet.setPreviewImage(previewImagePath || item.previewUrl, imageDir + "GeoGebra_loading.png", imageDir + "applet_play.png");
successCallback();
};
var onError = function onError() {
parameters.onError && parameters.onError();
log("Error: Fetching material (id " + parameters.material_id + ") failed.", parameters);
};
var host = location.host.match(/(www|stage|beta|groot|alpha).geogebra.(org|net)/) ? location.host : "www.geogebra.org";
var path = "/materials/" + parameters.material_id + "?scope=basic";
sendCorsRequest("https://" + host + "/api/proxy.php?path=" + encodeURIComponent(path), onSuccess, onError);
};
function updateAppletSettings(settings) {
var parameterNames = ["width", "height", "showToolBar", "showMenuBar", "showAlgebraInput", "allowStyleBar", "showResetIcon", "enableLabelDrags", "enableShiftDragZoom", "enableRightClick", "appName"];
["enableLabelDrags", "enableShiftDragZoom", "enableRightClick"].forEach(function (name) {
settings[name] = !!settings[name];
});
parameterNames.forEach(function (name) {
if (parameters[name] === undefined && settings[name] !== undefined) {
parameters[name] = settings[name];
}
});
if (parameters.showToolBarHelp === undefined) {
parameters.showToolBarHelp = parameters.showToolBar;
}
}
function sendCorsRequest(url, onSuccess, onError) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onload = function () {
onSuccess(xhr.responseText);
};
xhr.onerror = onError;
xhr.send();
}
applet.isHTML5Installed = function () {
return true;
};
applet.getLoadedAppletType = function () {
return loadedAppletType;
};
applet.setPreviewImage = function (previewFilePath, loadingFilePath, playFilePath) {
previewImagePath = previewFilePath;
previewLoadingPath = loadingFilePath;
previewPlayPath = playFilePath;
};
applet.removeExistingApplet = function (appletParent, showScreenshot) {
var i;
if (typeof appletParent === "string") {
appletParent = document.getElementById(appletParent);
}
loadedAppletType = null;
var removedID = null;
for (i = 0; i < appletParent.childNodes.length; i++) {
var currentChild = appletParent.childNodes[i];
var className = currentChild.className;
if (className === "applet_screenshot") {
if (showScreenshot) {
currentChild.style.display = "block";
loadedAppletType = "screenshot";
} else {
currentChild.style.display = "none";
}
} else if (className !== "applet_scaler prerender") {
appletParent.removeChild(currentChild);
removedID = className && className.indexOf("appletParameters") != -1 ? currentChild.id : null;
i--;
}
}
var appName = parameters.id !== undefined ? parameters.id : removedID;
var app = window[appName];
if (app && typeof app.getBase64 === "function") {
app.remove();
window[appName] = null;
}
};
applet.refreshHitPoints = function () {
if (parseVersion(ggbHTML5LoadedCodebaseVersion) >= 5) {
return true;
}
var app = applet.getAppletObject();
if (app) {
if (typeof app.recalculateEnvironments === "function") {
app.recalculateEnvironments();
return true;
}
}
return false;
};
applet.startAnimation = function () {
var app = applet.getAppletObject();
if (app) {
if (typeof app.startAnimation === "function") {
app.startAnimation();
return true;
}
}
return false;
};
applet.stopAnimation = function () {
var app = applet.getAppletObject();
if (app) {
if (typeof app.stopAnimation === "function") {
app.stopAnimation();
return true;
}
}
return false;
};
applet.getAppletObject = function () {
var appName = parameters.id !== undefined ? parameters.id : "ggbApplet";
return window[appName];
};
applet.resize = function () {};
var appendParam = function appendParam(applet, name, value) {
var param = document.createElement("param");
param.setAttribute("name", name);
param.setAttribute("value", value);
applet.appendChild(param);
};
var valBoolean = function valBoolean(value) {
return value && value !== "false";
};
var injectHTML5Applet = function injectHTML5Applet(appletElem, parameters, noPreview) {
if (parseVersion(html5CodebaseVersion) <= 4.2) {
noPreview = true;
}
var loadScript = !isRenderGGBElementEnabled && !scriptLoadStarted;
if (!isRenderGGBElementEnabled && !scriptLoadStarted || ggbHTML5LoadedCodebaseVersion !== html5CodebaseVersion || ggbHTML5LoadedCodebaseIsWebSimple && !html5CodebaseIsWebSimple) {
loadScript = true;
isRenderGGBElementEnabled = false;
scriptLoadStarted = false;
}
var article = document.createElement("div");
article.classList.add("appletParameters", "notranslate");
var oriWidth = parameters.width;
var oriHeight = parameters.height;
parameters.disableAutoScale = parameters.disableAutoScale === undefined ? GGBAppletUtils.isFlexibleWorksheetEditor() : parameters.disableAutoScale;
if (parameters.width !== undefined) {
if (parseVersion(html5CodebaseVersion) <= 4.4) {
if (valBoolean(parameters.showToolBar)) {
parameters.height -= 7;
}
if (valBoolean(parameters.showAlgebraInput)) {
parameters.height -= 37;
}
if (parameters.width < 605 && valBoolean(parameters.showToolBar)) {
parameters.width = 605;
oriWidth = 605;
}
} else {
var minWidth = 100;
if (valBoolean(parameters.showToolBar) || valBoolean(parameters.showMenuBar)) {
if (parameters.hasOwnProperty("customToolBar")) {
parameters.customToolbar = parameters.customToolBar;
}
minWidth = valBoolean(parameters.showMenuBar) ? 245 : 155;
}
if (oriWidth < minWidth) {
parameters.width = minWidth;
oriWidth = minWidth;
}
}
}
article.style.border = "none";
article.style.display = "inline-block";
for (var key in parameters) {
if (parameters.hasOwnProperty(key) && key !== "appletOnLoad") {
article.setAttribute("data-param-" + key, parameters[key]);
}
}
if (fonts_css_url) {
article.setAttribute("data-param-fontscssurl", fonts_css_url);
}
applet.resize = function () {
GGBAppletUtils.responsiveResize(appletElem, parameters);
};
window.addEventListener("resize", function (evt) {
applet.resize();
});
var oriAppletOnload = typeof parameters.appletOnLoad === "function" ? parameters.appletOnLoad : function () {};
if (!noPreview && parameters.width !== undefined) {
if (!parameters.hasOwnProperty("showSplash")) {
article.setAttribute("data-param-showSplash", "false");
}
var previewPositioner = appletElem.querySelector(".applet_scaler.prerender");
var preRendered = previewPositioner !== null;
if (!preRendered) {
var previewContainer = createScreenShotDiv(oriWidth, oriHeight, parameters.borderColor, false);
previewPositioner = document.createElement("div");
previewPositioner.className = "applet_scaler";
previewPositioner.style.position = "relative";
previewPositioner.style.display = "block";
previewPositioner.style.width = oriWidth + "px";
previewPositioner.style.height = oriHeight + "px";
} else {
var previewContainer = previewPositioner.querySelector(".ggb_preview");
}
if (window.GGBT_spinner) {
window.GGBT_spinner.attachSpinner(previewPositioner, "66%");
}
if (parseVersion(html5CodebaseVersion) >= 5) {
parameters.appletOnLoad = function (api) {
var preview = appletElem.querySelector(".ggb_preview");
if (preview) {
preview.parentNode.removeChild(preview);
}
if (window.GGBT_spinner) {
window.GGBT_spinner.removeSpinner(previewPositioner);
}
if (window.GGBT_wsf_view) {
$(window).trigger("resize");
}
oriAppletOnload(api);
};
if (!preRendered) {
previewPositioner.appendChild(previewContainer);
}
} else {
article.appendChild(previewContainer);
}
previewPositioner.appendChild(article);
if (!preRendered) {
appletElem.appendChild(previewPositioner);
}
setTimeout(function () {
applet.resize();
}, 1);
} else {
var appletScaler = document.createElement("div");
appletScaler.className = "applet_scaler";
appletScaler.style.position = "relative";
appletScaler.style.display = "block";
appletScaler.appendChild(article);
appletElem.appendChild(appletScaler);
parameters.appletOnLoad = function (api) {
applet.resize();
oriAppletOnload(api);
};
}
function renderGGBElementWithParams(article, parameters) {
if (parameters && typeof parameters.appletOnLoad === "function" && typeof renderGGBElement === "function") {
renderGGBElement(article, parameters.appletOnLoad);
} else {
renderGGBElement(article);
}
log("GeoGebra HTML5 applet injected and rendered with previously loaded codebase.", parameters);
}
function renderGGBElementOnTube(a, parameters) {
if (typeof renderGGBElement === "undefined") {
if (html5AppletsToProcess === null) {
html5AppletsToProcess = [];
}
html5AppletsToProcess.push({
article: a,
params: parameters
});
window.renderGGBElementReady = function () {
isRenderGGBElementEnabled = true;
if (html5AppletsToProcess !== null && html5AppletsToProcess.length) {
html5AppletsToProcess.forEach(function (obj) {
renderGGBElementWithParams(obj.article, obj.params);
});
html5AppletsToProcess = null;
}
};
if (parseVersion(html5CodebaseVersion) < 5) {
a.className += " geogebraweb";
}
} else {
renderGGBElementWithParams(a, parameters);
}
}
if (loadScript) {
scriptLoadStarted = true;
for (var i = 0; i < article.childNodes.length; i++) {
var tag = article.childNodes[i].tagName;
if (tag === "TABLE") {
article.removeChild(article.childNodes[i]);
i--;
}
}
if (ggbHTML5LoadedScript !== null) {
var el = document.querySelector('script[src="' + ggbHTML5LoadedScript + '"]');
if (el !== undefined && el !== null) {
el.parentNode.removeChild(el);
}
}
var script = document.createElement("script");
var scriptLoaded = function scriptLoaded() {
renderGGBElementOnTube(article, parameters);
};
script.src = html5Codebase + html5CodebaseScript;
ggbHTML5LoadedCodebaseIsWebSimple = html5CodebaseIsWebSimple;
ggbHTML5LoadedCodebaseVersion = html5CodebaseVersion;
ggbHTML5LoadedScript = script.src;
log("GeoGebra HTML5 codebase loaded: '" + html5Codebase + "'.", parameters);
if (!html5OverwrittenCodebase && (!html5OverwrittenCodebaseVersion || html5OverwrittenCodebaseVersion == "5.0")) {
if (html5CodebaseIsWebSimple) {
webSimple.succeeded = webSimple.succeeded || webSimple();
} else {
web3d.succeeded = web3d.succeeded || web3d();
}
scriptLoaded();
} else if (html5Codebase.requirejs) {
__webpack_require__.e(/*! AMD require */ 70686).then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(/*! ./web3d */ 70686)]; (scriptLoaded).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);}.bind(this))['catch'](__webpack_require__.oe);
} else {
script.onload = scriptLoaded;
appletElem.appendChild(script);
}
} else {
renderGGBElementOnTube(article, parameters);
}
parameters.height = oriHeight;
parameters.width = oriWidth;
};
var injectScreenshot = function injectScreenshot(appletElem, parameters, showPlayButton) {
var previewContainer = createScreenShotDiv(parameters.width, parameters.height, parameters.borderColor, showPlayButton);
var previewPositioner = document.createElement("div");
previewPositioner.style.position = "relative";
previewPositioner.style.display = "block";
previewPositioner.style.width = parameters.width + "px";
previewPositioner.style.height = parameters.height + "px";
previewPositioner.className = "applet_screenshot applet_scaler" + (showPlayButton ? " applet_screenshot_play" : "");
previewPositioner.appendChild(previewContainer);
var scale = GGBAppletUtils.getScale(parameters, appletElem, showPlayButton);
if (showPlayButton) {
appletElem.appendChild(getPlayButton());
if (!window.GGBT_wsf_view) {
appletElem.style.position = "relative";
}
} else if (window.GGBT_spinner) {
window.GGBT_spinner.attachSpinner(previewPositioner, "66%");
}
appletElem.appendChild(previewPositioner);
if (scale !== 1 && !isNaN(scale)) {
GGBAppletUtils.scaleElement(previewPositioner, scale);
previewPositioner.style.width = parameters.width + "px";
previewPositioner.style.height = parameters.height + "px";
previewPositioner.parentNode.style.width = parameters.width * scale + "px";
previewPositioner.parentNode.style.height = parameters.height * scale + "px";
}
applet.resize = function () {
resizeScreenshot(appletElem, previewContainer, previewPositioner, showPlayButton);
};
window.addEventListener("resize", function (evt) {
applet.resize();
});
applet.resize();
};
function resizeScreenshot(appletElem, previewContainer, previewPositioner, showPlayButton) {
if (!appletElem.contains(previewContainer)) {
return;
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
if (appletElem.id !== "fullscreencontent") {
return;
}
window.GGBT_wsf_view.setCloseBtnPosition(appletElem);
}
var scale = GGBAppletUtils.getScale(parameters, appletElem, showPlayButton);
if (previewPositioner.parentNode !== null) {
if (!isNaN(scale) && scale !== 1) {
GGBAppletUtils.scaleElement(previewPositioner, scale);
previewPositioner.parentNode.style.width = parameters.width * scale + "px";
previewPositioner.parentNode.style.height = parameters.height * scale + "px";
} else {
GGBAppletUtils.scaleElement(previewPositioner, 1);
previewPositioner.parentNode.style.width = parameters.width + "px";
previewPositioner.parentNode.style.height = parameters.height + "px";
}
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
GGBAppletUtils.positionCenter(appletElem);
}
if (_typeof(window.GGBT_ws_header_footer) === "object") {
window.GGBT_ws_header_footer.setWsScrollerHeight();
}
}
applet.onExitFullscreen = function (fullscreenContainer, appletElem) {
appletElem.appendChild(fullscreenContainer);
};
var injectPlayButton = function injectPlayButton(appletElem, parameters, noPreview, type) {
injectScreenshot(appletElem, parameters, true);
var play = function play() {
var elems = [];
for (i = 0; i < appletElem.childNodes.length; i++) {
elems.push(appletElem.childNodes[i]);
}
if (window.GGBT_wsf_view) {
var content = window.GGBT_wsf_view.renderFullScreen(appletElem, parameters.id);
var container = document.getElementById("fullscreencontainer");
var oldcontent = jQuery(appletElem).find(".fullscreencontent");
if (oldcontent.length > 0) {
content.remove();
oldcontent.attr("id", "fullscreencontent").show();
jQuery(container).append(oldcontent);
window.dispatchEvent(new Event("resize"));
} else {
injectHTML5Applet(content, parameters, false);
}
window.GGBT_wsf_view.launchFullScreen(container);
} else {
loadedAppletType = type;
injectHTML5Applet(appletElem, parameters, false);
}
if (!window.GGBT_wsf_view) {
for (i = 0; i < elems.length; i++) {
appletElem.removeChild(elems[i]);
}
}
};
var imgs = appletElem.getElementsByClassName("ggb_preview_play");
for (var i = 0; i < imgs.length; i++) {
imgs[i].addEventListener("click", play, false);
imgs[i].addEventListener("ontouchstart", play, false);
}
if (typeof window.ggbAppletPlayerOnload === "function") {
window.ggbAppletPlayerOnload(appletElem);
}
if (isMobileDevice() && window.GGBT_wsf_view) {
$(".wsf-element-fullscreen-button").remove();
}
};
var getPlayButton = function getPlayButton() {
var playButtonContainer = document.createElement("div");
playButtonContainer.className = "ggb_preview_play icon-applet-play";
if (!window.GGBT_wsf_view) {
var css = "" + ".icon-applet-play {" + " width: 100%;" + " height: 100%;box-sizing: border-box;position: absolute;z-index: 1001;cursor: pointer;border-width: 0px;" + " background-color: transparent;background-repeat: no-repeat;left: 0;top: 0;background-position: center center;" + ' background-image: url("https://www.geogebra.org/images/worksheet/icon-start-applet.png");' + "}" + ".icon-applet-play:hover {" + 'background-image: url("https://www.geogebra.org/images/worksheet/icon-start-applet-hover.png");' + "}";
var style = document.createElement("style");
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
document.getElementsByTagName("head")[0].appendChild(style);
}
return playButtonContainer;
};
var createScreenShotDiv = function createScreenShotDiv(oriWidth, oriHeight, borderColor, showPlayButton) {
var previewContainer = document.createElement("div");
previewContainer.className = "ggb_preview";
previewContainer.style.position = "absolute";
previewContainer.style.zIndex = "90";
previewContainer.style.width = oriWidth - 2 + "px";
previewContainer.style.height = oriHeight - 2 + "px";
previewContainer.style.top = "0px";
previewContainer.style.left = "0px";
previewContainer.style.overflow = "hidden";
previewContainer.style.backgroundColor = "white";
var bc = "lightgrey";
if (borderColor !== undefined) {
if (borderColor === "none") {
bc = "transparent";
} else {
bc = borderColor;
}
}
previewContainer.style.border = "1px solid " + bc;
var preview = document.createElement("img");
preview.style.position = "relative";
preview.style.zIndex = "1000";
preview.style.top = "-1px";
preview.style.left = "-1px";
if (previewImagePath !== null) {
preview.setAttribute("src", previewImagePath);
}
preview.style.opacity = .7;
if (previewLoadingPath !== null) {
var previewOverlay;
var pWidth, pHeight;
if (!showPlayButton) {
previewOverlay = document.createElement("img");
previewOverlay.style.position = "absolute";
previewOverlay.style.zIndex = "1001";
previewOverlay.style.opacity = 1;
preview.style.opacity = .3;
pWidth = 360;
if (pWidth > oriWidth / 4 * 3) {
pWidth = oriWidth / 4 * 3;
}
pHeight = pWidth / 5.8;
previewOverlay.setAttribute("src", previewLoadingPath);
previewOverlay.setAttribute("width", pWidth);
previewOverlay.setAttribute("height", pHeight);
var pX = (oriWidth - pWidth) / 2;
var pY = (oriHeight - pHeight) / 2;
previewOverlay.style.left = pX + "px";
previewOverlay.style.top = pY + "px";
previewContainer.appendChild(previewOverlay);
}
}
previewContainer.appendChild(preview);
return previewContainer;
};
var detectAppletType = function detectAppletType(preferredType) {
preferredType = preferredType.toLowerCase();
if (preferredType === "html5" || preferredType === "screenshot") {
return preferredType;
}
return "html5";
};
var modules = ["web", "webSimple", "web3d", "tablet", "tablet3d", "phone"];
var setDefaultHTML5CodebaseForVersion = function setDefaultHTML5CodebaseForVersion(version, offline) {
html5CodebaseVersion = version;
if (offline) {
setHTML5CodebaseInternal(html5CodebaseVersion, true);
return;
}
var hasWebSimple = !html5NoWebSimple;
if (hasWebSimple) {
var v = parseVersion(html5CodebaseVersion);
if (!isNaN(v) && v < 4.4) {
hasWebSimple = false;
}
}
var protocol, codebase;
if (window.location.protocol.substr(0, 4) === "http") {
protocol = window.location.protocol;
} else {
protocol = "http:";
}
var index = html5CodebaseVersion.indexOf("//");
if (index > 0) {
codebase = html5CodebaseVersion;
} else if (index === 0) {
codebase = protocol + html5CodebaseVersion;
} else {
codebase = "https://www.geogebra.org/apps/5.2.814.0/";
}
for (var key in modules) {
if (html5CodebaseVersion.slice(modules[key].length * -1) === modules[key] || html5CodebaseVersion.slice((modules[key].length + 1) * -1) === modules[key] + "/") {
setHTML5CodebaseInternal(codebase, false);
return;
}
}
if (!GGBAppletUtils.isFlexibleWorksheetEditor() && hasWebSimple && !views.is3D && !views.AV && !views.SV && !views.CV && !views.EV2 && !views.CP && !views.PC && !views.DA && !views.FI && !views.PV && !valBoolean(parameters.showToolBar) && !valBoolean(parameters.showMenuBar) && !valBoolean(parameters.showAlgebraInput) && !valBoolean(parameters.enableRightClick) && (!parameters.appName || parameters.appName == "classic")) {
codebase += "webSimple/";
} else {
codebase += "web3d/";
}
setHTML5CodebaseInternal(codebase, false);
};
var setHTML5CodebaseInternal = function setHTML5CodebaseInternal(codebase, offline) {
if (codebase.requirejs) {
html5Codebase = codebase;
return;
}
if (codebase.slice(-1) !== "/") {
codebase += "/";
}
html5Codebase = codebase;
if (offline === null) {
offline = codebase.indexOf("http") === -1;
}
isHTML5Offline = offline;
html5CodebaseScript = "web.nocache.js";
html5CodebaseIsWebSimple = false;
var folders = html5Codebase.split("/");
if (folders.length > 1) {
if (!offline && folders[folders.length - 2] === "webSimple") {
html5CodebaseScript = "webSimple.nocache.js";
html5CodebaseIsWebSimple = true;
} else if (modules.indexOf(folders[folders.length - 2]) >= 0) {
html5CodebaseScript = folders[folders.length - 2] + ".nocache.js";
}
}
folders = codebase.split("/");
html5CodebaseVersion = folders[folders.length - 3];
if (html5CodebaseVersion.substr(0, 4) === "test") {
html5CodebaseVersion = html5CodebaseVersion.substr(4, 1) + "." + html5CodebaseVersion.substr(5, 1);
} else if (html5CodebaseVersion.substr(0, 3) === "war" || html5CodebaseVersion.substr(0, 4) === "beta") {
html5CodebaseVersion = "5.0";
}
var numVersion = parseFloat(html5CodebaseVersion);
if (numVersion !== NaN && numVersion < 5 && codebase.indexOf("geogebra.org") >= 0) {
console.log("The GeoGebra HTML5 codebase version " + numVersion + " is deprecated. Using version latest instead.");
setDefaultHTML5CodebaseForVersion("5.0", offline);
}
};
var log = function log(text, parameters) {
if (window.console && window.console.log) {
if (!parameters || typeof parameters.showLogging === "undefined" || parameters.showLogging && parameters.showLogging !== "false") {
console.log(text);
}
}
};
if (parameters.material_id !== undefined) {
fetchParametersFromApi(continueInit);
} else {
continueInit();
}
function continueInit() {
var html5Version = ggbVersion;
if (html5OverwrittenCodebaseVersion !== null) {
html5Version = html5OverwrittenCodebaseVersion;
} else {
if (parseFloat(html5Version) < 5) {
html5Version = "5.0";
}
}
setDefaultHTML5CodebaseForVersion(html5Version, false);
if (html5OverwrittenCodebase !== null) {
setHTML5CodebaseInternal(html5OverwrittenCodebase, isHTML5Offline);
}
initComplete = true;
}
return applet;
};
var GGBAppletUtils = function () {
"use strict";
function isFlexibleWorksheetEditor() {
return window.GGBT_wsf_edit !== undefined;
}
function scaleElement(el, scale) {
if (scale != 1) {
el.style.transformOrigin = "0% 0% 0px";
el.style.webkitTransformOrigin = "0% 0% 0px";
el.style.transform = "scale(" + scale + "," + scale + ")";
el.style.webkitTransform = "scale(" + scale + "," + scale + ")";
el.style.maxWidth = "initial";
if (el.querySelector(".ggb_preview") !== null) {
el.querySelector(".ggb_preview").style.maxWidth = "initial";
}
if (el.querySelectorAll(".ggb_preview img")[0] !== undefined) {
el.querySelectorAll(".ggb_preview img")[0].style.maxWidth = "initial";
}
if (el.querySelectorAll(".ggb_preview img")[1] !== undefined) {
el.querySelectorAll(".ggb_preview img")[1].style.maxWidth = "initial";
}
} else {
el.style.transform = "none";
el.style.webkitTransform = "none";
}
}
function getWidthHeight(appletElem, appletWidth, allowUpscale, autoHeight, noBorder, scaleContainerClass) {
var container = null;
if (scaleContainerClass != undefined && scaleContainerClass != "") {
var parent = appletElem.parentNode;
while (parent != null) {
if ((" " + parent.className + " ").indexOf(" " + scaleContainerClass + " ") > -1) {
container = parent;
break;
} else {
parent = parent.parentNode;
}
}
}
var myWidth = 0,
myHeight = 0,
windowWidth = 0,
border = 0,
borderRight = 0,
borderLeft = 0,
borderTop = 0;
if (container) {
myWidth = container.offsetWidth;
myHeight = Math.max(autoHeight ? container.offsetWidth : 0, container.offsetHeight);
} else {
if (window.innerWidth && document.documentElement.clientWidth) {
myWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
myHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
windowWidth = myWidth;
} else {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
windowWidth = window.innerWidth;
}
if (appletElem) {
var rect = appletElem.getBoundingClientRect();
if (rect.left > 0) {
if (rect.left <= myWidth && (noBorder === undefined || !noBorder)) {
if (document.dir === "rtl") {
borderRight = myWidth - rect.width - rect.left;
borderLeft = windowWidth <= 480 ? 10 : 30;
} else {
borderLeft = rect.left;
borderRight = windowWidth <= 480 ? 10 : 30;
}
border = borderLeft + borderRight;
}
}
}
if (appletElem && _typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
var appletRect = appletElem.getBoundingClientRect();
if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionRight") {
border = 40;
borderTop = 0;
} else if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionTop") {
border = 0;
borderTop = 40;
}
}
}
if (appletElem) {
if ((allowUpscale === undefined || !allowUpscale) && appletWidth > 0 && appletWidth + border < myWidth) {
myWidth = appletWidth;
} else {
myWidth -= border;
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen() && (allowUpscale === undefined || !allowUpscale)) {
myHeight -= borderTop;
}
}
return {
width: myWidth,
height: myHeight
};
}
function calcScale(parameters, appletElem, allowUpscale, showPlayButton, scaleContainerClass) {
if (parameters.isScreenshoGenerator) {
return 1;
}
var ignoreHeight = showPlayButton !== undefined && showPlayButton;
var noScaleMargin = parameters.noScaleMargin != undefined && parameters.noScaleMargin;
var valBoolean = function valBoolean(value) {
return value && value !== "false";
};
var autoHeight = valBoolean(parameters.autoHeight);
var windowSize = getWidthHeight(appletElem, parameters.width, allowUpscale, autoHeight, ignoreHeight && window.GGBT_wsf_view || noScaleMargin, scaleContainerClass);
var windowWidth = parseInt(windowSize.width);
var appletWidth = parameters.width;
var appletHeight = parameters.height;
if (appletWidth === undefined) {
var article = appletElem.querySelector(".appletParameters");
if (article) {
appletWidth = article.offsetWidth;
appletHeight = article.offsetHeight;
}
}
var xscale = windowWidth / appletWidth;
var yscale = ignoreHeight ? 1 : windowSize.height / appletHeight;
if (allowUpscale !== undefined && !allowUpscale) {
xscale = Math.min(1, xscale);
yscale = Math.min(1, yscale);
}
return Math.min(xscale, yscale);
}
function getScale(parameters, appletElem, showPlayButton) {
var scale = 1,
autoScale,
allowUpscale = false;
if (parameters.hasOwnProperty("allowUpscale")) {
allowUpscale = parameters.allowUpscale;
}
if (parameters.hasOwnProperty("scale")) {
scale = parseFloat(parameters.scale);
if (isNaN(scale) || scale === null || scale === 0) {
scale = 1;
}
if (scale > 1) {
allowUpscale = true;
}
}
if (appletElem && _typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
allowUpscale = true;
}
if (!(parameters.hasOwnProperty("disableAutoScale") && parameters.disableAutoScale)) {
autoScale = calcScale(parameters, appletElem, allowUpscale, showPlayButton, parameters.scaleContainerClass);
} else {
return scale;
}
if (allowUpscale && (!parameters.hasOwnProperty("scale") || scale === 1)) {
return autoScale;
} else {
return Math.min(scale, autoScale);
}
}
function positionCenter(appletElem) {
var windowWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
var windowHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
var appletRect = appletElem.getBoundingClientRect();
var calcHorizontalBorder = (windowWidth - appletRect.width) / 2;
var calcVerticalBorder = (windowHeight - appletRect.height) / 2;
if (calcVerticalBorder < 0) {
calcVerticalBorder = 0;
}
appletElem.style.position = "relative";
if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionRight") {
if (calcHorizontalBorder < 40) {
appletElem.style.left = "40px";
} else {
appletElem.style.left = calcHorizontalBorder + "px";
}
appletElem.style.top = calcVerticalBorder + "px";
} else if (window.GGBT_wsf_view.getCloseBtnPosition() === "closePositionTop") {
if (calcVerticalBorder < 40) {
appletElem.style.top = "40px";
} else {
appletElem.style.top = calcVerticalBorder + "px";
}
appletElem.style.left = calcHorizontalBorder + "px";
}
}
function responsiveResize(appletElem, parameters) {
var article = appletElem.querySelector(".appletParameters");
if (article) {
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
if (parameters.id !== article.getAttribute("data-param-id")) {
return;
}
window.GGBT_wsf_view.setCloseBtnPosition(appletElem);
}
if (article.parentElement && /fullscreen/.test(article.parentElement.className)) {
return;
}
var scale = getScale(parameters, appletElem);
if (isFlexibleWorksheetEditor()) {
article.setAttribute("data-param-scale", scale);
}
var scaleElem = null;
for (var i = 0; i < appletElem.childNodes.length; i++) {
if (appletElem.childNodes[i].className !== undefined && appletElem.childNodes[i].className.match(/^applet_scaler/)) {
scaleElem = appletElem.childNodes[i];
break;
}
}
if (scaleElem !== null && scaleElem.querySelector(".noscale") !== null) {
return;
}
var appName = parameters.id !== undefined ? parameters.id : "ggbApplet";
var app = window[appName];
if ((app == null || !app.recalculateEnvironments) && scaleElem !== null && !scaleElem.className.match(/fullscreen/)) {
scaleElem.parentNode.style.transform = "";
if (!isNaN(scale) && scale !== 1) {
scaleElem.parentNode.style.width = parameters.width * scale + "px";
scaleElem.parentNode.style.height = parameters.height * scale + "px";
scaleElement(scaleElem, scale);
} else {
scaleElement(scaleElem, 1);
scaleElem.parentNode.style.width = parameters.width + "px";
scaleElem.parentNode.style.height = parameters.height + "px";
}
}
if (_typeof(window.GGBT_wsf_view) === "object" && window.GGBT_wsf_view.isFullscreen()) {
positionCenter(appletElem);
}
if (window.GGBT_wsf_view && !window.GGBT_wsf_view.isFullscreen()) {
window.GGBT_wsf_general.adjustContentToResize($(article).parents(".content-added-content"));
}
}
}
return {
responsiveResize: responsiveResize,
isFlexibleWorksheetEditor: isFlexibleWorksheetEditor,
positionCenter: positionCenter,
getScale: getScale,
scaleElement: scaleElement
};
}();
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return GGBApplet;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
GGBAppletUtils.makeModule = function (name, permutation) {
function webModule() {
var H = "bootstrap",
I = "begin",
J = "gwt.codesvr." + name + "=",
K = "gwt.codesvr=",
L = name,
M = "startup",
N = "DUMMY",
O = 0,
P = 1,
Q = "iframe",
R = "position:absolute; width:0; height:0; border:none; left: -1000px;",
S = " top: -1000px;",
T = "Chrome",
U = "CSS1Compat",
V = "<!doctype html>",
W = "",
X = "<html><head></head><body></body></html>",
Y = "undefined",
Z = "readystatechange",
$ = 10,
_ = "script",
ab = "javascript",
bb = "Failed to load ",
cb = "moduleStartup",
db = "scriptTagAdded",
eb = "moduleRequested",
fb = "meta",
gb = "name",
hb = name + "::",
ib = "::",
jb = "gwt:property",
kb = "content",
lb = "=",
mb = "gwt:onPropertyErrorFn",
nb = 'Bad handler "',
ob = '" for "gwt:onPropertyErrorFn"',
pb = "gwt:onLoadErrorFn",
qb = '" for "gwt:onLoadErrorFn"',
rb = "#",
sb = "?",
tb = "/",
ub = "img",
vb = "clear.cache.gif",
wb = "baseUrl",
xb = name + ".nocache.js",
yb = "base",
zb = "//",
Ab = "selectingPermutation",
Bb = name + ".devmode.js",
Cb = permutation,
Db = ":",
Eb = ".cache.js",
Fb = "loadExternalRefs",
Gb = "end";
var n = window;
var o = document;
q(H, I);
function p() {
var a = n.location.search;
return a.indexOf(J) != -1 || a.indexOf(K) != -1;
}
function q(a, b) {}
webModule.__sendStats = q;
webModule.__moduleName = L;
webModule.__errFn = null;
webModule.__moduleBase = N;
webModule.__softPermutationId = O;
webModule.__computePropValue = null;
webModule.__getPropMap = null;
webModule.__installRunAsyncCode = function () {};
webModule.__gwtStartLoadingFragment = function () {
return null;
};
webModule.__gwt_isKnownPropertyValue = function () {
return false;
};
webModule.__gwt_getMetaProperty = function () {
return null;
};
var r = null;
var s = n.__gwt_activeModules = n.__gwt_activeModules || {};
s[L] = {
moduleName: L
};
webModule.__moduleStartupDone = function (e) {
var f = s[L].bindings;
s[L].bindings = function () {
var a = f ? f() : {};
var b = e[webModule.__softPermutationId];
for (var c = O; c < b.length; c++) {
var d = b[c];
a[d[O]] = d[P];
}
return a;
};
};
var t;
function u() {
v();
return t;
}
function v() {
if (t) {
return;
}
var a = o.createElement(Q);
a.id = L;
a.style.cssText = R + S;
a.tabIndex = -1;
o.body.appendChild(a);
t = a.contentWindow.document;
if (navigator.userAgent.indexOf(T) == -1) {
t.open();
var b = document.compatMode == U ? V : W;
t.write(b + X);
t.close();
}
}
function w(f) {
function g(a) {
function b() {
if (_typeof(o.readyState) == Y) {
return _typeof(o.body) != Y && o.body != null;
}
return /loaded|complete/.test(o.readyState);
}
var c = b();
if (c) {
a();
return;
}
function d() {
if (!c) {
if (!b()) {
return;
}
c = true;
a();
if (o.removeEventListener) {
o.removeEventListener(Z, d, false);
}
if (e) {
clearInterval(e);
}
}
}
if (o.addEventListener) {
o.addEventListener(Z, d, false);
}
var e = setInterval(function () {
d();
}, $);
}
function h(a) {
var b = u();
var c = b.body;
var d = b.createElement(_);
d.language = ab;
d.crossOrigin = W;
d.src = a;
if (webModule.__errFn) {
d.onerror = function () {
webModule.__errFn(L, new Error(bb + a));
};
}
c.appendChild(d);
q(cb, db);
}
q(cb, eb);
g(function () {
h(f);
});
}
webModule.__startLoadingFragment = function (a) {
return C(a);
};
webModule.__installRunAsyncCode = function (a) {
var b = u();
var c = b.body;
var d = b.createElement(_);
d.language = ab;
d.text = a;
c.appendChild(d);
c.removeChild(d);
};
function A() {
var c = {};
var d;
var e;
var f = o.getElementsByTagName(fb);
for (var g = O, h = f.length; g < h; ++g) {
var i = f[g],
j = i.getAttribute(gb),
k;
if (j) {
j = j.replace(hb, W);
if (j.indexOf(ib) >= O) {
continue;
}
if (j == jb) {
k = i.getAttribute(kb);
if (k) {
var l,
m = k.indexOf(lb);
if (m >= O) {
j = k.substring(O, m);
l = k.substring(m + P);
} else {
j = k;
l = W;
}
c[j] = l;
}
} else if (j == mb) {
k = i.getAttribute(kb);
if (k) {
try {
d = eval(k);
} catch (a) {
alert(nb + k + ob);
}
}
} else if (j == pb) {
k = i.getAttribute(kb);
if (k) {
try {
e = eval(k);
} catch (a) {
alert(nb + k + qb);
}
}
}
}
}
__gwt_getMetaProperty = function __gwt_getMetaProperty(a) {
var b = c[a];
return b == null ? null : b;
};
r = d;
webModule.__errFn = e;
}
function B() {
function e(a) {
var b = a.lastIndexOf(rb);
if (b == -1) {
b = a.length;
}
var c = a.indexOf(sb);
if (c == -1) {
c = a.length;
}
var d = a.lastIndexOf(tb, Math.min(c, b));
return d >= O ? a.substring(O, d + P) : W;
}
function f(a) {
if (a.match(/^\w+:\/\//)) {} else {
var b = o.createElement(ub);
b.src = a + vb;
a = e(b.src);
}
return a;
}
function g() {
var a = __gwt_getMetaProperty(wb);
if (a != null) {
return a;
}
return W;
}
function h() {
var a = o.getElementsByTagName(_);
for (var b = O; b < a.length; ++b) {
if (a[b].src.indexOf(xb) != -1) {
return e(a[b].src);
}
}
return W;
}
function i() {
var a = o.getElementsByTagName(yb);
if (a.length > O) {
return a[a.length - P].href;
}
return W;
}
function j() {
var a = o.location;
return a.href == a.protocol + zb + a.host + a.pathname + a.search + a.hash;
}
var k = g();
if (k == W) {
k = h();
}
if (k == W) {
k = i();
}
if (k == W && j()) {
k = e(o.location.href);
}
k = f(k);
return k;
}
function C(a) {
if (a.match(/^\//)) {
return a;
}
if (a.match(/^[a-zA-Z]+:\/\//)) {
return a;
}
return webModule.__moduleBase + a;
}
function D() {
var f = [];
var g = O;
var h = [];
var i = [];
function j(a) {
var b = i[a](),
c = h[a];
if (b in c) {
return b;
}
var d = [];
for (var e in c) {
d[c[e]] = e;
}
if (r) {
r(a, d, b);
}
throw null;
}
__gwt_isKnownPropertyValue = function __gwt_isKnownPropertyValue(a, b) {
return b in h[a];
};
webModule.__getPropMap = function () {
var a = {};
for (var b in h) {
if (h.hasOwnProperty(b)) {
a[b] = j(b);
}
}
return a;
};
webModule.__computePropValue = j;
n.__gwt_activeModules[L].bindings = webModule.__getPropMap;
if (p()) {
return C(Bb);
}
var k;
try {
k = Cb;
var l = k.indexOf(Db);
if (l != -1) {
g = parseInt(k.substring(l + P), $);
k = k.substring(O, l);
}
} catch (a) {}
webModule.__softPermutationId = g;
return C(k + Eb);
}
function F() {
if (!n.__gwt_stylesLoaded) {
n.__gwt_stylesLoaded = {};
}
}
A();
webModule.__moduleBase = (location.hostname === "localhost" ? "" : "/react/build") + "/js/mathematicalGraphics/" + name + "/";
s[L].moduleBase = webModule.__moduleBase;
var G = D();
F();
w(G);
return true;
}
return webModule;
};
if (typeof window.web3d !== "function") {
window.web3d = GGBAppletUtils.makeModule("web3d", "A18F540516513B1292CA7CEF2F6AFC7E");
}
if (typeof window.webSimple !== "function") {
window.webSimple = GGBAppletUtils.makeModule("webSimple", "96B09BF1B436BF53F0DF54116700F16A");
}
window.GGBApplet = GGBApplet;
})();
/***/ }),
/***/ 88548:
/*!*********************************!*\
!*** ./src/pages/tasks/util.js ***!
\*********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Ax: function() { return /* binding */ processTreeData; },
/* harmony export */ Ds: function() { return /* binding */ debounce; },
/* harmony export */ KI: function() { return /* binding */ apiPref; },
/* harmony export */ SI: function() { return /* binding */ getTreeData; },
/* harmony export */ f1: function() { return /* binding */ isCompileOk; }
/* harmony export */ });
/* unused harmony export isProd */
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/env */ 97730);
function isCompileOk(rs) {
var flag = true;
if (rs.length > 0) {
for (var i = 0; i < rs.length; i++) {
if (rs[i].compile_success == 0 || !rs[i].compile_success) {
flag = false;
break;
}
}
} else {
flag = false;
}
return flag;
}
function getTreeData(data) {
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var result = [];
for (var i = 0; i < data.length; i++) {
var item = data[i];
var key = parentKey ? "".concat(parentKey, "/").concat(item.name) : "".concat(item.name);
result.push({
title: item.name,
isLeaf: item.type === 'tree' ? false : true,
key: key
});
}
return result;
}
function processTreeData(repos, key, newData) {
for (var i = 0; i < repos.length; i++) {
var item = repos[i];
if (item.key === key) {
item.children = newData;
break;
}
if (item.children) {
processTreeData(item.children, key, newData);
}
}
return repos;
}
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this,
args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
var isProd = true;
var apiPref = _utils_env__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z.API_SERVER;
// export const isProd =
// window.location.href.indexOf('test-') > 0 ||
// window.location.href.indexOf('localhost') > 0
// ? false
// : true;
// export const apiPref = isProd
// ? 'https://www.educoder.net'
// : 'https://test-newweb.educoder.net';
/***/ }),
/***/ 81107:
/*!********************************************************!*\
!*** ./src/components/MathsLatexKeybords/keybords.tsx ***!
\********************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd */ 95237);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! antd */ 43604);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 99313);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var _components_RenderHtml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/RenderHtml */ 96030);
/* harmony import */ var _index_less_modules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less?modules */ 36625);
/* harmony import */ var mathlatex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mathlatex */ 48136);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var MathsLatex = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (_ref, ref) {
var callback = _ref.callback,
showSaveButton = _ref.showSaveButton,
_ref$value = _ref.value,
value = _ref$value === void 0 ? "" : _ref$value;
var GraphicsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
var datas = [{
name: "分数得分",
value: "\\frac{x}{y}",
children: [{
name: "分数 Fractions",
data: [{
value: "\\frac{a}{b}"
}, {
value: "x\\tfrac{x}{a} "
}, {
value: "\\mathrm{d}t"
}, {
value: "\\partial t"
}, {
value: "\\frac{\\partial y}{\\partial x}"
}, {
value: "\\nabla\\psi"
}, {
value: "\\frac{\\partial^2}{\\partial x_1\\partial x_2}y"
}, {
value: "\\cfrac{1}{a + \\cfrac{7}{b + \\cfrac{2}{9}}} = c"
}]
}, {
name: "导数 Derivative",
data: [{
value: "\\dot{a} "
}, {
value: "\\ddot{a}"
}, {
"value": "{f}^{\\prime}"
}, {
"value": "{f}^{\\prime\\prime}"
}, {
"value": "{f}^{(n)}"
}]
}, {
name: "模算术 Modular arithmetic",
data: [{
value: "a \\bmod b"
}, {
value: "a \\equiv b \\pmod{m} "
}, {
value: "\\gcd(m, n) "
}, {
value: "\\operatorname{lcm}(m, n) "
}]
}]
}, {
name: "根式角标",
value: "\\sqrt{x}",
children: [{
name: "根式 Radicals",
data: [{
value: "\\sqrt{x}"
}, {
value: "\\sqrt[y]{x}"
}]
}, {
name: "上下标 Sub&Super",
data: [{
value: "x^{a}"
}, {
value: "x_{a}"
}, {
value: "x_{a}^{b} "
}, {
value: "_{a}^{b} x"
}, {
value: "x_{a}^{b} "
}]
}, {
name: "重音符及其他 Accents and Others",
//
data: [{
value: "\\hat{a} "
}, {
value: "\\sqrt[y]{x}"
}, {
value: "\\check{} "
}, {
value: "\\grave{a} "
}, {
value: "\\acute{a}"
}, {
value: "\\tilde{a}"
}, {
value: "\\breve{a}"
}, {
value: "\\bar{a}"
}, {
value: "\\vec{a}"
}, {
value: "\\not{a}"
}, {
value: "\\widetilde{abc}"
}, {
value: "\\widehat{abc}"
}, {
value: "\\overleftarrow{abc} "
}, {
value: "\\overrightarrow{abc}"
}, {
value: "\\overline{abc}"
}, {
value: "\\underline{abc}"
}, {
value: "\\overbrace{abc}"
}, {
value: "\\underbrace{abc}"
}, {
value: "\\overset{a}{abc}"
}, {
value: "\\underset{a}{abc} \\stackrel\\frown{ab}"
}, {
value: "\\overline{ab} "
}, {
value: "\\overleftrightarrow{ab}"
}, {
value: "\\overset{a}{\\leftarrow}"
}, {
value: "\\overset{a}{\\rightarrow}"
}, {
value: "\\xleftarrow[abc]{a}"
}, {
value: "\\xrightarrow[abc]{a} "
}]
}]
}, {
name: "极限对数",
value: "\\lim_{x \\to 0}",
children: [{
name: "极限 Limits",
data: [{
value: "\\lim a"
}, {
value: "\\lim_{x \\to 0}"
}, {
value: "\\lim_{x \\to \\infty}"
}, {
value: "\\max_b{a}"
}, {
value: "\\min_a{b}"
}]
}, {
name: "对数指数 Logarithms and exponentials",
data: [{
value: "\\log_{a}{b}"
}, {
value: "\\lg_{a}{b}"
}, {
value: "\\ln_{a}{b}"
}, {
value: "\\exp a"
}]
}, {
name: "界限 Bounds",
data: [{
value: "\\min x"
}, {
value: "\\sup t"
}, {
value: "\\inf s"
}, {
value: "\\lim u"
}, {
value: "\\limsup w"
}, {
value: "\\dim p"
}, {
value: "\\ker\\phi "
}]
}]
}, {
name: "三角函数",
value: "\\sin a",
children: [{
name: "三角函数 Trigonometric functions",
data: [{
value: "\\sin a"
}, {
value: "\\cos a"
}, {
value: "\\tan a"
}, {
value: "\\cot a "
}, {
value: "\\sec a "
}, {
value: "\\csc a "
}]
}, {
name: "反三角函数 Inverse trigonometric functions",
data: [{
value: "\\sin^{-1}"
}, {
value: "\\cos^{-1}"
}, {
value: "\\tan^{-1}"
}, {
value: "\\cot^{-1}"
}, {
value: "\\sec^{-1}"
}, {
value: "\\csc^{-1}"
}, {
value: "\\arcsin a"
}, {
value: "\\arccos a"
}, {
value: "\\arctan a"
}, {
value: "\\operatorname{arccot} a"
}, {
value: "\\operatorname{arcsec} a"
}, {
value: "\\operatorname{arccsc} a"
}]
}, {
name: "双曲函数 Hyperblic functions",
data: [{
value: "\\sinh a"
}, {
value: "\\cosh a"
}, {
value: "\\tanh a"
}, {
value: "\\coth a"
}, {
value: "\\operatorname{sech} a"
}, {
value: "\\operatorname{csch} a"
}]
}, {
name: "反双曲函数 Inverse hyperbolic functions",
data: [{
value: "\\sinh^{-1}"
}, {
value: "a\\cosh^{-1} a"
}, {
value: "\\tanh^{-1} a"
}, {
value: "\\coth^{-1} a"
}, {
value: "\\operatorname{sech}^{-1} a"
}, {
value: "\\operatorname{csch}^{-1} a"
}]
}]
}, {
name: "积分运算",
value: "\\int_{a}^{b}",
children: [{
name: "积分 Integral",
data: [{
value: "\\int"
}, {
value: "\\int_{a}^{b}"
}, {
value: "\\int\\limits_{a}^{b}"
}]
}, {
name: "双重积分 Double integral",
data: [{
value: "\\iint"
}, {
value: "\\iint_{a}^{b} "
}, {
value: "\\iint\\limits_{a}^{b} "
}]
}, {
name: "三重积分 Triple integral",
data: [{
value: "\\iiint"
}, {
value: "\\iiint_{a}^{b}"
}, {
value: "\\iiint\\limits_{a}^{b} "
}]
}, {
name: "曲线积分 Closed line or path integral",
data: [{
value: "\\oint"
}, {
value: "\\oint_{a}^{b} "
}]
}]
}, {
name: "大型运算",
value: "\\sum_{a}^{b}",
children: [{
name: "求和 Summation",
data: [{
value: "\\sum"
}, {
value: "\\sum_{a}^{b}"
}, {
value: "{\\textstyle \\sum_{a}^{b}} "
}]
}, {
name: "乘积余积 Product and coproduct",
data: [{
value: "\\prod"
}, {
value: "\\prod_{a}^{b}"
}, {
value: "{\\textstyle \\prod_{a}^{b}}"
}, {
value: "\\coprod"
}, {
value: "\\coprod_{a}^{b}"
}, {
value: "{\\textstyle \\coprod_{a}^{b}} "
}]
}, {
name: "并集交集 Union and intersection",
data: [{
value: "\\bigcup"
}, {
value: "\\bigcup_{a}^{b}"
}, {
value: "{\\textstyle \\bigcup_{a}^{b}}"
}, {
value: "\\bigcap"
}, {
value: "\\bigcap_{a}^{b}"
}]
}, {
name: "析取合取 Disjunction and conjunction",
data: [{
"value": "\\bigvee"
}, {
"value": "\\bigvee_{a}^{b}"
}, {
"value": "\\bigwedge"
}, {
"value": "\\bigwedge_{a}^{b}"
}]
}]
}, {
name: "括号取整",
value: "\\left [ \\left ( \\right ) \\right ] ",
children: [{
name: "括号 Brackets",
data: [{
"value": "\\left ( \\right )"
}, {
"value": "\\left [ \\right ]"
}, {
"value": "\\left \\langle \\right \\rangle "
}, {
"value": "\\left | \\right | "
}, {
"value": "\\left \\lfloor \\right \\rfloor "
}, {
"value": "\\left \\lceil \\right \\rceil "
}]
}]
}];
var datasLatex = [{
name: "代数",
value: "\\sqrt{a^2+b^2}",
children: [{
data: [{
value: "\\left(x-1\\right)\\left(x+3\\right) "
}, {
value: "\\sqrt{a^2+b^2}"
}, {
value: "\\left ( \\frac{a}{b}\\right )^{n}= \\frac{a^{n}}{b^{n}}"
}, {
"value": "\\frac{a}{b}\\pm \\frac{c}{d}= \\frac{ad \\pm bc}{bd} "
}, {
"value": "\\frac{x^{2}}{a^{2}}-\\frac{y^{2}}{b^{2}}=1 "
}, {
"value": "\\frac{1}{\\sqrt{a}}=\\frac{\\sqrt{a}}{a},a\\ge 0\\frac{1}{\\sqrt{a}}=\\frac{\\sqrt{a}}{a},a\\ge 0 "
}, {
"value": "\\sqrt[n]{a^{n}}=\\left ( \\sqrt[n]{a}\\right )^{n} "
}, {
"value": "x ={-b \\pm \\sqrt{b^2-4ac}\\over 2a} "
}, {
"value": "y-y_{1}=k \\left( x-x_{1}\\right) "
}, {
"value": "\\left\\{\\begin{matrix} \r\n x=a + r\\text{cos}\\theta \\ \r\n y=b + r\\text{sin}\\theta \r\n\\end{matrix}\\right. "
}, {
value: "\\begin{array}{l} \r\n \\text{对于方程形如:}x^{3}-1=0 \\ \r\n \\text{设}\\text{:}\\omega =\\frac{-1+\\sqrt{3}i}{2} \\ \r\n x_{1}=1,x_{2}= \\omega =\\frac{-1+\\sqrt{3}i}{2} \\ \r\n x_{3}= \\omega ^{2}=\\frac{-1-\\sqrt{3}i}{2} \r\n\\end{array} "
}, {
value: "\\begin{array}{l} \r\n a\\mathop{{x}}\\nolimits^{{2}}+bx+c=0 \\ \r\n \\Delta =\\mathop{{b}}\\nolimits^{{2}}-4ac \\ \r\n \\left\\{\\begin{matrix} \r\n \\Delta \\gt 0\\text{方程有两个不相等的实根} \\ \r\n \\Delta = 0\\text{方程有两个相等的实根} \\ \r\n \\Delta \\lt 0\\text{方程无实根} \r\n\\end{matrix}\\right. \r\n\\end{array} "
}, {
value: "\\begin{array}{l} \r\n a\\mathop{{x}}\\nolimits^{{2}}+bx+c=0 \\ \r\n \\Delta =\\mathop{{b}}\\nolimits^{{2}}-4ac \\ \r\n \\mathop{{x}}\\nolimits_{{1,2}}=\\frac{{-b \\pm \r\n \\sqrt{{\\mathop{{b}}\\nolimits^{{2}}-4ac}}}}{{2a}} \\ \r\n \\mathop{{x}}\\nolimits_{{1}}+\\mathop{{x}}\\nolimits_{{2}}=-\\frac{{b}}{{a}} \\ \r\n \\mathop{{x}}\\nolimits_{{1}}\\mathop{{x}}\\nolimits_{{2}}=\\frac{{c}}{{a}} \r\n\\end{array} "
}]
}]
}, {
name: "几何",
value: "\\Delta A B C ",
children: [{
data: [{
"value": "\\Delta A B C "
}, {
"value": "a \\parallel c,b \\parallel c \\Rightarrow a \\parallel b "
}, {
"value": "l \\perp \\beta ,l \\subset \\alpha \\Rightarrow \\alpha \\perp \\beta"
}, {
"value": "\\left.\\begin{matrix} \r\n a \\perp \\alpha \\ \r\n b \\perp \\alpha \r\n\\end{matrix}\\right\\}\\Rightarrow a \\parallel b"
}, {
"value": "P \\in \\alpha ,P \\in \\beta , \\alpha \\cap \\beta =l \\Rightarrow P \\in l "
}, {
"value": "\\alpha \\perp \\beta , \\alpha \\cap \\beta =l,a \\subset \\alpha ,a \\perp l \r\n \\Rightarrow a \\perp \\beta "
}, {
"value": "\\left.\\begin{matrix} \r\n a \\subset \\beta ,b \\subset \\beta ,a \\cap b=P \\ \r\n a \\parallel \\partial ,b \\parallel \\partial \r\n\\end{matrix}\\right\\}\\Rightarrow \\beta \\parallel \\alpha "
}, {
"value": "\\alpha \\parallel \\beta , \\gamma \\cap \\alpha =a, \\gamma \\cap \\beta =b \\Rightarrow a \\parallel b "
}, {
"value": "A \\in l,B \\in l,A \\in \\alpha ,B \\in \\alpha \\Rightarrow l \\subset \\alpha "
}, {
"value": "\\left.\\begin{matrix} \r\n m \\subset \\alpha ,n \\subset \\alpha ,m \\cap n=P \\ \r\n a \\perp m,a \\perp n \r\n\\end{matrix}\\right\\}\\Rightarrow a \\perp \\alpha "
}, {
"value": "\\begin{array}{c} \r\n \\text{直角三角形中,直角边长a,b,斜边边长c} \\ \r\n a^{2}+b^{2}=c^{2} \r\n\\end{array}"
}]
}]
}, {
name: "不等式",
value: "a > b",
children: [{
data: [{
"value": "a > b,b > c \\Rightarrow a > c "
}, {
"value": "a > b,c > d \\Rightarrow a+c > b+d "
}, {
"value": "a > b > 0,c > d > 0 \\Rightarrow ac bd "
}, {
"value": "\\begin{array}{c} \r\n a \\gt b,c \\gt 0 \\Rightarrow ac \\gt bc \\ \r\n a \\gt b,c \\lt 0 \\Rightarrow ac \\lt bc \r\n\\end{array}"
}, {
"value": "\\left | a-b \\right | \\geqslant \\left | a \\right | -\\left | b \\right | "
}, {
"value": "-\\left | a \\right |\\leq a\\leqslant \\left | a \\right | "
}, {
"value": "\\left | a \\right |\\leqslant b \\Rightarrow -b \\leqslant a \\leqslant \\left | b \\right | "
}, {
"value": "\\left | a+b \\right | \\leqslant \\left | a \\right | + \\left | b \\right | "
}, {
"value": "\\begin{array}{c} \r\n a \\gt b \\gt 0,n \\in N^{\\ast},n \\gt 1 \\ \r\n \\Rightarrow a^{n}\\gt b^{n}, \\sqrt[n]{a}\\gt \\sqrt[n]{b} \r\n\\end{array}"
}, {
"value": "\\left( \\sum_{k=1}^n a_k b_k \\right)^{\\!\\!2}\\leq \r\n\\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right) "
}, {
"value": "\\begin{array}{c} \r\n a,b \\in R^{+} \\ \r\n \\Rightarrow \\frac{a+b}{{2}}\\ge \\sqrt{ab} \\ \r\n \\left( \\text{当且仅当}a=b\\text{时取“}=\\text{”号}\\right) \r\n\\end{array}"
}, {
"value": "\\begin{array}{c} \r\n a,b \\in R \\ \r\n \\Rightarrow a^{2}+b^{2}\\gt 2ab \\ \r\n \\left( \\text{当且仅当}a=b\\text{时取“}=\\text{”号}\\right) \r\n\\end{array}"
}, {
"value": "\\begin{array}{c} \r\n H_{n}=\\frac{n}{\\sum \\limits_{i=1}^{n}\\frac{1}{x_{i}}}= \\frac{n}{\\frac{1}{x_{1}}+ \\frac{1}{x_{2}}+ \\cdots + \\frac{1}{x_{n}}} \\ G_{n}=\\sqrt[n]{\\prod \\limits_{i=1}^{n}x_{i}}= \\sqrt[n]{x_{1}x_{2}\\cdots x_{n}} \\ A_{n}=\\frac{1}{n}\\sum \\limits_{i=1}^{n}x_{i}=\\frac{x_{1}+ x_{2}+ \\cdots + x_{n}}{n} \\ Q_{n}=\\sqrt{\\sum \\limits_{i=1}^{n}x_{i}^{2}}= \\sqrt{\\frac{x_{1}^{2}+ x_{2}^{2}+ \\cdots + x_{n}^{2}}{n}} \\ H_{n}\\leq G_{n}\\leq A_{n}\\leq Q_{n} \r\n\\end{array}"
}]
}]
}, {
name: "积分",
value: "\\frac{\\mathrm{d}\\partial}{\\partial x}",
children: [{
data: [{
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}x^n=nx^{n-1} "
}, {
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}e^{ax}=a\\,e^{ax} "
}, {
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}\\ln(x)=\\frac{1}{x} "
}, {
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}\\sin x=\\cos x "
}, {
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}\\cos x=-\\sin x "
}, {
"value": "\\int k\\mathrm{d}x = kx+C "
}, {
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}\\tan x=\\sec^2 x "
}, {
"value": "\\frac{\\mathrm{d}}{\\mathrm{d}x}\\cot x=-\\csc^2 x "
}, {
"value": "\\int \\frac{1}{x}\\mathrm{d}x= \\ln \\left| x \\right| +C "
}, {
"value": "\\int \\frac{1}{\\sqrt{1-x^{2}}}\\mathrm{d}x= \\arcsin x +C "
}, {
"value": "\\int \\frac{1}{1+x^{2}}\\mathrm{d}x= \\arctan x +C "
}, {
"value": "\\int u \\frac{\\mathrm{d}v}{\\mathrm{d}x}\\,\\mathrm{d}x=uv-\\int \\frac{\\mathrm{d}u}{\\mathrm{d}x}v\\,\\mathrm{d}x "
}, {
"value": "f(x) = \\int_{-\\infty}^\\infty \\hat f(x)\\xi\\,e^{2 \\pi i \\xi x} \\,\\mathrm{d}\\xi "
}, {
"value": "\\int x^{\\mu}\\mathrm{d}x=\\frac{x^{\\mu +1}}{\\mu +1}+C, \\left({\\mu \\neq -1}\\right) "
}]
}]
},
// {
// name: "矩阵",
// value: "\\begin{pmatrix} \r\n 1 & 0 \\\\ \r\n 0 & 1 \r\n\\end{pmatrix} ",
// children: [{
// data: [
// { "value": "\\begin{pmatrix} \r\n 1 & 0 \\\\ \r\n 0 & 1 \r\n\\end{pmatrix} " }, { "value": "\\begin{pmatrix} \r\n a_{11} & a_{12} & a_{13} \\ \r\n a_{21} & a_{22} & a_{23} \\ \r\n a_{31} & a_{32} & a_{33} \r\n\\end{pmatrix} " }, { "value": "\\begin{pmatrix} \r\n a_{11} & \\cdots & a_{1n} \\ \r\n \\vdots & \\ddots & \\vdots \\ \r\n a_{m1} & \\cdots & a_{mn} \r\n\\end{pmatrix} " }, { "value": "\\begin{array}{c} \r\n A=A^{T} \\ \r\n A=-A^{T} \r\n\\end{array}" }, { "value": "O = \\begin{bmatrix} \r\n 0 & 0 & \\cdots & 0 \\ \r\n 0 & 0 & \\cdots & 0 \\ \r\n \\vdots & \\vdots & \\ddots & \\vdots \\ \r\n 0 & 0 & \\cdots & 0 \r\n\\end{bmatrix} " }, { "value": "A_{m\\times n}= \r\n\\begin{bmatrix} \r\n a_{11}& a_{12}& \\cdots & a_{1n} \\ \r\n a_{21}& a_{22}& \\cdots & a_{2n} \\ \r\n \\vdots & \\vdots & \\ddots & \\vdots \\ \r\n a_{m1}& a_{m2}& \\cdots & a_{mn} \r\n\\end{bmatrix} \r\n=\\left [ a_{ij}\\right ] " }, { "value": "\\begin{array}{c} \r\n A={\\left[ a_{ij}\\right]_{m \\times n}},B={\\left[ b_{ij}\\right]_{n \\times s}} \\ \r\n c_{ij}= \\sum \\limits_{k=1}^{{n}}a_{ik}b_{kj} \\ \r\n C=AB=\\left[ c_{ij}\\right]_{m \\times s} \r\n = \\left[ \\sum \\limits_{k=1}^{n}a_{ik}b_{kj}\\right]_{m \\times s} \r\n\\end{array}" }, { "value": "\\mathbf{V}_1 \\times \\mathbf{V}_2 = \r\n\\begin{vmatrix} \r\n \\mathbf{i}& \\mathbf{j}& \\mathbf{k} \\ \r\n \\frac{\\partial X}{\\partial u}& \\frac{\\partial Y}{\\partial u}& 0 \\ \r\n \\frac{\\partial X}{\\partial v}& \\frac{\\partial Y}{\\partial v}& 0 \\ \r\n\\end{vmatrix} " }
// ]
// }]
// },
{
name: "三角",
value: "e^{i \\theta}",
children: [{
name: "求和 Summation",
data: [{
"value": "e^{i \\theta} "
}, {
"value": "\\left(\\frac{\\pi}{2}-\\theta \\right ) "
}, {
"value": "\\text{sin}^{2}\\frac{\\alpha}{2}=\\frac{1- \\text{cos}\\alpha}{2} "
}, {
"value": "\\text{cos}^{2}\\frac{\\alpha}{2}=\\frac{1+ \\text{cos}\\alpha}{2} "
}, {
"value": "\\text{tan}\\frac{\\alpha}{2}=\\frac{\\text{sin}\\alpha}{1+ \\text{cos}\\alpha} "
}, {
"value": "\\sin \\alpha + \\sin \\beta =2 \\sin \\frac{\\alpha + \\beta}{2}\\cos \\frac{\\alpha - \\beta}{2} "
}, {
"value": "\\sin \\alpha - \\sin \\beta =2 \\cos \\frac{\\alpha + \\beta}{2}\\sin \\frac{\\alpha - \\beta}{2} "
}, {
"value": "\\cos \\alpha + \\cos \\beta =2 \\cos \\frac{\\alpha + \\beta}{2}\\cos \\frac{\\alpha - \\beta}{2} "
}, {
"value": "\\cos \\alpha - \\cos \\beta =-2\\sin \\frac{\\alpha + \\beta}{2}\\sin \\frac{\\alpha - \\beta}{2} "
}, {
"value": "a^{2}=b^{2}+c^{2}-2bc\\cos A "
}, {
"value": "\\frac{\\sin A}{a}=\\frac{\\sin B}{b}=\\frac{\\sin C}{c}=\\frac{1}{2R} "
}, {
"value": "\\sin \\left ( \\frac{\\pi}{2}-\\alpha \\right ) = \\cos \\alpha "
}, {
"value": "\\sin \\left ( \\frac{\\pi}{2}+\\alpha \\right ) = \\cos \\alpha "
}]
}]
}, {
name: "统计",
value: "C_{r}^{n}",
children: [{
data: [{
"value": "C_{r}^{n} "
}, {
"value": "\\frac{n!}{r!(n-r)!} "
}, {
"value": "\\sum_{i=1}^{n}{X_i} "
}, {
"value": "\\sum_{i=1}^{n}{X_i^2} "
}, {
"value": "X_1, \\cdots,X_n "
}, {
"value": "\\frac{x-\\mu}{\\sigma} "
}, {
"value": "\\sum_{i=1}^{n}{(X_i - \\overline{X})^2} "
}, {
"value": "\\begin{array}{c} \r\n \\text{若}P \\left( AB \\right) =P \\left( A \\right) P \\left( B \\right) \\\\ \r\n \\text{则}P \\left( A \\left| B\\right. \\right) =P \\left({B}\\right) \r\n\\end{array}"
}, {
"value": "P(E) ={n \\choose k}p^k (1-p)^{n-k} "
}, {
"value": "P \\left( A \\right) = \\lim \\limits_{n \\to \\infty}f_{n}\\left ( A \\right ) "
}, {
"value": "P \\left( \\bigcup \\limits_{i=1}^{+ \\infty}A_{i}\\right) = \\prod \\limits_{i=1}^{+ \\infty}P{\\left( A_{i}\\right)} "
}, {
"value": "\\begin{array}{c} \r\n P \\left( \\emptyset \\right) =0 \\\\ \r\n P \\left( S \\right) =1 \r\n\\end{array}"
}, {
"value": "\\begin{array}{c} \r\n \\forall A \\in S \\\\ \r\n P \\left( A \\right) \\ge 0 \r\n\\end{array}"
}, {
"value": "P \\left( \\bigcup \\limits_{i=1}^{n}A_{i}\\right) = \\prod \\limits_{i=1}^{n}P \\left( A_{i}\\right) "
}, {
"value": "\\begin{array}{c} \r\n S= \\binom{N}{n},A_{k}=\\binom{M}{k}\\cdot \\binom{N-M}{n-k} \\\\ \r\n P\\left ( A_{k}\\right ) = \\frac{\\binom{M}{k}\\cdot \\binom{N-M}{n-k}}{\\binom{N}{n}} \r\n\\end{array}"
}, {
"value": "\\begin{array}{c} \r\n P_{n}=n! \\\\ \r\n A_{n}^{k}=\\frac{n!}{\\left( n-k \\left) !\\right. \\right.} \r\n\\end{array}"
}]
}]
}];
var setValue = function setValue(item) {
GraphicsRef.current.setValue(GraphicsRef.current.getValue() + " " + item.value + " ");
};
var items = [{
key: '1',
label: '快捷模板',
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.lists,
gutter: [10, 10],
children: datas.map(function (data, key) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
flex: "110px",
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.item,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
value: "$$".concat(data.value, "$$")
}), data.name]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.children,
children: data.children.map(function (data, key) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("h1", {
children: data.name
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
gutter: [10, 10],
children: data.data.map(function (item, k) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
onClick: function onClick() {
return setValue(item);
},
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.diamond,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
value: "`$$" + item.value + "$$`"
})
}, k);
})
})]
}, key);
})
})]
});
})
})
}, {
key: '2',
label: '公式模板',
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.lists,
gutter: [10, 10],
children: datasLatex.map(function (data, key) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
flex: "110px",
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.item,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
value: "`$$" + data.value + "$$`"
}), data.name]
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.children,
children: data.children.map(function (item, key) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
children: [item.name && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("h1", {
children: item.name
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
gutter: [10, 10],
children: item.data.map(function (item, k) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
onClick: function onClick() {
return setValue(item);
},
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.diamond,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_components_RenderHtml__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
value: "`$$" + item.value + "$$`"
})
}, k);
})
})]
}, key);
})
})]
});
})
})
}];
var getData = function getData() {
var dom = document.createElement("div");
dom.innerHTML = GraphicsRef.current.getValue();
var str = dom.innerText;
callback && callback(str);
return str;
};
(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref, function () {
return {
getData: getData
};
});
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
if (GraphicsRef.current) GraphicsRef.current.menuItems = GraphicsRef.current.menuItems.filter(function (item) {
return item.id !== "copy" && item.id !== "paste" && item.keyboardShortcut !== "meta+X";
});
}, [GraphicsRef.current]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.mathWrap,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
defaultActiveKey: "1",
items: items
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("math-field", {
locale: "zh_cn",
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.mathField,
placeholder: "\u8BF7\u6253\u5F00\u952E\u76D8\uFF0C\u8F93\u5165\u516C\u5F0F",
ref: GraphicsRef,
style: {
width: 800,
marginTop: 30,
fontSize: 18
},
children: value || ""
}), showSaveButton && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
className: _index_less_modules__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z.button,
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP, {
size: "large",
onClick: getData,
style: {
zIndex: 8,
marginTop: 10
},
type: "primary",
children: "\u4FDD\u5B58\u5230\u7F16\u8F91\u5668"
})
})]
});
});
/* harmony default export */ __webpack_exports__.Z = (MathsLatex);
/***/ }),
/***/ 46478:
/*!*************************************************************!*\
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ h: function() { return /* binding */ MyCodeMirror; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js */ 82242);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js */ 79800);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd */ 57809);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd */ 78241);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! codemirror */ 89780);
/* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ 27334);
/* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ 36857);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var Option = antd__WEBPACK_IMPORTED_MODULE_7__["default"].Option;
//https://github.com/codemirror/CodeMirror/issues/4838
var formItemLayout = {
labelCol: {
span: 4
},
wrapperCol: {
span: 20
}
};
var LanguageDesc = {
asp: ['ASP', 'vbscript'],
actionscript: ['ActionScript(3.0)/Flash/Flex', 'clike'],
bash: ['Bash/Bat', 'shell'],
css: ['CSS', 'css'],
c: ['C', 'clike'],
cpp: ['C++', 'clike'],
csharp: ['C#', 'clike'],
coffeescript: ['CoffeeScript', 'coffeescript'],
d: ['D', 'd'],
dart: ['Dart', 'dart'],
delphi: ['Delphi/Pascal', 'pascal'],
erlang: ['Erlang', 'erlang'],
go: ['Golang', 'go'],
groovy: ['Groovy', 'groovy'],
html: ['HTML', 'text/html'],
java: ['Java', 'clike'],
json: ['JSON', 'text/json'],
javascript: ['Javascript', 'javascript'],
lua: ['Lua', 'lua'],
less: ['LESS', 'css'],
markdown: ['Markdown', 'gfm'],
'objective-c': ['Objective-C', 'clike'],
php: ['PHP', 'php'],
perl: ['Perl', 'perl'],
python: ['Python', 'python'],
r: ['R', 'r'],
rst: ['reStructedText', 'rst'],
ruby: ['Ruby', 'ruby'],
sql: ['SQL', 'sql'],
sass: ['SASS/SCSS', 'sass'],
shell: ['Shell', 'shell'],
scala: ['Scala', 'clike'],
swift: ['Swift', 'clike'],
vb: ['VB/VBScript', 'vb'],
xml: ['XML', 'text/xml'],
yaml: ['YAML', 'yaml']
};
/* harmony default export */ __webpack_exports__.Z = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)('python'),
_useState2 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
mode = _useState2[0],
setMode = _useState2[1];
function onSetMode(value) {
setMode(LanguageDesc[value][1]);
}
function onSubmit(values) {
callback(values);
}
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, formItemLayout), {}, {
className: "code-block-panel",
initialValues: {
language: 'python',
content: ''
},
onFinish: onSubmit,
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
label: "\u4EE3\u7801\u8BED\u8A00",
name: "language",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__["default"], {
getPopupContainer: function getPopupContainer(trigger) {
return trigger.parentNode;
},
onChange: onSetMode,
children: Object.keys(LanguageDesc).map(function (item) {
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(Option, {
value: item,
children: LanguageDesc[item][0]
}, item);
})
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z.Item, {
label: "\u4EE3\u7801\u5185\u5BB9",
name: "content",
rules: [{
required: true,
message: '请输入代码内容'
}],
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(MyCodeMirror, {
mode: mode
})
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
function MyCodeMirror(_ref2) {
var value = _ref2.value,
onChange = _ref2.onChange,
mode = _ref2.mode,
_ref2$options = _ref2.options,
options = _ref2$options === void 0 ? {} : _ref2$options;
var el = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(),
_useState4 = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
cm = _useState4[0],
setCm = _useState4[1];
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
var onChangeHandler = function onChangeHandler(cm) {
var content = cm.getValue();
onChange && onChange(content);
};
cm.on('change', onChangeHandler);
return function () {
cm.off('change', onChangeHandler);
};
}
}, [cm, onChange]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
cm.setOption('mode', mode);
}
}, [cm, mode]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (cm) {
if (value !== cm.getValue() || value === '') {
setTimeout(function () {
cm.setValue(value || '');
}, 300);
}
}
}, [cm, value]);
(0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
if (el.current && !cm) {
var instance = codemirror__WEBPACK_IMPORTED_MODULE_3___default().fromTextArea(el.current, _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
mode: mode,
lineNumbers: true,
lineWrapping: true,
autoCloseBrackets: true,
tabSize: 4,
autofocus: true,
autoCloseTags: true,
matchBrackets: true,
styleActiveLine: true
}, options));
setCm(instance);
}
}, [el.current, cm]);
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div", {
className: "my-codemirror-container",
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("textarea", {
ref: el
})
});
}
/***/ }),
/***/ 74607:
/*!***************************************************************!*\
!*** ./src/components/markdown-editor/index.tsx + 13 modules ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ markdown_editor; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createForOfIteratorHelper.js
var createForOfIteratorHelper = __webpack_require__(91232);
var createForOfIteratorHelper_default = /*#__PURE__*/__webpack_require__.n(createForOfIteratorHelper);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(7557);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(41498);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__(85573);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.js
var codemirror = __webpack_require__(89780);
var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror);
// EXTERNAL MODULE: ./node_modules/_resize-observer-polyfill@1.5.1@resize-observer-polyfill/dist/ResizeObserver.es.js
var ResizeObserver_es = __webpack_require__(76374);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/lib/codemirror.css
var lib_codemirror = __webpack_require__(27334);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closetag.js
var closetag = __webpack_require__(6313);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/edit/closebrackets.js
var closebrackets = __webpack_require__(25717);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/addon/display/placeholder.js
var placeholder = __webpack_require__(99498);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/markdown/markdown.js
var markdown = __webpack_require__(25419);
// EXTERNAL MODULE: ./node_modules/_codemirror@5.58.2@codemirror/mode/stex/stex.js
var stex = __webpack_require__(67549);
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx
var RenderHtml = __webpack_require__(96030);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// 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 = (0,_react_17_0_2_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__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
dangerouslySetInnerHTML: {
__html: html
}
})
});
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.less
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/components/markdown-editor/css/iconfont.css
// extracted by mini-css-extract-plugin
;// CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts
var LINK = 'link';
var UPLOAD_IMAGE = 'upload-image';
var CODE_BLOCK = 'code-block';
var MIND_ELIXIR = 'mind-elixir';
var ADD_TABLE = 'add-table';
var HRLINE = '------------';
var ALIGNSIGN = {
"default": HRLINE,
left: ":".concat(HRLINE),
center: ":".concat(HRLINE, ":"),
right: "".concat(HRLINE, ":")
};
;// CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx
var DEFAULTICONS = [{
title: '粗体',
icon: 'md-iconfont icon-bold',
actionName: 'bold'
}, {
title: '斜体',
icon: 'md-iconfont icon-italic',
actionName: 'italic'
}, '|', {
title: '无序列表',
icon: 'md-iconfont icon-unorder-list',
actionName: 'list-ul'
}, {
title: '有序列表',
icon: 'md-iconfont icon-order-list',
actionName: 'list-ol'
}, '|', {
title: '行内代码',
icon: 'md-iconfont icon-code',
actionName: 'code'
}, {
title: '代码块(多语言风格)',
icon: 'md-iconfont icon-file-code',
actionName: 'code-block'
}, {
title: '链接',
icon: 'md-iconfont icon-link',
actionName: 'link'
}, '|', {
title: '行内公式',
icon: 'md-iconfont icon-sum',
actionName: 'inline-latex'
}, {
title: '数学图像',
icon: 'iconfont icon-shuxuetuxiang2',
actionName: 'maths-latex'
}, {
title: '多行公式',
icon: 'md-iconfont icon-formula',
actionName: 'latex'
}, '|', {
title: '添加图片',
icon: 'md-iconfont icon-picture',
actionName: 'upload-image'
}, {
title: '思维导图',
icon: 'iconfont icon-siweidaotu',
actionName: MIND_ELIXIR
}, {
title: '表格',
icon: 'md-iconfont icon-table',
actionName: 'add-table'
}, '|', {
title: '换行',
icon: 'md-iconfont icon-minus',
actionName: 'line-break'
}, {
title: '清空',
icon: 'md-iconfont 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__*/(0,jsx_runtime.jsxs)("a", {
title: title,
className: className,
onClick: onAction,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "".concat(icon)
}), children]
});
}
/* harmony default export */ var toolbar = (function (_ref2) {
var watch = _ref2.watch,
showNullButton = _ref2.showNullButton,
showNullProgramButton = _ref2.showNullProgramButton,
onActionCallback = _ref2.onActionCallback,
fullScreen = _ref2.fullScreen,
insertTemp = _ref2.insertTemp,
hidetoolBar = _ref2.hidetoolBar;
var icons = [].concat(DEFAULTICONS, [{
title: "".concat(watch ? '关闭实时预览' : '开启实时预览'),
icon: "".concat(watch ? 'md-iconfont icon-eye-slash' : 'md-iconfont icon-eye'),
actionName: 'trigger-watch'
}]);
return /*#__PURE__*/(0,jsx_runtime.jsxs)("ul", {
className: "markdown-toolbar-container",
children: [!hidetoolBar && icons.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: item.actionName ? /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, objectSpread2_default()(objectSpread2_default()({}, item), {}, {
onActionCallback: onActionCallback
})) : /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "v-line"
})
}, index);
}), showNullButton ? /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-edit insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-null-ch",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"
})
})
}) : null, showNullProgramButton ? /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-edit insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-signal",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "+\u5355\u884C\u586B\u7A7A\u9879"
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-uniE900 insert-blank",
className: "btn-null",
title: "\u589E\u52A0\u586B\u7A7A",
actionName: "add-multiple",
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "+\u591A\u884C\u586B\u7A7A\u9879"
})
})
})]
}) : null, insertTemp && /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "md-iconfont icon-edit",
className: "btn-null",
title: "\u63D2\u5165\u6A21\u677F",
actionName: "inster-template-".concat(insertTemp),
onActionCallback: onActionCallback,
children: /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "fill-tip",
children: "\u63D2\u5165\u6A21\u677F"
})
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("li", {
className: "btn-full-screen",
children: /*#__PURE__*/(0,jsx_runtime.jsx)(AButton, {
icon: "".concat(fullScreen ? 'md-iconfont icon-shrink' : 'md-iconfont icon-enlarge'),
title: fullScreen ? '关闭全屏' : '开启全屏',
actionName: "trigger-full-screen",
onActionCallback: onActionCallback
})
})]
});
});
// EXTERNAL MODULE: ./src/components/modal.tsx
var modal = __webpack_require__(11418);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(73782);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
;// 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__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({}, formItemLayout), {}, {
initialValues: {
link: 'http://',
title: ''
},
className: "link-panel",
onFinish: onSubmit,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u94FE\u63A5\u5730\u5740",
name: "link",
rules: [{
required: true,
message: '请输入链接地址'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u94FE\u63A5\u6807\u9898",
name: "title",
rules: [{
required: true,
message: '请输入链接标题'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
// EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx
var code_block = __webpack_require__(46478);
// EXTERNAL MODULE: ./src/components/markdown-editor/upload-image/index.tsx + 1 modules
var upload_image = __webpack_require__(8531);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/radio/index.js + 5 modules
var es_radio = __webpack_require__(5112);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input-number/index.js + 14 modules
var input_number = __webpack_require__(94001);
;// CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx
var RadioGroup = es_radio/* default.Group */.ZP.Group;
var 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__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, {
className: "add-table-panel",
initialValues: {
row: 3,
col: 2,
align: 'default'
},
onFinish: onSubmit,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
style: {
alignItems: "baseline"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: style,
children: "\u5355\u5143\u683C\u6570\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: style,
children: "\u884C\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "row",
rules: [{
required: true,
message: '请输入行数'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: style,
children: "\u5217\u6570"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "col",
rules: [{
required: true,
message: '请输入列数'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input_number/* default */.Z, {})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
style: {
marginTop: 12,
alignItems: "baseline"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: style,
children: "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
name: "align",
children: /*#__PURE__*/(0,jsx_runtime.jsxs)(RadioGroup, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "default",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-justify"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "left",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-left"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "center",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-center"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_radio/* default */.ZP, {
value: "right",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
className: "fa fa-align-right"
})
})]
})
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container flex-end",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "ghost",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
});
});
// EXTERNAL MODULE: ./src/utils/env.ts + 1 modules
var env = __webpack_require__(97730);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(23634);
// EXTERNAL MODULE: ./node_modules/_uuid@8.3.0@uuid/dist/esm-browser/v4.js + 4 modules
var v4 = __webpack_require__(1012);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/col/index.js
var col = __webpack_require__(43604);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/index.js + 16 modules
var es_modal = __webpack_require__(43418);
// EXTERNAL MODULE: ./src/components/useInterval.tsx
var useInterval = __webpack_require__(36944);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/switch/index.js + 2 modules
var es_switch = __webpack_require__(78673);
// EXTERNAL MODULE: ./src/components/MathematicalGraphics/js/index.js
var js = __webpack_require__(8433);
var js_default = /*#__PURE__*/__webpack_require__.n(js);
;// CONCATENATED MODULE: ./src/components/MathematicalGraphics/index.tsx
var FlowChart = /*#__PURE__*/(0,_react_17_0_2_react.forwardRef)(function (_ref, ref) {
var use3d = _ref.use3d,
width = _ref.width,
height = _ref.height,
callback = _ref.callback,
showSaveButton = _ref.showSaveButton;
var ggbAppletRef = (0,_react_17_0_2_react.useRef)();
var appletRef = (0,_react_17_0_2_react.useRef)();
var _useState = (0,_react_17_0_2_react.useState)(false),
_useState2 = slicedToArray_default()(_useState, 2),
is3D = _useState2[0],
setIs3d = _useState2[1];
var parameters = (0,_react_17_0_2_react.useRef)({
"id": ggbAppletRef,
"appName": "graphing",
"width": width || 1000,
"height": height || 600,
"showToolBar": true,
"showMenuBar": true,
"allowStyleBar": true,
"showAlgebraInput": true,
"enableLabelDrags": false,
"enableShiftDragZoom": true,
"showToolBarHelp": false,
"errorDialogsActive": true,
"showTutorialLink": true,
"showLogging": true,
"useBrowserForJS": false
});
(0,_react_17_0_2_react.useEffect)(function () {
appletRef.current = new (js_default())(parameters.current, true);
window.onload = function () {
appletRef.current.inject('applet_container');
};
}, []);
var getImgData = function getImgData() {
var str = window.ggbApplet.getPNGBase64(1, true, 72);
callback && callback(str);
return str;
};
(0,_react_17_0_2_react.useEffect)(function () {
parameters.current.appName = is3D ? "3D" : "graphing";
appletRef.current.inject('applet_container');
}, [is3D]);
(0,_react_17_0_2_react.useEffect)(function () {
setIs3d(use3d);
}, [use3d]);
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
return {
getImgData: getImgData
};
});
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
width: "100%",
height: "100%"
},
id: "applet_container",
ref: ggbAppletRef
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
flex: 1,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_switch/* default */.Z, {
size: "default",
checkedChildren: "\u5173\u95ED3D\u56FE\u50CF",
unCheckedChildren: "\u5F00\u542F3D\u56FE\u50CF",
checked: is3D,
onChange: function onChange(e) {
return setIs3d(e);
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
size: "large",
onClick: getImgData,
style: {
zIndex: 8,
marginTop: 10
},
type: "primary",
children: "\u4FDD\u5B58\u5230\u7F16\u8F91\u5668"
})
})]
})]
});
});
/* harmony default export */ var MathematicalGraphics = (FlowChart);
// EXTERNAL MODULE: ./src/components/MathsLatexKeybords/keybords.tsx
var keybords = __webpack_require__(81107);
// EXTERNAL MODULE: ./node_modules/_mind-elixir@4.3.1@mind-elixir/dist/MindElixir.js
var MindElixir = __webpack_require__(63518);
// EXTERNAL MODULE: ./node_modules/_node-menu-bar@1.0.0@node-menu-bar/dist/node-menu.js
var node_menu = __webpack_require__(99113);
// EXTERNAL MODULE: ./node_modules/_node-menu-bar@1.0.0@node-menu-bar/dist/style.css
var dist_style = __webpack_require__(88917);
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
var _classnames_2_5_1_classnames = __webpack_require__(92310);
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
;// CONCATENATED MODULE: ./src/components/MindElixir/index.tsx
var theme = {
name: 'Latte',
palette: ['#4968a3', '#3b88c4', '#4fa3d4', '#2b5b84', '#367fa2', '#5e93b7', '#4a719c', '#28567d', '#214e6d', '#336699'],
cssVar: {
'--main-color': '#444446',
'--main-bgcolor': '#ffffff',
'--color': '#777777',
'--bgcolor': '#F6F7F9',
'--panel-color': '#444446',
'--panel-bgcolor': '#ffffff',
'--panel-border-color': '#eaeaea',
"--root-bgcolor": "#3061D0"
}
};
var defaultInitData = {
direction: 2,
nodeData: {
id: "1c11affb6d8aafe1",
root: false,
topic: "中心主题",
children: [{
direction: 1,
id: "1c11b0accef2b276",
topic: "分支主题1"
}, {
direction: 1,
id: "1c11b0ea1865330a",
topic: "分支主题2"
}, {
direction: 0,
id: "1c11b14599afe03e",
topic: "分支主题3"
}, {
direction: 0,
id: "1c11d29f0a0766b7",
topic: "分支主题4"
}]
}
};
/**
* @description 官网文档https://docs.mind-elixir.com/zh-Hans/
*/
var MindElixirDom = function MindElixirDom(_ref) {
var _ref$MindElixirOption = _ref.MindElixirOptions,
MindElixirOptions = _ref$MindElixirOption === void 0 ? {} : _ref$MindElixirOption,
style = _ref.style,
className = _ref.className,
_ref$initData = _ref.initData,
initData = _ref$initData === void 0 ? defaultInitData : _ref$initData,
getMindElixirInstance = _ref.getMindElixirInstance;
var refMindElixirDom = (0,_react_17_0_2_react.useRef)(null);
var instance = (0,_react_17_0_2_react.useRef)(null);
(0,_react_17_0_2_react.useEffect)(function () {
instance.current = new MindElixir/* default */.Z(objectSpread2_default()({
el: refMindElixirDom.current,
// direction: MindElixir.LEFT,
draggable: true,
// default true
contextMenu: true,
// default true
toolBar: true,
// default true
nodeMenu: true,
// default true
keypress: true,
// default true
theme: theme,
locale: 'zh_CN'
}, MindElixirOptions));
instance.current.install(node_menu/* default */.Z);
instance.current.init(initData);
instance.current.bus.addListener('expandNode', function (node) {
console.log('expandNode: ', node);
});
}, [refMindElixirDom.current]);
(0,_react_17_0_2_react.useEffect)(function () {
if (instance.current && getMindElixirInstance) {
getMindElixirInstance(instance.current);
}
}, [instance.current, getMindElixirInstance]);
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
ref: refMindElixirDom,
className: _classnames_2_5_1_classnames_default()(className),
style: objectSpread2_default()({
height: "500px",
width: "100%"
}, style)
});
};
/* harmony default export */ var components_MindElixir = (MindElixirDom);
;// CONCATENATED MODULE: ./src/components/MindElixir/css/index.css?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var cssmodules = ({"token":"token___aH8hY","comment":"comment___Iqu7S","block-comment":"block-comment___oTi9U","prolog":"prolog___W1XzV","doctype":"doctype___aI16P","cdata":"cdata___mbRLP","punctuation":"punctuation___bGjgy","property":"property___kQPiF","tag":"tag___YLPxz","boolean":"boolean___Qj8xU","number":"number___zbDqM","function-name":"function-name___MyGZh","constant":"constant___RhvWL","symbol":"symbol____2iqM","deleted":"deleted___Guyo_","selector":"selector___uvqpG","attr-name":"attr-name___Z_214","string":"string___em9LE","char":"char___rHDNG","function":"function___T2K0R","builtin":"builtin___lMNus","inserted":"inserted___AdA4k","operator":"operator___D7vKt","entity":"entity___H7oxQ","url":"url___L7hNO","variable":"variable___e6hO7","atrule":"atrule___q9hFk","attr-value":"attr-value___DrxZO","keyword":"keyword___dqilp","class-name":"class-name___Yn8Bc","regex":"regex___mOtKV","important":"important___D8K78","language-css":"language-css___Opn54","style":"style___swmhn","bold":"bold___S5ib6","italic":"italic___AdvlH","namespace":"namespace___beqpl","tab":"tab___tZ4k5","cr":"cr___OpTsE","lf":"lf___tvsol","line-numbers":"line-numbers___lKQmD","line-numbers-rows":"line-numbers-rows___wsoWA","line-highlight":"line-highlight___nWWTT"});
;// CONCATENATED MODULE: ./src/components/MindElixir/css/katex.css?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var katexmodules = ({"katex":"katex___iCBTQ","katex-version":"katex-version___cOhKF","katex-mathml":"katex-mathml___NIZbj","katex-html":"katex-html___AU3lC","newline":"newline___sEmlt","base":"base___j7kAb","strut":"strut___XADpH","textbf":"textbf___ugxxw","textit":"textit___E3MEh","textrm":"textrm___KaQT3","textsf":"textsf___b_1UN","texttt":"texttt___bXWLz","mathnormal":"mathnormal___S_BNe","mathit":"mathit___px3DU","mathrm":"mathrm___CJ0Ov","mathbf":"mathbf___o0Cxs","boldsymbol":"boldsymbol____tl0e","amsrm":"amsrm___zCdO5","mathbb":"mathbb___MDsZ7","textbb":"textbb___aZRpb","mathcal":"mathcal___FUzAj","mathfrak":"mathfrak___oeP6B","textfrak":"textfrak___atjFL","mathboldfrak":"mathboldfrak___ZYz5s","textboldfrak":"textboldfrak___l0B4G","mathtt":"mathtt___cCLQk","mathscr":"mathscr___h4MFC","textscr":"textscr___OrKjP","mathsf":"mathsf___KaUE9","mathboldsf":"mathboldsf___lreWi","textboldsf":"textboldsf___UOSzk","mathitsf":"mathitsf___lLciw","textitsf":"textitsf___nk9Bo","mainrm":"mainrm___EU6OB","vlist-t":"vlist-t___zUdQN","vlist-r":"vlist-r___eu_Dr","vlist":"vlist___VbprB","pstrut":"pstrut___giEcz","vlist-t2":"vlist-t2___MMKcs","vlist-s":"vlist-s___RRml8","vbox":"vbox___cSrTt","hbox":"hbox___knR9t","thinbox":"thinbox___nZDgA","msupsub":"msupsub___o7pVw","mfrac":"mfrac___rci5r","frac-line":"frac-line___dECAj","hdashline":"hdashline___vJhXN","hline":"hline___NUZJw","overline":"overline___e3ter","overline-line":"overline-line___m5W0K","rule":"rule___DxtkL","underline":"underline___VFo4l","underline-line":"underline-line___hag9b","mspace":"mspace___qwufg","clap":"clap___JYvp7","llap":"llap___y7PVB","rlap":"rlap___ldOox","inner":"inner___poMdG","fix":"fix___NRSg0","sqrt":"sqrt___B9zAK","root":"root___gc6a4","fontsize-ensurer":"fontsize-ensurer___o8w0H","reset-size1":"reset-size1___gxAos","size1":"size1___xfvvW","sizing":"sizing___ABfsX","size2":"size2___BPvA_","size3":"size3___o4xL1","size4":"size4___l90IH","size5":"size5___p9Y6Y","size6":"size6___f1SPW","size7":"size7___hb_Zm","size8":"size8___XmVzJ","size9":"size9___xqJRt","size10":"size10___Vs1h_","size11":"size11___y2pIM","reset-size2":"reset-size2___wwUwy","reset-size3":"reset-size3___gSwgL","reset-size4":"reset-size4___xS1TT","reset-size5":"reset-size5___LuaA9","reset-size6":"reset-size6___WeXyX","reset-size7":"reset-size7___YKHaR","reset-size8":"reset-size8___bVV_s","reset-size9":"reset-size9___FePDs","reset-size10":"reset-size10___B7cDv","reset-size11":"reset-size11___rvsDQ","delimsizing":"delimsizing___ln0A5","mult":"mult____cmiX","delim-size1":"delim-size1___FXVIY","delim-size4":"delim-size4___ChZ9k","nulldelimiter":"nulldelimiter___j_THC","delimcenter":"delimcenter___BjiTF","op-symbol":"op-symbol___qxVPt","small-op":"small-op___kZP5R","large-op":"large-op___Yzafh","accent":"accent___ilAb4","op-limits":"op-limits___CWAz5","accent-body":"accent-body___P5hAq","accent-full":"accent-full___DU15H","overlay":"overlay___NGtxJ","mtable":"mtable___IlJ23","vertical-separator":"vertical-separator___vTUjP","arraycolsep":"arraycolsep___RlCP8","col-align-c":"col-align-c___uBNk4","col-align-l":"col-align-l___UdFvQ","col-align-r":"col-align-r___PJ6D6","svg-align":"svg-align___zJLza","stretchy":"stretchy___Lqfp6","hide-tail":"hide-tail___UGhaL","halfarrow-left":"halfarrow-left___JW6IH","halfarrow-right":"halfarrow-right____DtTU","brace-left":"brace-left___R1Wxj","brace-center":"brace-center___rKNf4","brace-right":"brace-right___qNjpg","x-arrow-pad":"x-arrow-pad___eRD54","cd-arrow-pad":"cd-arrow-pad___XS4hg","mover":"mover___iz_dZ","munder":"munder___wVC3M","x-arrow":"x-arrow____L_h6","boxpad":"boxpad___RHcxm","fbox":"fbox___pRD8o","fcolorbox":"fcolorbox___u9Ti4","cancel-pad":"cancel-pad___Wulr8","cancel-lap":"cancel-lap___Hbe_3","sout":"sout___dAS7Q","angl":"angl___bCFqs","anglpad":"anglpad___c4vWJ","eqn-num":"eqn-num___aPXrl","mml-eqn-num":"mml-eqn-num___Rb8zj","mtr-glue":"mtr-glue___LaO6a","cd-vert-arrow":"cd-vert-arrow___aoi1S","cd-label-left":"cd-label-left___fBNdS","cd-label-right":"cd-label-right___RoRPh","katex-display":"katex-display___CwVRR","tag":"tag___b062H","leqno":"leqno___LSddg","fleqn":"fleqn___g8Drc"});
;// CONCATENATED MODULE: ./src/components/MindElixir/utils.ts
/**
* @description 官方提供的导出image的方法
* @returns {string} URL
*/
var getMindImageUrl = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee(_ref) {
var mind, type, _ref$style, style, _ref$katex, katex, blob, url;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
mind = _ref.mind, type = _ref.type, _ref$style = _ref.style, style = _ref$style === void 0 ? cssmodules : _ref$style, _ref$katex = _ref.katex, katex = _ref$katex === void 0 ? katexmodules : _ref$katex;
_context.prev = 1;
blob = null;
if (!(type === 'png')) {
_context.next = 9;
break;
}
_context.next = 6;
return mind.exportPng(false, style + katex);
case 6:
blob = _context.sent;
_context.next = 12;
break;
case 9:
_context.next = 11;
return mind.exportSvg(false, style + katex);
case 11:
blob = _context.sent;
case 12:
if (blob) {
_context.next = 14;
break;
}
return _context.abrupt("return");
case 14:
url = URL.createObjectURL(blob);
return _context.abrupt("return", {
url: url,
blob: blob
});
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](1);
console.error(_context.t0);
case 21:
case "end":
return _context.stop();
}
}, _callee, null, [[1, 18]]);
}));
return function getMindImageUrl(_x) {
return _ref2.apply(this, arguments);
};
}();
;// CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx
function noop() {}
var pending = 0;
var StorageTimeTicket = 10000;
var NULL_CH = '▁';
var ADD_MULTI = '@▁▁@';
var ADD_SINGLE = '@▁@';
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 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"];
var DEFAULTKEYMAP = defineProperty_default()(defineProperty_default()({}, key + '-B', 'bold'), key + '-I', 'italic');
var TitleDesc = defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, LINK, '添加链接'), CODE_BLOCK, '添加代码块'), UPLOAD_IMAGE, '添加文件'), ADD_TABLE, '添加表格'), 'maths-latex', "数学图像"), 'inline-latex', "LATEX公式"), MIND_ELIXIR, "插入思维导图");
//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 markdown_editor = (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$showNullProgramB = _ref.showNullProgramButton,
showNullProgramButton = _ref$showNullProgramB === void 0 ? false : _ref$showNullProgramB,
_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$disabled = _ref.disabled,
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
_ref$disabledFill = _ref.disabledFill,
disabledFill = _ref$disabledFill === void 0 ? false : _ref$disabledFill,
_ref$placeholder = _ref.placeholder,
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
_ref$values = _ref.values,
values = _ref$values === void 0 ? '' : _ref$values;
var _useState = (0,_react_17_0_2_react.useState)(null),
_useState2 = slicedToArray_default()(_useState, 2),
cm = _useState2[0],
setCm = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)(defaultValue),
_useState4 = slicedToArray_default()(_useState3, 2),
value = _useState4[0],
setValue = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(watch),
_useState6 = slicedToArray_default()(_useState5, 2),
preview = _useState6[0],
setPreview = _useState6[1];
var _useState7 = (0,_react_17_0_2_react.useState)(fullScreen),
_useState8 = slicedToArray_default()(_useState7, 2),
isFull = _useState8[0],
setIsFull = _useState8[1];
var _useState9 = (0,_react_17_0_2_react.useState)(''),
_useState10 = slicedToArray_default()(_useState9, 2),
action = _useState10[0],
setAction = _useState10[1];
var _useState11 = (0,_react_17_0_2_react.useState)(0),
_useState12 = slicedToArray_default()(_useState11, 2),
lastedUpdateTime = _useState12[0],
setLastedUpdateTime = _useState12[1];
var _useState13 = (0,_react_17_0_2_react.useState)(height),
_useState14 = slicedToArray_default()(_useState13, 2),
h = _useState14[0],
setH = _useState14[1];
var _useState15 = (0,_react_17_0_2_react.useState)(false),
_useState16 = slicedToArray_default()(_useState15, 2),
tip = _useState16[0],
setTip = _useState16[1];
var uuidRef = (0,_react_17_0_2_react.useRef)((0,v4/* default */.Z)());
var openPhoneRef = (0,_react_17_0_2_react.useRef)(false);
var timer = (0,_react_17_0_2_react.useRef)();
var cmEl = (0,_react_17_0_2_react.useRef)();
var containerEl = (0,_react_17_0_2_react.useRef)();
var resizeBarEl = (0,_react_17_0_2_react.useRef)();
var previewEl = (0,_react_17_0_2_react.useRef)();
var mindElixir = (0,_react_17_0_2_react.useRef)(null);
var ModalEl = (0,_react_17_0_2_react.useRef)();
var checkFiles = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var _res$attachments;
var res;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0,fetch/* default */.ZP)("/api/attachments/distinct_hash_val.json", {
method: "post",
body: {
hash_val: uuidRef.current
}
});
case 2:
res = _context.sent;
if (!!(res !== null && res !== void 0 && (_res$attachments = res.attachments) !== null && _res$attachments !== void 0 && _res$attachments.length)) {
console.log("cm:", cm, cmEl);
res.attachments.map(function (item) {
if (item.content_type.indexOf("image") > -1) {
cm.replaceSelection("![,](/api/attachments/".concat(item.id, "?type=").concat(item.content_type, ")"));
} else if (item.content_type.indexOf("video") > -1) {
cm.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if (item.content_type.indexOf("pdf") > -1) {
cm.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, "&disposition=inline\" target=\"_blank\">").concat(item.name, "</a>"));
} else {
cm.replaceSelection("[".concat(item.name, "](").concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(item.id, "?type=").concat(item.content_type, ")"));
}
});
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return function checkFiles() {
return _ref2.apply(this, arguments);
};
}();
// useEffect(() => {
// setValue(defaultValue)
// cm?.setValue(defaultValue)
// },[])
(0,_react_17_0_2_react.useEffect)(function () {
var scrollTop = window.scrollY || window.pageYOffset;
setValue(values);
cm === null || cm === void 0 || cm.setValue(values);
window.scrollTo(0, scrollTop);
}, [values]);
(0,_react_17_0_2_react.useEffect)(function () {
onFullScreen === null || onFullScreen === void 0 || onFullScreen(isFull);
}, [isFull]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cmEl.current) {
var onPaste = function onPaste(_, e) {
if (disablePaste) {
e.preventDefault();
return;
}
var clipboardData = e.clipboardData;
if (clipboardData) {
var types = clipboardData.types.toString();
var items = clipboardData.items;
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))
(0,upload_image/* uploadImage */.I)(file, function (data) {
if (data.id) {
var _file$type, _file$type2, _file$type3;
if ((file === null || file === void 0 || (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) {
instance.replaceSelection("![,](/api/attachments/".concat(data.id, "?type=").concat(data.content_type, ")"));
} else if ((file === null || file === void 0 || (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) {
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if ((file === null || file === void 0 || (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else if (officeSix.includes(fileSix)) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else {
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.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/* default */.ZP.warning("请使用chrome浏览器粘贴");
}
return true;
} else {
//toMarkdown ?
// let html = clipboardData.getData('text/html')
return true;
}
}
return true;
};
var instance = codemirror_default().fromTextArea(cmEl.current, {
mode: mode,
// inputStyle: 'contenteditable',
lineNumbers: miniToolbar ? false : true,
lineWrapping: true,
value: defaultValue,
autoCloseTags: showNullProgramButton ? false : true,
autoCloseBrackets: true
});
instance.on("keyup", function (cm, event) {
if (event.keyCode === 8) {
if (cm.getValue() == "") {
instance.setOption("placeholder", placeholder);
} else {
instance.setOption("placeholder", null);
}
}
});
instance.on("keydown", function (cm, event) {
if (event.keyCode === 8) {
var pos = deleteAtSymbol(cm);
if (pos) {
event.preventDefault();
}
}
});
isFocus && instance.focus();
instance.on('paste', onPaste);
instance.on('dragleave', function (data, e) {
containerEl.current.classList.remove("mouse-hover-md");
});
instance.on('dragover', function (data, e) {
containerEl.current.classList.add("mouse-hover-md");
});
instance.on('drop', function (data, e) {
containerEl.current.classList.add("mouse-hover-md");
// var file;
var files;
// Check if files were dropped
files = e.dataTransfer.files;
if (files.length > 0) {
e.preventDefault();
e.stopPropagation();
// file = files[0];
// alert('File: ' + file.name);
// return false;
var _loop = function _loop() {
var file = files[i];
var fileSix = file.name.split(".").pop();
(0,upload_image/* uploadImage */.I)(file, function (data) {
if (data.id) {
var _file$type4, _file$type5, _file$type6;
if ((file === null || file === void 0 || (_file$type4 = file.type) === null || _file$type4 === void 0 ? void 0 : _file$type4.indexOf("image")) > -1) {
instance.replaceSelection("![,](/api/attachments/".concat(data.id, "?type=").concat(data.content_type, ")"));
} else if ((file === null || file === void 0 || (_file$type5 = file.type) === null || _file$type5 === void 0 ? void 0 : _file$type5.indexOf("video")) > -1) {
instance.replaceSelection("<video width=\"100%\" controls src=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "\"></video>"));
} else if ((file === null || file === void 0 || (_file$type6 = file.type) === null || _file$type6 === void 0 ? void 0 : _file$type6.indexOf("pdf")) > -1) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(file.type, "&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else if (officeSix.includes(fileSix)) {
instance.replaceSelection("<a href=\"".concat(env/* default */.Z.API_SERVER, "/api/attachments/").concat(data.id, "?type=office&disposition=inline\" target=\"_blank\">").concat(file.name, "</a>"));
} else {
instance.replaceSelection("[".concat(file.name, "](").concat(env/* default */.Z.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';
}
});
};
for (var i = 0; i < files.length; i++) {
_loop();
}
// files.map((file:any) => {
// })
}
});
if (disabled) {
instance.on("beforeChange", function (instances, change) {
if (change.origin === "paste" || change.origin === "+input") {
change.cancel();
}
});
}
setCm(instance);
return function () {
instance.off('paste', onPaste);
};
}
}, []);
var resizeEditorBodyHeight = (0,_react_17_0_2_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]);
(0,_react_17_0_2_react.useEffect)(function () {
function onLayout() {
var ro = new ResizeObserver_es/* default */.Z(function (entries) {
var _iterator = createForOfIteratorHelper_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 () {
var _cmEl$current, _cmEl$current2;
if ((_cmEl$current = cmEl.current) !== null && _cmEl$current !== void 0 && _cmEl$current.parentElement) ro.unobserve((_cmEl$current2 = cmEl.current) === null || _cmEl$current2 === void 0 ? void 0 : _cmEl$current2.parentElement);
};
}
}, [cm, resizeEditorBodyHeight]);
//keymap
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
var keymap = [];
var _loop2 = function _loop2() {
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
k = _Object$entries$_i[0],
value = _Object$entries$_i[1];
var map = defineProperty_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++) {
_loop2();
}
timer.current = setInterval(function () {
if (openPhoneRef.current) {
checkFiles();
}
}, 4000);
return function () {
clearInterval(timer.current);
for (var _i2 = 0, _keymap = keymap; _i2 < _keymap.length; _i2++) {
var m = _keymap[_i2];
cm.removeKeyMap(m);
}
};
}
}, [cm]);
(0,_react_17_0_2_react.useEffect)(function () {
if (fullScreen !== isFull) {
setIsFull(fullScreen);
}
}, [fullScreen]);
(0,useInterval/* default */.Z)(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);
(0,_react_17_0_2_react.useEffect)(function () {
setPreview(watch);
}, [cm, watch]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
isFocus && cm.focus();
}
}, [cm, isFocus]);
(0,_react_17_0_2_react.useEffect)(function () {
if (preview && cm) {
var syncScroll = function syncScroll(e) {
var target = e.target;
if (previewEl.current) {
var ratio = target.scrollTop / target.scrollHeight;
previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio;
}
};
var scrollEl = cm.getScrollerElement();
scrollEl.addEventListener('scroll', syncScroll);
return function () {
scrollEl.removeEventListener('scroll', syncScroll);
};
}
}, [cm, preview]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm && onCMBeforeChange) {
var onChangeHandler = function onChangeHandler(cm, change) {
onCMBeforeChange(cm, change);
};
cm.on('beforeChange', onChangeHandler);
return function () {
cm.off('beforeChange', onChangeHandler);
};
}
}, [cm, onCMBeforeChange]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm && onBlur) {
var onBlurHandler = function onBlurHandler() {
onBlur(cm.getValue());
};
cm.on('blur', onBlurHandler);
return function () {
cm.off('blur', onBlurHandler);
};
}
}, [cm, onBlur]);
function deleteAtSymbol(cm, change) {
var doc = cm.getDoc();
var cursor = doc.getCursor();
var line = doc.getLine(cursor.line);
var ch = line.charAt(cursor.ch - 1);
var p1 = line.lastIndexOf("@▁@", cursor.ch);
var p2 = line.lastIndexOf("@▁▁@", cursor.ch);
var posStart = p1 > p2 ? p1 : p2;
var n = p1 > p2 ? 3 : 4;
if (ADD_MULTI.indexOf(ch) === -1) return null;
console.log("change1:", change, cm, line, cursor, posStart, p1, p2, ch);
if (posStart >= 0 && cursor.ch - posStart < 5) {
var posEnd = posStart + n;
doc.replaceRange("", {
line: cursor.line,
ch: posStart
}, {
line: cursor.line,
ch: posEnd
});
return {
line: cursor.line,
ch: posEnd
};
}
return null;
}
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
var onChangeHandler = function onChangeHandler(cm, change) {
var content = cm.getValue();
setValue(content);
setLastedUpdateTime(new Date().getTime());
cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll'));
if (onChange) {
if (showNullProgramButton) {
onChange(content, formatProgramFill(content));
} else {
onChange(content);
}
}
};
cm.on('change', onChangeHandler);
return function () {
cm.off('change', onChangeHandler);
};
}
}, [cm, onChange]);
(0,_react_17_0_2_react.useEffect)(function () {
if (cm) {
// isFocus && cm.focus()
if (defaultValue === null || defaultValue === undefined) {
cm.setValue('');
setValue('');
} else {
var scrollTop = window.scrollY || window.pageYOffset;
if (defaultValue !== cm.getValue()) {
cm.setValue(defaultValue);
setValue(defaultValue);
cm.setCursor(disabled ? 1 : cm.lineCount(), 0);
window.scrollTo(0, scrollTop);
}
}
}
}, [cm, defaultValue]);
var onActionCallback = (0,_react_17_0_2_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':
setAction("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('<br/>\n');
return cm.focus();
case 'list-ul':
if (selection === '') {
cm.replaceSelection('- ' + selection);
} else {
cm.replaceSelection(selectionText.map(function (item) {
return item === '' ? '' : "- ".concat(item);
}).join('\n'));
}
return cm.focus();
case 'list-ol':
if (selection === '') {
cm.replaceSelection('1. ' + selection);
} else {
cm.replaceSelection(selectionText.map(function (item, index) {
return item === '' ? '' : "".concat(index + 1, ". ").concat(item);
}).join('\n'));
}
return cm.focus();
case 'add-null-ch':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(NULL_CH);
return cm.focus();
case 'add-signal':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(ADD_SINGLE);
return cm.focus();
case 'add-multiple':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(ADD_MULTI);
return cm.focus();
case 'inster-template-1':
if (selection === '') {
cm.setCursor(cursor.line, cursor.ch);
}
cm.replaceSelection(TEMP1);
return cm.focus();
case 'eraser':
cm.setValue('');
return cm.focus();
case 'trigger-watch':
setPreview(!preview);
return cm.focus();
case 'trigger-full-screen':
setIsFull(!isFull);
return cm.focus();
case "maths-latex":
setAction("maths-latex");
return;
case LINK:
setAction(LINK);
return;
case CODE_BLOCK:
setAction(CODE_BLOCK);
return;
case UPLOAD_IMAGE:
setAction(UPLOAD_IMAGE);
return;
case ADD_TABLE:
setAction(ADD_TABLE);
return;
case MIND_ELIXIR:
setAction(MIND_ELIXIR);
return;
default:
throw new Error();
}
}, [cm, preview, isFull]);
var ExecutePluginAction = (0,_react_17_0_2_react.useCallback)(function (values) {
setAction('');
switch (action) {
case LINK:
var title = values.title,
link = values.link;
cm.replaceSelection("[".concat(title, "](").concat(link, ")"));
return cm.focus();
case CODE_BLOCK:
var language = values.language,
content = values.content;
cm.replaceSelection(['```' + language, content, '```'].join('\n'));
return cm.focus();
case "maths-latex":
var binaryString = atob(values);
var uint8Array = new Uint8Array(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
uint8Array[i] = binaryString.charCodeAt(i);
}
var files = new Blob([uint8Array], {
type: "image/png"
});
(0,upload_image/* uploadImage */.I)(files, function (data) {
if (data.id) {
cm.replaceSelection("![,](/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';
}
});
break;
case "inline-latex":
cm.replaceSelection("`$$" + values + "$$`");
break;
case UPLOAD_IMAGE:
var src = values.src,
alt = values.alt;
if (alt) {
cm.replaceSelection("![ ".concat(alt, " ]( ").concat(src, " \"").concat(alt, "\" )"));
} else {
cm.replaceSelection("![,](".concat(src, ")"));
}
return cm.focus();
case ADD_TABLE:
var row = values.row,
col = values.col,
align = values.align;
var table = '\n';
for (var r = 0; r < row; r++) {
var rows = [];
var heads = [];
for (var c = 0; c < col; c++) {
if (r === 1) {
heads.push(ALIGNSIGN[align]);
}
rows.push(' ');
}
if (r === 1) {
table += "| ".concat(heads.join(' | '), " |\n");
}
table += "| ".concat(rows.join(col === 1 ? '' : ' | '), " |\n");
}
cm.replaceSelection(table + '\n');
return cm.focus();
default:
throw new Error();
}
}, [cm, action]);
var PluginEl = (0,_react_17_0_2_react.useMemo)(function () {
switch (action) {
case LINK:
return /*#__PURE__*/(0,jsx_runtime.jsx)(markdown_editor_link, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case CODE_BLOCK:
return /*#__PURE__*/(0,jsx_runtime.jsx)(code_block/* default */.Z, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case UPLOAD_IMAGE:
return /*#__PURE__*/(0,jsx_runtime.jsx)(upload_image/* default */.Z, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case ADD_TABLE:
return /*#__PURE__*/(0,jsx_runtime.jsx)(add_table_panel, {
callback: ExecutePluginAction,
onCancel: onCancel
});
case "maths-latex":
return /*#__PURE__*/(0,jsx_runtime.jsx)(MathematicalGraphics, {
showSaveButton: true,
callback: ExecutePluginAction
});
case "inline-latex":
return /*#__PURE__*/(0,jsx_runtime.jsx)(keybords/* default */.Z, {
showSaveButton: true,
callback: ExecutePluginAction
});
case MIND_ELIXIR:
return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(components_MindElixir, {
style: {
height: 500,
width: 800,
overflow: "auto"
},
getMindElixirInstance: function getMindElixirInstance(mind) {
mind && (mindElixir.current = mind);
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
className: "mt20",
align: "middle",
justify: "end",
gutter: 20,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
onClick: function onClick() {
onCancel();
},
children: "\u53D6\u6D88"
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(col/* default */.Z, {
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
onClick: /*#__PURE__*/asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee2() {
var _yield$getMindImageUr, url, blob;
return regeneratorRuntime_default()().wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (mindElixir.current) {
_context2.next = 2;
break;
}
return _context2.abrupt("return");
case 2:
_context2.next = 4;
return getMindImageUrl({
mind: mindElixir.current,
type: 'png'
});
case 4:
_yield$getMindImageUr = _context2.sent;
url = _yield$getMindImageUr.url;
blob = _yield$getMindImageUr.blob;
if (blob) {
_context2.next = 9;
break;
}
return _context2.abrupt("return", message/* default */.ZP.warning("导出图片失败,请重试"));
case 9:
(0,upload_image/* uploadImage */.I)(blob, function (data) {
if (data.id) {
cm.replaceSelection("![,](/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';
}
setAction('');
});
case 10:
case "end":
return _context2.stop();
}
}, _callee2);
})),
children: "\u4FDD\u5B58\u5230\u7F16\u8F91\u5668"
})
})]
})]
});
default:
return null;
}
}, [action]);
function onCancel() {
if (action == MIND_ELIXIR) {
es_modal/* default */.Z.confirm({
title: '提示',
icon: null,
centered: true,
getContainer: function getContainer() {
return ModalEl.current;
},
content: "关闭弹窗将不会保存已编辑的思维导图,确认关闭弹窗吗?",
onOk: function onOk() {
setAction('');
}
});
return;
}
setAction('');
}
(0,_react_17_0_2_react.useEffect)(function () {
if (resizeBarEl.current) {
var onMouseDown = function onMouseDown(e) {
dragging = true;
startY = e.pageY;
};
var onMouseUp = function onMouseUp() {
dragging = false;
};
var onMouseMove = function onMouseMove(e) {
if (dragging) {
var delta = e.pageY - startY;
if (delta < 0) {
delta = 0;
}
if (delta > 300) {
delta = 300;
}
var resizeH = height + delta + 'px';
setH(resizeH);
}
};
var resizeBar = resizeBarEl.current;
var dragging = false;
var startY = 0;
resizeBar.addEventListener('mousedown', onMouseDown);
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', onMouseUp);
return function () {
resizeBar.removeEventListener('mousedown', onMouseDown);
document.removeEventListener('mousemove', onMouseMove);
document.removeEventListener('mouseup', onMouseUp);
};
}
}, [cm, resizeBarEl]);
(0,_react_17_0_2_react.useEffect)(function () {
setH(height);
}, [height]);
var fixedWidth = processSize(width);
var fixedHeight = processSize(h);
var style = {
width: fixedWidth,
height: fixedHeight
};
var saveTime = (0,_react_17_0_2_react.useMemo)(function () {
if (lastedUpdateTime) {
var d = new Date(lastedUpdateTime);
var _h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
_h = _h < 10 ? '0' + _h : _h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
return "".concat(_h, ":").concat(m, ":").concat(s);
}
return 0;
}, [lastedUpdateTime]);
var formatProgramFill = function formatProgramFill(str) {
var arr = [];
if (showNullProgramButton) {
var num = -1;
str = str.replace(/(@▁▁@|@▁@)/g, function (a, b, c) {
arr.push({
multiLine: !(a === ADD_SINGLE)
});
});
}
return arr;
};
function onCancelStorage() {
window.sessionStorage.removeItem(id);
setTip(false);
setLastedUpdateTime(0);
}
function onReset() {
setTip(false);
setLastedUpdateTime(0);
cm.setValue(window.sessionStorage.getItem(id));
}
function setValues(a, b) {
var content = cm.getValue();
content = content.replace(a, b);
setValue(content);
cm === null || cm === void 0 || cm.setValue(content);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-wrapper",
ref: containerEl,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-container ".concat(className, " ").concat(preview ? 'on-preview' : '', " ").concat(miniToolbar ? 'mini' : '', " ").concat(isFull ? 'full-screen' : ''),
style: style,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(toolbar, {
insertTemp: insertTemp,
watch: preview,
fullScreen: isFull,
showNullButton: showNullButton,
showNullProgramButton: showNullProgramButton,
onActionCallback: onActionCallback,
hidetoolBar: hidetoolBar,
uuid: uuidRef.current,
setOpenPhones: function setOpenPhones() {
openPhoneRef.current = true;
}
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "markdown-editor-body",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: "codemirror-container",
children: /*#__PURE__*/(0,jsx_runtime.jsx)("textarea", {
ref: cmEl,
placeholder: placeholder
})
}), preview ? /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
ref: previewEl,
className: "preview-container",
children: [mode === "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml_stex, {
value: value
}), mode !== "stex" && /*#__PURE__*/(0,jsx_runtime.jsx)(RenderHtml/* default */.Z, {
disabledFill: disabledFill,
showProgramFill: showNullProgramButton,
value: value
})]
}) : null]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
zIndex: 1011,
position: "fixed"
},
ref: ModalEl
})]
}), showResizeBar ? /*#__PURE__*/(0,jsx_runtime.jsx)("a", {
ref: resizeBarEl,
className: "editor-resize"
}) : null, /*#__PURE__*/(0,jsx_runtime.jsx)(modal/* default */.Z, {
children: TitleDesc[action] ? /*#__PURE__*/(0,jsx_runtime.jsx)(es_modal/* default */.Z, {
getContainer: function getContainer() {
return ModalEl.current;
},
centered: true,
title: TitleDesc[action],
open: true,
onCancel: onCancel,
footer: null,
width: null,
className: "markdown-popup-form",
children: PluginEl
}) : null
})]
});
});
/***/ }),
/***/ 8531:
/*!***************************************************************************!*\
!*** ./src/components/markdown-editor/upload-image/index.tsx + 1 modules ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: function() { return /* binding */ upload_image; },
I: function() { return /* binding */ uploadImage; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = __webpack_require__(82242);
var objectSpread2_default = /*#__PURE__*/__webpack_require__.n(objectSpread2);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(79800);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/form/index.js + 19 modules
var es_form = __webpack_require__(78241);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/input/index.js + 5 modules
var input = __webpack_require__(73782);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/button/index.js
var es_button = __webpack_require__(3113);
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.less
// extracted by mini-css-extract-plugin
// EXTERNAL MODULE: ./src/pages/tasks/util.js
var util = __webpack_require__(88548);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx
var useForm = es_form/* default */.Z.useForm;
var style = {
width: 280,
marginRight: 10
};
var formItemLayout = {
labelCol: {
span: 5
},
wrapperCol: {
span: 19
}
};
/* harmony default export */ var upload_image = (function (_ref) {
var callback = _ref.callback,
onCancel = _ref.onCancel;
var _useForm = useForm(),
_useForm2 = slicedToArray_default()(_useForm, 1),
form = _useForm2[0];
var nameRef = (0,_react_17_0_2_react.useRef)();
function onSubmit(values) {
callback(objectSpread2_default()(objectSpread2_default()({}, values), {}, {
name: nameRef.current
}));
}
function onAddUrl(data, file) {
if (data.status === -1) {
message/* default */.ZP.error(data.message);
return;
}
form.setFieldsValue({
src: "/api/attachments/".concat(data.id),
type: file.type
});
}
function onFileChange(e) {
var file = e.target.files[0];
nameRef.current = file.name;
uploadImage(file, onAddUrl);
}
return /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z, objectSpread2_default()(objectSpread2_default()({
form: form
}, formItemLayout), {}, {
className: "upload-image-panel",
onFinish: onSubmit,
style: {
width: 470,
overflow: "hidden"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u56FE\u7247\u5730\u5740",
required: true,
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: "flex-container",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
noStyle: true,
name: "src",
rules: [{
required: true,
message: '请输入文件地址'
}],
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: style
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton, {
onFileChange: onFileChange
})]
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_form/* default */.Z.Item, {
label: "\u56FE\u7247\u63CF\u8FF0",
name: "alt"
// rules={[{ required: true, message: '请输入图片描述' }]}
,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(input/* default */.Z, {
style: {
width: 264
}
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)(es_form/* default */.Z.Item, {
style: {
textAlign: "right"
},
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "primary",
htmlType: "submit",
style: {
marginRight: 10
},
children: "\u786E\u5B9A"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(es_button/* default */.ZP, {
type: "default",
onClick: onCancel,
children: "\u53D6\u6D88"
})]
})]
}));
});
function UploadButton(_ref2) {
var onFileChange = _ref2.onFileChange;
return /*#__PURE__*/(0,jsx_runtime.jsxs)("label", {
className: "upload-button",
style: {
cursor: "pointer"
},
children: ["\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/(0,jsx_runtime.jsx)("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/* apiPref */.KI, "/api/attachments.json"));
xhr.send(formData);
}
/***/ }),
/***/ 11418:
/*!**********************************!*\
!*** ./src/components/modal.tsx ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Z: function() { return /* binding */ Dialog; }
/* harmony export */ });
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/classCallCheck.js */ 82100);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createClass.js */ 29186);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/inherits.js */ 80619);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.6@@babel/runtime/helpers/createSuper.js */ 47074);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-dom */ 4676);
var Dialog = /*#__PURE__*/function (_React$Component) {
_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_inherits_js__WEBPACK_IMPORTED_MODULE_2___default()(Dialog, _React$Component);
var _super = _root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createSuper_js__WEBPACK_IMPORTED_MODULE_3___default()(Dialog);
function Dialog(props) {
var _this;
_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0___default()(this, Dialog);
_this = _super.call(this, props);
var doc = window.document;
_this.node = doc.createElement('div');
doc.body.appendChild(_this.node);
return _this;
}
_root_workspace_ppte5yg23_local_v9_test2_node_modules_babel_runtime_7_23_6_babel_runtime_helpers_createClass_js__WEBPACK_IMPORTED_MODULE_1___default()(Dialog, [{
key: "render",
value: function render() {
var children = this.props.children;
return /*#__PURE__*/(0,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__.Component);
/***/ }),
/***/ 36944:
/*!****************************************!*\
!*** ./src/components/useInterval.tsx ***!
\****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Z: function() { return /* binding */ useInterval; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 59301);
function useInterval(callback, delay) {
var savedCallback = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
// 保存新回调
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
savedCallback.current = callback;
});
// 建立 interval
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
function tick() {
savedCallback.current();
}
if (delay !== null) {
var id = setInterval(tick, delay);
return function () {
return clearInterval(id);
};
}
}, [delay]);
}
/***/ }),
/***/ 36625:
/*!**************************************************************!*\
!*** ./src/components/MathsLatexKeybords/index.less?modules ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__) {
"use strict";
// extracted by mini-css-extract-plugin
/* harmony default export */ __webpack_exports__.Z = ({"lists":"lists___xhHyq","item":"item___pWJAA","children":"children___sDG61","diamond":"diamond___FwgzD","button":"button___WPN6r","mathWrap":"mathWrap___FmnMJ","mathFillWrap":"mathFillWrap___PmY3H"});
/***/ })
}]);