开发者

Removing toolbar buttons from the WMD Editor by Derobins

I am trying-out Derobins WMD Editor but would like to know where I can remove some of the buttons at the header since I do开发者_如何学Cn't need them in my PHP app.

Buttons like image, anchor link etc.


In the wmd.js file, there is a function called makeSpritedButtonRow which is used to create each of the buttons on the menu. This is located around line 913 of the file.

The code to create each button is grouped together and to disable a button you need to comment out the code block for the button you want to remove.

Example

Below is an extract from the top of the function.

var makeSpritedButtonRow = function(){

    var buttonBar = document.getElementById("wmd-button-bar");

    var normalYShift = "0px";
    var disabledYShift = "-20px";
    var highlightYShift = "-40px";

    var buttonRow = document.createElement("ul");
    buttonRow.id = "wmd-button-row";
    buttonRow = buttonBar.appendChild(buttonRow);


    var boldButton = document.createElement("li");
    boldButton.className = "wmd-button";
    boldButton.id = "wmd-bold-button";
    boldButton.title = "Strong <strong> Ctrl+B";
    boldButton.XShift = "0px";
    boldButton.textOp = command.doBold;
    setupButton(boldButton, true);
    buttonRow.appendChild(boldButton);

To disable the bold button in your application, comment out the code block for the boldButton so it looks like the code below.

var makeSpritedButtonRow = function(){

    var buttonBar = document.getElementById("wmd-button-bar");

    var normalYShift = "0px";
    var disabledYShift = "-20px";
    var highlightYShift = "-40px";

    var buttonRow = document.createElement("ul");
    buttonRow.id = "wmd-button-row";
    buttonRow = buttonBar.appendChild(buttonRow);

    // var boldButton = document.createElement("li");
    // boldButton.className = "wmd-button";
    // boldButton.id = "wmd-bold-button";
    // boldButton.title = "Strong <strong> Ctrl+B";
    // boldButton.XShift = "0px";
    // boldButton.textOp = command.doBold;
    // setupButton(boldButton, true);
    // buttonRow.appendChild(boldButton);

This will remove the button.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜