Skip to content

Commit 235d83e

Browse files
committed
merge with devel
2 parents 4477305 + fee2648 commit 235d83e

14 files changed

+187
-109
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 2.25.0
2+
### Features
3+
* add new API `$.rpc` for JSON-RPC requests
4+
### Bugfix
5+
* properly handle promise rejection in login
6+
* fix re executing extended commands on resize [#666](https://github.com/jcubic/jquery.terminal/issues/666)
7+
* fix rendering jQuery object with Canvas [#664](https://github.com/jcubic/jquery.terminal/issues/664)
8+
* fix right mouse click on link to not scroll to cursor [#644](https://github.com/jcubic/jquery.terminal/issues/644)
9+
110
## 2.24.0
211
### Features
312
* add `terminal::typing` API method

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
__ / / // / // / _ / _/ // / / / _ / _/ / / \/ / _ \/ /
55
/ / / // / // / ___/ // // / / / ___/ // / / / / /\ / // / /__
66
\___/____ \\__/____/_/ \__ / /_/____/_//_/_/_/_/_/ \/\__\_\___/
7-
\/ /____/ version 2.24.0
7+
\/ /____/ version DEV
88
```
99

1010
[JavaScript Library for Web Based Terminal Emulators](https://terminal.jcubic.pl)
1111

12-
[![npm](https://img.shields.io/badge/npm-2.24.0-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
13-
![bower](https://img.shields.io/badge/bower-2.24.0-yellow.svg)
14-
[![travis](https://travis-ci.org/jcubic/jquery.terminal.svg?branch=master&51bf989081c6b83335340a91870b973c39082ecf)](https://travis-ci.org/jcubic/jquery.terminal)
15-
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=master&cf32f2bbbfa12a58ebb8621ad02249ad)](https://coveralls.io/github/jcubic/jquery.terminal?branch=master)
12+
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
13+
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
14+
[![travis](https://travis-ci.org/jcubic/jquery.terminal.svg?branch=devel&927855028494b1c263fab53c0b06c123b21b7bf3)](https://travis-ci.org/jcubic/jquery.terminal)
15+
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&5b8e8c659ac14001b439fcffb102a41a)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
1616
![downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
1717
[![](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded)](https://www.jsdelivr.com/package/npm/jquery.terminal)
1818
[![LICENSE MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jcubic/jquery.terminal/blob/master/LICENSE)
@@ -80,20 +80,20 @@ Include jQuery library, you can use cdn from https://jquery.com/download/
8080

8181
```
8282

83-
Then include js/jquery.terminal-2.24.0.min.js and css/jquery.terminal-2.24.0.min.css
83+
Then include js/jquery.terminal-DEV.min.js and css/jquery.terminal-DEV.min.css
8484

8585
You can grab the files from CDN:
8686

8787
```html
88-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.24.0/js/jquery.terminal.min.js"></script>
89-
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.24.0/css/jquery.terminal.min.css" rel="stylesheet"/>
88+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/DEV/js/jquery.terminal.min.js"></script>
89+
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/DEV/css/jquery.terminal.min.css" rel="stylesheet"/>
9090
```
9191

9292
or
9393

9494
```html
95-
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@2.24.0/js/jquery.terminal.min.js"></script>
96-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.24.0/css/jquery.terminal.min.css">
95+
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@DEV/js/jquery.terminal.min.js"></script>
96+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@DEV/css/jquery.terminal.min.css">
9797
```
9898

9999
If you always want latest version, you can get it from [unpkg](https://unpkg.com/) without specifying version,

css/emoji.css

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/jquery.terminal-2.24.0.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
55
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
66
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
7-
* \/ /____/ version 2.24.0
7+
* \/ /____/ version DEV
88
* http://terminal.jcubic.pl
99
*
1010
* This file is part of jQuery Terminal.
1111
*
1212
* Copyright (c) 2011-2021 Jakub Jankiewicz <https://jcubic.pl/me>
1313
* Released under the MIT license
1414
*
15-
* Date: Sat, 22 May 2021 11:55:42 +0000
15+
* Date: Mon, 31 May 2021 07:17:41 +0000
1616
*/
1717

1818
.terminal .terminal-output .format, .cmd .format,

css/jquery.terminal-2.24.0.min.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/jquery.terminal.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
55
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
66
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
7-
* \/ /____/ version 2.24.0
7+
* \/ /____/ version DEV
88
* http://terminal.jcubic.pl
99
*
1010
* This file is part of jQuery Terminal.
1111
*
1212
* Copyright (c) 2011-2021 Jakub Jankiewicz <https://jcubic.pl/me>
1313
* Released under the MIT license
1414
*
15-
* Date: Sat, 22 May 2021 11:55:42 +0000
15+
* Date: Mon, 31 May 2021 07:17:41 +0000
1616
*/
1717

1818
.terminal .terminal-output .format, .cmd .format,

css/jquery.terminal.min.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/jquery.terminal.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery.terminal-2.24.0.js

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
55
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
66
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
7-
* \/ /____/ version 2.24.0
7+
* \/ /____/ version DEV
88
*
99
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
1010
*
@@ -41,7 +41,7 @@
4141
*
4242
* broken image by Sophia Bai from the Noun Project (CC-BY)
4343
*
44-
* Date: Sat, 22 May 2021 11:55:42 +0000
44+
* Date: Mon, 31 May 2021 08:50:49 +0000
4545
*/
4646
/* global define, Map */
4747
/* eslint-disable */
@@ -4780,8 +4780,8 @@
47804780
}
47814781
// -------------------------------------------------------------------------
47824782
$.terminal = {
4783-
version: '2.24.0',
4784-
date: 'Sat, 22 May 2021 11:55:42 +0000',
4783+
version: 'DEV',
4784+
date: 'Mon, 31 May 2021 08:50:49 +0000',
47854785
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
47864786
color_names: [
47874787
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
@@ -6429,6 +6429,18 @@
64296429
return deferred.promise();
64306430
};
64316431
// -----------------------------------------------------------------------
6432+
$.rpc = function(url, method, params) {
6433+
var deferred = new $.Deferred();
6434+
function success(res) {
6435+
deferred.resolve(res.result);
6436+
}
6437+
function error(res) {
6438+
deferred.reject(res.error.message);
6439+
}
6440+
$.jrpc(url, method, params, success, error);
6441+
return deferred.promise();
6442+
};
6443+
// -----------------------------------------------------------------------
64326444
function terminal_ready(term) {
64336445
return !!(term.closest('body').length &&
64346446
term.is(':visible') &&
@@ -6817,17 +6829,7 @@
68176829
var settings = $.extend({}, options, {
68186830
raw: true,
68196831
finalize: function(div) {
6820-
var node;
6821-
if (value instanceof $.fn.init) {
6822-
// deep clone with events - we clone because remove
6823-
// from DOM will remove events from original object
6824-
node = value.clone(true, true);
6825-
} else {
6826-
// don't clone html nodes because it will not
6827-
// work for canvas or video tag
6828-
node = value;
6829-
}
6830-
div.find('.terminal-render-item').replaceWith(node);
6832+
div.find('.terminal-render-item').replaceWith(value);
68316833
if (options && is_function(options.finalize)) {
68326834
options.finalize(div, self);
68336835
}
@@ -7561,6 +7563,7 @@
75617563
// and lines variable have all extended commands
75627564
string = string.replace(/^\[\[|\]\]$/g, '');
75637565
if (line_settings.exec) {
7566+
line.options.exec = false;
75647567
var trim = string.trim();
75657568
if (prev_exec_cmd && prev_exec_cmd === trim) {
75667569
prev_exec_cmd = '';
@@ -8685,6 +8688,16 @@
86858688
if (ret && is_function(ret.then || ret.done)) {
86868689
(ret.then || ret.done).call(ret, function(token) {
86878690
login_callback(user, token);
8691+
}).catch(function(err) {
8692+
if (self.paused()) {
8693+
self.resume();
8694+
}
8695+
self.pop(undefined, true).pop(undefined, true);
8696+
self.error(err.message);
8697+
if (is_function(error)) {
8698+
error();
8699+
}
8700+
self.off('terminal.autologin');
86888701
});
86898702
}
86908703
} catch (e) {
@@ -9661,7 +9674,7 @@
96619674
}
96629675
// Did previous value end in newline?
96639676
if (last_newline) {
9664-
lines.push([value, $.extend({exec: false}, locals)]);
9677+
lines.push([value, locals]);
96659678
} else {
96669679
// If not append current value to it
96679680
var old_value = last_line[0];
@@ -10684,6 +10697,11 @@
1068410697
// work weird on mobile
1068510698
$win.on('focus.terminal_' + self.id(), focus_terminal).
1068610699
on('blur.terminal_' + self.id(), blur_terminal);
10700+
// context is used to check if terminal should not scroll to bottom after right click on:
10701+
// e.g. img, canvas, a and then click to hide the menu. The problem is that
10702+
// right click on those elements don't move the textarea to show proper context menu
10703+
// like save as on images or open on links. See #644 bug
10704+
var was_context_event;
1068710705
// detect mouse drag
1068810706
(function() {
1068910707
var count = 0;
@@ -10714,6 +10732,10 @@
1071410732
$target = $(e.target);
1071510733
}
1071610734
}).mouseup(function() {
10735+
if (was_context_event) {
10736+
was_context_event = false;
10737+
return;
10738+
}
1071710739
if ($target && $target.closest(ignore_elements).length) {
1071810740
if (enabled) {
1071910741
self.disable();
@@ -10753,7 +10775,8 @@
1075310775
event_name = 'mousedown.terminal';
1075410776
}
1075510777
self.on(event_name, function(e) {
10756-
if (get_selected_html() === '' && is_context_event(e)) {
10778+
was_context_event = get_selected_html() === '' && is_context_event(e);
10779+
if (was_context_event) {
1075710780
var $target = $(e.target);
1075810781
if ($target.is('img,value,audio,object,canvas,a')) {
1075910782
return;

js/jquery.terminal-2.24.0.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery.terminal-src.js

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6429,6 +6429,18 @@
64296429
return deferred.promise();
64306430
};
64316431
// -----------------------------------------------------------------------
6432+
$.rpc = function(url, method, params) {
6433+
var deferred = new $.Deferred();
6434+
function success(res) {
6435+
deferred.resolve(res.result);
6436+
}
6437+
function error(res) {
6438+
deferred.reject(res.error.message);
6439+
}
6440+
$.jrpc(url, method, params, success, error);
6441+
return deferred.promise();
6442+
};
6443+
// -----------------------------------------------------------------------
64326444
function terminal_ready(term) {
64336445
return !!(term.closest('body').length &&
64346446
term.is(':visible') &&
@@ -6817,17 +6829,7 @@
68176829
var settings = $.extend({}, options, {
68186830
raw: true,
68196831
finalize: function(div) {
6820-
var node;
6821-
if (value instanceof $.fn.init) {
6822-
// deep clone with events - we clone because remove
6823-
// from DOM will remove events from original object
6824-
node = value.clone(true, true);
6825-
} else {
6826-
// don't clone html nodes because it will not
6827-
// work for canvas or video tag
6828-
node = value;
6829-
}
6830-
div.find('.terminal-render-item').replaceWith(node);
6832+
div.find('.terminal-render-item').replaceWith(value);
68316833
if (options && is_function(options.finalize)) {
68326834
options.finalize(div, self);
68336835
}
@@ -7561,6 +7563,7 @@
75617563
// and lines variable have all extended commands
75627564
string = string.replace(/^\[\[|\]\]$/g, '');
75637565
if (line_settings.exec) {
7566+
line.options.exec = false;
75647567
var trim = string.trim();
75657568
if (prev_exec_cmd && prev_exec_cmd === trim) {
75667569
prev_exec_cmd = '';
@@ -8685,6 +8688,16 @@
86858688
if (ret && is_function(ret.then || ret.done)) {
86868689
(ret.then || ret.done).call(ret, function(token) {
86878690
login_callback(user, token);
8691+
}).catch(function(err) {
8692+
if (self.paused()) {
8693+
self.resume();
8694+
}
8695+
self.pop(undefined, true).pop(undefined, true);
8696+
self.error(err.message);
8697+
if (is_function(error)) {
8698+
error();
8699+
}
8700+
self.off('terminal.autologin');
86888701
});
86898702
}
86908703
} catch (e) {
@@ -9661,7 +9674,7 @@
96619674
}
96629675
// Did previous value end in newline?
96639676
if (last_newline) {
9664-
lines.push([value, $.extend({exec: false}, locals)]);
9677+
lines.push([value, locals]);
96659678
} else {
96669679
// If not append current value to it
96679680
var old_value = last_line[0];
@@ -10684,6 +10697,11 @@
1068410697
// work weird on mobile
1068510698
$win.on('focus.terminal_' + self.id(), focus_terminal).
1068610699
on('blur.terminal_' + self.id(), blur_terminal);
10700+
// context is used to check if terminal should not scroll to bottom after right click on:
10701+
// e.g. img, canvas, a and then click to hide the menu. The problem is that
10702+
// right click on those elements don't move the textarea to show proper context menu
10703+
// like save as on images or open on links. See #644 bug
10704+
var was_context_event;
1068710705
// detect mouse drag
1068810706
(function() {
1068910707
var count = 0;
@@ -10714,6 +10732,10 @@
1071410732
$target = $(e.target);
1071510733
}
1071610734
}).mouseup(function() {
10735+
if (was_context_event) {
10736+
was_context_event = false;
10737+
return;
10738+
}
1071710739
if ($target && $target.closest(ignore_elements).length) {
1071810740
if (enabled) {
1071910741
self.disable();
@@ -10753,7 +10775,8 @@
1075310775
event_name = 'mousedown.terminal';
1075410776
}
1075510777
self.on(event_name, function(e) {
10756-
if (get_selected_html() === '' && is_context_event(e)) {
10778+
was_context_event = get_selected_html() === '' && is_context_event(e);
10779+
if (was_context_event) {
1075710780
var $target = $(e.target);
1075810781
if ($target.is('img,value,audio,object,canvas,a')) {
1075910782
return;

0 commit comments

Comments
 (0)