Created
November 27, 2018 11:54
-
-
Save stevenhao/0c5356ce0fbfcd57f81cb601256a34fd to your computer and use it in GitHub Desktop.
Expose ace editor when its module is globally loaded
This file contains hidden or 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 Ace Editor Exposer | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://modeanalytics.com/* | |
// @grant none | |
// ==/UserScript== | |
const ace = window.ace; | |
window.aceEditors = []; | |
console.debug('found ace module', ace); | |
const oldEdit = ace.edit.bind(ace); | |
ace.edit = function(...args) { | |
const editor = oldEdit(...args); | |
const element = args[0]; | |
window.aceEditors.push({ | |
editor, | |
element, | |
}); | |
return editor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment