Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
erp5
Commits
307e1f3f
Commit
307e1f3f
authored
Sep 16, 2015
by
Kristopher Ruzic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add multiline support to messaging
use shift+enter to add newlines, and enter to send messages
parent
8bd33b5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
21 deletions
+28
-21
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberclient_js.xml
...ateItem/web_page_module/jabber_gadget_jabberclient_js.xml
+28
-21
No files found.
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberclient_js.xml
View file @
307e1f3f
...
...
@@ -239,16 +239,6 @@
var dateObject = new Date();\n
return dateObject.toUTCString(); \n
}\n
\n
$(document).ready(function() {\n
console.log("TEST");\n
$(\'#jabber-message\').keyup(function(e) {\n
if (e.which == 13 && ! e.shiftKey) {\n
$(this.form).submit();\n
return false;\n
}\n
});\n
});\n
\n
\n
function sequentialMessages(li, new_msg) { \n
...
...
@@ -464,7 +454,7 @@
}\n
\n
function renderDialogPage(gadget, connection_gadget) {\n
var jid,\n
var jid,
message_box,
\n
contact_url;\n
return RSVP.Queue()\n
.push(function () {\n
...
...
@@ -499,15 +489,32 @@
}\n
gadget.props.contact_dict[jid].read = true;\n
\n
function sendMessageHandler(submit_event) {\n
var text = submit_event.target[0].value;\n
submit_event.target[0].value = "";\n
return RSVP.all([\n
connection_gadget.sendMessage(jid, text),\n
updateConversation(gadget, jid, text, false)\n
]);\n
function sendMessageHandler(e) {\n
// don\'t send empty messages \n
if (!message_box.val().trim()) {\n
if (e.which === 13
&&
!e.shiftKey) {\n
e.preventDefault();\n
} \n
return true;\n
}\n
// send messages when the field is focused and Enter is pressed \n
if (e.which == 13
&&
!e.shiftKey
&&
message_box.is(":focus")) {\n
e.preventDefault(); // prevent newline from being added before sending\n
var text = message_box.val();\n
message_box.val("");\n
return RSVP.all([\n
connection_gadget.sendMessage(jid, text),\n
updateConversation(gadget, jid, text, false)\n
]);\n
}\n
}\n
\n
\n
// add keypress listener to textarea\n
message_box = $(\'#jabber-message\');\n
message_box.on(\'keypress\', function(e) {\n
sendMessageHandler(e);\n
});\n
\n
return loopEventListener(\n
gadget.props.content_element.querySelector(\'form.message-form\'),\n
\'submit\',\n
...
...
@@ -1065,7 +1072,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
945.
49472.21975.11707
</string>
</value>
<value>
<string>
945.
50924.44927.18978
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -1083,7 +1090,7 @@
</tuple>
<state>
<tuple>
<float>
14423
06131.67
</float>
<float>
14423
93081.82
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment