Steps to reproduce:
- In VE standalone, edit <p>abc<img src='x'>def</p> .
- Select just the image (so selected range is 4-6).
- Use the Bold action in the menu.
Expected behaviour:
The image gets annotated as bold.
Observed behaviour:
TreeModifier throws an exception with the following stacktrace:
TypeError: a.node.splice is not a function at Object.ve.dm.TreeModifier.static.applyTreeOperation (file:///home/ubuntu/src/ve/src/dm/ve.dm.TreeModifier.js:323:11) at Object.ve.dm.TreeModifier.static.applyTreeOperations (file:///home/ubuntu/src/ve/src/dm/ve.dm.TreeModifier.js:106:8) at VeDmTreeModifier.ve.dm.TreeModifier.process (file:///home/ubuntu/src/ve/src/dm/ve.dm.TreeModifier.js:365:26) at VeDmTransactionProcessor.ve.dm.TransactionProcessor.process (file:///home/ubuntu/src/ve/src/dm/ve.dm.TransactionProcessor.js:111:22) at VeDmDocument.ve.dm.Document.commit (file:///home/ubuntu/src/ve/src/dm/ve.dm.Document.js:341:65) at VeDmSurface.ve.dm.Surface.changeInternal (file:///home/ubuntu/src/ve/src/dm/ve.dm.Surface.js:950:25) at VeDmSurface.ve.dm.Surface.change (file:///home/ubuntu/src/ve/src/dm/ve.dm.Surface.js:918:7) at VeDmSurfaceFragment.ve.dm.SurfaceFragment.change (file:///home/ubuntu/src/ve/src/dm/ve.dm.SurfaceFragment.js:126:15) at VeDmSurfaceFragment.ve.dm.SurfaceFragment.annotateContent (file:///home/ubuntu/src/ve/src/dm/ve.dm.SurfaceFragment.js:767:7) at VeUiAnnotationAction.ve.ui.AnnotationAction.setInternal (file:///home/ubuntu/src/ve/src/ui/actions/ve.ui.AnnotationAction.js:154:11)
This is because when ensureNotText splits the text node, it returns the newly created text node, not the position between the two text nodes.