Skip to content

Commit 79cdfd5

Browse files
committed
trigger change event after modifications from shortcuts
1 parent 5026a50 commit 79cdfd5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/codearea.coffee

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ get_row = (str, point) ->
1111
count += 1 for i in str when i is '\n'
1212
count
1313

14+
triggerInput = (element) ->
15+
event = new Event 'input',
16+
bubbles: true,
17+
cancelable: true
18+
19+
element.dispatchEvent(event);
20+
1421
# main idea, to wrap text to all in object
1522
wrap_text = (target) ->
1623
sta = target.selectionStart
@@ -49,6 +56,9 @@ write_text = (target, obj) ->
4956
target.value = arr.join '\n'
5057
target.selectionStart = set_position arr, ar, ac
5158
target.selectionEnd = set_position arr, br, bc
59+
60+
triggerInput target
61+
5262
false
5363

5464
# change raw and column index to position

src/main.cirru

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ var main $ \ ()
1414
codearea paper
1515
paper.focus
1616

17+
= paper.oninput $ \ (event)
18+
console.log :input $ JSON.stringify event.target.value
19+
1720
= window.onload main

0 commit comments

Comments
 (0)