diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 21:14:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 21:14:27 +0300 |
commit | f6c037b73c90ac251625c17720e6b8307c1698cc (patch) | |
tree | 26a287a09ae414da75f7e383dd1eaae5d3704ca5 /app/assets/javascripts/content_editor | |
parent | bf0d6692fc4c16205cc49b8b87b7b7e0daa97c63 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/content_editor')
9 files changed, 46 insertions, 30 deletions
diff --git a/app/assets/javascripts/content_editor/extensions/attachment.js b/app/assets/javascripts/content_editor/extensions/attachment.js index 29ee282f2d2..72df1d071d1 100644 --- a/app/assets/javascripts/content_editor/extensions/attachment.js +++ b/app/assets/javascripts/content_editor/extensions/attachment.js @@ -5,9 +5,11 @@ import { handleFileEvent } from '../services/upload_helpers'; export default Extension.create({ name: 'attachment', - defaultOptions: { - uploadsPath: null, - renderMarkdown: null, + addOptions() { + return { + uploadsPath: null, + renderMarkdown: null, + }; }, addCommands() { diff --git a/app/assets/javascripts/content_editor/extensions/audio.js b/app/assets/javascripts/content_editor/extensions/audio.js index 25d4068c93f..ea48ee0cee0 100644 --- a/app/assets/javascripts/content_editor/extensions/audio.js +++ b/app/assets/javascripts/content_editor/extensions/audio.js @@ -2,8 +2,10 @@ import Playable from './playable'; export default Playable.extend({ name: 'audio', - defaultOptions: { - ...Playable.options, - mediaType: 'audio', + addOptions() { + return { + ...this.parent?.(), + mediaType: 'audio', + }; }, }); diff --git a/app/assets/javascripts/content_editor/extensions/html_marks.js b/app/assets/javascripts/content_editor/extensions/html_marks.js index 3abf0e3eee2..9579f3b06f6 100644 --- a/app/assets/javascripts/content_editor/extensions/html_marks.js +++ b/app/assets/javascripts/content_editor/extensions/html_marks.js @@ -31,13 +31,12 @@ const attrs = { export default marks.map((name) => Mark.create({ name, - inclusive: false, - - defaultOptions: { - HTMLAttributes: {}, + addOptions() { + return { + HTMLAttributes: {}, + }; }, - addAttributes() { return (attrs[name] || []).reduce( (acc, attr) => ({ diff --git a/app/assets/javascripts/content_editor/extensions/image.js b/app/assets/javascripts/content_editor/extensions/image.js index 837fab0585f..d7fb617f7ee 100644 --- a/app/assets/javascripts/content_editor/extensions/image.js +++ b/app/assets/javascripts/content_editor/extensions/image.js @@ -7,9 +7,11 @@ const resolveImageEl = (element) => element.nodeName === 'IMG' ? element : element.querySelector('img'); export default Image.extend({ - defaultOptions: { - ...Image.options, - inline: true, + addOptions() { + return { + ...this.parent?.(), + inline: true, + }; }, addAttributes() { return { diff --git a/app/assets/javascripts/content_editor/extensions/inline_diff.js b/app/assets/javascripts/content_editor/extensions/inline_diff.js index 22bb1ac072e..f76943a0669 100644 --- a/app/assets/javascripts/content_editor/extensions/inline_diff.js +++ b/app/assets/javascripts/content_editor/extensions/inline_diff.js @@ -3,8 +3,10 @@ import { Mark, markInputRule, mergeAttributes } from '@tiptap/core'; export default Mark.create({ name: 'inlineDiff', - defaultOptions: { - HTMLAttributes: {}, + addOptions() { + return { + HTMLAttributes: {}, + }; }, addAttributes() { diff --git a/app/assets/javascripts/content_editor/extensions/link.js b/app/assets/javascripts/content_editor/extensions/link.js index 27bc05dce6f..f9b12f631fe 100644 --- a/app/assets/javascripts/content_editor/extensions/link.js +++ b/app/assets/javascripts/content_editor/extensions/link.js @@ -18,10 +18,13 @@ export const extractHrefFromMarkdownLink = (match) => { }; export default Link.extend({ - defaultOptions: { - ...Link.options, - openOnClick: false, + addOptions() { + return { + ...this.parent?.(), + openOnClick: false, + }; }, + addInputRules() { const markdownLinkSyntaxInputRuleRegExp = /(?:^|\s)\[([\w|\s|-]+)\]\((?<href>.+?)\)$/gm; const urlSyntaxRegExp = /(?:^|\s)(?<href>(?:https?:\/\/|www\.)[\S]+)(?:\s|\n)$/gim; diff --git a/app/assets/javascripts/content_editor/extensions/task_item.js b/app/assets/javascripts/content_editor/extensions/task_item.js index 9b050edcb28..6efef3f8198 100644 --- a/app/assets/javascripts/content_editor/extensions/task_item.js +++ b/app/assets/javascripts/content_editor/extensions/task_item.js @@ -2,9 +2,11 @@ import { TaskItem } from '@tiptap/extension-task-item'; import { PARSE_HTML_PRIORITY_HIGHEST } from '../constants'; export default TaskItem.extend({ - defaultOptions: { - nested: true, - HTMLAttributes: {}, + addOptions() { + return { + nested: true, + HTMLAttributes: {}, + }; }, addAttributes() { diff --git a/app/assets/javascripts/content_editor/extensions/video.js b/app/assets/javascripts/content_editor/extensions/video.js index 9923b7c04cd..312e8cd5ff6 100644 --- a/app/assets/javascripts/content_editor/extensions/video.js +++ b/app/assets/javascripts/content_editor/extensions/video.js @@ -2,9 +2,11 @@ import Playable from './playable'; export default Playable.extend({ name: 'video', - defaultOptions: { - ...Playable.options, - mediaType: 'video', - extraElementAttrs: { width: '400' }, + addOptions() { + return { + ...this.parent?.(), + mediaType: 'video', + extraElementAttrs: { width: '400' }, + }; }, }); diff --git a/app/assets/javascripts/content_editor/extensions/word_break.js b/app/assets/javascripts/content_editor/extensions/word_break.js index fa7e02f8cc8..457b7c36564 100644 --- a/app/assets/javascripts/content_editor/extensions/word_break.js +++ b/app/assets/javascripts/content_editor/extensions/word_break.js @@ -7,10 +7,12 @@ export default Node.create({ selectable: false, atom: true, - defaultOptions: { - HTMLAttributes: { - class: 'gl-display-inline-flex gl-px-1 gl-bg-blue-100 gl-rounded-base gl-font-sm', - }, + addOptions() { + return { + HTMLAttributes: { + class: 'gl-display-inline-flex gl-px-1 gl-bg-blue-100 gl-rounded-base gl-font-sm', + }, + }; }, parseHTML() { |