vue document editor
v2.3.2 (Vue3)


Vue-Document-编辑器是一位富文本编辑器,使用本机满足浏览器实现和一些JavaScript Triptery构建在Vue.js之上,并在纸张大小的页面上传播内容。它的设计主要旨在允许使用HTML或Interactive模板进行预定的文档进行靶向修改。
npm install vue-document-editor
npm install vue-document-editor@1
dist文件夹导入资产< template >
< div style = " font-family : Avenir, sans-serif " >
< vue-document-editor v-model:content = " content " /> <!-- Vue 3 syntax -->
<!-- <vue-document-editor :content.sync="content" /> --> <!-- Vue 2 syntax -->
</ div >
</ template >
< script >
import VueDocumentEditor from ' vue-document-editor '
export default {
components : { VueDocumentEditor },
data () {
return {
content : [ " <h1>Hello!</h1>Fill this page with text and new pages will be created as it overflows. " ]
}
}
}
</ script > < html >
< head >
< script src =" https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js " > </ script >
< script src =" https://cdn.jsdelivr.net/npm/vue-document-editor@2/dist/VueDocumentEditor.umd.min.js " > </ script >
< link href =" https://cdn.jsdelivr.net/npm/vue-document-editor@2/dist/VueDocumentEditor.css " rel =" stylesheet " >
</ head >
< body >
< div id =" app " >
< div style =" font-family: Avenir, sans-serif " >
< vue-document-editor v-model:content =" content " />
</ div >
</ div >
< script >
const app = Vue . createApp ( {
components : { VueDocumentEditor } ,
data ( ) {
return {
content : [ "<h1>Hello!</h1>Fill this page with text and new pages will be created as it overflows." ]
}
}
} ) . mount ( '#app' ) ;
</ script >
</ body >
</ html > < html >
< head >
< script src =" https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js " > </ script >
< script src =" https://cdn.jsdelivr.net/npm/vue-document-editor@1/dist/VueDocumentEditor.umd.min.js " > </ script >
< link href =" https://cdn.jsdelivr.net/npm/vue-document-editor@1/dist/VueDocumentEditor.css " rel =" stylesheet " >
</ head >
< body >
< div id =" app " >
< div style =" font-family: Avenir, sans-serif " >
< vue-document-editor :content.sync =" content " />
</ div >
</ div >
< script >
var app = new Vue ( {
el : '#app' ,
components : { VueDocumentEditor } ,
data ( ) {
return {
content : [ "<h1>Hello!</h1>Fill this page with text and new pages will be created as it overflows." ]
}
}
} )
</ script >
</ body >
</ html > 请参阅demo.vue文件和与实时演示相对应的voiceTemplate.ce.vue文件。
对于道具,数据和样式变量的列表:读取API 。
content更新并将其存储在堆栈中,然后恢复它们来自己实现。演示实现了这一点。同样,如果您的交互式模板与content没有同步,则需要进行自定义的撤消/重做管理。contenteditable="false"和onclick="..."包含您自己的JavaScript代码的属性=“ false” =“ false”和ontribute进行交互。 npm run serve汇编,服务和热线充电演示进行开发npm run build编译并减少生产文件和演示版权(C)2020 Romain Lamothe,麻省理工学院许可证