EditCheck: Use getLinearFragment shortcut

Change-Id: I53859c24567e01e24ff46a88799ee0edadbd8e1b
This commit is contained in:
Ed Sanders 2024-10-30 20:28:14 +00:00
parent d06e9dbc31
commit f3930e7e12
3 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ mw.editcheck.AddReferenceEditCheck.static.description = ve.msg( 'editcheck-dialo
mw.editcheck.AddReferenceEditCheck.prototype.onBeforeSave = function ( surfaceModel ) {
return this.findAddedContent( surfaceModel.getDocument() ).map( ( range ) => {
const fragment = surfaceModel.getFragment( new ve.dm.LinearSelection( range ) );
const fragment = surfaceModel.getLinearFragment( range );
return new mw.editcheck.EditCheckAction( {
highlight: fragment,
selection: this.adjustForPunctuation( fragment.collapseToEnd() ),

View file

@ -20,7 +20,7 @@ mw.editcheck.ConvertReferenceEditCheck.prototype.onDocumentChange = function ( s
const referenceNode = documentModel.getInternalList().getItemNode( index );
const href = ve.ui.CitoidReferenceContextItem.static.getConvertibleHref( referenceNode );
if ( href ) {
const fragment = surfaceModel().getFragment( new ve.dm.LinearSelection( node.getOuterRange() ) );
const fragment = surfaceModel().getLinearFragment( node.getOuterRange() );
return new mw.editcheck.EditCheckAction( {
highlight: fragment,
selection: fragment,

View file

@ -19,7 +19,7 @@ mw.editcheck.TextMatchEditCheck.prototype.onDocumentChange = function ( surfaceM
const actions = [];
this.constructor.static.replacers.forEach( ( replacer ) => {
surfaceModel.getDocument().findText( replacer.query ).forEach( ( range ) => {
const fragment = surfaceModel.getFragment( new ve.dm.LinearSelection( range ) );
const fragment = surfaceModel.getLinearFragment( range );
actions.push(
new mw.editcheck.EditCheckAction( {
highlight: fragment,