0

我的公司在其内部 wiki 中使用 Confluence,这很好,除了编辑器绑定了一些键盘快捷键,这让我很难受。特别是,当我希望它遵守“kill line”的系统默认行为时,它使用 ^K 表示“插入链接”。

我已经找到了插入监听器的相关代码:

$("#markupTextarea").select(function () {
    AJS.Editor.storeTextareaBits(true);
}).keyup(function (e) {
    AJS.Editor.contentChangeHandler();

    if (e.ctrlKey) {
        if (e.keyCode == 75) {// bind ctrl+k to insert link
            return openLinkPopup(e);
        }
        if (e.keyCode == 77) {// bind ctrl+m to insert image
            $("#editor-insert-image").click();
            return false;
        }
    }
}).keydown(function (e) {
    // prevent firefox's default behaviour
    if (e.ctrlKey && e.keyCode == 75) {
        return AJS.stopEvent(e);
    }
}).change(function () {
    AJS.Editor.contentChangeHandler();
});

就上下文而言,他们似乎正在使用自定义版本的 TinyMCE。理想情况下,我想要一个 Chrome 用户脚本,它可以对这些事件侦听器进行核对,但我什至无法通过在 Chrome JS 控制台中对它们执行操作来让它们消失。

我尝试过的事情(主要是在其他人的建议下;我并不是一个出色的 JS 黑客):

$('markupTextarea').unbind('select')——说Object #<HTMLTextAreaElement> has no method 'unbind'

$('markupTextarea').removeEventListener -- doesn't work since I don't have a name to reference these listeners by

I'm pretty much out of ideas.

4

1 回答 1

0

$不是 jQuery。

jQuery('#markupTextarea').unbind('select')

于 2011-06-24T18:07:25.403 回答