Skip to content

Commit af41067

Browse files
Removing Warnings and Errors from TextEditor.vue file (#271)
removing warnings and errors
1 parent 1ef3895 commit af41067

File tree

1 file changed

+40
-35
lines changed

1 file changed

+40
-35
lines changed

src/components/helpers/createNewProject/TextEditor.vue

+40-35
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<template>
22
<div id="text-editor" :class="{ fullscreen: fullscreen }">
3-
<div class="toolbar" v-if="editor">
3+
<div v-if="editor" class="toolbar">
44
<div class="align-dropdown">
55
<button class="dropbtn" @click.prevent="">Heading ▼</button>
66
<div class="dropdown-content">
77
<a
88
v-for="index in 6"
9+
:key="index"
910
:class="{
1011
active: editor.isActive('heading', {
1112
level: index,
@@ -15,8 +16,8 @@
1516
fontSize: 20 - index + 'px',
1617
backgroundColor: '#555',
1718
}"
18-
@click.prevent="onHeadingClick(index)"
1919
role="button"
20+
@click.prevent="onHeadingClick(index)"
2021
>
2122
H{{ index }}
2223
</a>
@@ -25,6 +26,7 @@
2526

2627
<button
2728
v-for="({ slug, option, active, icon }, index) in textActions"
29+
:key="index"
2830
:class="{ active: editor.isActive(active) }"
2931
@click.prevent="onActionClick(slug, option)"
3032
>
@@ -33,14 +35,14 @@
3335

3436
<div class="mode-toggle">
3537
<button
36-
@click.prevent="toggleMode"
3738
:class="{ active: showSourceCode }"
39+
@click.prevent="toggleMode"
3840
>
3941
<i class="fas fa-file-code"></i>
4042
</button>
4143
<button
42-
@click.prevent="toggleFullscreen"
4344
:class="{ active: fullscreen }"
45+
@click.prevent="toggleFullscreen"
4446
>
4547
<i v-if="!fullscreen" class="fas fa-expand-arrows-alt"></i>
4648
<i v-else class="fas fa-compress-arrows-alt"></i>
@@ -202,6 +204,37 @@ export default {
202204
}
203205
},
204206
},
207+
mounted() {
208+
this.editor = new Editor({
209+
content: this.modelValue,
210+
extensions: [
211+
StarterKit,
212+
Underline,
213+
Subscript,
214+
Superscript,
215+
CharacterCount.configure({
216+
limit: this.maxLimit,
217+
}),
218+
TextAlign.configure({
219+
types: ['heading', 'paragraph'],
220+
}),
221+
],
222+
onUpdate: () => {
223+
this.$emit('update:modelValue', this.editor.getHTML())
224+
},
225+
})
226+
document.addEventListener(
227+
'fullscreenchange',
228+
this.handleFullscreenChange
229+
)
230+
},
231+
beforeUnmount() {
232+
this.editor.destroy()
233+
document.removeEventListener(
234+
'fullscreenchange',
235+
this.handleFullscreenChange
236+
)
237+
},
205238
methods: {
206239
onActionClick(slug, option = null) {
207240
if (this.showSourceCode) return
@@ -250,37 +283,6 @@ export default {
250283
this.fullscreen = document.fullscreenElement !== null
251284
},
252285
},
253-
mounted() {
254-
this.editor = new Editor({
255-
content: this.modelValue,
256-
extensions: [
257-
StarterKit,
258-
Underline,
259-
Subscript,
260-
Superscript,
261-
CharacterCount.configure({
262-
limit: this.maxLimit,
263-
}),
264-
TextAlign.configure({
265-
types: ['heading', 'paragraph'],
266-
}),
267-
],
268-
onUpdate: () => {
269-
this.$emit('update:modelValue', this.editor.getHTML())
270-
},
271-
})
272-
document.addEventListener(
273-
'fullscreenchange',
274-
this.handleFullscreenChange
275-
)
276-
},
277-
beforeUnmount() {
278-
this.editor.destroy()
279-
document.removeEventListener(
280-
'fullscreenchange',
281-
this.handleFullscreenChange
282-
)
283-
},
284286
}
285287
</script>
286288

@@ -325,6 +327,7 @@ export default {
325327
border-radius: 2px;
326328
margin: 0.5em 4px;
327329
-webkit-appearance: none;
330+
appearance: none;
328331
cursor: pointer;
329332
}
330333
@@ -346,6 +349,7 @@ export default {
346349
border: none;
347350
border-radius: 2px;
348351
-webkit-appearance: none;
352+
appearance: none;
349353
cursor: pointer;
350354
}
351355
@@ -430,6 +434,7 @@ export default {
430434
border-radius: 2px;
431435
margin: 0.5em 4px;
432436
-webkit-appearance: none;
437+
appearance: none;
433438
cursor: pointer;
434439
}
435440

0 commit comments

Comments
 (0)