Merge branch 'MDL-62319-34' of git://github.com/damyon/moodle into MOODLE_34_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2018-10-16 00:07:23 +02:00
5 changed files with 158 additions and 3 deletions
+2
View File
@@ -44,6 +44,7 @@
position: absolute;
overflow: auto;
background-color: #ccc;
touch-action: none;
}
.assignfeedback_editpdf_widget {
@@ -397,6 +398,7 @@ ul.assignfeedback_editpdf_menu {
position: relative;
margin-bottom: 1em;
top: 0;
max-height: 312px;
}
.assignfeedback_editpdf_widget .pageheader {
@@ -4027,6 +4027,8 @@ EDITOR.prototype = {
if (this.get('readonly')) {
return;
}
this.disable_touch_scroll();
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = this.get_dialogue_element(selector);
@@ -4120,6 +4122,7 @@ EDITOR.prototype = {
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
}
this.refresh_button_state();
},
@@ -4664,6 +4667,54 @@ EDITOR.prototype = {
for (i = 0; i < this.drawables.length; i++) {
this.drawables[i].scroll_update(x, y);
}
},
/**
* Test the browser support for options objects on event listeners.
* @return Boolean
*/
event_listener_options_supported: function() {
var passivesupported = false,
options,
testeventname = "testpassiveeventoptions";
// Options support testing example from:
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
try {
options = Object.defineProperty({}, "passive", {
get: function() {
passivesupported = true;
}
});
// We use an event name that is not likely to conflict with any real event.
document.addEventListener(testeventname, options, options);
// We remove the event listener as we have tested the options already.
document.removeEventListener(testeventname, options, options);
} catch(err) {
// It's already false.
passivesupported = false;
}
return passivesupported;
},
/**
* Disable Touch Move scrolling
*/
disable_touch_scroll: function() {
if (this.event_listener_options_supported()) {
document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false});
}
},
/**
* Stop Touch Scrolling
* @param {Object} e
*/
stop_touch_scroll: function(e) {
e.stopPropagation();
e.preventDefault();
}
};
File diff suppressed because one or more lines are too long
@@ -4027,6 +4027,8 @@ EDITOR.prototype = {
if (this.get('readonly')) {
return;
}
this.disable_touch_scroll();
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = this.get_dialogue_element(selector);
@@ -4120,6 +4122,7 @@ EDITOR.prototype = {
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
}
this.refresh_button_state();
},
@@ -4664,6 +4667,54 @@ EDITOR.prototype = {
for (i = 0; i < this.drawables.length; i++) {
this.drawables[i].scroll_update(x, y);
}
},
/**
* Test the browser support for options objects on event listeners.
* @return Boolean
*/
event_listener_options_supported: function() {
var passivesupported = false,
options,
testeventname = "testpassiveeventoptions";
// Options support testing example from:
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
try {
options = Object.defineProperty({}, "passive", {
get: function() {
passivesupported = true;
}
});
// We use an event name that is not likely to conflict with any real event.
document.addEventListener(testeventname, options, options);
// We remove the event listener as we have tested the options already.
document.removeEventListener(testeventname, options, options);
} catch(err) {
// It's already false.
passivesupported = false;
}
return passivesupported;
},
/**
* Disable Touch Move scrolling
*/
disable_touch_scroll: function() {
if (this.event_listener_options_supported()) {
document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false});
}
},
/**
* Stop Touch Scrolling
* @param {Object} e
*/
stop_touch_scroll: function(e) {
e.stopPropagation();
e.preventDefault();
}
};
+51
View File
@@ -754,6 +754,8 @@ EDITOR.prototype = {
if (this.get('readonly')) {
return;
}
this.disable_touch_scroll();
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = this.get_dialogue_element(selector);
@@ -847,6 +849,7 @@ EDITOR.prototype = {
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
}
this.refresh_button_state();
},
@@ -1391,6 +1394,54 @@ EDITOR.prototype = {
for (i = 0; i < this.drawables.length; i++) {
this.drawables[i].scroll_update(x, y);
}
},
/**
* Test the browser support for options objects on event listeners.
* @return Boolean
*/
event_listener_options_supported: function() {
var passivesupported = false,
options,
testeventname = "testpassiveeventoptions";
// Options support testing example from:
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
try {
options = Object.defineProperty({}, "passive", {
get: function() {
passivesupported = true;
}
});
// We use an event name that is not likely to conflict with any real event.
document.addEventListener(testeventname, options, options);
// We remove the event listener as we have tested the options already.
document.removeEventListener(testeventname, options, options);
} catch(err) {
// It's already false.
passivesupported = false;
}
return passivesupported;
},
/**
* Disable Touch Move scrolling
*/
disable_touch_scroll: function() {
if (this.event_listener_options_supported()) {
document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false});
}
},
/**
* Stop Touch Scrolling
* @param {Object} e
*/
stop_touch_scroll: function(e) {
e.stopPropagation();
e.preventDefault();
}
};