Page MenuHomePhabricator

Make Linter edit helper compatible with VisualEditor
Closed, ResolvedPublic1 Story Points


Right now Linter has some very basic code to highlight the spot of specific errors: however this isn't compatible with VisualEditor.

Somehow we should have the &lintId= parameter always force the new source editor (or old source editor) instead of VE and then have our highlighting system work.

Event Timeline

Legoktm created this task.Mar 9 2017, 7:33 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 9 2017, 7:33 PM

@Esanders any ideas/suggestions on how to make this work for NWE? new ve.Range( start, end ) )

sets a selection in NWE. The indices are a bit different, though, as the document starts with a <p> tag that counts as 1, and each linebreak is represented by </p><p> increasing the index by 2 instead of 1.

Yeah, for now you would just have to count newlines up to an offset to convert indicies:

function getModelOffsetFromWikitextOffset( offset ) {
    return ( 0, offset ).match( /\n/g ) || [] ).length + 1 + offset;

I'm not aware of other users' need for this so I couldn't say if it's worth us coming up with a better solution yet.

Change 342279 had a related patch set uploaded (by Legoktm):
[mediawiki/extensions/Linter] Support new wikitext editor for edit helper

Thanks for the help so far - I got most of it working except the highlight flashes and then immediately goes away. :(

Change 342915 had a related patch set uploaded (by Jforrester):
[mediawiki/extensions/VisualEditor] Don't load VE or NWE on lint-targetted pages (until that works)

Change 342915 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor] Don't load VE or NWE on lint-targetted pages (until that works)

Change 342279 merged by jenkins-bot:
[mediawiki/extensions/Linter@master] Support new wikitext editor for edit helper

I guess this is just a first attempt but you could easily load all the lint errors for a particular page instead of just one, and let the user scroll through them like findAndReplace results.

Change 350313 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Un-blacklist the lintid parameter

Change 350313 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Un-blacklist the lintid parameter

Jdforrester-WMF closed this task as Resolved.May 4 2017, 5:58 PM
Jdforrester-WMF claimed this task.
Jdforrester-WMF set the point value for this task to 1.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptMay 4 2017, 5:58 PM