Commit 1533ddec authored by David O'Regan's avatar David O'Regan

Merge branch '328760-strikethrough-content-editor' into 'master'

Add support for strikethrough in the content editor

Changelog: added

See merge request gitlab-org/gitlab!63942
parents 1924379c ed226820
...@@ -63,6 +63,15 @@ export default { ...@@ -63,6 +63,15 @@ export default {
:tiptap-editor="contentEditor.tiptapEditor" :tiptap-editor="contentEditor.tiptapEditor"
@execute="trackToolbarControlExecution" @execute="trackToolbarControlExecution"
/> />
<toolbar-button
data-testid="strike"
content-type="strike"
icon-name="strikethrough"
editor-command="toggleStrike"
:label="__('Strikethrough')"
:tiptap-editor="contentEditor.tiptapEditor"
@execute="trackToolbarControlExecution"
/>
<toolbar-button <toolbar-button
data-testid="code" data-testid="code"
content-type="code" content-type="code"
......
import { Strike } from '@tiptap/extension-strike';
export const tiptapExtension = Strike;
export const serializer = {
open: '~~',
close: '~~',
mixable: true,
expelEnclosingWhitespace: true,
};
...@@ -19,6 +19,7 @@ import * as Link from '../extensions/link'; ...@@ -19,6 +19,7 @@ import * as Link from '../extensions/link';
import * as ListItem from '../extensions/list_item'; import * as ListItem from '../extensions/list_item';
import * as OrderedList from '../extensions/ordered_list'; import * as OrderedList from '../extensions/ordered_list';
import * as Paragraph from '../extensions/paragraph'; import * as Paragraph from '../extensions/paragraph';
import * as Strike from '../extensions/strike';
import * as Text from '../extensions/text'; import * as Text from '../extensions/text';
import buildSerializerConfig from './build_serializer_config'; import buildSerializerConfig from './build_serializer_config';
import { ContentEditor } from './content_editor'; import { ContentEditor } from './content_editor';
...@@ -44,6 +45,7 @@ const builtInContentEditorExtensions = [ ...@@ -44,6 +45,7 @@ const builtInContentEditorExtensions = [
ListItem, ListItem,
OrderedList, OrderedList,
Paragraph, Paragraph,
Strike,
Text, Text,
]; ];
......
...@@ -31227,6 +31227,9 @@ msgstr "" ...@@ -31227,6 +31227,9 @@ msgstr ""
msgid "StorageSize|Unknown" msgid "StorageSize|Unknown"
msgstr "" msgstr ""
msgid "Strikethrough"
msgstr ""
msgid "Subgroup information" msgid "Subgroup information"
msgstr "" msgstr ""
......
...@@ -42,6 +42,7 @@ describe('content_editor/components/top_toolbar', () => { ...@@ -42,6 +42,7 @@ describe('content_editor/components/top_toolbar', () => {
testId | controlProps testId | controlProps
${'bold'} | ${{ contentType: 'bold', iconName: 'bold', label: 'Bold text', editorCommand: 'toggleBold' }} ${'bold'} | ${{ contentType: 'bold', iconName: 'bold', label: 'Bold text', editorCommand: 'toggleBold' }}
${'italic'} | ${{ contentType: 'italic', iconName: 'italic', label: 'Italic text', editorCommand: 'toggleItalic' }} ${'italic'} | ${{ contentType: 'italic', iconName: 'italic', label: 'Italic text', editorCommand: 'toggleItalic' }}
${'strike'} | ${{ contentType: 'strike', iconName: 'strikethrough', label: 'Strikethrough', editorCommand: 'toggleStrike' }}
${'code'} | ${{ contentType: 'code', iconName: 'code', label: 'Code', editorCommand: 'toggleCode' }} ${'code'} | ${{ contentType: 'code', iconName: 'code', label: 'Code', editorCommand: 'toggleCode' }}
${'blockquote'} | ${{ contentType: 'blockquote', iconName: 'quote', label: 'Insert a quote', editorCommand: 'toggleBlockquote' }} ${'blockquote'} | ${{ contentType: 'blockquote', iconName: 'quote', label: 'Insert a quote', editorCommand: 'toggleBlockquote' }}
${'bullet-list'} | ${{ contentType: 'bulletList', iconName: 'list-bulleted', label: 'Add a bullet list', editorCommand: 'toggleBulletList' }} ${'bullet-list'} | ${{ contentType: 'bulletList', iconName: 'list-bulleted', label: 'Add a bullet list', editorCommand: 'toggleBulletList' }}
......
# This data file drives the specs in # This data file drives the specs in
# spec/frontend/fixtures/api_markdown.rb and # spec/frontend/fixtures/api_markdown.rb and
# spec/frontend/rich_text_editor/extensions/markdown_processing_spec.js # spec/frontend/content_editor/extensions/markdown_processing_spec.js
--- ---
- name: bold - name: bold
markdown: '**bold**' markdown: '**bold**'
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
markdown: '_emphasized text_' markdown: '_emphasized text_'
- name: inline_code - name: inline_code
markdown: '`code`' markdown: '`code`'
- name: strike
markdown: '~~del~~'
- name: link - name: link
markdown: '[GitLab](https://gitlab.com)' markdown: '[GitLab](https://gitlab.com)'
- name: code_block - name: code_block
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment