Skip to content

Commit

Permalink
call onClear before clear and allow to cancel #527
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Oct 13, 2019
1 parent 646fa69 commit bc6815b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.9.0
### features
* allow to return a promise from greetings function [#531](https://github.com/jcubic/jquery.terminal/issues/531)
* call onClear before clear and allow to cancel [#527](https://github.com/jcubic/jquery.terminal/issues/527)
### Bugfix
* fix links from formatters in cmd
* fix images from formatters in cmd [#519](https://github.com/jcubic/jquery.terminal/issues/519)
Expand Down
13 changes: 7 additions & 6 deletions js/jquery.terminal-2.8.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sun, 13 Oct 2019 18:24:31 +0000
* Date: Sun, 13 Oct 2019 21:34:11 +0000
*/
/* global location, setTimeout, window, global, sprintf, setImmediate,
IntersectionObserver, ResizeObserver, module, require, define,
Expand Down Expand Up @@ -4053,7 +4053,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 13 Oct 2019 18:24:31 +0000',
date: 'Sun, 13 Oct 2019 21:34:11 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -7345,10 +7345,11 @@
// :: Clear the output
// -------------------------------------------------------------
clear: function() {
lines = [];
output.html('');
fire_event('onClear');
self.attr({scrollTop: 0});
if (fire_event('onClear') !== false) {
lines = [];
output.html('');
self.attr({scrollTop: 0});
}
return self;
},
// -------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.8.0.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -7345,10 +7345,11 @@
// :: Clear the output
// -------------------------------------------------------------
clear: function() {
lines = [];
output.html('');
fire_event('onClear');
self.attr({scrollTop: 0});
if (fire_event('onClear') !== false) {
lines = [];
output.html('');
self.attr({scrollTop: 0});
}
return self;
},
// -------------------------------------------------------------
Expand Down
13 changes: 7 additions & 6 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* emoji regex v7.0.1 by Mathias Bynens
* MIT license
*
* Date: Sun, 13 Oct 2019 18:24:31 +0000
* Date: Sun, 13 Oct 2019 21:34:11 +0000
*/
/* global location, setTimeout, window, global, sprintf, setImmediate,
IntersectionObserver, ResizeObserver, module, require, define,
Expand Down Expand Up @@ -4053,7 +4053,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 13 Oct 2019 18:24:31 +0000',
date: 'Sun, 13 Oct 2019 21:34:11 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -7345,10 +7345,11 @@
// :: Clear the output
// -------------------------------------------------------------
clear: function() {
lines = [];
output.html('');
fire_event('onClear');
self.attr({scrollTop: 0});
if (fire_event('onClear') !== false) {
lines = [];
output.html('');
self.attr({scrollTop: 0});
}
return self;
},
// -------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit bc6815b

Please sign in to comment.