2012-11-08 107 views
3

我在我的網站上使用pagedown,目前爲止很棒,唯一的細節是 它不是一個面向程序設計的網站,所以我想刪除'code'按鈕。隱藏頁面向下的按鈕

有沒有辦法做到這一點?我嘗試使用CSS來隱藏按鈕,但HTML有內聯樣式「left:xxx」,我無法使用CSS進行更改。

在此先感謝!

回答

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,只使用編輯器和預覽組件。

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; 
    

    };

是在setupButton函數的調用傳遞的trueisEnabled標誌。我所做的只是創建了另一個makeButton函數,並將其放在第一個函數下。我唯一改變的是isEnabled標誌到false。然後我改爲button.code = makeButton(...)button.code = makeButton2(...)

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