Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
diaspora
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Gigadoc 2
diaspora
Commits
a6fb85d1
Unverified
Commit
a6fb85d1
authored
Aug 12, 2017
by
Steffen van Bergerem
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7524 from ivantedja/7273-cmd-enter-submit
support cmd+enter for post submission
parents
53f05eff
b154e9d7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
11 deletions
+50
-11
Changelog.md
Changelog.md
+1
-0
app/assets/javascripts/app/views/comment_stream_view.js
app/assets/javascripts/app/views/comment_stream_view.js
+1
-1
app/assets/javascripts/app/views/conversations_form_view.js
app/assets/javascripts/app/views/conversations_form_view.js
+1
-1
app/assets/javascripts/app/views/publisher_view.js
app/assets/javascripts/app/views/publisher_view.js
+1
-1
spec/javascripts/app/views/comment_stream_view_spec.js
spec/javascripts/app/views/comment_stream_view_spec.js
+15
-4
spec/javascripts/app/views/conversations_form_view_spec.js
spec/javascripts/app/views/conversations_form_view_spec.js
+18
-4
spec/javascripts/app/views/publisher_view_spec.js
spec/javascripts/app/views/publisher_view_spec.js
+13
-0
No files found.
Changelog.md
View file @
a6fb85d1
...
...
@@ -46,6 +46,7 @@ If so, please delete it since it will prevent the federation from working proper
*
Add inviter first and last name in the invitation e-mail
[
#7484
](
https://github.com/diaspora/diaspora/pull/7484
)
*
Add markdown editor for comments and conversations
[
#7482
](
https://github.com/diaspora/diaspora/pull/7482
)
*
Improve responsive header in desktop version
[
#7509
](
https://github.com/diaspora/diaspora/pull/7509
)
*
Support cmd+enter to submit posts, comments and conversations
[
#7524
](
https://github.com/diaspora/diaspora/pull/7524
)
# 0.6.8.0
...
...
app/assets/javascripts/app/views/comment_stream_view.js
View file @
a6fb85d1
...
...
@@ -82,7 +82,7 @@ app.views.CommentStream = app.views.Base.extend({
},
keyDownOnCommentBox
:
function
(
evt
)
{
if
(
evt
.
which
===
Keycodes
.
ENTER
&&
evt
.
ctrlKey
)
{
if
(
evt
.
which
===
Keycodes
.
ENTER
&&
(
evt
.
metaKey
||
evt
.
ctrlKey
)
)
{
this
.
$
(
"
form
"
).
submit
();
return
false
;
}
...
...
app/assets/javascripts/app/views/conversations_form_view.js
View file @
a6fb85d1
...
...
@@ -74,7 +74,7 @@ app.views.ConversationsForm = app.views.Base.extend({
},
keyDown
:
function
(
evt
)
{
if
(
evt
.
which
===
Keycodes
.
ENTER
&&
evt
.
ctrlKey
)
{
if
(
evt
.
which
===
Keycodes
.
ENTER
&&
(
evt
.
metaKey
||
evt
.
ctrlKey
)
)
{
$
(
evt
.
target
).
parents
(
"
form
"
).
submit
();
}
},
...
...
app/assets/javascripts/app/views/publisher_view.js
View file @
a6fb85d1
...
...
@@ -352,7 +352,7 @@ app.views.Publisher = Backbone.View.extend({
},
keyDown
:
function
(
evt
)
{
if
(
evt
.
which
===
Keycodes
.
ENTER
&&
evt
.
ctrlKey
)
{
if
(
evt
.
which
===
Keycodes
.
ENTER
&&
(
evt
.
metaKey
||
evt
.
ctrlKey
)
)
{
this
.
$
(
"
form
"
).
submit
();
this
.
open
();
return
false
;
...
...
spec/javascripts/app/views/comment_stream_view_spec.js
View file @
a6fb85d1
...
...
@@ -410,23 +410,34 @@ describe("app.views.CommentStream", function(){
submitCallback
=
jasmine
.
createSpy
().
and
.
returnValue
(
false
);
});
it
(
"
should not submit the form w
hen enter key is pressed
"
,
function
()
{
it
(
"
should not submit the form w
ithout the ctrl or cmd keys
"
,
function
()
{
this
.
view
.
render
();
var
form
=
this
.
view
.
$
(
"
form
"
);
form
.
submit
(
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
false
});
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
false
,
metaKey
:
false
});
this
.
view
.
keyDownOnCommentBox
(
e
);
expect
(
submitCallback
).
not
.
toHaveBeenCalled
();
});
it
(
"
should submit the form when enter is pressed with ctrl
"
,
function
(){
it
(
"
should submit the form when enter is pressed with ctrl
"
,
function
()
{
this
.
view
.
render
();
var
form
=
this
.
view
.
$
(
"
form
"
);
form
.
submit
(
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
true
});
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
true
});
this
.
view
.
keyDownOnCommentBox
(
e
);
expect
(
submitCallback
).
toHaveBeenCalled
();
});
it
(
"
should submit the form when enter is pressed with cmd
"
,
function
()
{
this
.
view
.
render
();
var
form
=
this
.
view
.
$
(
"
form
"
);
form
.
submit
(
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
metaKey
:
true
});
this
.
view
.
keyDownOnCommentBox
(
e
);
expect
(
submitCallback
).
toHaveBeenCalled
();
...
...
spec/javascripts/app/views/conversations_form_view_spec.js
View file @
a6fb85d1
...
...
@@ -164,9 +164,16 @@ describe("app.views.ConversationsForm", function() {
expect
(
this
.
submitCallback
).
toHaveBeenCalled
();
});
it
(
"
should
n't submit the form without the ctrl key
"
,
function
()
{
it
(
"
should
submit the form with cmd+enter
"
,
function
()
{
$
(
"
#new-conversation
"
).
submit
(
this
.
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
false
});
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
metaKey
:
true
});
$
(
"
#new-message-text
"
).
trigger
(
e
);
expect
(
this
.
submitCallback
).
toHaveBeenCalled
();
});
it
(
"
shouldn't submit the form without the ctrl or cmd key
"
,
function
()
{
$
(
"
#new-conversation
"
).
submit
(
this
.
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
false
,
metaKey
:
false
});
$
(
"
#new-message-text
"
).
trigger
(
e
);
expect
(
this
.
submitCallback
).
not
.
toHaveBeenCalled
();
});
...
...
@@ -185,9 +192,16 @@ describe("app.views.ConversationsForm", function() {
expect
(
this
.
submitCallback
).
toHaveBeenCalled
();
});
it
(
"
shouldn't submit the form without the ctrl key
"
,
function
()
{
it
(
"
should submit the form with cmd+enter
"
,
function
()
{
$
(
"
#response-message
"
).
submit
(
this
.
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
metaKey
:
true
});
$
(
"
#response-message-text
"
).
trigger
(
e
);
expect
(
this
.
submitCallback
).
toHaveBeenCalled
();
});
it
(
"
shouldn't submit the form without the ctrl or cmd key
"
,
function
()
{
$
(
"
#response-message
"
).
submit
(
this
.
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
false
});
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
ctrlKey
:
false
,
metaKey
:
false
});
$
(
"
#response-message-text
"
).
trigger
(
e
);
expect
(
this
.
submitCallback
).
not
.
toHaveBeenCalled
();
});
...
...
spec/javascripts/app/views/publisher_view_spec.js
View file @
a6fb85d1
...
...
@@ -250,6 +250,19 @@ describe("app.views.Publisher", function() {
expect
(
submitCallback
).
toHaveBeenCalled
();
expect
(
$
(
this
.
view
.
el
)).
not
.
toHaveClass
(
"
closed
"
);
});
it
(
"
should submit the form when cmd+enter is pressed
"
,
function
()
{
this
.
view
.
render
();
var
form
=
this
.
view
.
$
(
"
form
"
);
var
submitCallback
=
jasmine
.
createSpy
().
and
.
returnValue
(
false
);
form
.
submit
(
submitCallback
);
var
e
=
$
.
Event
(
"
keydown
"
,
{
which
:
Keycodes
.
ENTER
,
metaKey
:
true
});
this
.
view
.
keyDown
(
e
);
expect
(
submitCallback
).
toHaveBeenCalled
();
expect
(
$
(
this
.
view
.
el
)).
not
.
toHaveClass
(
"
closed
"
);
});
});
describe
(
"
tryClose
"
,
function
()
{
...
...
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