-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exposing simpleMDEditor as Javascript object (again) #10409
Comments
Plan is to switch to easymde (#9973), I guess it can be exposed via |
Returning to this now that monaco is being used: it would be great if the But it's just thrown away here:
Most of the customizations described in the Monaco Editor Playground are not possible without the |
I'll look into that. Will probably be an array SimpleMDE will eventually go away (probably replaced by a textarea), see #10729. |
#11739 will fix this. The only tricky part is because the editor is lazy-loaded, you'll need to wait until it is done loading, for example polling for it: function waitForEditor() {
return new Promise(resolve => {
const interval = setInterval(() => {
if (window.codeEditors && window.codeEditors.length) {
clearInterval(interval);
resolve(window.codeEditors);
}
}, 500);
});
}
for (const editor of await waitForEditor()) {
console.log(editor);
} |
Fixes: #10409 Co-authored-by: Lauris BH <lauris@nix.lv>
Fixes: go-gitea#10409 Co-authored-by: Lauris BH <lauris@nix.lv>
[x]
):Description
I think exposing simpleMDEditor as Javascript object from web_src/js/index.js could be very useful for customizing Gitea.
I added this function to web_src/js/index.js:
and that allows me to play with CodeMirror. Fox example:
allowed me to bring popup list after one would use [Alt-u] keyboard shortcut.
I am working on a simple UI in which one could use Gitea to maintain Hugo web site and so far it worked very good but for less tech-savvy people in our team I wanted to bring autocomplete for internal links of the Hugo website. This is the way which allows me to do that.
I played with adding these kind of things via custom templates and it worked great.
Screenshots
The text was updated successfully, but these errors were encountered: