Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Jérome Perrin
gitlab-ce
Commits
2c954117
Commit
2c954117
authored
Jun 26, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed multi-line markdown in issue edit form
Closes #34318
parent
4d6ed39b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
38 deletions
+75
-38
app/assets/javascripts/lib/utils/text_utility.js
app/assets/javascripts/lib/utils/text_utility.js
+2
-2
changelogs/unreleased/issue-form-multiple-line-markdown.yml
changelogs/unreleased/issue-form-multiple-line-markdown.yml
+4
-0
spec/javascripts/vue_shared/components/markdown/field_spec.js
.../javascripts/vue_shared/components/markdown/field_spec.js
+69
-36
No files found.
app/assets/javascripts/lib/utils/text_utility.js
View file @
2c954117
...
@@ -94,8 +94,8 @@ gl.text.insertText = function(textArea, text, tag, blockTag, selected, wrap) {
...
@@ -94,8 +94,8 @@ gl.text.insertText = function(textArea, text, tag, blockTag, selected, wrap) {
startChar
=
!
wrap
&&
!
currentLineEmpty
&&
textArea
.
selectionStart
>
0
?
'
\n
'
:
''
;
startChar
=
!
wrap
&&
!
currentLineEmpty
&&
textArea
.
selectionStart
>
0
?
'
\n
'
:
''
;
if
(
selectedSplit
.
length
>
1
&&
(
!
wrap
||
(
blockTag
!=
null
)))
{
if
(
selectedSplit
.
length
>
1
&&
(
!
wrap
||
(
blockTag
!=
null
&&
blockTag
!==
''
)))
{
if
(
blockTag
!=
null
)
{
if
(
blockTag
!=
null
&&
blockTag
!==
''
)
{
insertText
=
this
.
blockTagText
(
text
,
textArea
,
blockTag
,
selected
);
insertText
=
this
.
blockTagText
(
text
,
textArea
,
blockTag
,
selected
);
}
else
{
}
else
{
insertText
=
selectedSplit
.
map
(
function
(
val
)
{
insertText
=
selectedSplit
.
map
(
function
(
val
)
{
...
...
changelogs/unreleased/issue-form-multiple-line-markdown.yml
0 → 100644
View file @
2c954117
---
title
:
Fixed multi-line markdown tooltip buttons in issue edit form
merge_request
:
author
:
spec/javascripts/vue_shared/components/markdown/field_spec.js
View file @
2c954117
...
@@ -4,47 +4,33 @@ import fieldComponent from '~/vue_shared/components/markdown/field.vue';
...
@@ -4,47 +4,33 @@ import fieldComponent from '~/vue_shared/components/markdown/field.vue';
describe
(
'
Markdown field component
'
,
()
=>
{
describe
(
'
Markdown field component
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
(()
=>
{
beforeEach
((
done
)
=>
{
vm
=
new
Vue
({
vm
=
new
Vue
({
render
(
createElement
)
{
data
()
{
return
createElement
(
return
{
fieldComponent
,
text
:
'
testing
\n
123
'
,
{
};
props
:
{
markdownPreviewUrl
:
'
/preview
'
,
markdownDocs
:
'
/docs
'
,
},
},
[
createElement
(
'
textarea
'
,
{
slot
:
'
textarea
'
,
}),
],
);
},
},
});
components
:
{
});
fieldComponent
,
},
it
(
'
creates a new instance of GL form
'
,
(
done
)
=>
{
template
:
`
spyOn
(
gl
,
'
GLForm
'
);
<field-component
vm
.
$mount
();
marodown-preview-url="/preview"
markdown-docs="/docs"
Vue
.
nextTick
(()
=>
{
>
expect
(
<textarea
gl
.
GLForm
,
slot="textarea"
).
toHaveBeenCalled
();
v-model="text">
</textarea>
done
();
</field-component>
});
`
,
}).
$mount
();
Vue
.
nextTick
(
done
);
});
});
describe
(
'
mounted
'
,
()
=>
{
describe
(
'
mounted
'
,
()
=>
{
beforeEach
((
done
)
=>
{
vm
.
$mount
();
Vue
.
nextTick
(
done
);
});
it
(
'
renders textarea inside backdrop
'
,
()
=>
{
it
(
'
renders textarea inside backdrop
'
,
()
=>
{
expect
(
expect
(
vm
.
$el
.
querySelector
(
'
.zen-backdrop textarea
'
),
vm
.
$el
.
querySelector
(
'
.zen-backdrop textarea
'
),
...
@@ -117,5 +103,52 @@ describe('Markdown field component', () => {
...
@@ -117,5 +103,52 @@ describe('Markdown field component', () => {
});
});
});
});
});
});
describe
(
'
markdown buttons
'
,
()
=>
{
it
(
'
converts single words
'
,
(
done
)
=>
{
const
textarea
=
vm
.
$el
.
querySelector
(
'
textarea
'
);
textarea
.
setSelectionRange
(
0
,
7
);
vm
.
$el
.
querySelector
(
'
.js-md
'
).
click
();
Vue
.
nextTick
(()
=>
{
expect
(
textarea
.
value
,
).
toContain
(
'
**testing**
'
);
done
();
});
});
it
(
'
converts a line
'
,
(
done
)
=>
{
const
textarea
=
vm
.
$el
.
querySelector
(
'
textarea
'
);
textarea
.
setSelectionRange
(
0
,
0
);
vm
.
$el
.
querySelectorAll
(
'
.js-md
'
)[
4
].
click
();
Vue
.
nextTick
(()
=>
{
expect
(
textarea
.
value
,
).
toContain
(
'
* testing
'
);
done
();
});
});
it
(
'
converts multiple lines
'
,
(
done
)
=>
{
const
textarea
=
vm
.
$el
.
querySelector
(
'
textarea
'
);
textarea
.
setSelectionRange
(
0
,
50
);
vm
.
$el
.
querySelectorAll
(
'
.js-md
'
)[
4
].
click
();
Vue
.
nextTick
(()
=>
{
expect
(
textarea
.
value
,
).
toContain
(
'
* testing
\n
* 123
'
);
done
();
});
});
});
});
});
});
});
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