现在我使用Summernote文本编辑器。有没有办法以百分比设置其宽度和高度?不幸的是,我找不到任何答案。
editor.summernote({
//buttons in toolbar
toolbar: [
['style', ['bold', 'italic', 'underline', 'clear']],
['font', ['strikethrough', 'superscript', 'subscript']],
['fontsize', ['fontname', 'fontsize', 'style']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['customButton', ['equation']],
['util', ['undo', 'redo']],
],
// prevents copying of text formattion from an external resource
callbacks: {
onPaste: function (e) {
var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text');
e.preventDefault();
document.execCommand('insertText', false, bufferText);
}
},
buttons: {
equation: equationButton
},
toolbarContainer: '#editorToolbar',
placeholder: 'Type Here',
height: 200,
width: 200, // - > **something like 40% ?**
});
谢谢你的回答!
答案 0 :(得分:1)
您可以在.note-editor
类上通过CSS设置宽度,如果您需要同时按宽度和高度百分比进行设置,那么CSS只会将其剪切掉然后您可以通过CSS设置宽度高度与:
$('.note-editor').height($(window).height()* 0.4)); sets it to 40% of screen height.