在页面向下隐藏按钮

时间:2012-11-08 14:16:27

标签: pagedown

我现在在我的网站上使用pagedown,到目前为止它很棒,唯一的细节是 它不是一个面向编程的网站,所以我想删除“代码”按钮。

我有办法吗?我尝试使用CSS隐藏按钮,但html的内联样式为“left:xxx”,我无法使用CSS更改。

提前致谢!

2 个答案:

答案 0 :(得分:3)

如果您打开Markdown.Editor.js,并滚动到大约1360行(根据您使用的版本而有所不同),您将看到一个区域:

group1 = makeGroup(1);
buttons.bold = makeButton("wmd-bold-button", "Bold - Ctrl+B", "icon-bold", bindCommand("doBold"), group1);
buttons.italic = makeButton("wmd-italic-button", "Italic - Ctrl+I", "icon-italic", bindCommand("doItalic"), group1);

group2 = makeGroup(2);
buttons.link = makeButton("wmd-link-button", "Link - Ctrl+L", "icon-link", bindCommand(function (chunk, postProcessing) {
  return this.doLinkOrImage(chunk, postProcessing, false);
}), group2);
buttons.quote = makeButton("wmd-quote-button", "Blockquote - Ctrl+Q", "icon-blockquote", bindCommand("doBlockquote"), group2);
buttons.code = makeButton("wmd-code-button", "Code Sample - Ctrl+K", "icon-code", bindCommand("doCode"), group2);
buttons.image = makeButton("wmd-image-button", "Image - Ctrl+G", "icon-picture", bindCommand(function (chunk, postProcessing) {
  return this.doLinkOrImage(chunk, postProcessing, true);
}), group2);

等等。只需引出您不想要的按钮。

或者,你可以简单地省略整个wmd-buttons div,只使用编辑器和预览组件。

答案 1 :(得分:0)

  • 在代码中搜索doClick(buttons.code)并将其注释

  • 如果你看一下makeButton函数:

    var makeButton = function (id, title, XShift, textOp) {
    var button = document.createElement("li");
    button.className = "wmd-button";
    button.style.left = xPosition + "px";
    xPosition += 25;
    var buttonImage = document.createElement("span");
    button.id = id + postfix;
    button.appendChild(buttonImage);
    button.title = title;
    button.XShift = XShift;
    if (textOp)
        button.textOp = textOp;
    setupButton(button, true); // <--- LOOK HERE
    buttonRow.appendChild(button);
    return button;
    

    };

true函数调用中传递的setupButtonisEnabled标志。我所做的只是创建了另一个makeButton函数并将其放在第一个函数下面。我改变的唯一事情是isEnabled标志false。然后我更改为button.code = makeButton(...)button.code = makeButton2(...)

buttons.code = makeButton2("wmd-code-button", getString("code"), "-80px", bindCommand("doCode"));