mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-02 11:42:42 +01:00
700666ae0a
Summary: Fixes T11623. Enables send-on-enter and shift-enter for linebreaks, per durable column. Also cleaned up UI for Joining Room or Logging In. Test Plan: See room I can join, click Join Room. Leave Room, Log out, visit room with login prompt. Login, Join Room again. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11623 Differential Revision: https://secure.phabricator.com/D16595
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-conpherence-pontificate
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-util
|
|
* javelin-workflow
|
|
* javelin-stratcom
|
|
* conpherence-thread-manager
|
|
*/
|
|
|
|
JX.behavior('conpherence-pontificate', function() {
|
|
|
|
var _sendMessage = function(e) {
|
|
e.kill();
|
|
var form = e.getNode('tag:form');
|
|
var threadManager = JX.ConpherenceThreadManager.getInstance();
|
|
threadManager.sendMessage(form, {});
|
|
};
|
|
|
|
JX.Stratcom.listen(
|
|
['submit', 'didSyntheticSubmit'],
|
|
'conpherence-pontificate',
|
|
_sendMessage);
|
|
|
|
// Send on enter if the shift key is not held.
|
|
JX.Stratcom.listen(
|
|
'keydown',
|
|
'conpherence-pontificate',
|
|
function(e) {
|
|
if (e.getSpecialKey() != 'return') {
|
|
return;
|
|
}
|
|
|
|
var raw = e.getRawEvent();
|
|
if (raw.shiftKey) {
|
|
// If the shift key is pressed, let the browser write a newline into
|
|
// the textarea.
|
|
return;
|
|
}
|
|
|
|
// From here on, interpret this as a "send" action, not a literal
|
|
// newline.
|
|
e.kill();
|
|
|
|
_sendMessage(e);
|
|
});
|
|
|
|
});
|