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
d7c74c3e
Commit
d7c74c3e
authored
Mar 24, 2021
by
Enrique Alcántara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group content editor dependencies in a single chunk
parent
726c581a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
3 deletions
+55
-3
app/assets/javascripts/content_editor/components/content_editor.vue
.../javascripts/content_editor/components/content_editor.vue
+18
-0
app/assets/javascripts/content_editor/services/create_editor.js
...sets/javascripts/content_editor/services/create_editor.js
+3
-3
config/webpack.config.js
config/webpack.config.js
+8
-0
spec/frontend/content_editor/components/content_editor_spec.js
...frontend/content_editor/components/content_editor_spec.js
+26
-0
No files found.
app/assets/javascripts/content_editor/components/content_editor.vue
0 → 100644
View file @
d7c74c3e
<
script
>
import
{
EditorContent
}
from
'
tiptap
'
;
import
createEditor
from
'
../services/create_editor
'
;
export
default
{
components
:
{
EditorContent
,
},
data
()
{
return
{
editor
:
createEditor
(),
};
},
};
</
script
>
<
template
>
<editor-content
:editor=
"editor"
/>
</
template
>
app/assets/javascripts/content_editor/services/create_editor.js
View file @
d7c74c3e
const
createEditor
=
async
({
content
})
=>
{
const
{
Editor
}
=
await
import
(
/* webpackChunkName: 'tiptap' */
'
tiptap
'
);
const
{
Bold
,
Code
}
=
await
import
(
/* webpackChunkName: 'tiptap' */
'
tiptap-extensions
'
);
import
{
Editor
}
from
'
tiptap
'
;
import
{
Bold
,
Code
}
from
'
tiptap-extensions
'
;
const
createEditor
=
({
content
}
=
{})
=>
{
return
new
Editor
({
extensions
:
[
new
Bold
(),
new
Code
()],
content
,
...
...
config/webpack.config.js
View file @
d7c74c3e
...
...
@@ -307,6 +307,14 @@ module.exports = {
chunks
:
'
initial
'
,
minChunks
:
autoEntriesCount
*
0.9
,
}),
tiptap
:
{
priority
:
17
,
name
:
'
tiptap
'
,
chunks
:
'
all
'
,
test
:
/
[\\/]
node_modules
[\\/](
tiptap|prosemirror
)
-
?\w
*
[\\/]
/
,
minChunks
:
2
,
reuseExistingChunk
:
true
,
},
graphql
:
{
priority
:
16
,
name
:
'
graphql
'
,
...
...
spec/frontend/content_editor/components/content_editor_spec.js
0 → 100644
View file @
d7c74c3e
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
EditorContent
}
from
'
tiptap
'
;
import
ContentEditor
from
'
~/content_editor/components/content_editor.vue
'
;
import
createEditor
from
'
~/content_editor/services/create_editor
'
;
jest
.
mock
(
'
~/content_editor/services/create_editor
'
);
describe
(
'
ContentEditor
'
,
()
=>
{
let
wrapper
;
const
buildWrapper
=
()
=>
{
wrapper
=
shallowMount
(
ContentEditor
);
};
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders editor content component and attaches editor instance
'
,
()
=>
{
const
editor
=
{};
createEditor
.
mockReturnValueOnce
(
editor
);
buildWrapper
();
expect
(
wrapper
.
findComponent
(
EditorContent
).
props
().
editor
).
toBe
(
editor
);
});
});
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