Akaunting Html Editor component fixed.. 0.js and 37.js file deleted :)

This commit is contained in:
Cüneyt Şentürk 2021-01-18 16:20:57 +03:00
parent 1a562e4707
commit 12c1be09e6

View File

@ -11,20 +11,30 @@
<button type="button" class="ql-list" value="bullet"></button>
</div>
</div>
<div :id="editorId" :name="name" class="" ref="editor">
</div>
</div>
</template>
<script>
import Quill from 'quill';
export default {
name: 'akaunting-html-editor',
props: {
name: String,
value: {
type: String,
default: ''
},
name: String
theme: {
type: String,
default: 'snow'
},
},
data () {
return {
editor: null,
@ -34,14 +44,17 @@
toolbarId: null
}
},
methods: {
initialize (Quill) {
let theme = this.theme;
this.editor = new Quill(`#${this.editorId}`, {
theme: 'snow',
theme: theme,
modules: {
toolbar: `#${this.toolbarId}`
}
})
});
if (this.value.length > 0) {
this.editor.pasteHTML(this.value)
@ -60,12 +73,12 @@
this.content = html;
this.$emit('input', this.content);
})
});
},
pasteHTML () {
if (!this.editor) {
return
return;
}
this.editor.pasteHTML(this.value);
@ -80,16 +93,12 @@
}
return text;
}
},
},
async mounted () {
this.content = this.value;
let Quill = await import('quill');
Quill = Quill.default || Quill;
this.editorId = this.randomString();
this.toolbarId = this.randomString();
@ -107,7 +116,7 @@
content (newVal) {
this.$emit('input', newVal);
}
}
},
},
}
</script>