Skip to content

Commit

Permalink
fix issue with focus on click on MacOS #255
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Sep 4, 2017
1 parent 19d7e78 commit 8779b36
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 46 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* fix issue that on click next terminal get focused on desktop with touch screen and on mobile (reported by @itsZN)
* fix missing default keymap in cmd plugin (found on SO by Arnaldo Montoya)
* update dterm to enable terminal when is visible (when open) using IntersectionObserver
* fix issue with focus on click on MacOS (reported by @RomanPerin)

## 1.6.4
* just missed build
Expand Down
2 changes: 1 addition & 1 deletion css/jquery.terminal-1.6.4.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Copyright (c) 2011-2017 Jakub Jankiewicz <http://jcubic.pl>
* Released under the MIT license
*
* Date: Thu, 31 Aug 2017 18:54:40 +0000
* Date: Mon, 04 Sep 2017 07:48:16 +0000
*/
.terminal .terminal-output .format, .cmd .format,
.cmd .prompt, .cmd .prompt div, .terminal .terminal-output div div{
Expand Down
2 changes: 1 addition & 1 deletion css/jquery.terminal-1.6.4.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/jquery.terminal.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Copyright (c) 2011-2017 Jakub Jankiewicz <http://jcubic.pl>
* Released under the MIT license
*
* Date: Thu, 31 Aug 2017 18:54:40 +0000
* Date: Mon, 04 Sep 2017 07:48:16 +0000
*/
.terminal .terminal-output .format, .cmd .format,
.cmd .prompt, .cmd .prompt div, .terminal .terminal-output div div{
Expand Down
2 changes: 1 addition & 1 deletion css/jquery.terminal.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 21 additions & 13 deletions js/jquery.terminal-1.6.4.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Copyright (c) 2007-2013 Alexandru Marasteanu <hello at alexei dot ro>
* licensed under 3 clause BSD license
*
* Date: Fri, 01 Sep 2017 20:37:32 +0000
* Date: Mon, 04 Sep 2017 07:48:15 +0000
*/

/* TODO:
Expand Down Expand Up @@ -2382,6 +2382,25 @@
}
return check;
})(navigator.userAgent || navigator.vendor || window.opera);
var get_selected_text = (function() {
if (window.getSelection || document.getSelection) {
return function() {
var selection = (window.getSelection || document.getSelection)();
if (selection.text) {
return selection.text;
} else {
return selection.toString();
}
};
} else if (document.selection && document.selection.type != "Control") {
return function() {
return document.selection.createRange().text;
};
}
return function() {
return '';
};
})();
// -------------------------------------------------------------------------
function process_command(string, fn) {
var array = string.match(command_re) || [];
Expand Down Expand Up @@ -6342,26 +6361,15 @@
// detect mouse drag
(function() {
var count = 0;
var isDragging = false;
var $target;
var name = 'click_' + self.id();
self.mousedown(function(e) {
$target = $(e.target);
if (e.originalEvent.button === 2) {
return;
}
self.oneTime(1, function() {
$(window).on('mousemove.terminal_' + self.id(), function() {
isDragging = true;
count = 0;
$(window).off('mousemove.terminal_' + self.id());
});
});
}).mouseup(function() {
var wasDragging = isDragging;
isDragging = false;
$(window).off('mousemove.terminal_' + self.id());
if (!wasDragging) {
if (get_selected_text() === '') {
if (++count === 1) {
if (!self.enabled() && !frozen) {
self.focus();
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-1.6.4.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 8779b36

Please sign in to comment.