forked from hinesboy/mavonEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editor.vue
63 lines (59 loc) · 1.39 KB
/
editor.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
<div class="container">
<div id="editor">
<mavon-editor style="height: 100%" v-model="code" :codeStyle="codeStyle" :xssOptions="xssOptions"></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 () {
return {
codeStyle: "github",
styles,
code: '<span style="color:red;font-size:36px;">A</span> \n```' + code + '\n```',
xssOptions:{
whiteList: {
span: ['style']
}
}
};
}
}
</script>
<style>
.container {
margin: auto;
width: 80%;
}
#editor {
height: 580px;
}
.switch-code-style {
margin-top: 10px;
font-size: 16px;
}
</style>