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
13181130
Commit
13181130
authored
Oct 01, 2021
by
GitLab Renovate
Committed by
Savas Vedova
Oct 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Content Editor Packages
parent
bc5d7fae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
38 deletions
+53
-38
app/assets/javascripts/content_editor/extensions/table_of_contents.js
...avascripts/content_editor/extensions/table_of_contents.js
+16
-2
package.json
package.json
+2
-2
spec/frontend/content_editor/extensions/table_of_contents_spec.js
...ntend/content_editor/extensions/table_of_contents_spec.js
+17
-16
yarn.lock
yarn.lock
+18
-18
No files found.
app/assets/javascripts/content_editor/extensions/table_of_contents.js
View file @
13181130
import
{
Node
,
nodeInputRule
}
from
'
@tiptap/core
'
;
import
{
Node
}
from
'
@tiptap/core
'
;
import
{
InputRule
}
from
'
prosemirror-inputrules
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
PARSE_HTML_PRIORITY_HIGHEST
}
from
'
../constants
'
;
import
{
PARSE_HTML_PRIORITY_HIGHEST
}
from
'
../constants
'
;
...
@@ -32,6 +33,19 @@ export default Node.create({
...
@@ -32,6 +33,19 @@ export default Node.create({
},
},
addInputRules
()
{
addInputRules
()
{
return
inputRuleRegExps
.
map
((
regex
)
=>
nodeInputRule
(
regex
,
this
.
type
));
const
{
type
}
=
this
;
return
inputRuleRegExps
.
map
(
(
regex
)
=>
new
InputRule
(
regex
,
(
state
,
match
,
start
,
end
)
=>
{
const
{
tr
}
=
state
;
if
(
match
)
{
tr
.
replaceWith
(
start
-
1
,
end
,
type
.
create
());
}
return
tr
;
}),
);
},
},
});
});
package.json
View file @
13181130
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
"
@rails/ujs
"
:
"
6.1.3-2
"
,
"
@rails/ujs
"
:
"
6.1.3-2
"
,
"
@sentry/browser
"
:
"
5.30.0
"
,
"
@sentry/browser
"
:
"
5.30.0
"
,
"
@sourcegraph/code-host-integration
"
:
"
0.0.60
"
,
"
@sourcegraph/code-host-integration
"
:
"
0.0.60
"
,
"
@tiptap/core
"
:
"
^2.0.0-beta.11
0
"
,
"
@tiptap/core
"
:
"
^2.0.0-beta.11
1
"
,
"
@tiptap/extension-blockquote
"
:
"
^2.0.0-beta.15
"
,
"
@tiptap/extension-blockquote
"
:
"
^2.0.0-beta.15
"
,
"
@tiptap/extension-bold
"
:
"
^2.0.0-beta.15
"
,
"
@tiptap/extension-bold
"
:
"
^2.0.0-beta.15
"
,
"
@tiptap/extension-bullet-list
"
:
"
^2.0.0-beta.15
"
,
"
@tiptap/extension-bullet-list
"
:
"
^2.0.0-beta.15
"
,
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
"
@tiptap/extension-task-item
"
:
"
^2.0.0-beta.18
"
,
"
@tiptap/extension-task-item
"
:
"
^2.0.0-beta.18
"
,
"
@tiptap/extension-task-list
"
:
"
^2.0.0-beta.17
"
,
"
@tiptap/extension-task-list
"
:
"
^2.0.0-beta.17
"
,
"
@tiptap/extension-text
"
:
"
^2.0.0-beta.13
"
,
"
@tiptap/extension-text
"
:
"
^2.0.0-beta.13
"
,
"
@tiptap/vue-2
"
:
"
^2.0.0-beta.5
2
"
,
"
@tiptap/vue-2
"
:
"
^2.0.0-beta.5
3
"
,
"
@toast-ui/editor
"
:
"
^2.5.2
"
,
"
@toast-ui/editor
"
:
"
^2.5.2
"
,
"
@toast-ui/vue-editor
"
:
"
^2.5.2
"
,
"
@toast-ui/vue-editor
"
:
"
^2.5.2
"
,
"
apollo-cache-inmemory
"
:
"
^1.6.6
"
,
"
apollo-cache-inmemory
"
:
"
^1.6.6
"
,
...
...
spec/frontend/content_editor/extensions/table_of_contents_spec.js
View file @
13181130
import
TableOfContents
from
'
~/content_editor/extensions/table_of_contents
'
;
import
TableOfContents
from
'
~/content_editor/extensions/table_of_contents
'
;
import
{
createTestEditor
}
from
'
../test_utils
'
;
import
{
createTestEditor
,
createDocBuilder
}
from
'
../test_utils
'
;
describe
(
'
content_editor/extensions/emoji
'
,
()
=>
{
describe
(
'
content_editor/extensions/emoji
'
,
()
=>
{
let
tiptapEditor
;
let
tiptapEditor
;
let
builders
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
tiptapEditor
=
createTestEditor
({
extensions
:
[
TableOfContents
]
});
tiptapEditor
=
createTestEditor
({
extensions
:
[
TableOfContents
]
});
({
builders
}
=
createDocBuilder
({
tiptapEditor
,
names
:
{
tableOfContents
:
{
nodeType
:
TableOfContents
.
name
}
},
}));
});
});
it
.
each
`
it
.
each
`
input | insertedNodeName
input | insertedNode
${
'
[[_TOC_]]
'
}
|
${
TableOfContents
.
name
}
${
'
[[_TOC_]]
'
}
|
${
'
tableOfContents
'
}
${
'
[TOC]
'
}
|
${
TableOfContents
.
name
}
${
'
[TOC]
'
}
|
${
'
tableOfContents
'
}
${
'
[toc]
'
}
|
${
'
paragraph
'
}
${
'
[toc]
'
}
|
${
'
p
'
}
${
'
TOC
'
}
|
${
'
paragraph
'
}
${
'
TOC
'
}
|
${
'
p
'
}
${
'
[_TOC_]
'
}
|
${
'
paragraph
'
}
${
'
[_TOC_]
'
}
|
${
'
p
'
}
${
'
[[TOC]]
'
}
|
${
'
paragraph
'
}
${
'
[[TOC]]
'
}
|
${
'
p
'
}
`
(
'
with input=$input, then should insert a $insertedNodeName
'
,
({
input
,
insertedNodeName
})
=>
{
`
(
'
with input=$input, then should insert a $insertedNode
'
,
({
input
,
insertedNode
})
=>
{
const
{
doc
}
=
builders
;
const
{
view
}
=
tiptapEditor
;
const
{
view
}
=
tiptapEditor
;
const
{
selection
}
=
view
.
state
;
const
{
selection
}
=
view
.
state
;
const
expectedDoc
=
doc
(
builders
[
insertedNode
]());
// Triggers the event handler that input rules listen to
// Triggers the event handler that input rules listen to
view
.
someProp
(
'
handleTextInput
'
,
(
f
)
=>
f
(
view
,
selection
.
from
,
selection
.
to
,
input
));
view
.
someProp
(
'
handleTextInput
'
,
(
f
)
=>
f
(
view
,
selection
.
from
,
selection
.
to
,
input
));
expect
(
tiptapEditor
.
state
.
doc
.
content
.
content
).
toEqual
([
expect
(
tiptapEditor
.
getJSON
()).
toEqual
(
expectedDoc
.
toJSON
());
expect
.
objectContaining
({
type
:
expect
.
objectContaining
({
name
:
insertedNodeName
,
}),
}),
]);
});
});
});
});
yarn.lock
View file @
13181130
...
@@ -1467,10 +1467,10 @@
...
@@ -1467,10 +1467,10 @@
dom-accessibility-api "^0.5.1"
dom-accessibility-api "^0.5.1"
pretty-format "^26.4.2"
pretty-format "^26.4.2"
"@tiptap/core@^2.0.0-beta.11
0
":
"@tiptap/core@^2.0.0-beta.11
1
":
version "2.0.0-beta.11
0
"
version "2.0.0-beta.11
1
"
resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.0.0-beta.11
0.tgz#a03413056f484b875c85b26aa2eff8b3022e014f
"
resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.0.0-beta.11
1.tgz#9f7237fad9ffd0da52808ec50915a84bb1452139
"
integrity sha512-Q
WfgDxommAzv1Ed9vA1KAAvBTkdWkkZmNiQIlqlyhe/5M1YffkMfy1+P7KOA+lxN9Ft5TERGa0+Fg9mK3VX2Q
Q==
integrity sha512-Q
wuVd5Ht+p/7x2/r8/Qzz/mvC6Ghd/CMEgj9vqkj8nLjPHisxfl7PqLy+vAgnX+7hUUTJJ0QZs6143K+dSorW
Q==
dependencies:
dependencies:
"@types/prosemirror-commands" "^1.0.4"
"@types/prosemirror-commands" "^1.0.4"
"@types/prosemirror-inputrules" "^1.0.4"
"@types/prosemirror-inputrules" "^1.0.4"
...
@@ -1501,10 +1501,10 @@
...
@@ -1501,10 +1501,10 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-bold/-/extension-bold-2.0.0-beta.15.tgz#cf9ddb3fc316be9707753ad4e497bfb8a3ebb0c2"
resolved "https://registry.yarnpkg.com/@tiptap/extension-bold/-/extension-bold-2.0.0-beta.15.tgz#cf9ddb3fc316be9707753ad4e497bfb8a3ebb0c2"
integrity sha512-jKyV6iiwhxwa0+7uuKD74jNDVNLNOS1GmU14MgaA95pY5e1fyaRBPPX8Gtt89niz2CLOY711AV17RPZTe/e60w==
integrity sha512-jKyV6iiwhxwa0+7uuKD74jNDVNLNOS1GmU14MgaA95pY5e1fyaRBPPX8Gtt89niz2CLOY711AV17RPZTe/e60w==
"@tiptap/extension-bubble-menu@^2.0.0-beta.3
4
":
"@tiptap/extension-bubble-menu@^2.0.0-beta.3
5
":
version "2.0.0-beta.3
4
"
version "2.0.0-beta.3
5
"
resolved "https://registry.yarnpkg.com/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.0.0-beta.3
4.tgz#07598730c3ac755c86b2ac1e283b5be3591fbb0a
"
resolved "https://registry.yarnpkg.com/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.0.0-beta.3
5.tgz#11ea379b9e9044c96ddbcdc457155b6fd4ee81e7
"
integrity sha512-
vw2RpwgqJUE7tpDayOey1AYs2qp1J0TVdlo4HYzlOWV1kJ+2Zevf0oA83j+IX6d0XmYqNTp+r+VgLZEd0K1Ne
g==
integrity sha512-
9Cu7X2HvTCLMDOZNZLM0gL/fXHsQOUiWtVoDTfYGizo2sztFcgg7IV+FYvquerAzwfZvUX3EDdYBnRbhVXRob
g==
dependencies:
dependencies:
prosemirror-state "^1.3.4"
prosemirror-state "^1.3.4"
prosemirror-view "^1.20.1"
prosemirror-view "^1.20.1"
...
@@ -1554,10 +1554,10 @@
...
@@ -1554,10 +1554,10 @@
"@types/prosemirror-dropcursor" "^1.0.3"
"@types/prosemirror-dropcursor" "^1.0.3"
prosemirror-dropcursor "^1.3.5"
prosemirror-dropcursor "^1.3.5"
"@tiptap/extension-floating-menu@^2.0.0-beta.2
8
":
"@tiptap/extension-floating-menu@^2.0.0-beta.2
9
":
version "2.0.0-beta.2
8
"
version "2.0.0-beta.2
9
"
resolved "https://registry.yarnpkg.com/@tiptap/extension-floating-menu/-/extension-floating-menu-2.0.0-beta.2
8.tgz#be45bd0a558498e0fdfc593832726618e69ee8f
c"
resolved "https://registry.yarnpkg.com/@tiptap/extension-floating-menu/-/extension-floating-menu-2.0.0-beta.2
9.tgz#a3d27a859be0f21334a37f9213bcd49e2f80241
c"
integrity sha512-
GxrD4i75Px6RLlY6ZZRU5C5aCjnEiKODA07TpyITlrB6cwmdzZG4L7n+x4Z/VGiUu6+fkiLpnjLbX/Fbk9Yn2w
==
integrity sha512-
PwXdDqGwbm4sUlm+FTs69xwPl99r1HQ8iye9XLuQMkjMJv7W4fByyStqzSMiocYcdGF3rWA+txQRen5/qo9O7Q
==
dependencies:
dependencies:
prosemirror-state "^1.3.4"
prosemirror-state "^1.3.4"
prosemirror-view "^1.20.1"
prosemirror-view "^1.20.1"
...
@@ -1687,13 +1687,13 @@
...
@@ -1687,13 +1687,13 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.0.0-beta.13.tgz#da0af8d9a3f149d20076e15d88c6af21fb6d940f"
resolved "https://registry.yarnpkg.com/@tiptap/extension-text/-/extension-text-2.0.0-beta.13.tgz#da0af8d9a3f149d20076e15d88c6af21fb6d940f"
integrity sha512-0EtAwuRldCAoFaL/iXgkRepEeOd55rPg5N4FQUN1xTwZT7PDofukP0DG/2jff/Uj17x4uTaJAa9qlFWuNnDvjw==
integrity sha512-0EtAwuRldCAoFaL/iXgkRepEeOd55rPg5N4FQUN1xTwZT7PDofukP0DG/2jff/Uj17x4uTaJAa9qlFWuNnDvjw==
"@tiptap/vue-2@^2.0.0-beta.5
2
":
"@tiptap/vue-2@^2.0.0-beta.5
3
":
version "2.0.0-beta.5
2
"
version "2.0.0-beta.5
3
"
resolved "https://registry.yarnpkg.com/@tiptap/vue-2/-/vue-2-2.0.0-beta.5
2.tgz#b61fd95f2368a86e64bee20b35a85a69a48fc930
"
resolved "https://registry.yarnpkg.com/@tiptap/vue-2/-/vue-2-2.0.0-beta.5
3.tgz#6b1239fbba315cfc2c48598b32f0e08ebdbedeae
"
integrity sha512-
81UfvJTK68hy+KZDdHSbtMVXbUhkZ8zW9u+dotga34YHgfTeZjO3UrF5eJ34dwzsPaaSU+buFu/TMH5vP3KcW
Q==
integrity sha512-
XviXJWtZG+z6LirjkbJ0/seatlXd3ecIPSzJKyNwCxM/PDzNlKjVotKmMdL1miJIvakWXQdmN2alh6/KESuvt
Q==
dependencies:
dependencies:
"@tiptap/extension-bubble-menu" "^2.0.0-beta.3
4
"
"@tiptap/extension-bubble-menu" "^2.0.0-beta.3
5
"
"@tiptap/extension-floating-menu" "^2.0.0-beta.2
8
"
"@tiptap/extension-floating-menu" "^2.0.0-beta.2
9
"
prosemirror-view "^1.20.1"
prosemirror-view "^1.20.1"
"@toast-ui/editor@^2.5.2":
"@toast-ui/editor@^2.5.2":
...
...
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