Skip to content

Commit

Permalink
Add switch code style demo and build to add checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawulin001 committed Nov 23, 2021
1 parent 57c3f2a commit d7ff5f2
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 42 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "./mavon-editor.d.ts",
"scripts": {
"dev": "webpack-dev-server --config webpack/webpack.dev.js",
"build": "webpack --progress --config webpack/webpack.build.js",
"ci-build": "webpack --progress --config webpack/webpack.build.js",
"build": "run-s lint test ci-build",
"test": "jest",
"test:coverage": "jest --coverage",
"lint": "eslint --ext .js,.vue src/",
Expand Down Expand Up @@ -88,6 +89,7 @@
"markdown-it-task-lists": "^2.1.1",
"markdown-it-toc": "^1.1.0",
"merges-utils": "^1.0.2",
"npm-run-all": "^4.1.5",
"optimize-css-assets-webpack-plugin": "^1.3.1",
"postcss": "^5.0.10",
"postcss-advanced-variables": "1.2.2",
Expand Down
21 changes: 14 additions & 7 deletions src/dev/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<button @click="imgreplace">imgreplace</button>
<input type="text" v-model="imgName" />
<button @click="imgdelete">delete</button>
<div class="switch-code-style">
<span>code style:</span>
<select v-model="codeStyle">
<option v-for="(val, key) in styles" :value="key">{{ key }}</option>
</select>
</div>
</div>
<mavon-editor ref=md :subfield="subfield" :toolbarsFlag="toolbarsFlag" :editable="editable"
:language="d_language" @change="change" @save="saveone" :ishljs="true" class="item-editor" v-model="help1"
Expand All @@ -38,6 +44,7 @@
:boxShadow="true"
:scrollStyle="true"
:transition="true"
:codeStyle="codeStyle"
box-shadow-style="0 2px 12px 0 rgba(0, 0, 0, 0.1)"
toolbars-background="#ffffff"
preview-background="#fbfbfb">
Expand Down Expand Up @@ -80,7 +87,7 @@
</template>

<script type="text/ecmascript-6">
// import {CONFIG} from './assets/config.js'
import styles from '../lib/core/hljs/lang.hljs.css.js'
import {CONFIG} from '../lib/config.js'
export default {
name: 'app',
Expand All @@ -102,11 +109,6 @@
preview: true,
subfield: false
},
// xssOptions: {
// escapeHtml (html) {
// return html
// }
// },
autofocus: true,
subfield: true,
editable: true,
Expand Down Expand Up @@ -165,7 +167,9 @@
imageClick: function (file) {
console.log(file);
},
imgName: ''
imgName: '',
codeStyle: "github",
styles
}
},
created () {
Expand Down Expand Up @@ -283,6 +287,9 @@
margin 0
padding 0
padding-bottom 50px
.switch-code-style
display inline
margin-left 8px
.page-lang
position absolute
top 15px
Expand Down
54 changes: 43 additions & 11 deletions src/dev/editor.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
<template>
<div id="editor">
<mavon-editor style="height: 100%"></mavon-editor>
<div class="container">
<div id="editor">
<mavon-editor style="height: 100%" v-model="code" :codeStyle="codeStyle"></mavon-editor>
</div>
<div class="switch-code-style">
<span>code style:</span>
<select v-model="codeStyle">
<option v-for="(val, key) in styles" :value="key">{{ key }}</option>
</select>
</div>
</div>
</template>
<script>
import styles from '../lib/core/hljs/lang.hljs.css.js'
const code = `java
/**
* @author John Smith <[email protected]>
*/
package l2f.gameserver.model;
public abstract strictfp class L2Char extends L2Object {
public static final Short ERROR = 0x0001;
public void moveTo(int x, int y, int z) {
_ai = null;
log("Should not be called");
if (1 > 5) { // wtf!?
return;
}
}
}`;
module.exports = {
name: 'editor',
data: function() {
data: function () {
return {
codeStyle: "github",
styles,
code: '```' + code + '\n```'
};
},
computed: {
},
methods: {
}
}
</script>
<style>
.container {
margin: auto;
width: 80%;
}
#editor {
margin: auto;
width: 80%;
height: 580px;
height: 580px;
}
.switch-code-style {
margin-top: 10px;
font-size: 16px;
}
</style>
103 changes: 80 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,6 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==

axios@^0.19.0:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
dependencies:
follow-redirects "1.5.10"

babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
Expand Down Expand Up @@ -2137,7 +2130,7 @@ cross-spawn@^5.1.0:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^6.0.0:
cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
Expand Down Expand Up @@ -2369,13 +2362,6 @@ [email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.
dependencies:
ms "2.0.0"

debug@=3.1.0, debug@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"

debug@^3.1.0, debug@^3.1.1:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
Expand All @@ -2390,6 +2376,13 @@ debug@^4.1.0:
dependencies:
ms "^2.1.1"

debug@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"

decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
Expand Down Expand Up @@ -2741,7 +2734,7 @@ errno@^0.1.1, errno@^0.1.3:
dependencies:
prr "~1.0.1"

error-ex@^1.2.0:
error-ex@^1.2.0, error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==
Expand Down Expand Up @@ -3405,13 +3398,6 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"

[email protected]:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"

follow-redirects@^1.0.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
Expand Down Expand Up @@ -5088,6 +5074,11 @@ json-loader@^0.5.4:
resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d"
integrity sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==

json-parse-better-errors@^1.0.1:
version "1.0.2"
resolved "https://registry.nlark.com/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
integrity sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk=

json-schema-traverse@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
Expand Down Expand Up @@ -5286,6 +5277,16 @@ load-json-file@^2.0.0:
pify "^2.0.0"
strip-bom "^3.0.0"

load-json-file@^4.0.0:
version "4.0.0"
resolved "https://registry.nlark.com/load-json-file/download/load-json-file-4.0.0.tgz?cache=0&sync_timestamp=1631508607226&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fload-json-file%2Fdownload%2Fload-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b"
integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs=
dependencies:
graceful-fs "^4.1.2"
parse-json "^4.0.0"
pify "^3.0.0"
strip-bom "^3.0.0"

loader-runner@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357"
Expand Down Expand Up @@ -5565,6 +5566,11 @@ memory-fs@^0.4.0, memory-fs@~0.4.1:
errno "^0.1.3"
readable-stream "^2.0.1"

memorystream@^0.3.1:
version "0.3.1"
resolved "https://registry.nlark.com/memorystream/download/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2"
integrity sha1-htcJCzDORV1j+64S3aUaR93K+bI=

meow@^3.3.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb"
Expand Down Expand Up @@ -5965,6 +5971,21 @@ normalize-url@^1.4.0:
query-string "^4.1.0"
sort-keys "^1.0.0"

npm-run-all@^4.1.5:
version "4.1.5"
resolved "https://registry.nlark.com/npm-run-all/download/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba"
integrity sha1-BEdiAqFe4OLiFAgIYb/xKlHZj7o=
dependencies:
ansi-styles "^3.2.1"
chalk "^2.4.1"
cross-spawn "^6.0.5"
memorystream "^0.3.1"
minimatch "^3.0.4"
pidtree "^0.3.0"
read-pkg "^3.0.0"
shell-quote "^1.6.1"
string.prototype.padend "^3.0.0"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
Expand Down Expand Up @@ -6298,6 +6319,14 @@ parse-json@^2.2.0:
dependencies:
error-ex "^1.2.0"

parse-json@^4.0.0:
version "4.0.0"
resolved "https://registry.npmmirror.com/parse-json/download/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"
integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=
dependencies:
error-ex "^1.3.1"
json-parse-better-errors "^1.0.1"

[email protected]:
version "4.0.0"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
Expand Down Expand Up @@ -6404,6 +6433,11 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

pidtree@^0.3.0:
version "0.3.1"
resolved "https://registry.nlark.com/pidtree/download/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a"
integrity sha1-7wmsLMBTPfHzJQzPLE02aw0SEUo=

pify@^2.0.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
Expand Down Expand Up @@ -7226,6 +7260,15 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"

read-pkg@^3.0.0:
version "3.0.0"
resolved "https://registry.nlark.com/read-pkg/download/read-pkg-3.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fread-pkg%2Fdownload%2Fread-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389"
integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=
dependencies:
load-json-file "^4.0.0"
normalize-package-data "^2.3.2"
path-type "^3.0.0"

"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
version "2.3.7"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
Expand Down Expand Up @@ -7824,6 +7867,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.npmmirror.com/shell-quote/download/shell-quote-1.7.3.tgz#aa40edac170445b9a431e17bb62c0b881b9c4123"
integrity sha1-qkDtrBcERbmkMeF7tiwLiBucQSM=

shellwords@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
Expand Down Expand Up @@ -8155,6 +8203,15 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"

string.prototype.padend@^3.0.0:
version "3.1.3"
resolved "https://registry.npmmirror.com/string.prototype.padend/download/string.prototype.padend-3.1.3.tgz?cache=0&sync_timestamp=1633395740145&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fstring.prototype.padend%2Fdownload%2Fstring.prototype.padend-3.1.3.tgz#997a6de12c92c7cb34dc8a201a6c53d9bd88a5f1"
integrity sha1-mXpt4SySx8s03IogGmxT2b2IpfE=
dependencies:
call-bind "^1.0.2"
define-properties "^1.1.3"
es-abstract "^1.19.1"

string.prototype.trimend@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.0.tgz#ee497fd29768646d84be2c9b819e292439614373"
Expand Down

0 comments on commit d7ff5f2

Please sign in to comment.