-
Notifications
You must be signed in to change notification settings - Fork 114
/
App.vue
225 lines (199 loc) · 5.79 KB
/
App.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<template>
<div id="app">
<at :members="members" name-key="name" v-model="html">
<!-- custom: same as default slot -->
<!-- <template v-slot:item="s">
<span v-text="s.item"></span>
</template> -->
<!-- custom: with avatars -->
<template v-slot:item="s">
<img :src="s.item.avatar">
<span v-text="s.item.name"></span>
</template>
<div class="editor"
contenteditable></div>
</at>
<at :members="members" name-key="name" v-model="html2">
<template v-slot:embeddedItem="s">
<span><span class="tag"><img class="avatar" :src="s.current.avatar">{{ s.current.name }}</span></span>
</template>
<!-- custom: with avatars -->
<template v-slot:item="s">
<img :src="s.item.avatar">
<span v-text="s.item.name"></span>
</template>
<div class="editor"
contenteditable></div>
</at>
<br />
<at-ta :members="members" name-key="name" v-model="text">
<!-- custom: with avatars -->
<template v-slot:item="s">
<img :src="s.item.avatar">
<span v-text="s.item.name"></span>
</template>
<textarea class="editor"></textarea>
</at-ta>
<at-ta :members="members" name-key="name">
<!-- custom: with avatars -->
<template v-slot:item="s">
<img :src="s.item.avatar">
<span v-text="s.item.name"></span>
</template>
<v-textarea class="vuetify-editor" v-model="text2"></v-textarea>
</at-ta>
<br />
<at-ta :members="members" name-key="name">
<!-- custom: with avatars -->
<template v-slot:item="s">
<img :src="s.item.avatar">
<span v-text="s.item.name"></span>
</template>
<el-input type="textarea" v-model="text3" class="element-editor"></el-input>
</at-ta>
</div>
</template>
<script>
import At from './At.vue'
import AtTa from './AtTextarea.vue'
// testing dist
// import At from '../dist/vue-at'
// import AtTa from '../dist/vue-at-textarea'
// testing npm_pack
// import At from '../package/dist/vue-at'
// import AtTa from '../package/dist/vue-at-textarea'
// testing node_modules
// import At from 'vue-at'
// import AtTa from 'vue-at/dist/vue-at-textarea'
let members = [
/* eslint-disable */
"Roxie Miles","grace.carroll",
"小浩",
"Helena Perez","melvin.miller",
"椿木",
"myrtie.green","elsie.graham","Elva Neal",
"肖逵",
"amy.sandoval","katie.leonard","lottie.hamilton",
/* eslint-enable */
]
members = members.map((v, i) => {
return {
avatar: `https://randomuser.me/api/portraits/men/${i % 5}.jpg`,
name: v
}
})
export default {
components: { At, AtTa },
name: 'app',
data () {
const data = {
members,
text: `
<<< Textarea >>>
Awesome Electron
Useful resources for creating apps with Electron
Inspired by the awesome list thing. You might also like awesome-nodejs.
Example apps
Some good apps written with Electron.
Open Source
Atom - Code editor.
Nuclide - Unified IDE.
Playback - Video player.
Awesome Electron
Useful resources for creating apps with Electron
Inspired by the awesome list thing. You might also like awesome-nodejs.
Example apps
Some good apps written with Electron.
Open Source
Atom - Code editor.
Nuclide - Unified IDE.
Playback - Video player.
`.trim(), // fix trailing abnormal nodes
html: `
<div><<< Content Editable Div >>></div><div>Awesome Electron
<img src="static/awesome.svg"></div><div><img style="max-width: 50px;" src="static/electron.svg"></div><div>Useful resources for creating apps with Electron</div><div>Inspired by the awesome list thing. You might also like awesome-nodejs.</div><div>Example apps</div><div>Some good apps written with Electron.</div><div>Open Source</div><div>Atom - Code editor.</div><div>Nuclide - Unified IDE.</div><div>Playback - Video player.</div>
<div><<< Content Editable Div >>></div><div>Awesome Electron <img style="max-width: 50px;" src="static/awesome.svg"></div><div><img style="max-width: 50px;" src="static/electron.svg"></div><div>Useful resources for creating apps with Electron</div><div>Inspired by the awesome list thing. You might also like awesome-nodejs.</div><div>Example apps</div><div>Some good apps written with Electron.</div><div>Open Source</div><div>Atom - Code editor.</div><div>Nuclide - Unified IDE.</div><div>Playback - Video player.</div>
`.trim() // fix trailing abnormal nodes
}
data.text2 = data.text
data.text3 = data.text
data.html2 = data.html
return data
}
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
margin-top: 30px;
}
.tag {
border-radius: 5px;
background: beige;
border: 1ps outset yellow;
}
.editor {
width: 400px;
height: 200px;
overflow: auto;
white-space: pre-wrap;
border: solid 2px rgba(0,0,0,.5);
}
textarea {
display: block;
}
.vuetify-editor {
width: 400px;
margin: 0;
padding: 0;
}
.vuetify-editor textarea {
height: 200px;
}
.v-input__slot {
margin: 0;
}
.v-text-field__details {
display: none;
}
.element-editor {
width: 400px;
}
.element-editor textarea {
height: 200px;
}
.editor img {
max-width: 10em;
vertical-align: bottom;
}
.tag .avatar {
max-width: 1em;
vertical-align: middle;
}
textarea {
padding: 0;
font-size: inherit;
resize: none;
}
/* override styles */
#app .atwho-li {
padding: 0 4px;
}
#app .atwho-li img {
height: 100%;
width: auto;
-webkit-transform: scale(.8);
}
#app .atwho-li span {
padding-left: 8px;
}
#app .atwho-wrap {
display: inline-block;
vertical-align: top;
margin-left: 40px;
margin-top: 30px;
}
</style>