Later Ctrl + ↑
 25   2 mon  

Fix issue with “Insert the picture” button in the Summernote

Summernote deactivates “Insert the picture” button when you use the context menu by mouse to insert the link.

You can use next code to fix this issue:

$('body').on('paste', '.note-image-url', function(e) {
    $('.note-image-url').val(e.originalEvent.clipboardData.getData('text'));
    $('.note-image-btn').removeAttr('disabled').removeClass('disabled');

    return false;
});
 37   2 mon  
 35   2 mon  

Fix: the text hides under the toolbar in Summernote

If you put several Summernote editors in Bootstrap tabs, then after navigating between tabs, the text in the editor hides under the toolbar. At the same time it is enough to scroll the page down or up and then everything falls into place.

We as users can patch it:

$('.yourSelector[data-toggle="tab"]').on('shown.bs.tab', function (e) {
    $('.note-editor').scroll();
});
 62   2 mon  

Fix: Option “disableDragAndDrop: true” doesn’t works in Summernote

In my case, this option doesn’t works:

$('.editorField').summernote({
    ...,
    disableDragAndDrop: true // Не работает...
});

I think it is a summernote bug. Maybe it will be fixed in new versions or it has already fixed, but I don’t want to update editor now. Therefore I made a dirty hack in my code:

$('body').on('drop', '.note-editable', function() {
    return false;
});
 50   2 mon  

How to remove records from active connections and ip_conntrack by IP

Someone can opens hundreds tabs with autoupdate pages in browser and make lot of persistent open connections to the server. If you want to drop his connections, you have to find him at first:

sudo cat /proc/net/ip_conntrack | grep 'ESTABLISHED' | wc -l
sudo cat /proc/net/ip_conntrack | grep 'ESTABLISHED'
netstat -tulpan | grep 'ESTABLISHED' | wc -l
netstat -tulpan | grep 'ESTABLISHED'

If you found a lot of connections from one IP, check it: (Replace 255.255.255.255 to necessary IP)

sudo cat /proc/net/ip_conntrack | grep 'ESTABLISHED' | grep '255.255.255.255' | wc -l
netstat -tulpan | grep '255.255.255.255' | wc -l
whois 255.255.255.255

Look to the web server logs whether the activity is suspicious:

cat /var/log/nginx/access.log | grep '255.255.255.255'

Then drop user connections:

sudo cutter 255.255.255.255
sudo conntrack -D conntrack --orig-src 255.255.255.255
sudo cat /proc/net/ip_conntrack | grep '255.255.255.255' | wc -l
sudo cat /proc/net/ip_conntrack | grep 'ESTABLISHED' | wc -l
 69   2 mon  
 69   2 mon