Skip to content
Snippets Groups Projects
Unverified Commit 5b1519a9 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

hack summernote to consider action-text-attachment as block tag

parent 83a926f0
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,6 @@
//= require appstack/app
//= require gdpr/cookie_consent
//= require trix
//= require summernote/summernote-bs5.min
//= require sortablejs/Sortable
//= require popper
//= require summernote/summernote-lite
......
/* eslint no-alert: 'off' */
/*global $, SummernoteAttachment, SummernoteAttachmentUpload */
// window.osuny.summernote.sendFile = function (file, toSummernote) {
// 'use strict';
// var data = new FormData();
// data.append('file', file);
// $.ajax({
// data: data,
// type: 'POST',
// headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
// url: '/admin/summernote_blobs',
// cache: false,
// contentType: false,
// processData: false,
// success: function (successData) {
// if (typeof successData.errors !== 'undefined' && successData.errors !== null) {
// return $.each(successData.errors, function (errorKey, messages) {
// return $.each(messages, function (messageKey, message) {
// return window.alert(message);
// });
// });
// }
// return toSummernote.summernote('pasteHTML', successData.node);
// }
// });
// };
//
/*global $, SummernoteAttachmentUpload */
$(function () {
'use strict';
......@@ -34,6 +8,21 @@ $(function () {
dropImage: 'Drop file'
});
$.summernote.dom.isAttachment = function (node) {
return node && (/^ACTION-TEXT-ATTACHMENT/).test(node.nodeName.toUpperCase());
};
$.summernote.dom.isInline = function (node) {
return !this.isBodyContainer(node) &&
!this.isList(node) &&
!this.makePredByNodeName('HR')(node) &&
!this.isPara(node) &&
!this.makePredByNodeName('TABLE')(node) &&
!this.makePredByNodeName('BLOCKQUOTE')(node) &&
!this.makePredByNodeName('DATA')(node) &&
!this.isAttachment(node);
};
$('[data-provider="summernote"]').each(function () {
$(this).summernote({
popover: {
......
/*global $, ActiveStorage, SummernoteAttachment */
/*global $, ActiveStorage */
var SummernoteAttachmentUpload = function (element, file) {
'use strict';
this.element = element;
......
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