1.1.2 • Published 5 months ago

summernote-handlebars-autocomplete v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Summernote Handlebars Autocomplete plugin

Summernote handlebars autocomplete plugin for summernote.

Demo

https://summernote-handlebars-autocomplete.ruiluntran.com/

Installation

Include the required files and the plugin file after summernote.min.js file.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.20/summernote-bs4.min.css"/>
        
<div id="summernote"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.20/summernote.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.20/summernote-bs4.min.js"></script>
<script src="../dist/summernote-handlebars-autocomplete.js"></script>

Configuration

To configure the plugin, pass in the options object with the key: handlebarsAutocomplete to summernote.

Example

$('#summernote').summernote({
  placeholder: 'Placeholder',
  handlebarsAutocomplete: {
    getSuggestions: (value) => {
      const suggestions = [
        {
          display: 'userName',
          value: 'ruiluntran'
        },
        {
          display: 'ensDomain',
          value: 'ruiluntran.eth'
        }
      ];
      return suggestions.filter(suggestion => {
        return suggestion.display.includes(value);
      });
    }
  }
});

Credits

Forked from https://github.com/team-loxo/summernote-at-mention

License

The contents of this repository is licensed under The MIT License.