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
1
Merge Requests
1
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
gitlab-ce
Commits
bcc57447
Commit
bcc57447
authored
Jun 03, 2020
by
jerasmus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Style ToastUI contextual menu's
Styled the menus to match design mockups
parent
a38eb0c4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
29 deletions
+69
-29
app/assets/javascripts/vue_shared/components/rich_content_editor/editor_service.js
...e_shared/components/rich_content_editor/editor_service.js
+1
-2
app/assets/javascripts/vue_shared/components/rich_content_editor/toolbar_item.vue
...ue_shared/components/rich_content_editor/toolbar_item.vue
+10
-3
app/assets/stylesheets/components/rich_content_editor.scss
app/assets/stylesheets/components/rich_content_editor.scss
+21
-1
changelogs/unreleased/216797-style-toastui-menus.yml
changelogs/unreleased/216797-style-toastui-menus.yml
+5
-0
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
...red/components/rich_content_editor/editor_service_spec.js
+0
-4
spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js
...hared/components/rich_content_editor/toolbar_item_spec.js
+32
-19
No files found.
app/assets/javascripts/vue_shared/components/rich_content_editor/editor_service.js
View file @
bcc57447
...
...
@@ -22,10 +22,9 @@ export const generateToolbarItem = config => {
return
{
type
:
'
button
'
,
options
:
{
el
:
buildWrapper
({
props
:
{
icon
},
class
:
classes
}),
el
:
buildWrapper
({
props
:
{
icon
,
tooltip
},
class
:
classes
}),
event
,
command
,
tooltip
,
},
};
};
...
...
app/assets/javascripts/vue_shared/components/rich_content_editor/toolbar_item.vue
View file @
bcc57447
<
script
>
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
export
default
{
components
:
{
GlIcon
,
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
props
:
{
icon
:
{
type
:
String
,
required
:
true
,
},
tooltip
:
{
type
:
String
,
required
:
true
,
},
},
};
</
script
>
<
template
>
<button
class=
"p-0 gl-display-flex toolbar-button"
>
<gl-icon
class=
"gl-mx-auto"
:name=
"icon"
/>
<button
v-gl-tooltip=
"
{ title: tooltip }"
class="p-0 gl-display-flex toolbar-button">
<gl-icon
class=
"gl-mx-auto
gl-align-self-center
"
:name=
"icon"
/>
</button>
</
template
>
app/assets/stylesheets/components/rich_content_editor.scss
View file @
bcc57447
// Overrides styles from ToastUI editor
/**
* Overrides styles from ToastUI editor
*/
// Toolbar buttons
.tui-editor-defaultUI-toolbar
.toolbar-button
{
color
:
$gl-gray-600
;
border
:
0
;
...
...
@@ -9,3 +13,19 @@
border
:
0
;
}
}
// Contextual menu's & popups
.tui-editor-defaultUI
.tui-popup-wrapper
{
@include
gl-overflow-hidden
;
@include
gl-rounded-base
;
@include
gl-border-gray-400
;
hr
{
@include
gl-m-0
;
@include
gl-bg-gray-400
;
}
button
{
@include
gl-text-gray-800
;
}
}
changelogs/unreleased/216797-style-toastui-menus.yml
0 → 100644
View file @
bcc57447
---
title
:
Style ToastUI contextual menus
merge_request
:
33719
author
:
type
:
changed
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
View file @
bcc57447
...
...
@@ -29,10 +29,6 @@ describe('Editor Service', () => {
expect
(
generatedItem
.
options
.
command
).
toBe
(
config
.
command
);
});
it
(
'
generates the correct tooltip
'
,
()
=>
{
expect
(
generatedItem
.
options
.
tooltip
).
toBe
(
config
.
tooltip
);
});
it
(
'
generates the correct event
'
,
()
=>
{
expect
(
generatedItem
.
options
.
event
).
toBe
(
config
.
event
);
});
...
...
spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js
View file @
bcc57447
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
ToolbarItem
from
'
~/vue_shared/components/rich_content_editor/toolbar_item.vue
'
;
...
...
@@ -9,33 +10,45 @@ describe('Toolbar Item', () => {
const
findButton
=
()
=>
wrapper
.
find
(
'
button
'
);
const
buildWrapper
=
propsData
=>
{
wrapper
=
shallowMount
(
ToolbarItem
,
{
propsData
});
wrapper
=
shallowMount
(
ToolbarItem
,
{
propsData
,
directives
:
{
GlTooltip
:
createMockDirective
(),
},
});
};
describe
.
each
`
icon
${
'
heading
'
}
${
'
bold
'
}
${
'
italic
'
}
${
'
strikethrough
'
}
${
'
quote
'
}
${
'
link
'
}
${
'
doc-code
'
}
${
'
list-bulleted
'
}
${
'
list-numbered
'
}
${
'
list-task
'
}
${
'
list-indent
'
}
${
'
list-outdent
'
}
${
'
dash
'
}
${
'
table
'
}
${
'
code
'
}
`
(
'
toolbar item component
'
,
({
icon
})
=>
{
beforeEach
(()
=>
buildWrapper
({
icon
}));
icon | tooltip
${
'
heading
'
}
|
${
'
Headings
'
}
${
'
bold
'
}
|
${
'
Add bold text
'
}
${
'
italic
'
}
|
${
'
Add italic text
'
}
${
'
strikethrough
'
}
|
${
'
Add strikethrough text
'
}
${
'
quote
'
}
|
${
'
Insert a quote
'
}
${
'
link
'
}
|
${
'
Add a link
'
}
${
'
doc-code
'
}
|
${
'
Insert a code block
'
}
${
'
list-bulleted
'
}
|
${
'
Add a bullet list
'
}
${
'
list-numbered
'
}
|
${
'
Add a numbered list
'
}
${
'
list-task
'
}
|
${
'
Add a task list
'
}
${
'
list-indent
'
}
|
${
'
Indent
'
}
${
'
list-outdent
'
}
|
${
'
Outdent
'
}
${
'
dash
'
}
|
${
'
Add a line
'
}
${
'
table
'
}
|
${
'
Add a table
'
}
${
'
code
'
}
|
${
'
Insert an image
'
}
${
'
code
'
}
|
${
'
Insert inline code
'
}
`
(
'
toolbar item component
'
,
({
icon
,
tooltip
})
=>
{
beforeEach
(()
=>
buildWrapper
({
icon
,
tooltip
}));
it
(
'
renders a toolbar button
'
,
()
=>
{
expect
(
findButton
().
exists
()).
toBe
(
true
);
});
it
(
'
renders the correct tooltip
'
,
()
=>
{
const
buttonTooltip
=
getBinding
(
wrapper
.
element
,
'
gl-tooltip
'
);
expect
(
buttonTooltip
).
toBeDefined
();
expect
(
buttonTooltip
.
value
.
title
).
toBe
(
tooltip
);
});
it
(
`renders the
${
icon
}
icon`
,
()
=>
{
expect
(
findIcon
().
exists
()).
toBe
(
true
);
expect
(
findIcon
().
props
().
name
).
toBe
(
icon
);
...
...
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