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
ab473c34
Commit
ab473c34
authored
Jan 04, 2022
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass existing options in track_input_rules ext
parent
fbfcc389
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js
...ontent_editor/services/track_input_rules_and_shortcuts.js
+25
-23
No files found.
app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js
View file @
ab473c34
...
...
@@ -35,31 +35,33 @@ const trackInputRule = (contentType, inputRule) => {
};
const
trackInputRulesAndShortcuts
=
(
tiptapExtension
)
=>
{
return
tiptapExtension
.
extend
({
addKeyboardShortcuts
()
{
const
shortcuts
=
this
.
parent
?.()
||
{};
const
{
name
}
=
this
;
/**
* We don’t want to track keyboard shortcuts
* that are not deliberately executed to create
* new types of content
*/
const
dotNotTrackKeys
=
[
ENTER_KEY
,
BACKSPACE_KEY
];
const
decorated
=
mapValues
(
shortcuts
,
(
commandFn
,
shortcut
)
=>
dotNotTrackKeys
.
includes
(
shortcut
)
?
commandFn
:
trackKeyboardShortcut
(
name
,
commandFn
,
shortcut
),
);
return
tiptapExtension
.
extend
({
addKeyboardShortcuts
()
{
const
shortcuts
=
this
.
parent
?.()
||
{};
const
{
name
}
=
this
;
/**
* We don’t want to track keyboard shortcuts
* that are not deliberately executed to create
* new types of content
*/
const
dotNotTrackKeys
=
[
ENTER_KEY
,
BACKSPACE_KEY
];
const
decorated
=
mapValues
(
shortcuts
,
(
commandFn
,
shortcut
)
=>
dotNotTrackKeys
.
includes
(
shortcut
)
?
commandFn
:
trackKeyboardShortcut
(
name
,
commandFn
,
shortcut
),
);
return
decorated
;
},
addInputRules
()
{
const
inputRules
=
this
.
parent
?.()
||
[];
const
{
name
}
=
this
;
return
decorated
;
},
addInputRules
()
{
const
inputRules
=
this
.
parent
?.()
||
[];
const
{
name
}
=
this
;
return
inputRules
.
map
((
inputRule
)
=>
trackInputRule
(
name
,
inputRule
));
},
});
return
inputRules
.
map
((
inputRule
)
=>
trackInputRule
(
name
,
inputRule
));
},
})
.
configure
(
tiptapExtension
.
options
);
};
export
default
trackInputRulesAndShortcuts
;
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