Hello, I try to insert wikitext like <br>
with gadget in order to not pass by the wikitext Editor so I try this after looking in the wiki.
ve.ui.commandRegistry.register(
new ve.ui.Command(
// Command name
'myBreak',
// Type and name of the action to execute
'content', 'insert', // Calls the ve.ui.ContentAction#insert method
{
// Extra arguments for the action
args: [
// Content to insert
[
'\n',
ve.init.target.getSurface().getModel().getFragment().insertHtml('<br>')
],// Annotate content to match surrounding annotations?
false,
// Move cursor to after the new content? (otherwise - select it)
true],
supportedSelections: [ 'linear' ]
}));
But I have an error at the line 35 when I test my gadget here is the error in the consol.
Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'VeDmDocument'
| property 'bindings' -> object with constructor 'Object'
| property 'transact' -> object with constructor 'Array'
| ...
| property 'context' -> object with constructor 'VeDmInternalList'
--- property 'document' closes the circle
at JSON.stringify (<anonymous>)
at VeDmSurface.ve.dm.Surface.storeChanges (load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:178:921)
at VeDmSurface.OO.EventEmitter.emit (<anonymous>:445:652)
at VeDmSurface.ve.dm.Surface.breakpoint (load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:174:240)
ve.dm.Surface.storeChanges @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:178
OO.EventEmitter.emit @ VM3027:445
ve.dm.Surface.breakpoint @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:174
setTimeout (asynchrone)
OO.EventEmitter.emit @ VM3027:445
ve.dm.Surface.breakpoint @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:174
setInterval (asynchrone)
ve.dm.Surface.startHistoryTracking @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:161
ve.dm.Surface.resetHistoryTrackingInterval @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:162
ve.dm.Surface.breakpoint @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:173
ve.ce.Surface.handleObservedChanges @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:484
ve.ce.SurfaceObserver.pollOnceInternal @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:508
ve.ce.SurfaceObserver.pollOnce @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:508
ve.ce.Surface.afterDocumentMouseUp @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:440
setTimeout (asynchrone)
ve.ce.Surface.onDocumentMouseUp @ load.php?lang=fr&modules=ext.visualEditor.core%2Cmwtransclusion&skin=timeless&version=3ben0:440
dispatch @ load.php?lang=fr&modules=ext.CodeMirror.lib%7Cext.HighlightjsIntegration%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets%7Cjquery.ui%7Coojs-ui.styles.icons-editing-advanced&skin=timeless&version=1l7ie:475
elemData.handle @ load.php?lang=fr&modules=ext.CodeMirror.lib%7Cext.HighlightjsIntegration%7Cjquery%2Coojs-ui-core%2Coojs-ui-widgets%7Cjquery.ui%7Coojs-ui.styles.icons-editing-advanced&skin=timeless&version=1l7ie:471
I don't understand this error or how to resolved it.
so if someone has a hint I would be thankful. Thank you