Skip to content
Snippets Groups Projects
Commit 50354406 authored by pabois's avatar pabois
Browse files

close #215

parent b56e9be2
No related branches found
No related tags found
No related merge requests found
......@@ -2,50 +2,63 @@
$(function () {
'use strict';
var configs = [];
configs['mini'] = {
toolbar: [
['font', ['bold', 'italic']],
['insert', ['link']],
['view', ['codeview']]
]
};
configs['default'] = {
popover: {
image: [
['remove', ['removeMedia']]
]
},
toolbar: [
['style', ['style']],
['font', ['bold', 'italic']],
['para', ['ul', 'ol']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['codeview']]
],
styleTags: [
'p',
'blockquote',
'pre',
'h2',
'h3',
'h4'
],
followingToolbar: true,
callbacks: {
onImageUpload: function (files) {
var attachmentUpload = new SummernoteAttachmentUpload(this, files[0]);
attachmentUpload.start();
},
onMediaDelete: function (_, $editable) {
$.summernote.rails.cleanEmptyAttachments($editable);
},
onKeyup: function (e) {
var $editable = $(e.currentTarget);
if (e.keyCode === 8) {
$.summernote.rails.cleanEmptyAttachments($editable);
}
}
}
};
$.extend($.summernote.lang['en-US'].image, {
dragImageHere: 'Drag file here',
dropImage: 'Drop file'
});
$('[data-provider="summernote"]').each(function () {
$(this).summernote({
popover: {
image: [
['remove', ['removeMedia']]
]
},
toolbar: [
['style', ['style']],
['font', ['bold', 'italic']],
['para', ['ul', 'ol']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['codeview']]
],
styleTags: [
'p',
'blockquote',
'pre',
'h2',
'h3',
'h4'
],
followingToolbar: true,
callbacks: {
onImageUpload: function (files) {
var attachmentUpload = new SummernoteAttachmentUpload(this, files[0]);
attachmentUpload.start();
},
onMediaDelete: function (_, $editable) {
$.summernote.rails.cleanEmptyAttachments($editable);
},
onKeyup: function (e) {
var $editable = $(e.currentTarget);
if (e.keyCode === 8) {
$.summernote.rails.cleanEmptyAttachments($editable);
}
}
}
});
var config = $(this).attr('data-summernote-config');
config = config || 'default';
$(this).summernote(configs[config]);
});
});
......@@ -22,7 +22,12 @@
input_html: { name: 'communication_website_index_page[breadcrumb_title]' },
hint: t('simple_form.hints.communication_website_index_page.breadcrumb_title') %>
<%= f.input :description, input_html: { name: 'communication_website_index_page[description]' } %>
<%= f.input :header_text, as: :summernote, input_html: { name: 'communication_website_index_page[header_text]' } %>
<%= f.input :header_text,
as: :summernote,
input_html: {
name: 'communication_website_index_page[header_text]',
data: { 'summernote-config' => 'mini' }
} %>
<%= f.input :text, as: :summernote, input_html: { name: 'communication_website_index_page[text]' } %>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment