Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/content_editor/extensions/highlight.js')
-rw-r--r--app/assets/javascripts/content_editor/extensions/highlight.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/assets/javascripts/content_editor/extensions/highlight.js b/app/assets/javascripts/content_editor/extensions/highlight.js
new file mode 100644
index 00000000000..b84388d6285
--- /dev/null
+++ b/app/assets/javascripts/content_editor/extensions/highlight.js
@@ -0,0 +1,19 @@
+import { markInputRule } from '@tiptap/core';
+import { Highlight } from '@tiptap/extension-highlight';
+import { markInputRegex, extractMarkAttributesFromMatch } from '../services/mark_utils';
+
+export default Highlight.extend({
+ addInputRules() {
+ return [
+ markInputRule({
+ find: markInputRegex('mark'),
+ type: this.type,
+ getAttributes: extractMarkAttributesFromMatch,
+ }),
+ ];
+ },
+
+ addPasteRules() {
+ return [];
+ },
+});