Skip to content

Commit

Permalink
Merge pull request #637 from ygj6/eslint_fix
Browse files Browse the repository at this point in the history
fix eslint error
  • Loading branch information
ygj6 committed Jan 3, 2021
2 parents 4def421 + aed0d02 commit 2722a96
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test": "echo true",
"dev": "webpack-dev-server --open --progress --config webpack/webpack.dev.js",
"build": "webpack --progress --config webpack/webpack.build.js",
"lint": "eslint --fix --ext .js,.vue src/"
"lint:fix": "eslint --fix --ext .js,.vue src/",
"lint": "eslint --ext .js,.vue src/"
},
"repository": {
"type": "git",
Expand Down
10 changes: 5 additions & 5 deletions src/components/md-toolbar-left.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
},
isEqualName(filename, pos) {
if (this.img_file[pos][1]) {
if (this.img_file[pos][1].name == filename || this.img_file[pos][1]._name == filename) {
if (this.img_file[pos][1].name === filename || this.img_file[pos][1]._name === filename) {
return true
}
}
Expand All @@ -235,7 +235,7 @@
$imgDelByFilename(filename) {
var pos = 0;
while (this.img_file.length > pos) {
if (this.img_file[pos][1] == filename || this.isEqualName(filename, pos)) {
if (this.img_file[pos][1] === filename || this.isEqualName(filename, pos)) {
this.$imgDel(pos);
return true;
}
Expand All @@ -245,7 +245,7 @@
},
$imgAddByFilename(filename, $file) {
for (var i = 0; i < this.img_file.length; i++)
{ if (this.img_file[i][0] == filename) return false; }
{ if (this.img_file[i][0] === filename) return false; }
this.img_file[0][0] = filename;
this.img_file[0][1] = $file;
this.img_file[0][2] = filename;
Expand All @@ -255,15 +255,15 @@
},
$imgAddByUrl(filename, $url) {
for (var i = 0; i < this.img_file.length; i++)
{ if (this.img_file[i][0] == filename) return false; }
{ if (this.img_file[i][0] === filename) return false; }
this.img_file[0][0] = filename;
this.img_file[0][1] = $url;
this.img_file.unshift(['./' + (this.num), null])
return true;
},
$imgUpdateByFilename(filename, $file) {
for (var i = 0; i < this.img_file.length; i++) {
if (this.img_file[i][0] == filename || this.isEqualName(filename, i)) {
if (this.img_file[i][0] === filename || this.isEqualName(filename, i)) {
this.img_file[i][1] = $file;
this.$emit('imgAdd', filename, $file, false);
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/extra-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ export function loadLink(src, callback, id) {
return;
}

if(id){
if (id) {
var styles = document.querySelectorAll("link#" + id);
if(styles.length){
if (styles.length) {
styles[0].href = src;
return;
}
Expand Down
19 changes: 10 additions & 9 deletions src/mavon-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@
<script>
// import tomarkdown from './lib/core/to-markdown.js'
import {autoTextarea} from 'auto-textarea'
import {keydownListen} from './lib/core/keydown-listen.js'
import {keydownListen} from './lib/core/keydown-listen.js'
import hljsCss from './lib/core/hljs/lang.hljs.css.js'
import hljsLangs from './lib/core/hljs/lang.hljs.js'
const xss = require('xss');
import {
fullscreenchange,
/* windowResize, */
Expand Down Expand Up @@ -121,6 +120,7 @@ import md_toolbar_left from './components/md-toolbar-left.vue'
import md_toolbar_right from './components/md-toolbar-right.vue'
import "./lib/font/css/fontello.css"
import './lib/css/md.css'
const xss = require('xss');
export default {
mixins: [markdown],
props: {
Expand Down Expand Up @@ -306,7 +306,7 @@ export default {
},
p_external_link: {},
textarea_selectionEnd: 0,
textarea_selectionEnds: [0],
textarea_selectionEnds: [0]
};
},
created() {
Expand Down Expand Up @@ -364,7 +364,7 @@ export default {
methods: {
loadExternalLink(name, type, callback) {
if (typeof this.p_external_link[name] !== 'function') {
if (this.p_external_link[name] != false) {
if (this.p_external_link[name] !== false) {
console.error('external_link.' + name, 'is not a function, if you want to disabled this error log, set external_link.' + name, 'to function or false');
}
return;
Expand Down Expand Up @@ -456,7 +456,7 @@ export default {
if (isinsert === true) {
// 去除特殊字符
$file._name = $file.name.replace(/[\[\]\(\)\+\{\}&\|\\\*^%$#@\-]/g, '');
$vm.insertText($vm.getTextareaDom(),
{
prefix: '![' + $file._name + '](' + pos + ')',
Expand Down Expand Up @@ -574,7 +574,7 @@ export default {
// 工具栏插入内容
insertText(obj, {prefix, subfix, str, type}) {
// if (this.s_preview_switch) {
insertTextAtCaret(obj, {prefix, subfix, str, type}, this);
},
insertTab() {
Expand Down Expand Up @@ -626,7 +626,7 @@ export default {
codeStyleChange(val, isInit) {
isInit = isInit ? isInit : false;
if (typeof this.p_external_link.hljs_css !== 'function') {
if (this.p_external_link.hljs_css != false)
if (this.p_external_link.hljs_css !== false)
{ console.error('external_link.hljs_css is not a function, if you want to disabled this error log, set external_link.hljs_css to function or false'); }
return;
}
Expand Down Expand Up @@ -682,7 +682,7 @@ export default {
if (this.xssOptions) {
val = xss(val, this.xssOptions);
}
if (val !== this.d_value) {
this.d_value = val
}
Expand All @@ -708,7 +708,8 @@ export default {
if (!default_open_) {
default_open_ = this.subfield ? 'preview' : 'edit';
}
return this.s_preview_switch = default_open_ === 'preview' ? true : false;
this.s_preview_switch = default_open_ === 'preview' ? true : false;
return this.s_preview_switch;
},
codeStyle: function (val) {
this.codeStyleChange(val)
Expand Down

0 comments on commit 2722a96

Please sign in to comment.