Create a toolbarReady hook for attaching toolbar tools

Using an event introduces a race condition where the extension
adding the listener has to do so before WikiEditor finishes loading.

Change-Id: I5a8dc6f8fd1b1939b5d98307b20ef1fd355cee99
This commit is contained in:
Ed Sanders 2020-04-21 15:28:40 +01:00
parent d86e85e26d
commit 8e9d306510
2 changed files with 3 additions and 1 deletions

View file

@ -1,6 +1,6 @@
{
"name": "WikiEditor",
"version": "0.5.2",
"version": "0.5.3",
"author": [
"Derk-Jan Hartman",
"Trevor Parscal",

View file

@ -768,6 +768,8 @@
}
setTimeout( function () {
context.$textarea.trigger( 'wikiEditor-toolbar-doneInitialSections' );
// Use hook for attaching new toolbar tools to avoid race conditions
mw.hook( 'wikiEditor.toolbarReady' ).fire( context.$textarea );
} );
}
}