Merge branch 'MDL-49671-27' of git://github.com/merrill-oakland/moodle into MOODLE_27_STABLE
This commit is contained in:
+8
-20
@@ -700,28 +700,15 @@ EditorClean.prototype = {
|
||||
var event = sourceEvent._event;
|
||||
// Check if we have a valid clipboardData object in the event.
|
||||
// IE has a clipboard object at window.clipboardData, but as of IE 11, it does not provide HTML content access.
|
||||
if (event && event.clipboardData && event.clipboardData.getData) {
|
||||
// Check if there is HTML type to be pasted, this is all we care about.
|
||||
if (event && event.clipboardData && event.clipboardData.getData && event.clipboardData.types) {
|
||||
// Check if there is HTML type to be pasted, if we can get it, we want to scrub before insert.
|
||||
var types = event.clipboardData.types;
|
||||
var isHTML = false;
|
||||
// Different browsers use different things to hold the types, so test various functions.
|
||||
if (!types) {
|
||||
isHTML = false;
|
||||
} else if (typeof types.contains === 'function') {
|
||||
// Different browsers use different containers to hold the types, so test various functions.
|
||||
if (typeof types.contains === 'function') {
|
||||
isHTML = types.contains('text/html');
|
||||
} else if (typeof types.indexOf === 'function') {
|
||||
isHTML = (types.indexOf('text/html') > -1);
|
||||
if (!isHTML) {
|
||||
if ((types.indexOf('com.apple.webarchive') > -1) || (types.indexOf('com.apple.iWork.TSPNativeData') > -1)) {
|
||||
// This is going to be a specialized Apple paste paste. We cannot capture this, so clean everything.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We don't know how to handle the clipboard info, so wait for the clipboard event to finish then fallback.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isHTML) {
|
||||
@@ -756,13 +743,14 @@ EditorClean.prototype = {
|
||||
this.updateOriginal();
|
||||
return false;
|
||||
} else {
|
||||
// This is a non-html paste event, we can just let this continue on and call updateOriginalDelayed.
|
||||
this.updateOriginalDelayed();
|
||||
// Due to poor cross browser clipboard compatibility, the failure to find html doesn't mean it isn't there.
|
||||
// Wait for the clipboard event to finish then fallback clean the entire editor.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// If we reached a here, this probably means the browser has limited (or no) clipboard support.
|
||||
// Wait for the clipboard event to finish then fallback.
|
||||
// Wait for the clipboard event to finish then fallback clean the entire editor.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
+8
-20
@@ -697,28 +697,15 @@ EditorClean.prototype = {
|
||||
var event = sourceEvent._event;
|
||||
// Check if we have a valid clipboardData object in the event.
|
||||
// IE has a clipboard object at window.clipboardData, but as of IE 11, it does not provide HTML content access.
|
||||
if (event && event.clipboardData && event.clipboardData.getData) {
|
||||
// Check if there is HTML type to be pasted, this is all we care about.
|
||||
if (event && event.clipboardData && event.clipboardData.getData && event.clipboardData.types) {
|
||||
// Check if there is HTML type to be pasted, if we can get it, we want to scrub before insert.
|
||||
var types = event.clipboardData.types;
|
||||
var isHTML = false;
|
||||
// Different browsers use different things to hold the types, so test various functions.
|
||||
if (!types) {
|
||||
isHTML = false;
|
||||
} else if (typeof types.contains === 'function') {
|
||||
// Different browsers use different containers to hold the types, so test various functions.
|
||||
if (typeof types.contains === 'function') {
|
||||
isHTML = types.contains('text/html');
|
||||
} else if (typeof types.indexOf === 'function') {
|
||||
isHTML = (types.indexOf('text/html') > -1);
|
||||
if (!isHTML) {
|
||||
if ((types.indexOf('com.apple.webarchive') > -1) || (types.indexOf('com.apple.iWork.TSPNativeData') > -1)) {
|
||||
// This is going to be a specialized Apple paste paste. We cannot capture this, so clean everything.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We don't know how to handle the clipboard info, so wait for the clipboard event to finish then fallback.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isHTML) {
|
||||
@@ -753,13 +740,14 @@ EditorClean.prototype = {
|
||||
this.updateOriginal();
|
||||
return false;
|
||||
} else {
|
||||
// This is a non-html paste event, we can just let this continue on and call updateOriginalDelayed.
|
||||
this.updateOriginalDelayed();
|
||||
// Due to poor cross browser clipboard compatibility, the failure to find html doesn't mean it isn't there.
|
||||
// Wait for the clipboard event to finish then fallback clean the entire editor.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// If we reached a here, this probably means the browser has limited (or no) clipboard support.
|
||||
// Wait for the clipboard event to finish then fallback.
|
||||
// Wait for the clipboard event to finish then fallback clean the entire editor.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
|
||||
+8
-20
@@ -135,28 +135,15 @@ EditorClean.prototype = {
|
||||
var event = sourceEvent._event;
|
||||
// Check if we have a valid clipboardData object in the event.
|
||||
// IE has a clipboard object at window.clipboardData, but as of IE 11, it does not provide HTML content access.
|
||||
if (event && event.clipboardData && event.clipboardData.getData) {
|
||||
// Check if there is HTML type to be pasted, this is all we care about.
|
||||
if (event && event.clipboardData && event.clipboardData.getData && event.clipboardData.types) {
|
||||
// Check if there is HTML type to be pasted, if we can get it, we want to scrub before insert.
|
||||
var types = event.clipboardData.types;
|
||||
var isHTML = false;
|
||||
// Different browsers use different things to hold the types, so test various functions.
|
||||
if (!types) {
|
||||
isHTML = false;
|
||||
} else if (typeof types.contains === 'function') {
|
||||
// Different browsers use different containers to hold the types, so test various functions.
|
||||
if (typeof types.contains === 'function') {
|
||||
isHTML = types.contains('text/html');
|
||||
} else if (typeof types.indexOf === 'function') {
|
||||
isHTML = (types.indexOf('text/html') > -1);
|
||||
if (!isHTML) {
|
||||
if ((types.indexOf('com.apple.webarchive') > -1) || (types.indexOf('com.apple.iWork.TSPNativeData') > -1)) {
|
||||
// This is going to be a specialized Apple paste paste. We cannot capture this, so clean everything.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// We don't know how to handle the clipboard info, so wait for the clipboard event to finish then fallback.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isHTML) {
|
||||
@@ -191,13 +178,14 @@ EditorClean.prototype = {
|
||||
this.updateOriginal();
|
||||
return false;
|
||||
} else {
|
||||
// This is a non-html paste event, we can just let this continue on and call updateOriginalDelayed.
|
||||
this.updateOriginalDelayed();
|
||||
// Due to poor cross browser clipboard compatibility, the failure to find html doesn't mean it isn't there.
|
||||
// Wait for the clipboard event to finish then fallback clean the entire editor.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// If we reached a here, this probably means the browser has limited (or no) clipboard support.
|
||||
// Wait for the clipboard event to finish then fallback.
|
||||
// Wait for the clipboard event to finish then fallback clean the entire editor.
|
||||
this.fallbackPasteCleanupDelayed();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user