diff --git a/build/webpack.demo.js b/build/webpack.demo.js index 4ad30ae1f..ff4c65772 100644 --- a/build/webpack.demo.js +++ b/build/webpack.demo.js @@ -7,6 +7,7 @@ const ProgressBarPlugin = require('progress-bar-webpack-plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); +const launchEditorMiddleware = require('launch-editor-middleware'); const config = require('./config'); @@ -33,7 +34,16 @@ const webpackConfig = { host: '0.0.0.0', port: 8085, publicPath: '/', - hot: true + hot: true, + before: (app) => { + /* + * 编辑器类型 :此处的指令表示的时各个各个编辑器在cmd或terminal中的命令 + * webstorm + * code // vscode + * idea + */ + app.use('/__open-in-editor', launchEditorMiddleware('code')); + } }, performance: { hints: false diff --git a/package.json b/package.json index d666e4c6a..df14cac11 100644 --- a/package.json +++ b/package.json @@ -115,6 +115,7 @@ "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "^0.0.32", "karma-webpack": "^3.0.5", + "launch-editor-middleware": "^2.3.0", "markdown-it": "^8.4.1", "markdown-it-anchor": "^5.0.2", "markdown-it-chain": "^1.3.0", diff --git a/yarn.lock b/yarn.lock index e2ce8716e..2f4814d33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5659,6 +5659,21 @@ last-run@^1.1.0: default-resolution "^2.0.0" es6-weak-map "^2.0.1" +launch-editor-middleware@^2.3.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/launch-editor-middleware/-/launch-editor-middleware-2.4.0.tgz#0c3f24608fa69e4ae00d5d1c89f34bf0ba25a8f4" + integrity sha512-/M7AX/6xktZY60KE7j71XLrj9U6H5TBoP+mJzhYB3fcdAq8rcazit/K0qWiu1jvytUPXP4lJRd1VJFwvdMQ/uw== + dependencies: + launch-editor "^2.4.0" + +launch-editor@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.4.0.tgz#2849de434e4684da2298db48c4e5b8ca64291173" + integrity sha512-mZ0BHeSn/ohL+Ib+b+JnxC59vcNz6v5IR9d0CuM8f0x8ni8oK3IIG6G0vMkpxc0gFsmvINkztGOHiWTaX4BmAg== + dependencies: + picocolors "^1.0.0" + shell-quote "^1.6.1" + lazystream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" @@ -7265,6 +7280,11 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -8505,6 +8525,11 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= +shell-quote@^1.6.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.3.tgz#aa40edac170445b9a431e17bb62c0b881b9c4123" + integrity sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw== + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"