Last active
May 13, 2021 06:45
-
-
Save from-unknown/b145af982ee570890907817ffcde76cd to your computer and use it in GitHub Desktop.
Disable Confulence Shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Disable Shortcut | |
// @namespace https://gist.github.com/from-unknown | |
// @version 0.1 | |
// @description disable shortcuts | |
// @author from-unknown | |
// @include */editpage.action?* | |
// @include */createpage.action?* | |
// @run-at document-idle | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
let id = setInterval(()=>{ | |
if(document.querySelector("#wysiwygTextarea_ifr")) { | |
let editor = document.querySelector("#wysiwygTextarea_ifr").contentDocument.querySelector("#tinymce"); | |
editor.addEventListener("focus", () => { | |
if (tinyMCE && tinyMCE.activeEditor) { | |
tinyMCE.activeEditor.shortcuts.remove('ctrl+shift+j', '', ''); | |
tinyMCE.activeEditor.shortcuts.remove('meta+shift+v', '', ''); | |
} | |
}); | |
clearInterval(id); | |
} | |
}, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Confluenceで ctrl+shift+v を有効にして幸せペーストできるようにする
こちらを参考にしたがうまく動作しなかったのでちょっと修正した。
どうやらエディターの読み込みのタイミングが変わったのか、スクリプトが実行される時に要素がまだ存在していない様なので、監視して要素が読み込まれてから処理が実行される様にした。
Ctrl+Shift+Jで日本語に切り替えているのでそちらもショートカットが動作しない様にしている。