Skip to content

Commit

Permalink
Merge pull request #14 from Katochimoto/issue-13
Browse files Browse the repository at this point in the history
fix #13
  • Loading branch information
Anton authored Jan 18, 2017
2 parents f4c34fb + 6229f01 commit 3301dc6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
20 changes: 15 additions & 5 deletions dist/x-bubbles-compact.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ var XBubbles =
var REG_HAS_ESCAPED_HTML = RegExp(REG_ESCAPED_HTML.source);
var REG_HAS_UNESCAPED_HTML = RegExp(REG_UNESCAPED_HTML.source);
var REG_IE = /Trident|Edge/;
var REG_MOBILE_IE = /IEMobile/;

exports.getSelection = function (nodeEditor) {
var selection = context.getSelection();
Expand Down Expand Up @@ -1388,6 +1389,10 @@ var XBubbles =
return REG_IE.test(context.navigator.userAgent);
}();

exports.isMobileIE = function () {
return REG_MOBILE_IE.test(context.navigator.userAgent);
}();

exports.ready = function () {
var elements = [];
var ready = false;
Expand Down Expand Up @@ -2087,21 +2092,26 @@ var XBubbles =
var context = __webpack_require__(1);
var text = __webpack_require__(5);
var select = __webpack_require__(14);
var utils = __webpack_require__(6);

exports.restore = restore;
exports.restoreBasis = restoreBasis;

/**
* Reset the cursor position to the end of the input field.
* This action is forbidden in the IE Mobile because it
* causes a browser crash. There is still no workaround.
* @alias module:x-bubbles/cursor.restore
* @param {HTMLElement} nodeSet
*/
function restore(nodeSet) {
select.clear(nodeSet);
var basis = restoreBasis(nodeSet);
var selection = context.getSelection();
selection.removeAllRanges();
selection.collapse(basis, 1);
if (!utils.isMobileIE) {
select.clear(nodeSet);
var basis = restoreBasis(nodeSet);
var selection = context.getSelection();
selection.removeAllRanges();
selection.collapse(basis, 1);
}
}

/**
Expand Down
20 changes: 15 additions & 5 deletions dist/x-bubbles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ var XBubbles =
var REG_HAS_ESCAPED_HTML = RegExp(REG_ESCAPED_HTML.source);
var REG_HAS_UNESCAPED_HTML = RegExp(REG_UNESCAPED_HTML.source);
var REG_IE = /Trident|Edge/;
var REG_MOBILE_IE = /IEMobile/;

exports.getSelection = function (nodeEditor) {
var selection = context.getSelection();
Expand Down Expand Up @@ -1388,6 +1389,10 @@ var XBubbles =
return REG_IE.test(context.navigator.userAgent);
}();

exports.isMobileIE = function () {
return REG_MOBILE_IE.test(context.navigator.userAgent);
}();

exports.ready = function () {
var elements = [];
var ready = false;
Expand Down Expand Up @@ -2087,21 +2092,26 @@ var XBubbles =
var context = __webpack_require__(1);
var text = __webpack_require__(5);
var select = __webpack_require__(14);
var utils = __webpack_require__(6);

exports.restore = restore;
exports.restoreBasis = restoreBasis;

/**
* Reset the cursor position to the end of the input field.
* This action is forbidden in the IE Mobile because it
* causes a browser crash. There is still no workaround.
* @alias module:x-bubbles/cursor.restore
* @param {HTMLElement} nodeSet
*/
function restore(nodeSet) {
select.clear(nodeSet);
var basis = restoreBasis(nodeSet);
var selection = context.getSelection();
selection.removeAllRanges();
selection.collapse(basis, 1);
if (!utils.isMobileIE) {
select.clear(nodeSet);
var basis = restoreBasis(nodeSet);
var selection = context.getSelection();
selection.removeAllRanges();
selection.collapse(basis, 1);
}
}

/**
Expand Down
15 changes: 10 additions & 5 deletions src/core/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
const context = require('../context');
const text = require('./text');
const select = require('./select');
const utils = require('./utils');

exports.restore = restore;
exports.restoreBasis = restoreBasis;

/**
* Reset the cursor position to the end of the input field.
* This action is forbidden in the IE Mobile because it
* causes a browser crash. There is still no workaround.
* @alias module:x-bubbles/cursor.restore
* @param {HTMLElement} nodeSet
*/
function restore(nodeSet) {
select.clear(nodeSet);
const basis = restoreBasis(nodeSet);
const selection = context.getSelection();
selection.removeAllRanges();
selection.collapse(basis, 1);
if (!utils.isMobileIE) {
select.clear(nodeSet);
const basis = restoreBasis(nodeSet);
const selection = context.getSelection();
selection.removeAllRanges();
selection.collapse(basis, 1);
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const REG_UNESCAPED_HTML = /[&<>"'`]/g;
const REG_HAS_ESCAPED_HTML = RegExp(REG_ESCAPED_HTML.source);
const REG_HAS_UNESCAPED_HTML = RegExp(REG_UNESCAPED_HTML.source);
const REG_IE = /Trident|Edge/;
const REG_MOBILE_IE = /IEMobile/;

exports.getSelection = function (nodeEditor) {
const selection = context.getSelection();
Expand Down Expand Up @@ -108,6 +109,10 @@ exports.isIE = (function () {
return REG_IE.test(context.navigator.userAgent);
})();

exports.isMobileIE = (function () {
return REG_MOBILE_IE.test(context.navigator.userAgent);
})();

exports.ready = (function () {
let elements = [];
let ready = false;
Expand Down

0 comments on commit 3301dc6

Please sign in to comment.