Last modified: 2014-10-23 08:07:29 UTC
While trying to figure out how to better integrate CodeEditor (w/ Ace editing widget) into WikiEditor based on the existing iframe mode, I found that there's some WikiEditor-specific hardcoding still in the jquery.textSelection module: var context = $(this).data( 'wikiEditor-context' ); var hasIframe = typeof context !== 'undefined' && context && typeof context.$iframe !== 'undefined'; // ... retval = ( hasIframe ? context.fn : fn )[command].call( this, options ); It looks like for now, to work with $.textSelection I'll have to pretend to be the WikiEditor iframe plugin. Ideally we probably want something that's not specific to WikiEditor, so it can be used on any textarea-alike that can provide some sort of context functions for the textSelection plugin.
Code still exists in MW core's resources/jquery/jquery.textSelection.js
Possibly related: https://github.com/wikimedia/mediawiki-core/blob/1a8175ed1ca611a67b1eee4e170312a3a4f7f217/resources/mediawiki.action/mediawiki.action.edit.js#L190-L201 // HACK: make $currentFocused work with the usability iframe // With proper focus detection support (HTML 5!) this'll be much cleaner // TODO: Get rid of this WikiEditor code from MediaWiki core! $iframe = $( '.wikiEditor-ui-text iframe' ); (...)
Change 130639 had a related patch set uploaded by Bartosz Dziewoński: jquery.textSelection: Remove hardcoded checks for removed WikiEditor iframe mode https://gerrit.wikimedia.org/r/130639
Change 130639 merged by jenkins-bot: jquery.textSelection: Remove hardcoded checks for removed WikiEditor iframe mode https://gerrit.wikimedia.org/r/130639
Reverted this when I found it seemed to be to blame for a bug where submitting anything from CodeEditor caused it to be lost. (no save made, can't get back the text you made, etc.) Reopening
Change 139690 had a related patch set uploaded by TheDJ: textSelection: Remove references to iframe https://gerrit.wikimedia.org/r/139690
Change 139690 merged by jenkins-bot: jquery.textSelection: Remove references to iframe https://gerrit.wikimedia.org/r/139690
Appears to have been fixed with the above patch. Please reopen if that's not the case.
Bug 68556, another regression, though not as bad this time. Reopening.. This regression is because I failed to realize that the CodeEditor could be disabled in the same session and that this would 'break' the function mapping in: http://git.wikimedia.org/blob/mediawiki%2Fextensions%2FCodeEditor.git/ad908b2da64da4083e10e391153112978fb9df8f/modules%2Fjquery.codeEditor.js#L517 There we basically assign the 'textSelection' api functions into the WikiEditor api. The disabling works fine for the WikiEditor API functions, because they listen to the conditional in L508, but the textSelection APIs are no longer part of the wikiEditor api's and stuff start breaking.
Change 150032 had a related patch set uploaded by TheDJ: jquery.textSelection: register an alt implementation https://gerrit.wikimedia.org/r/150032
Change 150037 had a related patch set uploaded by TheDJ: Split jquery.textSelection and WikiEditor api overrides https://gerrit.wikimedia.org/r/150037
Change 150032 merged by jenkins-bot: jquery.textSelection: Add ability to register custom implementation https://gerrit.wikimedia.org/r/150032
Change 150037 merged by jenkins-bot: Split jquery.textSelection and WikiEditor api overrides https://gerrit.wikimedia.org/r/150037
So… this is really fixed now, isn't it?