Skip to content

Instantly share code, notes, and snippets.

@foeken
Created March 13, 2021 15:19
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 foeken/e08cb2211c2d75b027efdfe166842bc3 to your computer and use it in GitHub Desktop.
Save foeken/e08cb2211c2d75b027efdfe166842bc3 to your computer and use it in GitHub Desktop.
Fix Chinese page creation in Roam Research
// Fix broken page creation for Chinese
document.addEventListener('input', function(e){
var elem = e.target;
var pos = elem.selectionStart;
if (elem.nodeName != 'TEXTAREA' || e.data != '【') return;
elem.value = elem.value.replace('【','[]');
elem.setSelectionRange(pos, pos);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment