aboutsummaryrefslogtreecommitdiff
path: root/tools/addon-sdk-1.4/examples/annotator/data/editor/annotation-editor.js
blob: 5a762fc61e2251d9fc1d584b3e28155392415707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
On a return key, send the content of the textArea back to the add-on,
and zero the textArea for the next time.
*/

var textArea = document.getElementById('annotation-box');

textArea.onkeyup = function(event) {
  if (event.keyCode == 13) {
    self.postMessage(textArea.value);
    textArea.value = '';
  }
};

self.on('message', function() {
  var textArea = document.getElementById('annotation-box');
  textArea.value = '';
  textArea.focus();
});