mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Use rare unicode characters for paste placeholders
Helps with bug reporting, like the snowman and pawn. Change-Id: Id133431eea987442c8b50a05821ebd54649b26b9
This commit is contained in:
parent
7cec9ae04a
commit
65aab78d3b
|
@ -794,19 +794,19 @@ ve.ce.Surface.prototype.beforePaste = function ( e ) {
|
|||
// If there is content to the left of the cursor, put a placeholder
|
||||
// character to the left of the cursor
|
||||
if ( selection.start > range.start ) {
|
||||
leftText = 'A';
|
||||
leftText = '☀';
|
||||
context.push( leftText );
|
||||
textStart = textEnd = 1;
|
||||
}
|
||||
// If there is content to the right of the cursor, put a placeholder
|
||||
// character to the right of the cursor
|
||||
if ( selection.end < range.end ) {
|
||||
rightText = 'B';
|
||||
rightText = '☂';
|
||||
context.push( rightText );
|
||||
}
|
||||
// If there is no text context, select some text to be replaced
|
||||
if ( !leftText && !rightText ) {
|
||||
context.push( 'C' );
|
||||
context.push( '☁' );
|
||||
textEnd = 1;
|
||||
}
|
||||
context.push( { 'type': '/' + context[0].type } );
|
||||
|
|
|
@ -445,14 +445,14 @@ QUnit.test( 'beforePaste/afterPaste', function ( assert ) {
|
|||
},
|
||||
{
|
||||
'range': new ve.Range( 4 ),
|
||||
'pasteTargetHtml': 'BfooA',
|
||||
'pasteTargetHtml': '☂foo☀',
|
||||
'expectedRange': new ve.Range( 9 ),
|
||||
'expectedOps': [
|
||||
[
|
||||
{ 'type': 'retain', 'length': 4 },
|
||||
{
|
||||
'type': 'replace',
|
||||
'insert': [ 'B', 'f', 'o', 'o', 'A' ],
|
||||
'insert': [ '☂', 'f', 'o', 'o', '☀' ],
|
||||
'remove': []
|
||||
},
|
||||
{ 'type': 'retain', 'length': 5 }
|
||||
|
|
Loading…
Reference in a new issue