[MediaWiki-commits] [Gerrit] Check for all important elements when pasting between instances - change (VisualEditor/VisualEditor)

2015-04-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Check for all important elements when pasting between instances
..


Check for all important elements when pasting between instances

It's not just spans that can get corrupted. This fixes the pasting
of block aliens between VE instances in Chrome.

Change-Id: I9f19e2e10d18857e3b3fa8417935408f98c498d0
---
M src/ce/ve.ce.Surface.js
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 33e797e..fc72047 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -1856,7 +1856,7 @@
data, doc, htmlDoc, $images, i,
context, left, right, contextRange,
items = [],
-   importantSpan = 'span[id],span[typeof],span[rel]',
+   importantElement = '[id],[typeof],[rel]',
importRules = this.getSurface().getImportRules(),
beforePasteData = this.beforePasteData || {},
selection = this.model.getSelection(),
@@ -2006,11 +2006,11 @@
if (
// HACK: Allow the test runner to force the use 
of clipboardData
clipboardKey === 'useClipboardData-0' || (
-   $elements.find( importantSpan 
).andSelf().filter( importantSpan ).length > 0 &&
-   this.$pasteTarget.find( importantSpan 
).length === 0
+   $elements.find( importantElement 
).andSelf().filter( importantElement ).length > 0 &&
+   this.$pasteTarget.find( 
importantElement ).length === 0
)
) {
-   // CE destroyed an important span, so revert to 
using clipboard data
+   // CE destroyed an important element, so revert 
to using clipboard data
htmlDoc = ve.createDocumentFromHtml( 
beforePasteData.html );
// Remove the pasteProtect class. See #onCopy.
$( htmlDoc ).find( 'span' ).removeClass( 
've-pasteProtect' );

-- 
To view, visit https://gerrit.wikimedia.org/r/204749
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9f19e2e10d18857e3b3fa8417935408f98c498d0
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Check for all important elements when pasting between instances - change (VisualEditor/VisualEditor)

2015-04-17 Thread Esanders (Code Review)
Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/204749

Change subject: Check for all important elements when pasting between instances
..

Check for all important elements when pasting between instances

It's not just spans that can get corrupted. This fixes the pasting
of block aliens between VE instances in Chrome.

Change-Id: I9f19e2e10d18857e3b3fa8417935408f98c498d0
---
M src/ce/ve.ce.Surface.js
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/49/204749/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 33e797e..fc72047 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -1856,7 +1856,7 @@
data, doc, htmlDoc, $images, i,
context, left, right, contextRange,
items = [],
-   importantSpan = 'span[id],span[typeof],span[rel]',
+   importantElement = '[id],[typeof],[rel]',
importRules = this.getSurface().getImportRules(),
beforePasteData = this.beforePasteData || {},
selection = this.model.getSelection(),
@@ -2006,11 +2006,11 @@
if (
// HACK: Allow the test runner to force the use 
of clipboardData
clipboardKey === 'useClipboardData-0' || (
-   $elements.find( importantSpan 
).andSelf().filter( importantSpan ).length > 0 &&
-   this.$pasteTarget.find( importantSpan 
).length === 0
+   $elements.find( importantElement 
).andSelf().filter( importantElement ).length > 0 &&
+   this.$pasteTarget.find( 
importantElement ).length === 0
)
) {
-   // CE destroyed an important span, so revert to 
using clipboard data
+   // CE destroyed an important element, so revert 
to using clipboard data
htmlDoc = ve.createDocumentFromHtml( 
beforePasteData.html );
// Remove the pasteProtect class. See #onCopy.
$( htmlDoc ).find( 'span' ).removeClass( 
've-pasteProtect' );

-- 
To view, visit https://gerrit.wikimedia.org/r/204749
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f19e2e10d18857e3b3fa8417935408f98c498d0
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits