Hi Robert,

While waiting for VE devs to respond, there are a few things you could do to narrow-down the issue:
1. Check what the diff window shows (click on Publish changes, then on the popup "Review your changes" in the lower-left corner).
2. Check if there was actually one or more newline(s) (\n) inserted in wikitext.In this case, the parser probably tries to simplify the wikitext unless a hooman decided otherwise (this seems in line with the "alienInline" you see).

Regards,
  Strainu


În lun., 13 mar. 2023 la 09:37, Robert Vogel via Wikitech-l <wikitech-l@lists.wikimedia.org> a scris:
Hi everyone!
Inspired by https://www.mediawiki.org/wiki/VisualEditor/Gadgets#Implementing_a_custom_command I was trying to add a `<br />` into the VE using this command:

```
ve.init.target.getSurface().getModel().getFragment().insertContent( [ { type: 'break' }, { type: '/break' } ] );
```

While it actually inserted the line break in visual edit mode, there was not `<br />` in the wikitext after saving the page or switching to wikitext mode within the edit session.
I also tried to implement the whole "command/tool" in an extension, but the behavior was the same. The odd thing is that a `<br />` inserted  in wikitext mode survives the round trip. The linear data model shows it as "alienInline" node then.

Any ideas why the official example didn't work for me?

Greetings,
Robert
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/