PageSourceSearch

https://finite.solutions/front-v2.2.1/assets/js/components/hs.summernote-editor.js

js finite.solutions collected 2026-09-29 15:49:24 UTC 2,276 bytes, 94 lines download raw bytes

1/**
2* Summernote editor wrapper.
3*
4* @author Htmlstream
5* @version 1.0
6*
7*/
8;(function ($) {
9  'use strict';
10
11  $.HSCore.components.HSSummernoteEditor = {
12    /**
13    *
14    *
15    * @var Object _baseConfig
16    */
17    _baseConfig: {
18      height: 100,
19      placeholder: ''
20    },
21
22    /**
23    *
24    *
25    * @var jQuery pageCollection
26    */
27    pageCollection: $(),
28
29    /**
30    * Initialization of Summernote editor wrapper.
31    *
32    * @param String selector (optional)
33    * @param Object config (optional)
34    *
35    * @return jQuery pageCollection - collection of initialized items.
36    */
37
38    init: function (selector, config) {
39
40      this.collection = selector && $(selector).length ? $(selector) : $();
41      if (!$(selector).length) return;
42
43      this.config = config && $.isPlainObject(config) ?
44      $.extend({}, this._baseConfig, config) : this._baseConfig;
45
46      this.config.itemSelector = selector;
47
48      this.initSummernoteEditor();
49
50      return this.pageCollection;
51
52    },
53
54    initSummernoteEditor: function () {
55      //Variables
56      var $self = this,
57      config = $self.config,
58      collection = $self.pageCollection;
59
60      //Actions
61      this.collection.each(function (i, el) {
62        //Variables
63        var $this = $(el),
64        height = !!$this.data('height') ? $this.data('height') : config.height,
65        mentions = !!$this.data('mentions') ? JSON.parse(el.getAttribute('data-mentions')) : [],
66        placeholder = !!$this.data('placeholder') ? $this.data('placeholder') : config.placeholder;
67
68        console.log(mentions);
69
70        $this.summernote({
71          height: height,
72          placeholder: placeholder,
73          hint: !!$this.data('mentions') ? {
74            mentions: mentions,
75            match: /\B@(\w*)$/,
76            search: function (keyword, callback) {
77              callback($.grep(this.mentions, function (item) {
78                return item.indexOf(keyword) == 0;
79              }));
80            },
81            content: function (item) {
82              return '@' + item;
83            }
84          } : false,
85        });
86
87        //Actions
88        collection = collection.add($this);
89      });
90    }
91
92  };
93
94})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.