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
cc2b5e1a
Commit
cc2b5e1a
authored
Apr 19, 2021
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add container classes to ProseMirror view
parent
ef6c614e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
app/assets/javascripts/content_editor/services/create_editor.js
...sets/javascripts/content_editor/services/create_editor.js
+5
-0
spec/frontend/content_editor/services/create_editor_spec.js
spec/frontend/content_editor/services/create_editor_spec.js
+11
-1
No files found.
app/assets/javascripts/content_editor/services/create_editor.js
View file @
cc2b5e1a
...
@@ -37,6 +37,11 @@ const createEditor = async ({ content, renderMarkdown, serializer: customSeriali
...
@@ -37,6 +37,11 @@ const createEditor = async ({ content, renderMarkdown, serializer: customSeriali
new
OrderedList
(),
new
OrderedList
(),
new
CodeBlockHighlight
(),
new
CodeBlockHighlight
(),
],
],
editorProps
:
{
attributes
:
{
class
:
'
gl-py-4 gl-px-5
'
,
},
},
});
});
const
serializer
=
customSerializer
||
createMarkdownSerializer
({
render
:
renderMarkdown
});
const
serializer
=
customSerializer
||
createMarkdownSerializer
({
render
:
renderMarkdown
});
...
...
spec/frontend/content_editor/services/create_editor_spec.js
View file @
cc2b5e1a
...
@@ -5,14 +5,24 @@ import createMarkdownSerializer from '~/content_editor/services/markdown_seriali
...
@@ -5,14 +5,24 @@ import createMarkdownSerializer from '~/content_editor/services/markdown_seriali
jest
.
mock
(
'
~/content_editor/services/markdown_serializer
'
);
jest
.
mock
(
'
~/content_editor/services/markdown_serializer
'
);
describe
(
'
content_editor/services/create_editor
'
,
()
=>
{
describe
(
'
content_editor/services/create_editor
'
,
()
=>
{
const
renderMarkdown
=
()
=>
true
;
const
buildMockSerializer
=
()
=>
({
const
buildMockSerializer
=
()
=>
({
serialize
:
jest
.
fn
(),
serialize
:
jest
.
fn
(),
deserialize
:
jest
.
fn
(),
deserialize
:
jest
.
fn
(),
});
});
it
(
'
sets gl-py-4 gl-px-5 class selectors to editor attributes
'
,
async
()
=>
{
const
editor
=
await
createEditor
({
renderMarkdown
});
expect
(
editor
.
options
.
editorProps
).
toMatchObject
({
attributes
:
{
class
:
'
gl-py-4 gl-px-5
'
,
},
});
});
describe
(
'
creating an editor
'
,
()
=>
{
describe
(
'
creating an editor
'
,
()
=>
{
it
(
'
uses markdown serializer when a renderMarkdown function is provided
'
,
async
()
=>
{
it
(
'
uses markdown serializer when a renderMarkdown function is provided
'
,
async
()
=>
{
const
renderMarkdown
=
()
=>
true
;
const
mockSerializer
=
buildMockSerializer
();
const
mockSerializer
=
buildMockSerializer
();
createMarkdownSerializer
.
mockReturnValueOnce
(
mockSerializer
);
createMarkdownSerializer
.
mockReturnValueOnce
(
mockSerializer
);
...
...
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