Commit Graph

12 Commits

Author SHA1 Message Date
Anders Kaseorg 28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00
Vinit Singh 03180752db compose: Update placeholder text depending on the narrow.
Change the `compose-textarea` placeholder text depending on the
stream/topic or PM recipients that the message will be sent to.

Resolves #12834.
2019-07-29 15:51:50 -07:00
Tim Abbott cef784b101 compose: Fix buggy escaping of LaTeX in quote-and-reply.
Apparently, our use of JavaScript string `.replace()` here was buggy,
because replace() has several special escape sequences starting with
`$` if they appear in the replacement content string.  We can work
around this through something of a hack, which is to pass a function
as the second argument to replace, which seems cleaner than replacing
all $s with $$s.

Thanks to Shreya for the report.
2019-04-13 10:52:44 -07:00
Tim Abbott f40cbdbd19 compose: Fix extra space being added by quote-and-reply.
The correct behavior here is that we want to ensure there is
whitespace in between the syntax being added and the content on either
side.  Our smart_insert logic handled this for the cases that were
common with inserting emoji (etc.), but didn't handle the more complex
cases with "quote and reply".

Fixes #11702.
2019-02-27 13:22:25 -08:00
Marco Burstein fa22cf18f6 compose_ui: Create the `compose_ui.replace_syntax` function.
`replace_syntax` will replace text inside of a compose textbox. Also,
add tests to the `compose_ui` Node tests for this function.
2018-08-26 23:33:24 -07:00
Steve Howell 42435db492 Add run_test helper for individual tests.
This run_test helper sets up a convention that allows
us to give really short tracebacks for errors, and
eventually we can have more control over running
individual tests.  (The latter goal has some
complications, since we often intentionally leak
setup in tests.)
2018-05-15 08:24:44 -07:00
Shubham Dhama bfcfe84bdd compose: Append space when text added at the end of textarea.
This appends a space when text is inserted at the end of a message
using `compose_ui.insert_syntax_and_focus`.  This is definitely what
users expect when using this feature.

Fixes: #8569.
2018-03-04 13:16:17 -08:00
Steve Howell 36ade63d84 compose: Fix bug in undo operation
This fixes compose.test_video_link_compose_clicked to just
use a stub for compose_ui.insert_syntax_and_focus.

It also adds direct tests for compose_ui.insert_syntax_and_focus.

Fixes #6362
2017-12-10 04:10:18 -08:00
Tim Abbott 9fa58a3c16 compose_ui: Automatically resize textarea after adding new syntax.
This fixes existing problems as well as an upcoming problem that
copy-and-pasting in markdown should usually expand the compose text
area.
2017-11-21 19:52:47 -08:00
Steve Howell d7254a0556 Append space as needed in compose_ui.smart_insert(). 2017-11-09 09:49:20 -08:00
Steve Howell f935afa241 Prepend space as needed in compose_ui.smart_insert(). 2017-11-09 09:49:20 -08:00
Steve Howell 1b1858aa64 node tests: Test compose_ui.smart_insert(). 2017-11-09 09:49:20 -08:00