mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 14:06:52 +00:00
EditCheck: Use getLinearFragment shortcut
Change-Id: I53859c24567e01e24ff46a88799ee0edadbd8e1b
This commit is contained in:
parent
d06e9dbc31
commit
f3930e7e12
|
@ -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() ),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue