mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
Merge branch 'MDL-49671-master' of git://github.com/merrill-oakland/moodle
This commit is contained in:
commit
f0fb1ed518
@ -1160,28 +1160,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) {
|
||||
@ -1216,13 +1203,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;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1150,28 +1150,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) {
|
||||
@ -1206,13 +1193,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;
|
||||
}
|
||||
|
28
lib/editor/atto/yui/src/editor/js/clean.js
vendored
28
lib/editor/atto/yui/src/editor/js/clean.js
vendored
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user