vue-html5-editor
Version:
A WYSIWYG text editor base on html5 and vue
113 lines (96 loc) • 2.96 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vue html5 editor demo</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
<script src="../dist/vue-html5-editor.js"></script>
<script src="https://cdn.bootcss.com/vue/2.2.6/vue.js"></script>
<style>
#app {
margin: 50px auto;
width: 800px;
max-width: 100%;
}
.custom-icon {
background-size: 100% 100%;
display: inline-block;
}
.custom-icon.text {
background-image: url(custom-icons/text.png);
}
.custom-icon.font {
background-image: url(custom-icons/font.png);
}
.custom-icon.align {
background-image: url(custom-icons/align.png);
}
.custom-icon.list {
background-image: url(custom-icons/list.png);
}
.custom-icon.color {
background-image: url(custom-icons/color.gif);
}
.custom-icon.eraser {
background-image: url(custom-icons/eraser.gif);
}
.custom-icon.full-screen {
background-image: url(custom-icons/full-screen.gif);
}
.custom-icon.hr {
background-image: url(custom-icons/hr.gif);
}
.custom-icon.image {
background-image: url(custom-icons/image.gif);
}
.custom-icon.link {
background-image: url(custom-icons/link.gif);
}
.custom-icon.table {
background-image: url(custom-icons/table.gif);
}
.custom-icon.undo {
background-image: url(custom-icons/undo.gif);
}
.custom-icon.unlink {
background-image: url(custom-icons/unlink.gif);
}
.custom-icon.info {
background-image: url(custom-icons/info.png);
}
</style>
</head>
<body>
<div id="app">
<vue-html5-editor :content.sync="content" :height="500"></vue-html5-editor>
</div>
<script>
Vue.use(VueHtml5Editor, {
image: {compress: false},
icons: {
text: "custom-icon text",
color: "custom-icon color",
font: "custom-icon font",
align: "custom-icon align",
list: "custom-icon list",
link: "custom-icon link",
unlink: "custom-icon unlink",
tabulation: "custom-icon table",
image: "custom-icon image",
"horizontal-rule": "custom-icon hr",
eraser: "custom-icon eraser",
hr: "custom-icon hr",
undo: "custom-icon undo",
"full-screen": "custom-icon full-screen",
info: "custom-icon info ",
}
})
new Vue({
el: "#app",
data: {
content: "<h3>vue html5 editor</h3>",
}
})
</script>
</body>
</html>