I'm trying to reduce users reliance on macros, per customer request. I need them to use macros only through the "+" button on the editor toolbar.
So far, the following jQuery code has not worked, and I've followed all of Confluence tutorials on their Developers' guide.
AJS.toInit(function(){
AJS.$("#d").keypress(function (e) {
var charTyped = String.fromCharCode(e.which);
if (charTyped == "{" || charTyped == "!") {
e.preventDefault();
var sel = window.getSelection();
if (sel.rangeCount > 0) {
var range = sel.getRangeAt(0);
range.deleteContents();
var text = (charTyped == ")") ? "{}" : "()";
var textNode = document.createTextNode(text);
range.insertNode(textNode);
range.setStart(textNode, 1);
range.setEnd(textNode, 1);
sel.removeAllRanges();
sel.addRange(range);
}
}
});
});It works on JSbin, yet there is no result on Confluence. Is there a file that overrides this type of attempts that are trying to affect the autocomplete functionality?
Is there a way I can modify a local js file to disable this functionality for all users?