$(document).on('click', '#addDiv', function () {
$('#newDiv').append("<div class='summernote'></div><div class='select2'></div>");
}
$(document).ready(function () {
$('.summernote').summernote({
height: null,
lang: 'ru-RU',
toolbar: [
["style", ["style"]],
["font", ["bold", "italic", "underline", "clear"]],
["fontname", ["fontname"]],
["color", ["color"]],
["para", ["ul", "ol", "paragraph"]],
["height", ["height"]],
["table", ["table"]],
["insert", ["link", "picture", "video", "hr"]],
["view", ["fullscreen", "codeview"]],
["help", ["help"]]
],
popover: {
image: [
['custom', ['imageAttributes']],
['float', ['floatLeft', 'alignCenter', 'floatRight']],
['remove', ['removeMedia']]
],
link: [
['link', ['linkDialogShow', 'unlink']]
],
air: [
['color', ['color']],
['font', ['bold', 'underline', 'clear']],
['para', ['ul', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture']]
]
},
callbacks: {
onInit: null,
onFocus: null,
onBlur: null,
onEnter: null,
onKeyup: null,
onKeydown: null,
onSubmit: null,
onImageUpload: function (files) {
var $editor = $(this);
var data = new FormData();
data.append('file', files[0]);
$.ajax({
url: '{{ route("iup") }}',
method: 'POST',
data: data,
processData: false,
contentType: false,
success: function (response) {
$editor.summernote('insertImage', response);
}
});
},
onImageUploadError: null
}
});
}
$(document).on('click', '#addDiv', function () {
$('#newDiv').append("<div class='summernote'></div><div class='select2'></div>");
$('.summernote').summernote();
...
}
$(document).on('click', '#addDiv', function () {
$('#newDiv').append("<div class='summernote' id="summer1"></div><div class='select2' id="select2"></div>");
$('#summer1').summernote({
height: null,
lang: 'ru-RU',
toolbar: [
["style", ["style"]],
["font", ["bold", "italic", "underline", "clear"]],
["fontname", ["fontname"]],
["color", ["color"]],
["para", ["ul", "ol", "paragraph"]],
["height", ["height"]],
["table", ["table"]],
["insert", ["link", "picture", "video", "hr"]],
["view", ["fullscreen", "codeview"]],
["help", ["help"]]
],
popover: {
image: [
['custom', ['imageAttributes']],
['float', ['floatLeft', 'alignCenter', 'floatRight']],
['remove', ['removeMedia']]
],
link: [
['link', ['linkDialogShow', 'unlink']]
],
air: [
['color', ['color']],
['font', ['bold', 'underline', 'clear']],
['para', ['ul', 'paragraph']],
['table', ['table']],
['insert', ['link', 'picture']]
]
},
callbacks: {
onInit: null,
onFocus: null,
onBlur: null,
onEnter: null,
onKeyup: null,
onKeydown: null,
onSubmit: null,
onImageUpload: function (files) {
var $editor = $(this);
var data = new FormData();
data.append('file', files[0]);
$.ajax({
url: '{{ route("iup") }}',
method: 'POST',
data: data,
processData: false,
contentType: false,
success: function (response) {
$editor.summernote('insertImage', response);
}
});
},
onImageUploadError: null
}
});
}