@@ -32,6 +32,17 @@ const styles = {
32
32
float : 'right' ,
33
33
paddingTop : '3px'
34
34
} ,
35
+ echo : {
36
+ display : 'inline-block' ,
37
+ paddingTop : '3px' ,
38
+ paddingLeft : '16px'
39
+ } ,
40
+ echoOn : {
41
+ color : '#000000'
42
+ } ,
43
+ echoOff : {
44
+ color : '#888888'
45
+ } ,
35
46
rx : {
36
47
backgroundColor : blue
37
48
} ,
@@ -45,13 +56,15 @@ function applyStyles(el, stylesToApply){
45
56
}
46
57
47
58
function rxtxBar ( app , opts , done ) {
59
+ const { toggleEcho } = app . handlers ;
48
60
49
61
let bottomBar ;
50
62
let rx ;
51
63
let tx ;
64
+ let echoContainer , echoLabel ;
52
65
53
66
function onConsoleChange ( ) {
54
- const { rxtx } = consoleStore . getState ( ) ;
67
+ const { rxtx, echo } = consoleStore . getState ( ) ;
55
68
const { flashRx, flashTx } = rxtx ;
56
69
57
70
if ( flashRx ) {
@@ -65,6 +78,14 @@ function rxtxBar(app, opts, done){
65
78
} else {
66
79
tx . style . backgroundColor = styles . indicator . backgroundColor ;
67
80
}
81
+
82
+ if ( echo ) {
83
+ applyStyles ( echoContainer , styles . echoOn ) ;
84
+ echoLabel . nodeValue = 'Echo On' ;
85
+ } else {
86
+ applyStyles ( echoContainer , styles . echoOff ) ;
87
+ echoLabel . nodeValue = 'Echo Off' ;
88
+ }
68
89
}
69
90
70
91
app . view ( 'editor' , function ( el , cb ) {
@@ -73,6 +94,16 @@ function rxtxBar(app, opts, done){
73
94
bottomBar = document . createElement ( 'div' ) ;
74
95
applyStyles ( bottomBar , styles . bar ) ;
75
96
97
+ echoContainer = document . createElement ( 'span' ) ;
98
+ applyStyles ( echoContainer , styles . echo ) ;
99
+ applyStyles ( echoContainer , styles . echoOff ) ;
100
+ bottomBar . appendChild ( echoContainer ) ;
101
+
102
+ echoLabel = document . createTextNode ( 'Echo Off' ) ;
103
+ echoContainer . appendChild ( echoLabel ) ;
104
+
105
+ echoContainer . addEventListener ( 'click' , toggleEcho , false ) ;
106
+
76
107
const rxtxContainer = document . createElement ( 'span' ) ;
77
108
applyStyles ( rxtxContainer , styles . rxtx ) ;
78
109
bottomBar . appendChild ( rxtxContainer ) ;
0 commit comments