Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
d8527219
Commit
d8527219
authored
Aug 07, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Place cursor at the end when correcting a message
parent
08dce556
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
src/converse-chatview.js
src/converse-chatview.js
+8
-6
src/utils/core.js
src/utils/core.js
+13
-0
No files found.
src/converse-chatview.js
View file @
d8527219
...
...
@@ -1012,21 +1012,23 @@
insertIntoTextArea
(
value
,
replace
=
false
,
correcting
=
false
)
{
const
textarea
=
this
.
el
.
querySelector
(
'
.chat-textarea
'
);
if
(
correcting
)
{
u
.
addClass
(
'
correcting
'
,
textarea
);
}
else
{
u
.
removeClass
(
'
correcting
'
,
textarea
);
}
if
(
replace
)
{
textarea
.
value
=
''
;
textarea
.
value
=
value
;
}
else
{
let
existing
=
textarea
.
value
;
if
(
existing
&&
(
existing
[
existing
.
length
-
1
]
!==
'
'
))
{
existing
=
existing
+
'
'
;
}
textarea
.
value
=
''
;
textarea
.
value
=
existing
+
value
+
'
'
;
}
if
(
correcting
)
{
u
.
addClass
(
'
correcting
'
,
textarea
);
}
else
{
u
.
removeClass
(
'
correcting
'
,
textarea
);
}
textarea
.
focus
()
u
.
putCurserAtEnd
(
textarea
);
},
createEmojiPicker
()
{
...
...
src/utils/core.js
View file @
d8527219
...
...
@@ -849,6 +849,19 @@
return
result
;
};
u
.
putCurserAtEnd
=
function
(
textarea
)
{
if
(
textarea
!==
document
.
activeElement
)
{
textarea
.
focus
();
}
// Double the length because Opera is inconsistent about whether a carriage return is one character or two.
const
len
=
textarea
.
value
.
length
*
2
;
// Timeout seems to be required for Blink
setTimeout
(()
=>
textarea
.
setSelectionRange
(
len
,
len
),
1
);
// Scroll to the bottom, in case we're in a tall textarea
// (Necessary for Firefox and Chrome)
this
.
scrollTop
=
999999
;
};
u
.
getUniqueId
=
function
()
{
return
'
xxxxxxxx-xxxx
'
.
replace
(
/
[
x
]
/g
,
function
(
c
)
{
var
r
=
Math
.
random
()
*
16
|
0
,
...
...
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