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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-22 18:06:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-22 18:06:55 +0300
commit793034a90509193ebf2ad14ed8e5eea10f7c6b4a (patch)
treec6326ec316c71dad77ab8f40b4eedf5093544403 /app/assets/javascripts/content_editor
parente2d00f9148a5c87fe4f56e4fd3c90a9b3574f03b (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/components/top_toolbar.vue9
-rw-r--r--app/assets/javascripts/content_editor/extensions/horizontal_rule.js9
2 files changed, 17 insertions, 1 deletions
diff --git a/app/assets/javascripts/content_editor/components/top_toolbar.vue b/app/assets/javascripts/content_editor/components/top_toolbar.vue
index d3363ce092b..398a9610fb5 100644
--- a/app/assets/javascripts/content_editor/components/top_toolbar.vue
+++ b/app/assets/javascripts/content_editor/components/top_toolbar.vue
@@ -123,5 +123,14 @@ export default {
:tiptap-editor="contentEditor.tiptapEditor"
@execute="trackToolbarControlExecution"
/>
+ <toolbar-button
+ data-testid="horizontal-rule"
+ content-type="horizontalRule"
+ icon-name="dash"
+ editor-command="setHorizontalRule"
+ :label="__('Add a horizontal rule')"
+ :tiptap-editor="contentEditor.tiptapEditor"
+ @execute="trackToolbarControlExecution"
+ />
</div>
</template>
diff --git a/app/assets/javascripts/content_editor/extensions/horizontal_rule.js b/app/assets/javascripts/content_editor/extensions/horizontal_rule.js
index dcc59476518..c287938af5c 100644
--- a/app/assets/javascripts/content_editor/extensions/horizontal_rule.js
+++ b/app/assets/javascripts/content_editor/extensions/horizontal_rule.js
@@ -1,5 +1,12 @@
+import { nodeInputRule } from '@tiptap/core';
import { HorizontalRule } from '@tiptap/extension-horizontal-rule';
import { defaultMarkdownSerializer } from 'prosemirror-markdown/src/to_markdown';
-export const tiptapExtension = HorizontalRule;
+export const hrInputRuleRegExp = /^---$/;
+
+export const tiptapExtension = HorizontalRule.extend({
+ addInputRules() {
+ return [nodeInputRule(hrInputRuleRegExp, this.type)];
+ },
+});
export const serializer = defaultMarkdownSerializer.nodes.horizontal_rule;