Merge branches 'dev_aliyun' and 'dev_aliyun2' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun2
commit
8eef510ceb
@ -0,0 +1 @@
|
||||
GENERATE_SOURCEMAP=false
|
@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
/dist
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
@ -0,0 +1,83 @@
|
||||
const {
|
||||
override,
|
||||
addLessLoader,
|
||||
disableEsLint,
|
||||
addBundleVisualizer,
|
||||
addWebpackAlias,
|
||||
fixBabelImports,
|
||||
addWebpackPlugin
|
||||
} = require("customize-cra")
|
||||
|
||||
|
||||
const path = require('path');
|
||||
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
|
||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin')
|
||||
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin')
|
||||
|
||||
let instance = new HardSourceWebpackPlugin({
|
||||
// Either an absolute path or relative to webpack's options.context.
|
||||
cacheDirectory: 'node_modules/.cache/hard-source/[confighash]',
|
||||
// Either a string of object hash function given a webpack config.
|
||||
configHash: function (webpackConfig) {
|
||||
// node-object-hash on npm can be used to build this.
|
||||
return require('node-object-hash')({ sort: false }).hash(webpackConfig);
|
||||
},
|
||||
// Either false, a string, an object, or a project hashing function.
|
||||
environmentHash: {
|
||||
root: process.cwd(),
|
||||
directories: [],
|
||||
files: ['package-lock.json', 'yarn.lock'],
|
||||
},// How to launch the extra processes. Default:
|
||||
fork: (fork, compiler, webpackBin) => fork(
|
||||
webpackBin(),
|
||||
['--config', __filename], {
|
||||
silent: true,
|
||||
}
|
||||
),
|
||||
// Number of workers to spawn. Default:
|
||||
numWorkers: () => require('os').cpus().length,
|
||||
// Number of modules built before launching parallel building. Default:
|
||||
minModules: 10,
|
||||
// An object.
|
||||
info: {
|
||||
// 'none' or 'test'.
|
||||
mode: 'none',
|
||||
// 'debug', 'log', 'info', 'warn', or 'error'.
|
||||
level: 'debug',
|
||||
},
|
||||
// Clean up large, old caches automatically.
|
||||
cachePrune: {
|
||||
// Caches younger than `maxAge` are not considered for deletion. They must
|
||||
// be at least this (default: 2 days) old in milliseconds.
|
||||
maxAge: 2 * 24 * 60 * 60 * 1000,
|
||||
// All caches together must be larger than `sizeThreshold` before any
|
||||
// caches will be deleted. Together they must be at least this
|
||||
// (default: 50 MB) big in bytes.
|
||||
sizeThreshold: 50 * 1024 * 1024
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = override(
|
||||
disableEsLint(),
|
||||
// addBundleVisualizer(),
|
||||
addWebpackAlias({
|
||||
"educoder": path.resolve(__dirname, 'src/common/educoder.js')
|
||||
}),
|
||||
addLessLoader({
|
||||
javascriptEnabled: true
|
||||
}),
|
||||
fixBabelImports('import', {
|
||||
libraryName: 'antd',
|
||||
libraryDirectory: 'es',
|
||||
style: true
|
||||
}),
|
||||
addWebpackPlugin(new MonacoWebpackPlugin({})),
|
||||
// addWebpackPlugin(instance),
|
||||
(config) => {
|
||||
config.resolve.plugins = config.resolve.plugins.filter(plugin => !(plugin instanceof ModuleScopePlugin));
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
config.output.publicPath = `/react/build/`;
|
||||
}
|
||||
return config
|
||||
}
|
||||
);
|
@ -1,14 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// This is a custom Jest transformer turning style imports into empty objects.
|
||||
// http://facebook.github.io/jest/docs/en/webpack.html
|
||||
|
||||
module.exports = {
|
||||
process() {
|
||||
return 'module.exports = {};';
|
||||
},
|
||||
getCacheKey() {
|
||||
// The output is always the same.
|
||||
return 'cssTransform';
|
||||
},
|
||||
};
|
@ -1,12 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
// This is a custom Jest transformer turning file imports into filenames.
|
||||
// http://facebook.github.io/jest/docs/en/webpack.html
|
||||
|
||||
module.exports = {
|
||||
process(src, filename) {
|
||||
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
|
||||
},
|
||||
};
|
@ -1,55 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const url = require('url');
|
||||
|
||||
// Make sure any symlinks in the project folder are resolved:
|
||||
// https://github.com/facebookincubator/create-react-app/issues/637
|
||||
const appDirectory = fs.realpathSync(process.cwd());
|
||||
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
||||
|
||||
const envPublicUrl = process.env.PUBLIC_URL;
|
||||
|
||||
function ensureSlash(path, needsSlash) {
|
||||
const hasSlash = path.endsWith('/');
|
||||
if (hasSlash && !needsSlash) {
|
||||
return path.substr(path, path.length - 1);
|
||||
} else if (!hasSlash && needsSlash) {
|
||||
return `${path}/`;
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
const getPublicUrl = appPackageJson =>
|
||||
envPublicUrl || require(appPackageJson).homepage;
|
||||
|
||||
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
|
||||
// "public path" at which the app is served.
|
||||
// Webpack needs to know it to put the right <script> hrefs into HTML even in
|
||||
// single-page apps that may serve index.html for nested URLs like /todos/42.
|
||||
// We can't use a relative path in HTML because we don't want to load something
|
||||
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
|
||||
function getServedPath(appPackageJson) {
|
||||
const publicUrl = getPublicUrl(appPackageJson);
|
||||
const servedUrl =
|
||||
envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : '/');
|
||||
return ensureSlash(servedUrl, true);
|
||||
}
|
||||
|
||||
// config after eject: we're in ./config/
|
||||
module.exports = {
|
||||
dotenv: resolveApp('.env'),
|
||||
appBuild: resolveApp('build'),
|
||||
appPublic: resolveApp('public'),
|
||||
appHtml: resolveApp('public/index.html'),
|
||||
appIndexJs: resolveApp('src/index.js'),
|
||||
appPackageJson: resolveApp('package.json'),
|
||||
appSrc: resolveApp('src'),
|
||||
yarnLockFile: resolveApp('yarn.lock'),
|
||||
testsSetup: resolveApp('src/setupTests.js'),
|
||||
appNodeModules: resolveApp('node_modules'),
|
||||
publicUrl: getPublicUrl(resolveApp('package.json')),
|
||||
servedPath: getServedPath(resolveApp('package.json')),
|
||||
};
|
@ -1,22 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
if (typeof Promise === 'undefined') {
|
||||
// Rejection tracking prevents a common issue where React gets into an
|
||||
// inconsistent state due to an error, but it gets swallowed by a Promise,
|
||||
// and the user has no idea what causes React's erratic future behavior.
|
||||
require('promise/lib/rejection-tracking').enable();
|
||||
window.Promise = require('promise/lib/es6-extensions.js');
|
||||
}
|
||||
|
||||
// fetch() polyfill for making API calls.
|
||||
require('whatwg-fetch');
|
||||
|
||||
// Object.assign() is commonly used with React.
|
||||
// It will use the native implementation if it's present and isn't buggy.
|
||||
Object.assign = require('object-assign');
|
||||
|
||||
// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
|
||||
// We don't polyfill it in the browser--this is user's responsibility.
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
require('raf').polyfill(global);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import './index.css';
|
||||
import './indexPlus.css';
|
||||
import App from './App';
|
||||
|
||||
// 加之前main.js 18.1MB
|
||||
// import { message } from 'antd';
|
||||
import message from 'antd/lib/message';
|
||||
import 'antd/lib/message/style/css';
|
||||
|
||||
import { AppContainer } from 'react-hot-loader';
|
||||
|
||||
import registerServiceWorker from './registerServiceWorker';
|
||||
|
||||
import { configureUrlQuery } from 'react-url-query';
|
||||
|
||||
import history from './history';
|
||||
|
||||
// link the history used in our app to url-query so it can update the URL with it.
|
||||
configureUrlQuery({ history });
|
||||
// ----------------------------------------------------------------------------------- 请求配置
|
||||
|
||||
window.__useKindEditor = false;
|
||||
|
||||
|
||||
const render = (Component) => {
|
||||
ReactDOM.render(
|
||||
<AppContainer {...this.props} {...this.state}>
|
||||
<Component {...this.props} {...this.state}/>
|
||||
</AppContainer>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ReactDOM.render(
|
||||
// ,
|
||||
// document.getElementById('root'));
|
||||
// registerServiceWorker();
|
||||
|
||||
render(App);
|
||||
if (module.hot) {
|
||||
module.hot.accept('./App', () => { render(App) });
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,192 +1,94 @@
|
||||
{
|
||||
"name": "educoder",
|
||||
"name": "h5",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"homepage": "/react/build/",
|
||||
"dependencies": {
|
||||
"@icedesign/base": "^0.2.5",
|
||||
"@monaco-editor/react": "^2.3.0",
|
||||
"@loadable/component": "^5.12.0",
|
||||
"@novnc/novnc": "^1.1.0",
|
||||
"antd": "^3.23.2",
|
||||
"array-flatten": "^2.1.2",
|
||||
"autoprefixer": "7.1.6",
|
||||
"axios": "^0.18.0",
|
||||
"babel-core": "6.26.0",
|
||||
"babel-eslint": "7.2.3",
|
||||
"babel-jest": "20.0.3",
|
||||
"babel-loader": "7.1.2",
|
||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||
"babel-preset-react-app": "^3.1.1",
|
||||
"babel-runtime": "6.26.0",
|
||||
"antd": "^3.26.12",
|
||||
"axios": "^0.19.2",
|
||||
"bizcharts": "^3.5.5",
|
||||
"bundle-loader": "^0.5.6",
|
||||
"case-sensitive-paths-webpack-plugin": "2.1.1",
|
||||
"chalk": "1.1.3",
|
||||
"classnames": "^2.2.5",
|
||||
"clipboard": "^2.0.4",
|
||||
"codemirror": "^5.46.0",
|
||||
"connected-react-router": "4.4.1",
|
||||
"css-loader": "0.28.7",
|
||||
"dotenv": "4.0.0",
|
||||
"dotenv-expand": "4.2.0",
|
||||
"echarts": "^4.2.0-rc.2",
|
||||
"codemirror": "^5.52.2",
|
||||
"echarts": "^4.7.0",
|
||||
"editor.md": "^1.5.0",
|
||||
"eslint": "4.10.0",
|
||||
"eslint-config-react-app": "^2.1.0",
|
||||
"eslint-loader": "1.9.0",
|
||||
"eslint-plugin-flowtype": "2.39.1",
|
||||
"eslint-plugin-import": "2.8.0",
|
||||
"eslint-plugin-jsx-a11y": "5.1.1",
|
||||
"eslint-plugin-react": "7.4.0",
|
||||
"extract-text-webpack-plugin": "3.0.2",
|
||||
"file-loader": "1.1.5",
|
||||
"flv.js": "^1.5.0",
|
||||
"fs-extra": "3.0.1",
|
||||
"html-webpack-plugin": "2.29.0",
|
||||
"immutability-helper": "^2.6.6",
|
||||
"install": "^0.12.2",
|
||||
"jest": "20.0.4",
|
||||
"js-base64": "^2.5.1",
|
||||
"flvplayer": "^1.1.5",
|
||||
"immutability-helper": "^3.0.1",
|
||||
"js-base64": "^2.5.2",
|
||||
"katex": "^0.11.1",
|
||||
"lodash": "^4.17.5",
|
||||
"loglevel": "^1.6.1",
|
||||
"material-ui": "^1.0.0-beta.40",
|
||||
"md5": "^2.2.1",
|
||||
"moment": "^2.23.0",
|
||||
"monaco-editor": "^0.15.6",
|
||||
"monaco-editor-webpack-plugin": "^1.7.0",
|
||||
"npm": "^6.10.1",
|
||||
"monaco-editor": "^0.20.0",
|
||||
"monaco-editor-webpack-plugin": "^1.9.0",
|
||||
"numeral": "^2.0.6",
|
||||
"object-assign": "4.1.1",
|
||||
"postcss-flexbugs-fixes": "3.2.0",
|
||||
"postcss-loader": "2.0.8",
|
||||
"promise": "8.0.1",
|
||||
"prop-types": "^15.6.1",
|
||||
"qrcode.react": "^1.0.0",
|
||||
"qs": "^6.6.0",
|
||||
"qs": "^6.9.2",
|
||||
"quill": "^1.3.7",
|
||||
"quill-delta-to-html": "^0.11.0",
|
||||
"raf": "3.4.0",
|
||||
"rc-form": "^2.1.7",
|
||||
"rc-pagination": "^1.16.2",
|
||||
"rc-rate": "^2.4.0",
|
||||
"rc-select": "^8.0.12",
|
||||
"rc-tree": "^1.7.11",
|
||||
"rc-upload": "^2.5.1",
|
||||
"react": "^16.9.0",
|
||||
"react": "^16.13.1",
|
||||
"react-beautiful-dnd": "^10.0.4",
|
||||
"react-codemirror": "^1.0.0",
|
||||
"react-codemirror2": "^6.0.0",
|
||||
"react-codemirror2": "^6.0.1",
|
||||
"react-content-loader": "^3.1.1",
|
||||
"react-cookie": "^4.0.3",
|
||||
"react-cookies": "^0.1.1",
|
||||
"react-datepicker": "^2.14.0",
|
||||
"react-dev-utils": "^5.0.0",
|
||||
"react-dom": "^16.9.0",
|
||||
"react-hot-loader": "^4.0.0",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-infinite-scroller": "^1.2.4",
|
||||
"react-loadable": "^5.3.1",
|
||||
"react-monaco-editor": "^0.25.1",
|
||||
"react-player": "^1.11.1",
|
||||
"react-redux": "5.0.7",
|
||||
"react-router": "^4.2.0",
|
||||
"react-router-dom": "^4.2.2",
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"react-scripts": "3.4.0",
|
||||
"react-split-pane": "^0.1.89",
|
||||
"react-url-query": "^1.4.0",
|
||||
"react-zmage": "^0.8.5-beta.31",
|
||||
"redux": "^4.0.0",
|
||||
"redux-thunk": "2.3.0",
|
||||
"rsuite": "^4.0.1",
|
||||
"sass-loader": "7.3.1",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"rsuite": "^4.3.2",
|
||||
"scroll-into-view": "^1.12.3",
|
||||
"showdown": "^1.9.1",
|
||||
"showdown-katex": "^0.6.0",
|
||||
"store": "^2.0.12",
|
||||
"style-loader": "0.19.0",
|
||||
"styled-components": "^4.1.3",
|
||||
"sw-precache-webpack-plugin": "0.11.4",
|
||||
"url-loader": "0.6.2",
|
||||
"webpack": "3.8.1",
|
||||
"webpack-dev-server": "2.9.4",
|
||||
"webpack-manifest-plugin": "1.3.2",
|
||||
"webpack-parallel-uglify-plugin": "^1.1.0",
|
||||
"styled-components": "^5.0.1",
|
||||
"whatwg-fetch": "2.0.3",
|
||||
"wrap-md-editor": "^0.2.20"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node --max_old_space_size=15360 scripts/start.js",
|
||||
"build": "node --max_old_space_size=15360 scripts/build.js",
|
||||
"concat": "node scripts/concat.js",
|
||||
"gen_stats": "NODE_ENV=production webpack --profile --config=./config/webpack.config.prod.js --json > stats.json",
|
||||
"ana": "webpack-bundle-analyzer ./stats.json",
|
||||
"analyze": "npm run build -- --stats && webpack-bundle-analyzer build/bundle-stats.json",
|
||||
"analyz": "NODE_ENV=production npm_config_report=true npm run build"
|
||||
"start": "PORT=3007 react-app-rewired start",
|
||||
"build": "react-app-rewired --max_old_space_size=8192 build ",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverageFrom": [
|
||||
"src/**/*.{js,jsx,mjs}"
|
||||
],
|
||||
"setupFiles": [
|
||||
"<rootDir>/config/polyfills.js"
|
||||
],
|
||||
"testMatch": [
|
||||
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
|
||||
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"testURL": "http://localhost",
|
||||
"transform": {
|
||||
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
|
||||
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
||||
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"^react-native$": "react-native-web"
|
||||
},
|
||||
"moduleFileExtensions": [
|
||||
"web.js",
|
||||
"mjs",
|
||||
"js",
|
||||
"json",
|
||||
"web.jsx",
|
||||
"jsx",
|
||||
"node"
|
||||
]
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"react",
|
||||
"react-app"
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"import",
|
||||
{
|
||||
"libraryName": "antd",
|
||||
"libraryDirectory": "lib",
|
||||
"style": "css"
|
||||
},
|
||||
"ant"
|
||||
],
|
||||
"syntax-dynamic-import"
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"proxy": "http://localhost:3000",
|
||||
"port": "3007",
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "7.0.0-beta.51",
|
||||
"babel-plugin-import": "^1.11.0",
|
||||
"compression-webpack-plugin": "^1.1.12",
|
||||
"concat": "^1.0.3",
|
||||
"happypack": "^5.0.1",
|
||||
"mockjs": "^1.1.0",
|
||||
"node-sass": "^4.12.0",
|
||||
"reqwest": "^2.0.5",
|
||||
"webpack-bundle-analyzer": "^3.0.3",
|
||||
"webpack-parallel-uglify-plugin": "^1.1.0"
|
||||
"babel-plugin-import": "^1.13.0",
|
||||
"customize-cra": "^0.5.0",
|
||||
"hard-source-webpack-plugin": "^0.13.1",
|
||||
"less": "^3.11.1",
|
||||
"less-loader": "^5.0.0",
|
||||
"react-app-rewired": "^2.1.5",
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"webpack-bundle-analyzer": "^3.6.0"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 410 KiB After Width: | Height: | Size: 412 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,98 +0,0 @@
|
||||
var fs = require('fs');
|
||||
var uglify = require("uglify-js");
|
||||
var path = require('path');
|
||||
var concat = require('concat')
|
||||
|
||||
var results = [];
|
||||
var walk = function(dir, done) {
|
||||
|
||||
fs.readdir(dir, function(err, list) {
|
||||
console.log(list)
|
||||
if (err) return done(err);
|
||||
var pending = list.length;
|
||||
if (!pending) return done(null, results);
|
||||
list.forEach(function(file) {
|
||||
file = path.resolve(dir, file);
|
||||
fs.stat(file, function(err, stat) {
|
||||
if (stat && stat.isDirectory()) {
|
||||
walk(file, function(err, res) {
|
||||
// results = results.concat(res);
|
||||
if (!--pending) done(null, results);
|
||||
});
|
||||
} else {
|
||||
results.push(file);
|
||||
if (!--pending) done(null, results);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 需要输出文件名数组时改为true
|
||||
var jsDir = './public/js/';
|
||||
var cssDir = './public/css'
|
||||
|
||||
// true &&
|
||||
false &&
|
||||
walk(cssDir, function() {
|
||||
console.log('results', results.length, results)
|
||||
})
|
||||
// return;
|
||||
|
||||
// ----------------------------------------------------------------------------- CSS
|
||||
var cssResults = [
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\css\\edu-common.css',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\css\\edu-public.css',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\css\\taskstyle.css' ,
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\css\\font-awesome.css',
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\css\\editormd.min.css',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\css\\merge.css',
|
||||
|
||||
]
|
||||
concat(cssResults, './public/css/css_min_all.css')
|
||||
|
||||
return;
|
||||
|
||||
// ----------------------------------------------------------------------------- JS
|
||||
var _results = [
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\jquery-1.8.3.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\underscore.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\marked.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\prettify.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\raphael.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\sequence-diagram.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\flowchart.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\jquery.flowchart.min.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\editormd\\editormd.min.js',
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\codemirror\\codemirror.js',
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\codemirror\\mode\\javascript.js',
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\diff_match_patch.js',
|
||||
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\merge.js',
|
||||
|
||||
'D:\\Code\\trustieplus\\public\\react\\public\\js\\edu_tpi.js',
|
||||
|
||||
]
|
||||
|
||||
concat(_results, './public/js/js_min_all.js')
|
||||
|
||||
// var uglified = uglify.minify(['./public/js/merge.js']);
|
||||
// console.log('uglified', uglified)
|
||||
// fs.writeFile('concat.min.js', uglified.code, function (err){
|
||||
// if(err) {
|
||||
// console.log(err);
|
||||
// } else {
|
||||
// console.log("Script generated and saved:", 'concat.min.js');
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
// var uglified = uglify.minify(['file1.js', 'file2.js', 'file3.js']);
|
||||
|
@ -1,23 +0,0 @@
|
||||
var fs2 = require('fs');
|
||||
|
||||
function generateNewIndexJsp() {
|
||||
|
||||
var filePath = './build/index.html';
|
||||
|
||||
var outputPath = filePath
|
||||
fs2.readFile(filePath, 'utf8', function (err,data) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
var result = data
|
||||
.replace('/js/create_kindeditor.js', '/react/build/js/create_kindeditor.js')
|
||||
.replace(/https:\/\/testeduplus2.educoder.net/g, '');
|
||||
// .replace(/http:\/\/testbdweb.educoder.net/g, '');
|
||||
|
||||
.replace('/css/css_min_all.css', '/react/build/css/css_min_all.css');
|
||||
|
||||
fs2.writeFile(outputPath, result, 'utf8', function (err) {
|
||||
if (err) return console.log(err);
|
||||
});
|
||||
});
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Do this as the first thing so that any code reading it knows the right env.
|
||||
process.env.BABEL_ENV = 'development';
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
|
||||
// Makes the script crash on unhandled rejections instead of silently
|
||||
// ignoring them. In the future, promise rejections that are not handled will
|
||||
// terminate the Node.js process with a non-zero exit code.
|
||||
process.on('unhandledRejection', err => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
// Ensure environment variables are read.
|
||||
require('../config/env');
|
||||
|
||||
const fs = require('fs');
|
||||
const chalk = require('chalk');
|
||||
const webpack = require('webpack');
|
||||
const WebpackDevServer = require('webpack-dev-server');
|
||||
const clearConsole = require('react-dev-utils/clearConsole');
|
||||
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
||||
const {
|
||||
choosePort,
|
||||
createCompiler,
|
||||
prepareProxy,
|
||||
prepareUrls,
|
||||
} = require('react-dev-utils/WebpackDevServerUtils');
|
||||
const openBrowser = require('react-dev-utils/openBrowser');
|
||||
const paths = require('../config/paths');
|
||||
const config = require('../config/webpack.config.dev');
|
||||
const createDevServerConfig = require('../config/webpackDevServer.config');
|
||||
|
||||
const useYarn = fs.existsSync(paths.yarnLockFile);
|
||||
const isInteractive = process.stdout.isTTY;
|
||||
|
||||
const portSetting = require(paths.appPackageJson).port
|
||||
if ( portSetting ) {
|
||||
process.env.port = portSetting
|
||||
}
|
||||
|
||||
// Warn and crash if required files are missing
|
||||
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Tools like Cloud9 rely on this.
|
||||
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3007;
|
||||
const HOST = process.env.HOST || '0.0.0.0';
|
||||
|
||||
if (process.env.HOST) {
|
||||
console.log(
|
||||
chalk.cyan(
|
||||
`Attempting to bind to HOST environment variable: ${chalk.yellow(
|
||||
chalk.bold(process.env.HOST)
|
||||
)}`
|
||||
)
|
||||
);
|
||||
console.log(
|
||||
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
|
||||
);
|
||||
console.log(`Learn more here: ${chalk.yellow('http://bit.ly/2mwWSwH')}`);
|
||||
console.log();
|
||||
}
|
||||
|
||||
// We attempt to use the default port but if it is busy, we offer the user to
|
||||
// run on a different port. `choosePort()` Promise resolves to the next free port.
|
||||
choosePort(HOST, DEFAULT_PORT)
|
||||
.then(port => {
|
||||
if (port == null) {
|
||||
// We have not found a port.
|
||||
return;
|
||||
}
|
||||
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
||||
const appName = require(paths.appPackageJson).name;
|
||||
const urls = prepareUrls(protocol, HOST, port);
|
||||
// Create a webpack compiler that is configured with custom messages.
|
||||
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
|
||||
// Load proxy config
|
||||
const proxySetting = require(paths.appPackageJson).proxy;
|
||||
console.log('-------------------------proxySetting:', proxySetting)
|
||||
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
|
||||
// Serve webpack assets generated by the compiler over a web sever.
|
||||
const serverConfig = createDevServerConfig(
|
||||
proxyConfig,
|
||||
urls.lanUrlForConfig
|
||||
);
|
||||
const devServer = new WebpackDevServer(compiler, serverConfig);
|
||||
// Launch WebpackDevServer.
|
||||
devServer.listen(port, HOST, err => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
if (isInteractive) {
|
||||
clearConsole();
|
||||
}
|
||||
console.log(chalk.cyan('Starting the development server...\n'));
|
||||
openBrowser(urls.localUrlForBrowser);
|
||||
});
|
||||
|
||||
['SIGINT', 'SIGTERM'].forEach(function(sig) {
|
||||
process.on(sig, function() {
|
||||
devServer.close();
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
if (err && err.message) {
|
||||
console.log(err.message);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
@ -1,27 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Do this as the first thing so that any code reading it knows the right env.
|
||||
process.env.BABEL_ENV = 'test';
|
||||
process.env.NODE_ENV = 'test';
|
||||
process.env.PUBLIC_URL = '';
|
||||
|
||||
// Makes the script crash on unhandled rejections instead of silently
|
||||
// ignoring them. In the future, promise rejections that are not handled will
|
||||
// terminate the Node.js process with a non-zero exit code.
|
||||
process.on('unhandledRejection', err => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
// Ensure environment variables are read.
|
||||
require('../config/env');
|
||||
|
||||
const jest = require('jest');
|
||||
const argv = process.argv.slice(2);
|
||||
|
||||
// Watch unless on CI or in coverage mode
|
||||
if (!process.env.CI && argv.indexOf('--coverage') < 0) {
|
||||
argv.push('--watch');
|
||||
}
|
||||
|
||||
|
||||
jest.run(argv);
|
@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
it('renders without crashing', () => {
|
||||
const div = document.createElement('div');
|
||||
ReactDOM.render(<App />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
@ -1,12 +0,0 @@
|
||||
import Loadable from 'react-loadable';
|
||||
|
||||
import Loading from "./Loading";
|
||||
|
||||
const CustomLoadable = (loader, loading = Loading) => {
|
||||
return Loadable({
|
||||
loader,
|
||||
loading
|
||||
})
|
||||
}
|
||||
|
||||
export default CustomLoadable
|
@ -1,5 +1,5 @@
|
||||
import md5 from 'md5';
|
||||
export function setmiyah(logins){
|
||||
const opens ="79e33abd4b6588941ab7622aed1e67e8";
|
||||
return md5(opens+logins);
|
||||
export default function setmiyah(logins) {
|
||||
const opens = "79e33abd4b6588941ab7622aed1e67e8";
|
||||
return md5(opens + logins);
|
||||
}
|
||||
|
@ -1,77 +1,82 @@
|
||||
//import { from } from '_array-flatten@2.1.2@array-flatten';
|
||||
|
||||
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
|
||||
export {
|
||||
getImageUrl as getImageUrl, getmyUrl as getmyUrl, getRandomNumber as getRandomNumber, getUrl as getUrl, publicSearchs as publicSearchs, getRandomcode as getRandomcode, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
|
||||
, getUploadActionUrl as getUploadActionUrl, getUploadActionUrltwo as getUploadActionUrltwo, getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
|
||||
, getTaskUrlById as getTaskUrlById, TEST_HOST, htmlEncode as htmlEncode, getupload_git_file as getupload_git_file
|
||||
} from './UrlTool';
|
||||
|
||||
export { getImageUrl as getImageUrl,getmyUrl as getmyUrl, getRandomNumber as getRandomNumber,getUrl as getUrl, publicSearchs as publicSearchs,getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
|
||||
, getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
|
||||
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode ,getupload_git_file as getupload_git_file} from './UrlTool';
|
||||
export { default as setmiyah } from './Component';
|
||||
export { default as queryString } from './UrlTool2';
|
||||
|
||||
export {setmiyah as setmiyah} from './Component';
|
||||
export { default as queryString } from './UrlTool2';
|
||||
export { default as SnackbarHOC } from './SnackbarHOC';
|
||||
|
||||
export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC';
|
||||
export {
|
||||
trigger as trigger, on as on, off as off
|
||||
, broadcastChannelPostMessage, broadcastChannelOnmessage
|
||||
} from './EventUtil';
|
||||
|
||||
export { trigger as trigger, on as on, off as off
|
||||
, broadcastChannelPostMessage, broadcastChannelOnmessage } from './EventUtil';
|
||||
export { updatePageParams as updatePageParams } from './RouterUtil';
|
||||
|
||||
export { updatePageParams as updatePageParams } from './RouterUtil';
|
||||
|
||||
export { bytesToSize as bytesToSize } from './UnitUtil';
|
||||
export { bytesToSize as bytesToSize } from './UnitUtil';
|
||||
|
||||
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension,
|
||||
downloadFile, sortDirections } from './TextUtil'
|
||||
export { handleDateString, getNextHalfHourOfMoment,formatDuring,formatSeconds} from './DateUtil'
|
||||
|
||||
export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil'
|
||||
|
||||
export { isDev as isDev, isMobile } from './Env'
|
||||
export { isDev as isDev, isMobile } from './Env'
|
||||
|
||||
export { toStore as toStore, fromStore as fromStore } from './Store'
|
||||
export { toStore as toStore, fromStore as fromStore } from './Store'
|
||||
|
||||
export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info_c, warn_c, error_c } from './LogUtil'
|
||||
export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info_c, warn_c, error_c } from './LogUtil'
|
||||
|
||||
export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
|
||||
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
|
||||
export {
|
||||
EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
|
||||
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL
|
||||
} from './Const'
|
||||
|
||||
|
||||
export { default as AttachmentList } from './components/attachment/AttachmentList'
|
||||
|
||||
export { themes, ThemeContext } from './context/ThemeContext'
|
||||
export { themes, ThemeContext } from './context/ThemeContext'
|
||||
|
||||
export { ModalHOC } from './components/ModalHOC'
|
||||
export { default as ModalHOC } from './components/ModalHOC'
|
||||
|
||||
export { SetAppModel } from './components/SetAppModel'
|
||||
export { default as SetAppModel } from './components/SetAppModel'
|
||||
|
||||
export { default as LinkAfterLogin } from './components/LinkAfterLogin'
|
||||
export { default as Cropper } from './components/Cropper'
|
||||
export { default as ConditionToolTip } from './components/ConditionToolTip'
|
||||
export { default as LinkAfterLogin } from './components/LinkAfterLogin'
|
||||
export { default as Cropper } from './components/Cropper'
|
||||
export { default as ConditionToolTip } from './components/ConditionToolTip'
|
||||
// export { default as DragValidator } from './components/DragValidator'
|
||||
|
||||
export { default as PopInstruction } from './components/instruction/PopInstruction'
|
||||
export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil'
|
||||
export { default as PopInstruction } from './components/instruction/PopInstruction'
|
||||
|
||||
export { default as City } from './components/form/City'
|
||||
export { default as City } from './components/form/City'
|
||||
|
||||
|
||||
// course
|
||||
export { default as WordsBtn } from './course/WordsBtn'
|
||||
|
||||
export { default as WordsBtn } from './course/WordsBtn'
|
||||
export { default as ActionBtn } from './course/ActionBtn'
|
||||
|
||||
export { default as MarkdownToHtml } from './components/markdown/MarkdownToHtml'
|
||||
|
||||
export { default as DMDEditor } from './components/markdown/DMDEditor'
|
||||
|
||||
export { default as Clappr } from './components/media/Clappr'
|
||||
export { default as AliyunUploader } from './components/media/AliyunUploader'
|
||||
|
||||
|
||||
export { default as ImageLayer2 } from './hooks/ImageLayer2'
|
||||
|
||||
// 外部
|
||||
export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb'
|
||||
export { CNotificationHOC as CNotificationHOC } from '../modules/courses/common/CNotificationHOC'
|
||||
export { default as CNotificationHOC } from '../modules/courses/common/CNotificationHOC'
|
||||
export { default as ModalWrapper } from '../modules/courses/common/ModalWrapper'
|
||||
export { default as NoneData } from '../modules/courses/coursesPublic/NoneData'
|
||||
|
||||
export {default as WordNumberTextarea} from '../modules/modals/WordNumberTextarea'
|
||||
export { default as WordNumberTextarea } from '../modules/modals/WordNumberTextarea'
|
||||
|
||||
import loadable from '@loadable/component'
|
||||
import defaultLoading from '../Loading'
|
||||
|
||||
export function Loadable({ loader, loading = defaultLoading }) {
|
||||
return loadable(loader, {
|
||||
fallback: loading
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
import test from 'ava';
|
||||
import asciimathToTex from './asciimath-to-tex';
|
||||
|
||||
test('just a number', t => {
|
||||
t.is(asciimathToTex('5'), '{5}');
|
||||
});
|
||||
|
||||
test('x=5', t => {
|
||||
t.is(asciimathToTex('x=5'), '{x}={5}');
|
||||
});
|
||||
|
||||
test('x=5+2', t => {
|
||||
t.is(asciimathToTex('x=5+2'), '{x}={5}+{2}');
|
||||
});
|
||||
|
||||
test('x = (-b+-sqrt(b^2-4ac))/(2a)', t => {
|
||||
t.is(
|
||||
asciimathToTex('x = (-b+-sqrt(b^2-4ac))/(2a)'),
|
||||
'{x}=\\frac{{-{b}\\pm\\sqrt{{{b}^{{2}}-{4}{a}{c}}}}}{{{2}{a}}}',
|
||||
);
|
||||
});
|
||||
|
||||
test('{x}=(-b+-sqrt(b^2-4ac))/(2a)', t => {
|
||||
t.is(
|
||||
asciimathToTex('{x}=(-b+-sqrt(b^2-4ac))/(2a)'),
|
||||
'{\\left\\lbrace{x}\\right\\rbrace}=\\frac{{-{b}\\pm\\sqrt{{{b}^{{2}}-{4}{a}{c}}}}}{{{2}{a}}}',
|
||||
);
|
||||
});
|
@ -0,0 +1,121 @@
|
||||
import katex from 'katex';
|
||||
import renderMathInElement from 'katex/dist/contrib/auto-render';
|
||||
import showdown from 'showdown';
|
||||
import asciimathToTex from './asciimath-to-tex';
|
||||
|
||||
if (process.env.TARGET === 'cjs') {
|
||||
const { JSDOM } = require('jsdom');
|
||||
const jsdom = new JSDOM();
|
||||
global.DOMParser = jsdom.window.DOMParser;
|
||||
global.document = jsdom.window.document;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} opts
|
||||
* @param {NodeListOf<Element>} opts.elements
|
||||
* @param opts.config
|
||||
* @param {boolean} opts.isAsciimath
|
||||
*/
|
||||
function renderBlockElements({ elements, config, isAsciimath }) {
|
||||
if (!elements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
elements.forEach(element => {
|
||||
const input = element.textContent || element.innerText;
|
||||
const latex = isAsciimath ? asciimathToTex(input) : input;
|
||||
const html = katex.renderToString(latex, config);
|
||||
element.parentNode.outerHTML = `<span title="${input.trim()}">${html}</span>`;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
||||
* @param {string} str
|
||||
* @returns {string} regexp escaped string
|
||||
*/
|
||||
function escapeRegExp(str) {
|
||||
return str.replace(/[-[\]/{}()*+?.\\$^|]/g, '\\$&');
|
||||
}
|
||||
|
||||
// katex config
|
||||
const getConfig = (config = {}) => ({
|
||||
displayMode: true,
|
||||
throwOnError: false, // fail silently
|
||||
errorColor: '#ff0000',
|
||||
...config,
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: false, asciimath: false },
|
||||
{ left: '~', right: '~', display: false, asciimath: true },
|
||||
].concat(config.delimiters || []),
|
||||
});
|
||||
|
||||
const showdownKatex = userConfig => () => {
|
||||
const parser = new DOMParser();
|
||||
const config = getConfig(userConfig);
|
||||
const asciimathDelimiters = config.delimiters
|
||||
.filter(item => item.asciimath)
|
||||
.map(({ left, right }) => {
|
||||
const l = escapeRegExp(left)
|
||||
const r = escapeRegExp(right)
|
||||
const test = new RegExp(
|
||||
`(?:${l})([^${l}${r}]+)(?:${r})`,
|
||||
'g',
|
||||
);
|
||||
const replacer = (match, asciimath) => {
|
||||
return `${left}${asciimathToTex(asciimath)}${right}`;
|
||||
};
|
||||
return { test, replacer };
|
||||
});
|
||||
|
||||
return [
|
||||
{
|
||||
type: 'output',
|
||||
filter(html = '') {
|
||||
const wrapper = parser.parseFromString(html, 'text/html').body;
|
||||
if (asciimathDelimiters.length) {
|
||||
wrapper.querySelectorAll(':not(code):not(pre)').forEach(el => {
|
||||
const textNodes = [...el.childNodes].filter(
|
||||
node => {
|
||||
if (node.nodeName === '#text') {
|
||||
return node.nodeValue.trim()
|
||||
}
|
||||
if (node.nodeName === 'CODE') {
|
||||
return node.innerText.trim()
|
||||
}
|
||||
},
|
||||
)
|
||||
textNodes.forEach(node => {
|
||||
const newText = asciimathDelimiters.reduce(
|
||||
(acc, { test, replacer }) => acc.replace(test, replacer),
|
||||
node.nodeValue || node.innerText
|
||||
)
|
||||
if (node.nodeName === '#text') {
|
||||
node.nodeValue = newText
|
||||
} else {
|
||||
node.innerText = newText;
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// find the math in code blocks
|
||||
const latex = wrapper.querySelectorAll('code.latex.language-latex');
|
||||
const asciimath = wrapper.querySelectorAll(
|
||||
'code.asciimath.language-asciimath',
|
||||
);
|
||||
|
||||
renderBlockElements({ elements: latex, config });
|
||||
renderBlockElements({ elements: asciimath, config, isAsciimath: true });
|
||||
renderMathInElement(wrapper, config);
|
||||
|
||||
return wrapper.innerHTML;
|
||||
},
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
// register extension with default config
|
||||
showdown.extension('showdown-katex', showdownKatex());
|
||||
|
||||
export default showdownKatex;
|
@ -0,0 +1,21 @@
|
||||
import test from 'ava';
|
||||
import showdown from 'showdown';
|
||||
import katex from '../lib/showdown-katex';
|
||||
|
||||
const input = '# hello, markdown!';
|
||||
const output = '<h1 id="hellomarkdown">hello, markdown!</h1>';
|
||||
|
||||
test('string extension', t => {
|
||||
const converter = new showdown.Converter({
|
||||
extensions: ['showdown-katex'],
|
||||
});
|
||||
t.is(converter.makeHtml(input), output);
|
||||
});
|
||||
|
||||
test('function extension', t => {
|
||||
const converter = new showdown.Converter({
|
||||
extensions: [katex()],
|
||||
});
|
||||
|
||||
t.is(converter.makeHtml(input), output);
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
import React from 'react'
|
||||
import './index.less'
|
||||
|
||||
export default ({ children, style = {} }) => {
|
||||
|
||||
return (
|
||||
<div className="dialog-container-wrapper">
|
||||
<div className="dialog-body" style={style}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
.dialog-container-wrapper {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 300;
|
||||
background: rgba(0, 0, 0, .7);
|
||||
|
||||
flex-flow: column nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dialog-body {
|
||||
width: 405px;
|
||||
height: auto;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import React from 'react'
|
||||
export default class ErrorBoundary extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = { hasError: false }
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error) {
|
||||
// Update state so the next render will show the fallback UI.
|
||||
return { hasError: true }
|
||||
}
|
||||
|
||||
componentDidCatch(error, errorInfo) {
|
||||
// You can also log the error to an error reporting service
|
||||
console.log(error, errorInfo)
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
// You can render any custom fallback UI
|
||||
return <h1>Something went wrong.</h1>
|
||||
}
|
||||
|
||||
return this.props.children
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import React from 'react'
|
||||
import './loading.less'
|
||||
|
||||
export default () => {
|
||||
return <div className="loading-tip">
|
||||
<p>
|
||||
loading ...
|
||||
</p>
|
||||
</div>
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.loading-tip {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background: #213857;
|
||||
color: #fff;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
.mini-pagination {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 0 10px 0 22px;
|
||||
border-width: 1px;
|
||||
border-radius: 3px;
|
||||
margin-right: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
cursor: pointer;
|
||||
border-style: solid;
|
||||
outline: none;
|
||||
border-color: #c4c6cf;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
background-color: #f2f3f7;
|
||||
border-color: #a0a2ad;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
content: ' ';
|
||||
width: 8px;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
height: 8px;
|
||||
transform: rotate(-45deg);
|
||||
border-top: 1px solid #333;
|
||||
border-left: 1px solid #333;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding: 0 22px 0 10px;
|
||||
margin: 0 0 0 4px;
|
||||
|
||||
&:before {
|
||||
left: auto;
|
||||
right: 10px;
|
||||
transform: rotate(135deg);
|
||||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
cursor: not-allowed;
|
||||
background-color: #f7f8fa;
|
||||
border-color: #e6e7eb;
|
||||
color: #e0e0e0;
|
||||
|
||||
&:before {
|
||||
border-top: 1px solid #e0e0e0;
|
||||
border-left: 1px solid #e0e0e0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
|
||||
export default class Dialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
const doc = window.document
|
||||
this.node = doc.createElement('div')
|
||||
doc.body.appendChild(this.node)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children } = this.props
|
||||
return createPortal(children, this.node)
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.document.body.removeChild(this.node);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
.nodata-panel-wrapper {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
|
||||
.nodata-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
margin: 0 auto 20px auto;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
.tag-green {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
bottom: 125px;
|
||||
}
|
||||
|
||||
.tag-org {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
.tag-org-name {
|
||||
width: 66px;
|
||||
height: 28px;
|
||||
background: #FF6802;
|
||||
width: 66px;
|
||||
height: 28px;
|
||||
border-radius: 0px 20px 20px 0px;
|
||||
}
|
||||
|
||||
.tag-org-name-test {
|
||||
width: 45px;
|
||||
height: 23px;
|
||||
font-size: 14px;
|
||||
color: #FFFFFF;
|
||||
line-height: 19px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.intermediatecenter {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import TPMMDEditor from '../modules/tpm/challengesnew/TPMMDEditor';
|
||||
|
||||
export default () => {
|
||||
return (
|
||||
<Fragment >
|
||||
<TPMMDEditor />
|
||||
</Fragment>
|
||||
)
|
||||
}
|
@ -1,46 +1,13 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import './index.css';
|
||||
import './indexPlus.css';
|
||||
import App from './App';
|
||||
|
||||
// 加之前main.js 18.1MB
|
||||
// import { message } from 'antd';
|
||||
import message from 'antd/lib/message';
|
||||
import 'antd/lib/message/style/css';
|
||||
|
||||
import { AppContainer } from 'react-hot-loader';
|
||||
|
||||
import registerServiceWorker from './registerServiceWorker';
|
||||
|
||||
import { configureUrlQuery } from 'react-url-query';
|
||||
|
||||
import history from './history';
|
||||
|
||||
// link the history used in our app to url-query so it can update the URL with it.
|
||||
configureUrlQuery({ history });
|
||||
// ----------------------------------------------------------------------------------- 请求配置
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import './index.css'
|
||||
import App from './App'
|
||||
import * as serviceWorker from './serviceWorker'
|
||||
|
||||
window.__useKindEditor = false;
|
||||
ReactDOM.render(<App />, document.getElementById('root'))
|
||||
|
||||
|
||||
const render = (Component) => {
|
||||
ReactDOM.render(
|
||||
<AppContainer {...this.props} {...this.state}>
|
||||
<Component {...this.props} {...this.state}/>
|
||||
</AppContainer>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ReactDOM.render(
|
||||
// ,
|
||||
// document.getElementById('root'));
|
||||
// registerServiceWorker();
|
||||
|
||||
render(App);
|
||||
if (module.hot) {
|
||||
module.hot.accept('./App', () => { render(App) });
|
||||
}
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
serviceWorker.unregister()
|
||||
|
@ -1,4 +0,0 @@
|
||||
/* material ui 给body加了个6px padding */
|
||||
body {
|
||||
padding-right: 0px !important;
|
||||
}
|
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@ -1,72 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Redirect } from 'react-router';
|
||||
|
||||
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classNames from 'classnames'
|
||||
|
||||
const $ = window.$;
|
||||
const _origin = window.location.origin;
|
||||
|
||||
class CommentItemKEEditor extends Component {
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { item, currentReplyComment } = this.props;
|
||||
if ( prevProps.showReplyEditorFlag != this.props.showReplyEditorFlag &&
|
||||
currentReplyComment && currentReplyComment.id == item.id ) {
|
||||
this.showOrHideEditor(currentReplyComment)
|
||||
}
|
||||
}
|
||||
// 如果未初始化,会先初始化
|
||||
showOrHideEditor = (comment) => {
|
||||
const { user } = this.props;
|
||||
console.log('initReply ', comment)
|
||||
|
||||
const $ = window.$;
|
||||
var id = comment.id
|
||||
var reply_message_el = `#reply_message_${id}`
|
||||
var reply_iconup_el = `#reply_iconup_${id}`
|
||||
if($(reply_message_el).html() == "") {
|
||||
$(".reply_to_message").html("");
|
||||
$(reply_message_el).html(`<div className=\"orig_reply_box borderBottomNone reply_to_message\" id=\"reply_to_message_${id}\">\n <div class=\"homepagePostReplyPortrait mr15 imageFuzzy fl\" id=\"reply_image_${id}\"><a href=\"${user.user_url}\" target=\"_blank\" alt=\"用户头像\"><img alt=\"0?1442652658\" height=\"33\" src=\"${_origin}/images/${user.image_url}\" width=\"33\" /><\/a><\/div>\n <div class=\"orig_textarea fl\" style=\"margin-bottom: 0px\">\n <div nhname=\'new_message_${id}\'>\n <form accept-charset=\"UTF-8\" action=\"/discusses?challenge_id=118&dis_id=61&dis_type=Shixun\" data-remote=\"true\" id=\"new_comment_form\" method=\"post\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"HJTbMpfI8LKUpwghfkvgB2SaMmcIVyVdAezyKmzJ7FU=\" /><\/div>\n <input type=\"hidden\" id=\"dis_reply_id\" name=\"reply_id\" value=\"${id}\">\n <div nhname=\'toolbar_container_${id}\'><\/div>\n <textarea placeholder=\"有问题或有建议,请直接给我留言吧!\" id=\"comment_news_${id}\" style=\"display: none\" nhname=\'new_message_textarea_${id}\' name=\"content\"><\/textarea>\n <a id=\"new_message_submit_btn_${id}\" href=\"javascript:void(0)\" onclick=\"this.style.display=\'none\'\" class=\"mt10 task-btn task-btn-orange fr\">发送<\/a>\n <div class=\"cl\"><\/div>\n <p nhname=\'contentmsg_${id}\'><\/p>\n<\/form> <\/div>\n <div class=\"cl\"><\/div>\n <\/div>\n <div class=\"cl\"><\/div>\n<\/div>\n`); //" ide语法识别
|
||||
$(reply_iconup_el).show();
|
||||
$(function(){
|
||||
window.sd_create_editor_from_data(id ,null,"100%", "Discuss");
|
||||
});
|
||||
|
||||
}else {
|
||||
if ($(reply_message_el).is(':visible')) {
|
||||
$(reply_message_el).hide();
|
||||
} else {
|
||||
$(reply_message_el).show();
|
||||
}
|
||||
// $(reply_message_el).html("");
|
||||
|
||||
// $(reply_iconup_el).hide();
|
||||
}
|
||||
// 自动focus
|
||||
setTimeout(()=>{
|
||||
var iframe =$(`#reply_to_message_${id}`).find('iframe')[0]
|
||||
iframe && iframe.contentDocument.body.focus()
|
||||
}, 200)
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
const { match, history, item, user } = this.props
|
||||
if (!item) {
|
||||
return <div></div>
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="cl"></div>
|
||||
<div id={`reply_message_${item.id}`} className="reply_to_message"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ( CommentItemKEEditor );
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue