Jump to content

Topic on 2017 wikitext editor/Feedback

Skalman (talkcontribs)

Hi, I'm creating a gadget for improved source editing. Are there any hooks that I can use?

So far, I am aware of the following ways to edit wikitext:

  • Traditional <textarea> (action=edit)
    • Hook: wikipage.editform
    • Edit with: $("#wpTextbox1")
  • Syntax highlighting with CodeMirror (action=edit)
    • Hook: ext.CodeMirror.switch
    • Edit with: elementFromHook.CodeMirror
  • 2017 wikitext editor (veaction=editsource)
    • Hook: ???
    • Edit with: $(".ve-ce-documentNode") - do you have anything more exact?


Also, is there a good way and place to show warnings that the user will see before saving?

Nux (talkcontribs)

Check this out for 2017: VisualEditor/Gadgets#User's position in the model. Seems to work fine for inserting text. Note that you can use `new ve.Range( 0 )` to insert at the beginning of the text.

The hook seems to be `ve.wikitextInteractive`, but haven't tested this.

Skalman (talkcontribs)

Thanks for the pointers, Nux. That link was very helpful!