diff --git a/example/App.vue b/example/App.vue index caff988..f1210d1 100644 --- a/example/App.vue +++ b/example/App.vue @@ -163,9 +163,17 @@

Tags

- +
+ +

Tags Allow Add

- +
+ +
+

Editor

+
+ +
+ + diff --git a/packages/Editor/types/editor.ts b/packages/Editor/types/editor.ts new file mode 100644 index 0000000..e5df423 --- /dev/null +++ b/packages/Editor/types/editor.ts @@ -0,0 +1,21 @@ +export type Lang = 'json' | 'sql' + +export type Switch = 'on' | 'off' + +export type renderLineHighlight = 'none' | 'line' | 'gutter' | 'all' | undefined + +export type ScrollBarStatus = 'auto' | 'visible' | 'hidden' | undefined + +export interface CustomMonacoOption { + value: string + lang: Lang + fontSize: number + lineNumbers: Switch + renderLineHighlight: renderLineHighlight + scrollbarStatus: ScrollBarStatus + disabled: boolean + wordWrap: Switch + lineHeight: number +} + +export default {} diff --git a/packages/index.ts b/packages/index.ts index c957953..b299d0b 100644 --- a/packages/index.ts +++ b/packages/index.ts @@ -27,6 +27,7 @@ import BreadcrumbItem from './BreadcrumbItem' import Upload from './Upload' import Tags from './Tags' import KeyValueEditor from './KeyValueEditor' +import Editor from './Editor' import Loading from './Loading' import './style/global.scss' @@ -68,6 +69,7 @@ const components = [ Upload, Tags, KeyValueEditor, + Editor, ] const plugins = [Loading] @@ -114,6 +116,7 @@ const packages = { Upload, Tags, KeyValueEditor, + Editor, } export default packages diff --git a/vue.config.js b/vue.config.js index 88eface..e4880d5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,5 +1,11 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires +const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin') + module.exports = { lintOnSave: false, + devServer: { + port: 6800, + }, pages: { index: { entry: 'example/main.ts', @@ -18,4 +24,12 @@ module.exports = { return options }) }, + configureWebpack: { + plugins: [ + new MonacoWebpackPlugin({ + output: 'static/', + languages: ['json', 'sql'], + }), + ], + }, } diff --git a/yarn.lock b/yarn.lock index e99fa0b..8fe2da7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6375,6 +6375,18 @@ mixin-deep@^1.2.0: dependencies: minimist "^1.2.5" +monaco-editor-webpack-plugin@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-3.0.1.tgz#b9bf93314eb2708907c232cfbf359622e7a6d98a" + integrity sha512-Hym4HqWgIpyoi9G0spln/b/7rkDKfYwIOrNzo1fHHMc+MLYSwD1JXHwKSDS77X27ZHfVJsEXbMZYdGhSYuVF0w== + dependencies: + loader-utils "^2.0.0" + +monaco-editor@^0.23.0: + version "0.23.0" + resolved "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.23.0.tgz#24844ba5640c7adb3a2a3ff3b520cf2d7170a6f0" + integrity sha512-q+CP5zMR/aFiMTE9QlIavGyGicKnG2v/H8qVvybLzeFsARM8f6G9fL0sMST2tyVYCwDKkGamZUI6647A0jR/Lg== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"