How do you disable the autocomplete macros collectively, in "The Editor"?

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? 

1 answer

This widget could not be displayed.
Ann Worley Atlassian Team Oct 31, 2017

We don't recommend altering the behavior of the editor using JQuery. It could lead to unpredictable behavior in the editor.

Each user's profile has an autocomplete setting that can be disabled: Enabling and disabling autocomplete. I tested and when I disabled that setting the macro menu did not come up when I typed { into the editor.

You are right @Ann Worley, disabling the autocomplete setting works, yet you have to flip this switch, on each user's account manually. This is not efficient from an Admin perspective.

Likewise, the "@", "//", and other keyboard shortcuts are disabled when you turn the autocomplete setting off. We only need to disable the "{" and "!" keyboard shortcuts collectively for all of our Confluence users.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

388 views 3 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you