Javascript – How to insert nuggets when the codeview mode is enabled in my Wysiwyg Summernote Editor

Hello I have my Wysiwyg editor. & # 39;Summer touchwith the mode code View By default, what I want to add is enabled nuggets in the codeview preview, but at summernote, the content is placed in another area of ​​the nugget.

Internally, I've made a process for the codeview mode so as not to disable the tools. I have done exactly that to add words through the nuggets.

The codeview mode is activated when content is inserted into the summernote (callback # onPaste #).

* What I need to know is that inserting a nugget option will immediately activate the focus, which is enabled in writing, and is not outside of my main content area, that is, within the container text area, the & # 39; Codeview & # 39; equals & # 39 ;:

Thanks for your help!

// Start Summernote
(summernote) summernote ({
// We define the tools
Toolbar: [
    ['insert', ['nugget']],
    ['codeview', ['codeview']]],
// We list the nuggets to use
Nugget: {
list: [
      'Alguma Coisa 1',
      'Alguma Coisa 2',
      'Alguma Coisa 3'
    ]
  },
// We execute the recall events
Callbacks: {
// We perform functions when we insert content
onPaste: function (s) {
// Immediately execute the methods after copying some content to view the contents in the & # 39; Codeview & # 39; to obtain.
setTimeout (function () {
// We execute the codeview mode
$ ("div.note-editor button.btn-codeview"). click ();
// We change the background color for white to "codeview" mode
$ ("div.note-editor textarea.note-codable"). css ("background-color", "# EFECE8"). css (& # 39; color & # 39 ;, & # 39; 000 (& # 39;);
// We enable the Nuggets tool to prevent the codeview mode from being blocked
$ ("div.note-editor button.dropdown-toggle") .prop (& # 39; disabled & 39 ;, false) .removeClass (& # 39; disabled & # 39;);
}, 1);
}
},
// Summernote height
Height: 200
});

Insert here the description of the picture