diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-05 18:13:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-05 18:13:51 +0300 |
commit | 67d7efba05353044f927a30634c63b921b2efb73 (patch) | |
tree | 9bc6fefcae4141dd80434b4a72e8eae57ab14466 /app/assets/javascripts/content_editor | |
parent | 6d29831123c8c806dc75d64e29b7691576cbea7f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/content_editor')
-rw-r--r-- | app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js b/app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js index 9b1cb76f845..eb1e4885ba6 100644 --- a/app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js +++ b/app/assets/javascripts/content_editor/services/track_input_rules_and_shortcuts.js @@ -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; |