Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add prism to summernote

Is there any way to add a button for prism in summernote editor?

I have prism css and js file included in my view but i don't know how to add button for it in editor:

$(document).ready(function() {
  $('.summernote').summernote({
      minHeight: 200,
      toolbar: [
         ['style', ['style', 'bold', 'italic', 'underline', 'clear']],
         ['font', ['strikethrough', 'superscript', 'subscript']],
         ['fontsize', ['fontsize', 'fontname', 'fontsizeunit', 'height']],
         ['color', ['color']],
         ['para', ['ul', 'ol', 'paragraph']],
         ['table', ['table']],
         ['insert', ['link', 'emoji', 'picture', 'video']],
         ['view', ['fullscreen', 'codeview', 'help']]
      ]
  });
});

Any idea?

like image 394
mafortis Avatar asked Feb 05 '20 09:02

mafortis


People also ask

How do I customize my Summernote toolbar?

If you look on the main Summernote website as opposed to the API docs you will see a clear example, that explains how to customise the toolbar. It is on the Deep Dive page and scroll down to Custom Toolbar. It also lists the available toolbar buttons. In your toolbar you set ['style', ['bold', 'italic',...

How do I add summer notes?

First, download the minified precompiled version of Summernote from the official website. Extract it & place it in the current working folder. Create an index. html file & declare the Bootstrap & jQuery links inside the <head> tag.


1 Answers

Solved

I fixed my issue by creating a plugin for summernote as well as package for others to use

Screenshots

editor editor

view

view

Package links

NPM

GitHub

Hope it help others as well.

like image 51
mafortis Avatar answered Oct 01 '22 06:10

mafortis