Moving vue app.js to the theme directly

parent 10cc1a48
<template>
<div class="ckeditor">
<textarea
:name="name"
:id="id"
:value="value"
:types="types"
:config="config">
</textarea>
</div>
</template>
<script>
let inc = 0
export default {
name: 'vue-ckeditor',
props: {
name: {
type: String,
default: () => `editor-${++inc}`
},
value: {
type: String
},
id: {
type: String,
default: () => `editor-${inc}`
},
types: {
type: String,
default: () => `classic`
},
config: {
type: Object,
default: () => {}
}
},
data () {
return { destroyed: false }
},
computed: {
instance () {
return CKEDITOR.instances[this.id]
}
},
watch: {
value (val) {
let html = this.instance.getData()
if (val !== html) {
this.instance.setData(val, null, true)
}
}
},
mounted () {
if (typeof CKEDITOR === 'undefined') {
console.log('CKEDITOR is missing (http://ckeditor.com/)')
} else {
if (this.types === 'inline') {
CKEDITOR.inline(this.id, this.config)
} else {
CKEDITOR.replace(this.id, this.config)
}
this.instance.on('change', () => {
let html = this.instance.getData()
if (html !== this.value) {
this.$emit('input', html)
this.$emit('update:value', html)
}
})
this.instance.on('blur', () => {
this.$emit('blur', this.instance)
})
this.instance.on('focus', () => {
this.$emit('focus', this.instance)
})
}
},
beforeDestroy () {
if (!this.destroyed) {
this.instance.focusManager.blur(true)
this.instance.removeAllListeners()
this.instance.destroy()
this.destroyed = true
}
}
}
</script>
<style>
.ckeditor::after {
content: "";
display: table;
clear: both;
}
</style>
......@@ -125,7 +125,6 @@ return [
'moment.js' => ['theme' => 'vendor/admin-lte/plugins/daterangepicker/moment.min.js'],
'clipboard.js' => ['theme' => 'vendor/clipboard/dist/clipboard.min.js'],
'simplemde.js' => ['theme' => 'vendor/simplemde/dist/simplemde.min.js'],
'vue-app.js' => ['cdn' => mix('js/app.js')],
],
/*
......@@ -162,7 +161,6 @@ return [
'pace.js',
'selectize.js',
'main.js',
'vue-app.js',
],
],
......
......@@ -72,6 +72,7 @@
@foreach($jsFiles as $js)
<script src="{{ URL::asset($js) }}" type="text/javascript"></script>
@endforeach
<script src="{{ mix('js/app.js') }}"></script>
<?php if (is_module_enabled('Notification')): ?>
<script src="https://js.pusher.com/3.0/pusher.min.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment