From 5565dc1b1421807f242d0e402895aecbd0749851 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 4 May 2015 20:02:08 +0300 Subject: client: update selected type prompt based on cursor --- src/client/view/textanalyser_input.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/client/view/textanalyser_input.js') diff --git a/src/client/view/textanalyser_input.js b/src/client/view/textanalyser_input.js index bf96db1b..89602008 100644 --- a/src/client/view/textanalyser_input.js +++ b/src/client/view/textanalyser_input.js @@ -74,6 +74,7 @@ function textanalyser_input(spec) { spec: spec, on_analysis__input: new Bacon.Bus(), on_analysis__output: new Bacon.Bus(), + on_cursor: new Bacon.Bus(), on_resize: new Bacon.Bus(), element: $(element_name), selectionStart: selectionStart, @@ -149,6 +150,9 @@ function textanalyser_input(spec) { e.preventDefault(); }); + ta.on_cursor.plug(element.asEventStream('input keyup click selectionchange').map(function() { + return selectionStart();}).skipDuplicates()); + ta.on_analysis__input.plug(element.asEventStream('input').map(current_value).map(function (val) { return update_element(val); })); -- cgit v1.3.1