<template>
	<view>
		<editor id="editor" class="ql-container" :placeholder="placeholder" @ready="onEditorReady" @blur='result'></editor>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				placeholder: '开始输入...'
			}
		},
		onLoad() {

		},
		methods: {
			onEditorReady() {
				// #ifdef MP-BAIDU
				this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editorId');
				// #endif

				// #ifdef APP-PLUS || H5 ||MP-WEIXIN
				uni.createSelectorQuery().select('#editor').context((res) => {
					this.editorCtx = res.context
				}).exec()
				// #endif
			},
			undo() {
				this.editorCtx.undo()
			},
			result(html, text, delta){
				console.log(html.detail.html)
			}
		}
	}
</script>

<style lang="less" scoped>

</style>
