mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Merge "EditCheck: Use getLinearFragment shortcut"
This commit is contained in:
commit
0dfdc3b009
|
@ -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