我在bootrap模态弹出窗口中将summernote.js用于html编辑器。默认情况下,编辑器中的“可编辑”项不起作用。但是,当调整浏览器屏幕大小或打开检查元素开发工具时,它开始工作。知道如何解决此问题
$(".summernote").summernote({
height: 150,
toolbar: [
['style', ['bold', 'italic', 'underline', 'clear']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul','ol','paragraph']],
["view", ["fullscreen", "codeview"]]
],
});
$('i.note-recent-color').each(function(){
$(this).attr('style','background-color: transparent;');
});
HTML代码是
<div id="myModal" class="modal fade in" role="dialog">
<div class="modal-dialog locationMail-dialog">
<div class="modal-content">
<input type="hidden" name="email-locationId" id="email-locationId" value="">
<input type="hidden" name="email-locationKey" id="email-locationKey" value="">
<div class="modal-header">
<h4 class="modal-title">Email</h4>
</div>
<div class="modal-body">
<div class="modal-email">
<label>To : </label>
<input type="text" name="email" id="email" value="" class="form-control" readonly>
</div>
<div class="modal-email">
<label>Subject : </label>
<input type="text" name="emailsubject" id="emailsubject" value="" class="form-control">
</div>
<div class="modal-msg">
<label>Message : </label>
<textarea class="form-control summernote" name="emailcontent" id="emailcontent" cols="50" rows="10"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-cancel" data-dismiss="modal">Close</button>
<img id="modal_loader" src="{{ env('APP_URL') }}/assets/images/ajax-loader.gif" style="display: none;">
<button type="button" class="btn btn-primary btn-send" data-dismiss="modal">Send</button>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
我为您创建了一个快速fiddle。
HTML:
<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.js"></script>
<!-- Button trigger modal -->
<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<div class="summernote">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
jQuery:
jQuery(document).ready(function(e) {
jQuery(".summernote").summernote({
height: 150,
toolbar: [
['style', ['bold', 'italic', 'underline', 'clear']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul','ol','paragraph']],
["view", ["fullscreen", "codeview"]]
],
});
jQuery('i.note-recent-color').each(function(){
jQuery(this).attr('style','background-color: transparent;');
});
});