Hello! I want to develop a VE gadget which wraps the selected Text with a <div class='mw-collapsible'>...</div>. I found out how to replace the text. But the editor puts a nowiki-tag around my replacement. How can I prevent this? Greetings, Till-Jonas
Topic on VisualEditor/Feedback
Maybe eranroz can help you?
I don't speak Hebrew or which language these interesting characters come from...
The simplest solution is to wrap text with template in similar way to VisualEditor gadgets#Adding templates and VisualEditor gadgets#Replacing text. Using template instead of html tag may be preferred choice as it is more natural in wiki. But if you really want to add div with no templates, than you should probably create annotation class (e.g to inherit ve.dm.Annotation) and than use
var fragment = ve.instances[0].getModel().getFragment();
fragment.annotateContent( 'set', 'collapsible');//assuming there is collapsible definition...
You can ask for tips and extra help on ve.dm in general in #mediawiki-visualeditor on freenode IRC.