Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created December 22, 2023 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/314158be57c890ff2562dc835389a8f7 to your computer and use it in GitHub Desktop.
Save bjoerntx/314158be57c890ff2562dc835389a8f7 to your computer and use it in GitHub Desktop.
// cancel the click handler of the "Footnote" menu item
TXTextControl.addEventListener("contextMenuOpening", (e) => {
// check if e.items contains an entry where property text == "Insert"
const index = e.items.findIndex((i) => i.text === "Insert");
// check if e.items[index].items contains an entry where property text == "Footnote"
const index2 = e.items[index].items.findIndex((i) => i.text === "Footnote");
// if so, cancel the click handler
e.items[index].items[index2].clickHandler = function(e) {
e.cancel = true; alert("Footnote is disabled");
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment