Provide a system for prompting the user to do things as they edit
Open, HighPublic40 Story Points

Description

Creation of this task was suggested by @Jdforrester-WMF on the wikitech-l [1].

The goal is to discuss how extension developers can bind on (public) events in VisualEditor to alter its behavior.
As an example, this is the case from the mailing list:

I want to check if a category is set and if it is not, show a message window to the user before he/she can save. I've already implemented a serverside check and the API returns an error if no category is set. But this API error message cannot be styled/customized and it gets displayed after the user clicked "save".

This would need some kind of "pre-save" hook that one can bind to. James told me that there are some plans for such a system. Maybe we can share thoughts about it here.

[1] http://markmail.org/thread/zhllqe53z5k56g4g#query:+page:1+mid:o7szui2x6tjf65p6+state:results

Osnard created this task.Aug 28 2015, 7:19 AM
Osnard updated the task description. (Show Details)
Osnard raised the priority of this task from to Needs Triage.
Osnard added a project: VisualEditor.
Osnard added a subscriber: Osnard.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 28 2015, 7:19 AM
Florian updated the task description. (Show Details)Aug 28 2015, 8:32 AM
Florian set Security to None.
Florian added subscribers: Florian, Jdforrester-WMF.

What is the category and the message you need to display? I'd rather we had a system for showing warnings in real time.

Alternatively you could override the save dialog.

I think "providing a system for prompting the user to do things as they edit" (with configurable save-blocking behaviour) is something we could get behind, yes. Would that suffice?

Legoktm renamed this task from API/Hooks to intercept certain events to API/Hooks to intercept certain events in VisualEditor.Aug 28 2015, 5:53 PM

@Esanders: I just want to perform some checks on the page content (one example is "Has the user assigned at least one category?") before I allow the user to submit the change. In case that the checks fail I need at least a way to notify the user (e.g. by a message dialog box) about it. Even better if I could give the user some options (e.g. opening up the "category" dialog after the user clicks OK on the message box).

When you say "showing warinings in realtime" what do you mean exactly? Have some kind of "validate" callback be run everytime the page model is updated? Maybe there could be a unified place to show such validation errors/warnings?

Overriding the save dialog is a nice idea. I will check that option.

Jdforrester-WMF renamed this task from API/Hooks to intercept certain events in VisualEditor to Provide a system for prompting the user to do things as they edit.Sep 8 2015, 7:06 PM
Jdforrester-WMF triaged this task as High priority.
Jdforrester-WMF edited projects, added Design; removed Architecture.
Jdforrester-WMF moved this task from To Triage to Backlog on the VisualEditor board.
Jdforrester-WMF added a subscriber: Nirzar.

Some quick thoughts about the kinds of prompts we might want to see:

Generic page-level prompts – automatically marked as "done", maybe with a %age bar of completion

  • This article should have an infobox
  • This article should have a lead image
  • This article should have some references
  • This article should have a references section
  • This article should have an external links section
  • This article should have some links to other articles
  • This article is very long and should be split into multiple pages
  • This article's talk page discussions about "X"

Content-contextual prompts – automatically marked as "done" when the context changes

  • This article's lede section is too long compared to the rest of it
  • This paragraph has no references
  • This paragraph has no links to other articles
  • This paragraph has too many links to other articles
  • This paragraph is very long and should be shorter
  • This run of paragraphs has no illustration

Edit-contextual prompts – automatically marked as "done" when the edit changes (expensive!)

  • Your edit will be blocked because…

[Difficult to do without making evading AbuseFilters and SpamBlacklist etc. too easy]

Template-driven non-contextual reminders – not clear how a [Done] button could work; move to meta-data?

  • {{use AmEng}} → This article is marked as needing to be written in American English.
  • {{use BrEng}} → This article is marked as needing to be written in British English.
  • {{use mdy dates}} → This article is marked as needing to be written with stupid dates.
  • {{use dmy dates}} → This article is marked as needing to be written with sane dates.

Template-driven non-contextual prompts – with a [Done] button that removes the template

  • {{cn}} → This statement needs to be referenced or removed.
  • {{underlinked}} → This article is marked as not having enough links to other articles.
  • {{overlinked}} → This article is marked as having too many links to other articles.
  • {{MOS}} → This article is marked as needing re-writing.
  • {{lead rewrite}} → This article's lede is marked as needing re-writing to give more context.
  • {{lead too short}} → This article's lede is marked as too short.
  • {{lead too long}} → This article's lede is marked as too lengthy.
  • {{sections}} → This article is marked as needing to be divided into sections.

Template-driven contextual prompts – with a [Done] button that removes the template

  • {{stub}} → This article is marked as a stub [but is long enough to not be].
  • {{as of}} → This information is marked as from [two years ago]; do you have more recent data?
  • {{dead end}} → This article is marked as having no links to other articles, but has [six].
  • {{lead missing}} → This article is marked as missing a lede, [but has one].

Additional thoughts

  • We'd want to have these defined on-wiki (e.g. the template names) so the editors can control things.
  • We'd want to keep it relatively high-level at first, and performant which may prevent some of these options (e.g. scanning for one of 27k stub templates).
  • Potentially we may need to get wikis to adjust their templates and workflows slightly (e.g. adding templatedata for kinds of template).
  • It'd be nice to let users add the tags as well as fulfill them, but we'd want to encourage cleanup over whining.
  • We'd probably want to define some core rules at the project (== Wikipedia / Wiktionary / …) level, which would then be extended by each language editing (== English Wikipedia / French Wiktionary / …).
  • This system isn't going to be expandable to the wikitext editor without re-doing that interface first, so we'd probably roll it out for users of the visual editor at first.
  • In the future we could extend this for WikiProjects, though dealing with competing demands between projects would be tiresome (e.g. different demands of which infobox template to use; there can be only one…).
  • We'll need to keep an eye on each wiki's localisation, in case they make the warning messages too nasty and off-putting. These are meant to be constructive, encouraging comments.
Elitre added a subscriber: Elitre.Feb 11 2016, 5:11 PM

Awesome. This is more than I have ever expected. Unfortunately I've only very little experience with VisualEditor. And this seems to be more a task for the VE core delevopers. If I can be of any help though, please let me know.