Insert HTML in NicEdit WYSIWYG

后端 未结 7 1524
忘了有多久
忘了有多久 2020-12-11 06:40

How can I insert text/code at the cursors place in a div created by NicEdit?

I\'ve tried to read the documentation and create my own plugin, but I want it to work wi

相关标签:
7条回答
  • 2020-12-11 07:25

    Insert Html Plugin

    Don't know if this will help or not, but this is the plugin I created for inserting Html at the cursor position. The button opens a content pane and I just paste in the html I want and submit. Works for me!

    var nicMyhtmlOptions = {
        buttons : {
          'html' : {name : 'Insert Html', type : 'nicMyhtmlButton'}
        },iconFiles : {'html' : '/nicedit/html_add.gif'}
    
    };
    
    var nicMyhtmlButton=nicEditorAdvancedButton.extend({
          addPane: function () {
          this.addForm({
            '': { type: 'title', txt: 'Insert Html' },
            'code' : {type : 'content', 'value' : '', style : {width: '340px', height : '200px'}}
          });
        },
    
        submit : function(e) {
          var mycode = this.inputs['code'].value;
          this.removePane();
          this.ne.nicCommand('insertHTML', mycode );
        }
    
    });
    nicEditors.registerPlugin(nicPlugin,nicMyhtmlOptions);
    

    I used the html_add icon from Silk Icons, pasted onto a transparent 18 x 18 and saved as gif in the same folder as nicEditorIcons.gif.

    0 讨论(0)
提交回复
热议问题