Merge "EditCheck: Use getLinearFragment shortcut"

This commit is contained in:
jenkins-bot 2024-10-31 11:32:25 +00:00 committed by Gerrit Code Review
commit 0dfdc3b009
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 ) { mw.editcheck.AddReferenceEditCheck.prototype.onBeforeSave = function ( surfaceModel ) {
return this.findAddedContent( surfaceModel.getDocument() ).map( ( range ) => { 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( { return new mw.editcheck.EditCheckAction( {
highlight: fragment, highlight: fragment,
selection: this.adjustForPunctuation( fragment.collapseToEnd() ), 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 referenceNode = documentModel.getInternalList().getItemNode( index );
const href = ve.ui.CitoidReferenceContextItem.static.getConvertibleHref( referenceNode ); const href = ve.ui.CitoidReferenceContextItem.static.getConvertibleHref( referenceNode );
if ( href ) { if ( href ) {
const fragment = surfaceModel().getFragment( new ve.dm.LinearSelection( node.getOuterRange() ) ); const fragment = surfaceModel().getLinearFragment( node.getOuterRange() );
return new mw.editcheck.EditCheckAction( { return new mw.editcheck.EditCheckAction( {
highlight: fragment, highlight: fragment,
selection: fragment, selection: fragment,

View file

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