分类: Html/Css
2016-03-18 17:27:55
<html>
...
html>
|
<script src="//code.jquery.com/jquery-1.9.1.min.js">script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js">script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<link href="summernote.css" />
<script src="summernote.min.js">script>
|
<div id="summernote">Hello Summernotediv> |
$(document).ready(function() {
$('#summernote').summernote();
});
|
$('.summernote').summernote(); |
$('.summernote').summernote({
height: 300, // set editor height
minHeight: null, // set minimum height of editor
maxHeight: null, // set maximum height of editor
focus: true, // set focus to editable area after initializing summernote});
|
$('.summernote').summernote({
toolbar: [
//[groupname, [button list]]
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
]
});
|
类型 | 按钮id | 方法 |
---|---|---|
Insert |
picture |
Insert a picture |
link |
Insert a hyperlink |
|
video |
Insert a video |
|
table |
Insert a table |
|
hr |
Insert a horizontal rule |
|
Style |
style |
Format selected block |
fontname |
Set font family |
|
fontsize |
Set font size |
|
color |
Set foreground and background color |
|
bold |
Toggle weight |
|
italic |
Toggle italic |
|
underline |
Toggle underline |
|
strikethrough |
Toggle strikethrough |
|
clear |
Clearing all styles |
|
Layout |
ul |
Make an un-ordered list |
ol |
Make an ordered list |
|
paragraph |
Set text alignment |
|
height |
Set height of text |
|
Misc |
fullscreen |
Toggle fullscreen editing mode |
codeview |
Toggle wysiwyg and html editing mode |
|
undo |
Undo |
|
redo |
Redo |
|
help |
Show help dialog |
$('.summernote').summernote({
airPopover: [
['color', ['color']],
['font', ['bold', 'underline', 'clear']],
['para', ['ul', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture']]
]
});
|
$('.summernote').destroy(); |
//取值
var sHTML = $('.summernote').code();
//同一页面多个summernote时,取第二个的值
var sHTML = $('.summernote').eq(1).code();
//赋值
$('.summernote').code(sHTML);
|
$('#summernote').summernote({
oninit: function() {
console.log('Summernote is launched');
}
});
|
$('#summernote').summernote({
onenter: function(e) {
console.log('Enter/Return key pressed');
}
});
|
$('#summernote').summernote({
onfocus: function(e) {
console.log('Editable area is focused');
}
});
|
$('#summernote').summernote({
onblur: function(e) {
console.log('Editable area loses focus');
}
});
|
$('#summernote').summernote({
onkeyup: function(e) {
console.log('Key is released:', e.keyCode);
}
});
|
$('#summernote').summernote({
onkeydown: function(e) {
console.log('Key is pressed:', e.keyCode);
}
});
|
$('#summernote').summernote({
onpaste: function(e) {
console.log('Called event paste');
}
});
|
$('#summernote').summernote({
onImageUpload: function(files, editor, $editable) {
console.log('image upload:', files, editor, $editable);
}
});
|
$('#summernote').summernote({
onChange: function(contents, $editable) {
console.log('onChange:', contents, $editable);
}
});
|
给主人留下些什么吧!~~
|