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 ) {
|
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() ),
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue