Page MenuHomePhabricator

CodeEditor Hook for editing formulas
Open, LowestPublic

Description

Hi,

I am looking to add my snippets and autcompletions to the code editor. But I wanted to create these files outside the extension repo . So , I was lookign for a JS hook , so that , as soon Ace is loaded , my script is also loaded. Unfortunately , I couldn't find one.

The hook listed in the documentation is mediawiki hook codeEditor.configure.

When it says that it is possible to change the configuration of the ACE editor, by hooking into the MediaWiki JS hook codeEditor.configure
it seems that this hook is fired only when the page has content model of js, css or json (by looking here ). Any chance that this hook will be fired also when editing a math formula? I want to use the Ace editor session manage some math snippets

Event Timeline

Jdforrester-WMF subscribed.

I'm not sure that this is about the VisualEditor integration of the CodeEditor software, or just how the MediaWiki extension works? Assuming the latter.

@Falitjain Where are you using the Codeeditor, in the Visual Editor's Math panel ?

Yes , while editing the formulas.
If we add the codeeditor in Visual Editor , it is used by code block and insert formulas.

This hook is not fired by the Visual Editor plugin right now.

Also if anyone were to work on this, note the hook currently only passes the session, and not the editor config.. And I think that officially it's not proper usage of the hook strategy to begin with (which is about DOM, though you could argue the ACE objects basically wrap DOM.