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
fa424e62
Commit
fa424e62
authored
May 21, 2021
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include text styles dropdown in top toolbar
parent
81be441f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
app/assets/javascripts/content_editor/components/top_toolbar.vue
...ets/javascripts/content_editor/components/top_toolbar.vue
+8
-0
spec/frontend/content_editor/components/top_toolbar_spec.js
spec/frontend/content_editor/components/top_toolbar_spec.js
+9
-8
No files found.
app/assets/javascripts/content_editor/components/top_toolbar.vue
View file @
fa424e62
...
@@ -4,6 +4,7 @@ import { CONTENT_EDITOR_TRACKING_LABEL, TOOLBAR_CONTROL_TRACKING_ACTION } from '
...
@@ -4,6 +4,7 @@ import { CONTENT_EDITOR_TRACKING_LABEL, TOOLBAR_CONTROL_TRACKING_ACTION } from '
import
{
ContentEditor
}
from
'
../services/content_editor
'
;
import
{
ContentEditor
}
from
'
../services/content_editor
'
;
import
Divider
from
'
./divider.vue
'
;
import
Divider
from
'
./divider.vue
'
;
import
ToolbarButton
from
'
./toolbar_button.vue
'
;
import
ToolbarButton
from
'
./toolbar_button.vue
'
;
import
ToolbarTextStyleDropdown
from
'
./toolbar_text_style_dropdown.vue
'
;
const
trackingMixin
=
Tracking
.
mixin
({
const
trackingMixin
=
Tracking
.
mixin
({
label
:
CONTENT_EDITOR_TRACKING_LABEL
,
label
:
CONTENT_EDITOR_TRACKING_LABEL
,
...
@@ -12,6 +13,7 @@ const trackingMixin = Tracking.mixin({
...
@@ -12,6 +13,7 @@ const trackingMixin = Tracking.mixin({
export
default
{
export
default
{
components
:
{
components
:
{
ToolbarButton
,
ToolbarButton
,
ToolbarTextStyleDropdown
,
Divider
,
Divider
,
},
},
mixins
:
[
trackingMixin
],
mixins
:
[
trackingMixin
],
...
@@ -35,6 +37,12 @@ export default {
...
@@ -35,6 +37,12 @@ export default {
<div
<div
class=
"gl-display-flex gl-justify-content-end gl-pb-3 gl-pt-0 gl-border-b-solid gl-border-b-1 gl-border-b-gray-200"
class=
"gl-display-flex gl-justify-content-end gl-pb-3 gl-pt-0 gl-border-b-solid gl-border-b-1 gl-border-b-gray-200"
>
>
<toolbar-text-style-dropdown
data-testid=
"text-styles"
:tiptap-editor=
"contentEditor.tiptapEditor"
@
execute=
"trackToolbarControlExecution"
/>
<divider
/>
<toolbar-button
<toolbar-button
data-testid=
"bold"
data-testid=
"bold"
content-type=
"bold"
content-type=
"bold"
...
...
spec/frontend/content_editor/components/top_toolbar_spec.js
View file @
fa424e62
...
@@ -39,32 +39,33 @@ describe('content_editor/components/top_toolbar', () => {
...
@@ -39,32 +39,33 @@ describe('content_editor/components/top_toolbar', () => {
});
});
describe
.
each
`
describe
.
each
`
testId |
button
Props
testId |
control
Props
${
'
bold
'
}
|
${{
contentType
:
'
bold
'
,
iconName
:
'
bold
'
,
label
:
'
Bold text
'
,
editorCommand
:
'
toggleBold
'
}
}
${
'
bold
'
}
|
${{
contentType
:
'
bold
'
,
iconName
:
'
bold
'
,
label
:
'
Bold text
'
,
editorCommand
:
'
toggleBold
'
}
}
${
'
italic
'
}
|
${{
contentType
:
'
italic
'
,
iconName
:
'
italic
'
,
label
:
'
Italic text
'
,
editorCommand
:
'
toggleItalic
'
}
}
${
'
italic
'
}
|
${{
contentType
:
'
italic
'
,
iconName
:
'
italic
'
,
label
:
'
Italic text
'
,
editorCommand
:
'
toggleItalic
'
}
}
${
'
code
'
}
|
${{
contentType
:
'
code
'
,
iconName
:
'
code
'
,
label
:
'
Code
'
,
editorCommand
:
'
toggleCode
'
}
}
${
'
code
'
}
|
${{
contentType
:
'
code
'
,
iconName
:
'
code
'
,
label
:
'
Code
'
,
editorCommand
:
'
toggleCode
'
}
}
${
'
blockquote
'
}
|
${{
contentType
:
'
blockquote
'
,
iconName
:
'
quote
'
,
label
:
'
Insert a quote
'
,
editorCommand
:
'
toggleBlockquote
'
}
}
${
'
blockquote
'
}
|
${{
contentType
:
'
blockquote
'
,
iconName
:
'
quote
'
,
label
:
'
Insert a quote
'
,
editorCommand
:
'
toggleBlockquote
'
}
}
${
'
bullet-list
'
}
|
${{
contentType
:
'
bulletList
'
,
iconName
:
'
list-bulleted
'
,
label
:
'
Add a bullet list
'
,
editorCommand
:
'
toggleBulletList
'
}
}
${
'
bullet-list
'
}
|
${{
contentType
:
'
bulletList
'
,
iconName
:
'
list-bulleted
'
,
label
:
'
Add a bullet list
'
,
editorCommand
:
'
toggleBulletList
'
}
}
${
'
ordered-list
'
}
|
${{
contentType
:
'
orderedList
'
,
iconName
:
'
list-numbered
'
,
label
:
'
Add a numbered list
'
,
editorCommand
:
'
toggleOrderedList
'
}
}
${
'
ordered-list
'
}
|
${{
contentType
:
'
orderedList
'
,
iconName
:
'
list-numbered
'
,
label
:
'
Add a numbered list
'
,
editorCommand
:
'
toggleOrderedList
'
}
}
`
(
'
given a $testId toolbar control
'
,
({
testId
,
buttonProps
})
=>
{
${
'
text-styles
'
}
|
${{}}
`('given a $testId toolbar control', ({ testId, controlProps }) => {
beforeEach(() => {
beforeEach(() => {
buildWrapper();
buildWrapper();
});
});
it('renders the toolbar control with the provided properties', () => {
it('renders the toolbar control with the provided properties', () => {
expect(wrapper.findByTestId(testId).props()).toEqual({
expect(wrapper.findByTestId(testId).props()).toEqual({
...
button
Props
,
...
control
Props,
tiptapEditor: contentEditor.tiptapEditor,
tiptapEditor: contentEditor.tiptapEditor,
});
});
});
});
it.each`
it.each`
control |
eventData
eventData
${
'
bold
'
}
|
${
{
contentType
:
'
bold
'
}
}
$
{{
contentType
:
'
bold
'
}
}
${
'
blockquote
'
}
|
${
{
contentType
:
'
blockquote
'
,
value
:
1
}
}
${{
contentType
:
'
blockquote
'
,
value
:
1
}
}
`
(
'
tracks the execution of toolbar controls
'
,
({
control
,
eventData
})
=>
{
`
(
'
tracks the execution of toolbar controls
'
,
({
eventData
})
=>
{
const
{
contentType
,
value
}
=
eventData
;
const
{
contentType
,
value
}
=
eventData
;
wrapper
.
findByTestId
(
control
).
vm
.
$emit
(
'
execute
'
,
eventData
);
wrapper
.
findByTestId
(
testId
).
vm
.
$emit
(
'
execute
'
,
eventData
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
TOOLBAR_CONTROL_TRACKING_ACTION
,
{
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
TOOLBAR_CONTROL_TRACKING_ACTION
,
{
label
:
CONTENT_EDITOR_TRACKING_LABEL
,
label
:
CONTENT_EDITOR_TRACKING_LABEL
,
...
...
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