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

horizontal_rule.js « extensions « content_editor « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c287938af5c60758543f9edb6bd55291b14822de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { nodeInputRule } from '@tiptap/core';
import { HorizontalRule } from '@tiptap/extension-horizontal-rule';
import { defaultMarkdownSerializer } from 'prosemirror-markdown/src/to_markdown';

export const hrInputRuleRegExp = /^---$/;

export const tiptapExtension = HorizontalRule.extend({
  addInputRules() {
    return [nodeInputRule(hrInputRuleRegExp, this.type)];
  },
});
export const serializer = defaultMarkdownSerializer.nodes.horizontal_rule;