File tree Expand file tree Collapse file tree 4 files changed +12
-16
lines changed Expand file tree Collapse file tree 4 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ Caret.prototype = {
68
68
69
69
show : function ( ) {
70
70
let html = `<div id="caret_${ this . page . getId ( ) } _${ this . id } " class="caret"></div>` ;
71
- // let parent = document.getElementById(`${this.page.getId()}`);
72
71
document . body . innerHTML += html ;
73
72
74
73
this . setPos ( this . row , this . col ) ;
Original file line number Diff line number Diff line change @@ -22,9 +22,17 @@ $(document).ready(function() {
22
22
// prevent TAB KEY from switching focus
23
23
if ( event . keyCode == 9 ) event . preventDefault ( ) ;
24
24
25
- // detect capslock
25
+ // toggle capslock
26
26
if ( event . originalEvent . getModifierState ( "CapsLock" ) ) capsLockKey . press ( ) ;
27
27
else capsLockKey . release ( ) ;
28
+
29
+ // toggle shiftkey
30
+ if ( event . shiftKey ) shiftKey . press ( ) ;
31
+ else shiftKey . release ( ) ;
32
+
33
+ // toggle ctrlKey
34
+ if ( event . ctrlKey ) ctrlKey . press ( ) ;
35
+ else ctrlKey . release ( ) ;
28
36
29
37
// handle key pressed
30
38
handleKeyDown ( page0 , event . keyCode ) ;
Original file line number Diff line number Diff line change @@ -48,13 +48,6 @@ const handleKeyDown = function(page, keyCode) {
48
48
var tmpkey = String . fromCharCode ( keyCode ) ;
49
49
// console.log(tmpkey + ' ' + keyCode);
50
50
51
- // TRIGGER HELPER KEYS: CTRL, SHIFT
52
- if ( keyCode == shiftKey . keyCode ) {
53
- shiftKey . press ( ) ;
54
- } else if ( keyCode == ctrlKey . keyCode ) {
55
- ctrlKey . press ( ) ;
56
- }
57
-
58
51
// Ignore Keys --------------------------------------------------------------------
59
52
if ( keyCode == 20 ) { }
60
53
@@ -139,9 +132,5 @@ const handleKeyDown = function(page, keyCode) {
139
132
140
133
// KEYUP
141
134
const handleKeyUp = function ( keyCode ) {
142
- if ( keyCode == shiftKey . keyCode ) {
143
- shiftKey . release ( ) ;
144
- } else if ( keyCode == ctrlKey . keyCode ) {
145
- ctrlKey . release ( ) ;
146
- }
135
+
147
136
}
Original file line number Diff line number Diff line change @@ -18,13 +18,13 @@ Page.prototype = {
18
18
return this . width ;
19
19
} ,
20
20
setWidth : function ( width ) {
21
- document . getElementById ( "page" ) . style . width = `${ width } px` ;
21
+ document . getElementById ( ` ${ this . id } ` ) . style . width = `${ width } px` ;
22
22
} ,
23
23
getHeight : function ( ) {
24
24
return this . height ;
25
25
} ,
26
26
setHeight : function ( height ) {
27
- document . getElementById ( "page" ) . style . height = `${ height } ` ;
27
+ document . getElementById ( ` ${ this . id } ` ) . style . height = `${ height } ` ;
28
28
} ,
29
29
30
30
getLineRef : function ( lineNum ) {
You can’t perform that action at this time.
0 commit comments