BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4140c462
Commit
4140c462
authored
Jun 06, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made markdown buttons work on all markdown textareas
Selecting multiple rows & a list correctly creates the selected text into a list
parent
d5b331b7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
26 deletions
+27
-26
gl_form.js.coffee
app/assets/javascripts/gl_form.js.coffee
+3
-0
text_utility.js.coffee
app/assets/javascripts/lib/text_utility.js.coffee
+24
-12
_discussion.html.haml
app/views/projects/issues/_discussion.html.haml
+0
-7
_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+0
-7
No files found.
app/assets/javascripts/gl_form.js.coffee
View file @
4140c462
...
...
@@ -34,6 +34,8 @@ class @GLForm
# form and textarea event listeners
@
addEventListeners
()
gl
.
text
.
init
(
@
form
)
# hide discard button
@
form
.
find
(
'.js-note-discard'
).
hide
()
...
...
@@ -42,6 +44,7 @@ class @GLForm
clearEventListeners
:
->
@
textarea
.
off
'focus'
@
textarea
.
off
'blur'
gl
.
text
.
removeListeners
(
@
form
)
addEventListeners
:
->
@
textarea
.
on
'focus'
,
->
...
...
app/assets/javascripts/lib/text_utility.js.coffee
View file @
4140c462
...
...
@@ -11,8 +11,18 @@
text
.
substring
(
textarea
.
selectionStart
,
textarea
.
selectionEnd
)
gl
.
text
.
insertText
=
(
textArea
,
text
,
tag
,
selected
,
wrap
)
->
selectedSplit
=
selected
.
split
(
'
\n
'
)
startChar
=
if
not
wrap
and
textArea
.
selectionStart
>
0
then
'
\n
'
else
''
insertText
=
"
#{
startChar
}#{
tag
}#{
selected
}#{
if
wrap
then
tag
else
' '
}
"
if
selectedSplit
.
length
>
1
and
not
wrap
insertText
=
selectedSplit
.
map
((
val
)
->
if
val
.
indexOf
(
tag
)
is
0
"
#{
val
.
replace
(
tag
,
''
)
}
"
else
"
#{
tag
}#{
val
}
"
).
join
(
'
\n
'
)
else
insertText
=
"
#{
startChar
}#{
tag
}#{
selected
}#{
if
wrap
then
tag
else
' '
}
"
if
document
.
queryCommandSupported
(
'insertText'
)
document
.
execCommand
'insertText'
,
false
,
insertText
...
...
@@ -51,17 +61,19 @@
@
insertText
(
textArea
,
text
,
tag
,
selected
,
wrap
)
gl
.
text
.
addListeners
=
->
gl
.
text
.
init
=
(
form
)
->
self
=
@
$
(
'.js-md'
).
on
'click'
,
->
$this
=
$
(
@
)
self
.
updateText
(
$this
.
closest
(
'.md-area'
).
find
(
'textarea'
),
$this
.
data
(
'md-tag'
),
not
$this
.
data
(
'md-prepend'
)
)
gl
.
text
.
removeListeners
=
->
$
(
'.js-md'
).
off
()
$
(
'.js-md'
,
form
)
.
off
'click'
.
on
'click'
,
->
$this
=
$
(
@
)
self
.
updateText
(
$this
.
closest
(
'.md-area'
).
find
(
'textarea'
),
$this
.
data
(
'md-tag'
),
not
$this
.
data
(
'md-prepend'
)
)
gl
.
text
.
removeListeners
=
(
form
)
->
$
(
'.js-md'
,
form
).
off
()
)
window
app/views/projects/issues/_discussion.html.haml
View file @
4140c462
...
...
@@ -5,9 +5,3 @@
#notes
=
render
'projects/notes/notes_with_form'
:javascript
$
(
function
(){
gl
.
text
.
removeListeners
();
gl
.
text
.
addListeners
();
})
\ No newline at end of file
app/views/projects/merge_requests/_discussion.html.haml
View file @
4140c462
...
...
@@ -6,9 +6,3 @@
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-grouped btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
#notes
=
render
"projects/notes/notes_with_form"
:javascript
$
(
function
(){
gl
.
text
.
removeListeners
();
gl
.
text
.
addListeners
();
})
\ No newline at end of file
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