<template>
	<div class="ueditor">
		<vue-ueditor-wrap
		id="editor"
		v-model="valueSync"
		:config="ueditorConfig"
		style="line-height: 20px;"
		></vue-ueditor-wrap>
	</div>
</template>

<script>
    import VueUeditorWrap from 'vue-ueditor-wrap'
    import { getToken } from "@/utils/auth";
	export default {
        components: {
            VueUeditorWrap
        },
		props:{
			value:{
				type: String,
				default: ''
			},
		},
        data(){
            return {
                valueSync: '',
                ueditorConfig: {
                    UEDITOR_HOME_URL: '/static/plugins/ueditor/',
                    autoHeightEnabled: false,
                    initialFrameHeight: 300,
                    initialFrameWidth: '100%',
                    serverUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/editor?api_token=" +getToken().replace("Bearer ",""),
                }
            }
        },
        created() {
            this.valueSync = this.value
        },
        watch: {
            valueSync(newValue, oldValue) {
                this.$emit('input', newValue)
            },
            value(val){
                if(val != this.valueSync){
                    this.valueSync = val
                }
            }
        },
		methods: {

		}
	}
</script>

<style>
#edui_fixedlayer{
    z-index: 10005 !important;
}
</style>
