forked from Gitlink/forgeplus-react
md alert
This commit is contained in:
parent
82b979894b
commit
c8a08bbd7f
|
@ -1169,13 +1169,13 @@
|
|||
"dependencies": {
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||
"resolved": "https://registry.nlark.com/inherits/download/inherits-2.0.1.tgz",
|
||||
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=",
|
||||
"dev": true
|
||||
},
|
||||
"util": {
|
||||
"version": "0.10.3",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
|
||||
"resolved": "https://registry.nlark.com/util/download/util-0.10.3.tgz",
|
||||
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -2158,7 +2158,7 @@
|
|||
"dependencies": {
|
||||
"define-property": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
|
||||
"resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz",
|
||||
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
|
||||
"requires": {
|
||||
"is-descriptor": "^1.0.0"
|
||||
|
@ -2441,7 +2441,7 @@
|
|||
"dependencies": {
|
||||
"resolve": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.1.7.tgz",
|
||||
"integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs="
|
||||
}
|
||||
}
|
||||
|
@ -3193,7 +3193,7 @@
|
|||
"dependencies": {
|
||||
"define-property": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
|
||||
"resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz",
|
||||
"integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
|
||||
"requires": {
|
||||
"is-descriptor": "^0.1.0"
|
||||
|
@ -5638,7 +5638,7 @@
|
|||
},
|
||||
"path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"resolved": "https://registry.nlark.com/path-to-regexp/download/path-to-regexp-0.1.7.tgz?cache=0&sync_timestamp=1618847046445&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpath-to-regexp%2Fdownload%2Fpath-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"qs": {
|
||||
|
@ -6055,7 +6055,7 @@
|
|||
"dependencies": {
|
||||
"core-js": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/core-js/download/core-js-1.2.7.tgz",
|
||||
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
|
||||
},
|
||||
"promise": {
|
||||
|
@ -7664,7 +7664,7 @@
|
|||
"dependencies": {
|
||||
"pify": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||
"resolved": "https://registry.nlark.com/pify/download/pify-3.0.0.tgz",
|
||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
|
||||
}
|
||||
}
|
||||
|
@ -10918,7 +10918,7 @@
|
|||
},
|
||||
"punycode": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
|
||||
"resolved": "https://registry.nlark.com/punycode/download/punycode-1.4.1.tgz",
|
||||
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
|
||||
"dev": true
|
||||
}
|
||||
|
@ -15644,7 +15644,7 @@
|
|||
"dependencies": {
|
||||
"jsesc": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
|
||||
"resolved": "https://registry.nlark.com/jsesc/download/jsesc-0.5.0.tgz",
|
||||
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0="
|
||||
}
|
||||
}
|
||||
|
@ -16355,7 +16355,7 @@
|
|||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/ms/download/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
}
|
||||
}
|
||||
|
@ -16458,7 +16458,7 @@
|
|||
"dependencies": {
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
|
@ -16883,7 +16883,7 @@
|
|||
},
|
||||
"define-property": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
|
||||
"resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz",
|
||||
"integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
|
||||
"requires": {
|
||||
"is-descriptor": "^0.1.0"
|
||||
|
@ -16891,7 +16891,7 @@
|
|||
},
|
||||
"extend-shallow": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||
"resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz",
|
||||
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||
"requires": {
|
||||
"is-extendable": "^0.1.0"
|
||||
|
@ -16899,7 +16899,7 @@
|
|||
},
|
||||
"source-map": {
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz",
|
||||
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
|
||||
}
|
||||
}
|
||||
|
@ -16916,7 +16916,7 @@
|
|||
"dependencies": {
|
||||
"define-property": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
|
||||
"resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz",
|
||||
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
|
||||
"requires": {
|
||||
"is-descriptor": "^1.0.0"
|
||||
|
@ -18712,7 +18712,7 @@
|
|||
"dependencies": {
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"resolved": "https://registry.nlark.com/inherits/download/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
// @ts-nocheck
|
||||
|
||||
if (window.g_initWebpackHotDevClient) {
|
||||
function tryApplyUpdates(onHotUpdateSuccess?: Function) {
|
||||
// @ts-ignore
|
||||
if (!module.hot) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
function isUpdateAvailable() {
|
||||
// @ts-ignore
|
||||
return window.g_getMostRecentCompilationHash() !== __webpack_hash__;
|
||||
}
|
||||
|
||||
// TODO: is update available?
|
||||
// @ts-ignore
|
||||
if (!isUpdateAvailable() || module.hot.status() !== 'idle') {
|
||||
return;
|
||||
}
|
||||
|
||||
function handleApplyUpdates(err: Error | null, updatedModules: any) {
|
||||
if (err || !updatedModules || window.g_getHadRuntimeError()) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
onHotUpdateSuccess?.();
|
||||
|
||||
if (isUpdateAvailable()) {
|
||||
// While we were updating, there was a new update! Do it again.
|
||||
tryApplyUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
module.hot.check(true).then(
|
||||
function (updatedModules: any) {
|
||||
handleApplyUpdates(null, updatedModules);
|
||||
},
|
||||
function (err: Error) {
|
||||
handleApplyUpdates(err, null);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
window.g_initWebpackHotDevClient({
|
||||
tryApplyUpdates,
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// @ts-nocheck
|
||||
import { createBrowserHistory } from '/Users/caishi/forgeplus-react/node_modules/@umijs/runtime';
|
||||
|
||||
let options = {
|
||||
"basename": "/"
|
||||
};
|
||||
if ((<any>window).routerBase) {
|
||||
options.basename = (<any>window).routerBase;
|
||||
}
|
||||
|
||||
// remove initial history because of ssr
|
||||
let history: any = process.env.__IS_SERVER ? null : createBrowserHistory(options);
|
||||
export const createHistory = (hotReload = false) => {
|
||||
if (!hotReload) {
|
||||
history = createBrowserHistory(options);
|
||||
}
|
||||
|
||||
return history;
|
||||
};
|
||||
|
||||
// 通常仅微前端场景需要调用这个 API
|
||||
export const setCreateHistoryOptions = (newOpts: any = {}) => {
|
||||
options = { ...options, ...newOpts };
|
||||
};
|
||||
|
||||
export { history };
|
|
@ -0,0 +1,8 @@
|
|||
// @ts-nocheck
|
||||
import { Plugin } from '/Users/caishi/forgeplus-react/node_modules/@umijs/runtime';
|
||||
|
||||
const plugin = new Plugin({
|
||||
validKeys: ['modifyClientRenderOpts','patchRoutes','rootContainer','render','onRouteChange',],
|
||||
});
|
||||
|
||||
export { plugin };
|
|
@ -0,0 +1,180 @@
|
|||
/** Created by Umi Plugin **/
|
||||
|
||||
export interface IConfigFromPlugins {
|
||||
routes?: {
|
||||
/**
|
||||
* Any valid URL path
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* A React component to render only when the location matches.
|
||||
*/
|
||||
component?: string | (() => any);
|
||||
wrappers?: string[];
|
||||
/**
|
||||
* navigate to a new location
|
||||
*/
|
||||
redirect?: string;
|
||||
/**
|
||||
* When true, the active class/style will only be applied if the location is matched exactly.
|
||||
*/
|
||||
exact?: boolean;
|
||||
routes?: any[];
|
||||
[k: string]: any;
|
||||
}[];
|
||||
history?: {
|
||||
type?: "browser" | "hash" | "memory";
|
||||
options?: {};
|
||||
};
|
||||
polyfill?: {
|
||||
imports?: string[];
|
||||
};
|
||||
alias?: {};
|
||||
analyze?: {
|
||||
analyzerMode?: "server" | "static" | "disabled";
|
||||
analyzerHost?: string;
|
||||
analyzerPort?: any;
|
||||
openAnalyzer?: boolean;
|
||||
generateStatsFile?: boolean;
|
||||
statsFilename?: string;
|
||||
logLevel?: "info" | "warn" | "error" | "silent";
|
||||
defaultSizes?: "stat" | "parsed" | "gzip";
|
||||
[k: string]: any;
|
||||
};
|
||||
/**
|
||||
* postcss autoprefixer, default flexbox: no-2009
|
||||
*/
|
||||
autoprefixer?: {};
|
||||
base?: string;
|
||||
chainWebpack?: () => any;
|
||||
chunks?: string[];
|
||||
/**
|
||||
* more css-loader options see https://webpack.js.org/loaders/css-loader/#options
|
||||
*/
|
||||
cssLoader?: {
|
||||
url?: boolean | (() => any);
|
||||
import?: boolean | (() => any);
|
||||
modules?: boolean | string | {};
|
||||
sourceMap?: boolean;
|
||||
importLoaders?: number;
|
||||
onlyLocals?: boolean;
|
||||
esModule?: boolean;
|
||||
localsConvention?: "asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly";
|
||||
};
|
||||
cssModulesTypescriptLoader?: {
|
||||
mode?: "emit" | "verify";
|
||||
};
|
||||
cssnano?: {};
|
||||
copy?: string[];
|
||||
define?: {};
|
||||
devScripts?: {};
|
||||
/**
|
||||
* devServer configs
|
||||
*/
|
||||
devServer?: {
|
||||
/**
|
||||
* devServer port, default 8000
|
||||
*/
|
||||
port?: number;
|
||||
host?: string;
|
||||
https?:
|
||||
| {
|
||||
key?: string;
|
||||
cert?: string;
|
||||
[k: string]: any;
|
||||
}
|
||||
| boolean;
|
||||
headers?: {};
|
||||
writeToDisk?: boolean | (() => any);
|
||||
[k: string]: any;
|
||||
};
|
||||
devtool?: string;
|
||||
/**
|
||||
* Code splitting for performance optimization
|
||||
*/
|
||||
dynamicImport?: {
|
||||
/**
|
||||
* loading the component before loaded
|
||||
*/
|
||||
loading?: string;
|
||||
};
|
||||
exportStatic?: {
|
||||
htmlSuffix?: boolean;
|
||||
dynamicRoot?: boolean;
|
||||
/**
|
||||
* extra render paths only enable in ssr
|
||||
*/
|
||||
extraRoutePaths?: () => any;
|
||||
};
|
||||
externals?: {} | string | (() => any);
|
||||
extraBabelPlugins?: any[];
|
||||
extraBabelPresets?: any[];
|
||||
extraPostCSSPlugins?: any[];
|
||||
/**
|
||||
* fork-ts-checker-webpack-plugin options see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#options
|
||||
*/
|
||||
forkTSChecker?: {
|
||||
async?: boolean;
|
||||
typescript?: boolean | {};
|
||||
eslint?: {};
|
||||
issue?: {};
|
||||
formatter?: string | {};
|
||||
logger?: {};
|
||||
[k: string]: any;
|
||||
};
|
||||
hash?: boolean;
|
||||
ignoreMomentLocale?: boolean;
|
||||
inlineLimit?: number;
|
||||
lessLoader?: {};
|
||||
manifest?: {
|
||||
fileName?: string;
|
||||
publicPath?: "";
|
||||
basePath?: string;
|
||||
writeToFileEmit?: boolean;
|
||||
};
|
||||
mountElementId?: "";
|
||||
mpa?: {};
|
||||
nodeModulesTransform?: {
|
||||
type?: "all" | "none";
|
||||
exclude?: string[];
|
||||
};
|
||||
outputPath?: "";
|
||||
plugins?: string[];
|
||||
postcssLoader?: {};
|
||||
presets?: string[];
|
||||
proxy?: {};
|
||||
publicPath?: string;
|
||||
runtimePublicPath?: boolean;
|
||||
ssr?: {
|
||||
/**
|
||||
* remove window.g_initialProps in html, to force execing Page getInitialProps functions
|
||||
*/
|
||||
forceInitial?: boolean;
|
||||
/**
|
||||
* disable serve-side render in umi dev mode.
|
||||
*/
|
||||
devServerRender?: boolean;
|
||||
mode?: "stream" | "string";
|
||||
/**
|
||||
* static markup in static site
|
||||
*/
|
||||
staticMarkup?: boolean;
|
||||
};
|
||||
singular?: boolean;
|
||||
styleLoader?: {};
|
||||
targets?: {};
|
||||
terserOptions?: {};
|
||||
theme?: {};
|
||||
runtimeHistory?: {};
|
||||
favicon?: string;
|
||||
headScripts?: any[];
|
||||
links?: any[];
|
||||
metas?: any[];
|
||||
scripts?: any[];
|
||||
styles?: any[];
|
||||
title?: string;
|
||||
mock?: {
|
||||
exclude?: string[];
|
||||
};
|
||||
[k: string]: any;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// @ts-nocheck
|
||||
import { plugin } from './plugin';
|
||||
import * as Plugin_0 from '/Users/caishi/forgeplus-react/src/app.js';
|
||||
|
||||
plugin.register({
|
||||
apply: Plugin_0,
|
||||
path: '/Users/caishi/forgeplus-react/src/app.js',
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
// @ts-nocheck
|
||||
import 'core-js';
|
||||
import 'regenerator-runtime/runtime';
|
|
@ -0,0 +1,16 @@
|
|||
// @ts-nocheck
|
||||
import { ApplyPluginsType } from '/Users/caishi/forgeplus-react/node_modules/@umijs/runtime';
|
||||
import { plugin } from './plugin';
|
||||
|
||||
export function getRoutes() {
|
||||
const routes = [];
|
||||
|
||||
// allow user to extend routes
|
||||
plugin.applyPlugins({
|
||||
key: 'patchRoutes',
|
||||
type: ApplyPluginsType.event,
|
||||
args: { routes },
|
||||
});
|
||||
|
||||
return routes;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
// @ts-nocheck
|
||||
export { history, setCreateHistoryOptions } from './history';
|
||||
export { plugin } from './plugin';
|
|
@ -0,0 +1,58 @@
|
|||
// @ts-nocheck
|
||||
import './core/polyfill';
|
||||
import '@@/core/devScripts';
|
||||
import { plugin } from './core/plugin';
|
||||
import './core/pluginRegister';
|
||||
import { createHistory } from './core/history';
|
||||
import { ApplyPluginsType } from '/Users/caishi/forgeplus-react/node_modules/@umijs/runtime';
|
||||
import { renderClient } from '/Users/caishi/forgeplus-react/node_modules/@umijs/renderer-react/dist/index.js';
|
||||
import { getRoutes } from './core/routes';
|
||||
|
||||
|
||||
|
||||
|
||||
const getClientRender = (args: { hot?: boolean; routes?: any[] } = {}) => plugin.applyPlugins({
|
||||
key: 'render',
|
||||
type: ApplyPluginsType.compose,
|
||||
initialValue: () => {
|
||||
const opts = plugin.applyPlugins({
|
||||
key: 'modifyClientRenderOpts',
|
||||
type: ApplyPluginsType.modify,
|
||||
initialValue: {
|
||||
routes: args.routes || getRoutes(),
|
||||
plugin,
|
||||
history: createHistory(args.hot),
|
||||
isServer: process.env.__IS_SERVER,
|
||||
rootElement: 'root',
|
||||
defaultTitle: ``,
|
||||
},
|
||||
});
|
||||
return renderClient(opts);
|
||||
},
|
||||
args,
|
||||
});
|
||||
|
||||
const clientRender = getClientRender();
|
||||
export default clientRender();
|
||||
|
||||
|
||||
window.g_umi = {
|
||||
version: '3.2.17',
|
||||
};
|
||||
|
||||
|
||||
// hot module replacement
|
||||
// @ts-ignore
|
||||
if (module.hot) {
|
||||
// @ts-ignore
|
||||
module.hot.accept('./core/routes', () => {
|
||||
const ret = require('./core/routes');
|
||||
if (ret.then) {
|
||||
ret.then(({ getRoutes }) => {
|
||||
getClientRender({ hot: true, routes: getRoutes() })();
|
||||
});
|
||||
} else {
|
||||
getClientRender({ hot: true, routes: ret.getRoutes() })();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -495,18 +495,18 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla
|
|||
});
|
||||
editorInstance.cm.on("change", (cm) => {
|
||||
//调用父组件的onchange方法,将输入内容传入父级组件
|
||||
// let reg = /alert\((.*?)\)/g;
|
||||
let reg = /alert\((.*?)\)/g;
|
||||
let v = cm.getValue();
|
||||
// if(v){
|
||||
// let matchvalue = v.match(reg);
|
||||
// if(matchvalue && matchvalue.length>0){
|
||||
// for(var x=0;x<matchvalue.length;x++){
|
||||
// v = v.replace(matchvalue[x],"");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if(v){
|
||||
let matchvalue = v.match(reg);
|
||||
if(matchvalue && matchvalue.length>0){
|
||||
for(var x=0;x<matchvalue.length;x++){
|
||||
v = v.replace(matchvalue[x],"");
|
||||
}
|
||||
}
|
||||
}
|
||||
// xss()防止恶意代码:如alert等
|
||||
onChange && onChange(xss(v));
|
||||
onChange && onChange(v);
|
||||
if(quoteVisibleRef.current){
|
||||
const cur = cm.doc.getCursor();
|
||||
const line = cur.line;
|
||||
|
|
Loading…
Reference in New Issue