开发者

Adding custom buttons to WMD Editor

开发者 https://www.devze.com 2023-02-05 10:56 出处:网络
Is there a way to add custom buttons to the WMD Editor that extends the editor\'s functionality? My ideas for various buttons I want to add are to:

Is there a way to add custom buttons to the WMD Editor that extends the editor's functionality?

My ideas for various buttons I want to add are to:

Thanks

Turgs


Yes, you can.

1) you need extend the Images "wmd-buttons.jpg"

edit the image and add a button for extended functionality. 2) Add Script for the button to bind with an event(like inserting some text)

        var Insertbutton= document.createElement("li");
        Insertbutton.className = "wmd-button";
        Insertbutton.id = "wmd-insertsometext-button";
        Insertbutton.title = "Emphasis <em> Ctrl+v";
        Insertbutton.XShift = "-60px";
        Insertbutton.textOp = command.inserttext;
        setupButton(inserttextButton, true);
        buttonRow.appendChild(inserttextButton);

3) Now Define inserttext function and place your insertion code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号