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
1505dc14
Commit
1505dc14
authored
Apr 29, 2020
by
Jacques Erasmus
Committed by
Natalia Tepluhina
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default editor options
Added default editor options to match our design mockups
parent
4095185d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
1 deletion
+71
-1
app/assets/javascripts/vue_shared/components/rich_content_editor/constants.js
...ts/vue_shared/components/rich_content_editor/constants.js
+25
-0
app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue
...ed/components/rich_content_editor/rich_content_editor.vue
+11
-1
spec/frontend/__mocks__/@toast-ui/vue-editor/index.js
spec/frontend/__mocks__/@toast-ui/vue-editor/index.js
+6
-0
spec/frontend/vue_shared/components/rich_content_editor/rich_content_editor_spec.js
...omponents/rich_content_editor/rich_content_editor_spec.js
+29
-0
No files found.
app/assets/javascripts/vue_shared/components/rich_content_editor/constants.js
0 → 100644
View file @
1505dc14
export
const
EDITOR_OPTIONS
=
{
toolbarItems
:
[
'
heading
'
,
'
bold
'
,
'
italic
'
,
'
strike
'
,
'
divider
'
,
'
quote
'
,
'
link
'
,
'
codeblock
'
,
'
divider
'
,
'
ul
'
,
'
ol
'
,
'
task
'
,
'
divider
'
,
'
hr
'
,
'
table
'
,
'
divider
'
,
'
code
'
,
],
};
export
const
EDITOR_TYPES
=
{
wysiwyg
:
'
wysiwyg
'
,
};
app/assets/javascripts/vue_shared/components/rich_content_editor/rich_content_editor.vue
View file @
1505dc14
...
...
@@ -2,6 +2,8 @@
import
'
codemirror/lib/codemirror.css
'
;
import
'
@toast-ui/editor/dist/toastui-editor.css
'
;
import
{
EDITOR_OPTIONS
,
EDITOR_TYPES
}
from
'
./constants
'
;
export
default
{
components
:
{
ToastEditor
:
()
=>
...
...
@@ -23,8 +25,16 @@ export default {
return
this
.
$refs
.
editor
.
invoke
(
'
getMarkdown
'
);
},
},
editorOptions
:
EDITOR_OPTIONS
,
initialEditType
:
EDITOR_TYPES
.
wysiwyg
,
};
</
script
>
<
template
>
<toast-editor
ref=
"editor"
:initial-value=
"value"
@
change=
"onContentChanged"
/>
<toast-editor
ref=
"editor"
:initial-edit-type=
"$options.initialEditType"
:initial-value=
"value"
:options=
"$options.editorOptions"
@
change=
"onContentChanged"
/>
</
template
>
spec/frontend/__mocks__/@toast-ui/vue-editor/index.js
View file @
1505dc14
...
...
@@ -4,6 +4,12 @@ export const Editor = {
type
:
String
,
required
:
true
,
},
options
:
{
type
:
Object
,
},
initialEditType
:
{
type
:
String
,
},
},
render
(
h
)
{
return
h
(
'
div
'
);
...
...
spec/frontend/vue_shared/components/rich_content_editor/rich_content_editor_spec.js
View file @
1505dc14
...
...
@@ -4,6 +4,27 @@ import RichContentEditor from '~/vue_shared/components/rich_content_editor/rich_
describe
(
'
Rich Content Editor
'
,
()
=>
{
let
wrapper
;
const
editorOptions
=
{
toolbarItems
:
[
'
heading
'
,
'
bold
'
,
'
italic
'
,
'
strike
'
,
'
divider
'
,
'
quote
'
,
'
link
'
,
'
codeblock
'
,
'
divider
'
,
'
ul
'
,
'
ol
'
,
'
task
'
,
'
divider
'
,
'
hr
'
,
'
table
'
,
'
divider
'
,
'
code
'
,
],
};
const
value
=
'
## Some Markdown
'
;
const
findEditor
=
()
=>
wrapper
.
find
({
ref
:
'
editor
'
});
...
...
@@ -21,6 +42,14 @@ describe('Rich Content Editor', () => {
it
(
'
renders the correct content
'
,
()
=>
{
expect
(
findEditor
().
props
().
initialValue
).
toBe
(
value
);
});
it
(
'
provides the correct editor options
'
,
()
=>
{
expect
(
findEditor
().
props
().
options
).
toEqual
(
editorOptions
);
});
it
(
'
has the correct initial edit type
'
,
()
=>
{
expect
(
findEditor
().
props
().
initialEditType
).
toBe
(
'
wysiwyg
'
);
});
});
describe
(
'
when content is changed
'
,
()
=>
{
...
...
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