summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 20:02:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 20:02:30 +0000
commit41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch)
tree9c8d89a8624828992f06d892cd2f43818ff5dcc8 /app/assets/javascripts/behaviors/markdown/marks/inline_html.js
parent0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff)
downloadgitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/behaviors/markdown/marks/inline_html.js')
-rw-r--r--app/assets/javascripts/behaviors/markdown/marks/inline_html.js71
1 files changed, 30 insertions, 41 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/marks/inline_html.js b/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
index e957f81b774..4520598e0ab 100644
--- a/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
+++ b/app/assets/javascripts/behaviors/markdown/marks/inline_html.js
@@ -1,46 +1,35 @@
-/* eslint-disable class-methods-use-this */
-
import { escape } from 'lodash';
-import { Mark } from 'tiptap';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
-export default class InlineHTML extends Mark {
- get name() {
- return 'inline_html';
- }
-
- get schema() {
- return {
- excludes: '',
- attrs: {
- tag: {},
- title: { default: null },
- },
- parseDOM: [
- {
- tag: 'sup, sub, kbd, q, samp, var',
- getAttrs: (el) => ({ tag: el.nodeName.toLowerCase() }),
- },
- {
- tag: 'abbr',
- getAttrs: (el) => ({ tag: 'abbr', title: el.getAttribute('title') }),
- },
- ],
- toDOM: (node) => [node.attrs.tag, { title: node.attrs.title }, 0],
- };
- }
-
- get toMarkdown() {
- return {
- mixable: true,
- open(state, mark) {
- return `<${mark.attrs.tag}${
- mark.attrs.title ? ` title="${state.esc(escape(mark.attrs.title))}"` : ''
- }>`;
+export default () => ({
+ name: 'inline_html',
+ schema: {
+ excludes: '',
+ attrs: {
+ tag: {},
+ title: { default: null },
+ },
+ parseDOM: [
+ {
+ tag: 'sup, sub, kbd, q, samp, var',
+ getAttrs: (el) => ({ tag: el.nodeName.toLowerCase() }),
},
- close(state, mark) {
- return `</${mark.attrs.tag}>`;
+ {
+ tag: 'abbr',
+ getAttrs: (el) => ({ tag: 'abbr', title: el.getAttribute('title') }),
},
- };
- }
-}
+ ],
+ toDOM: (node) => [node.attrs.tag, { title: node.attrs.title }, 0],
+ },
+ toMarkdown: {
+ mixable: true,
+ open(state, mark) {
+ return `<${mark.attrs.tag}${
+ mark.attrs.title ? ` title="${state.esc(escape(mark.attrs.title))}"` : ''
+ }>`;
+ },
+ close(_, mark) {
+ return `</${mark.attrs.tag}>`;
+ },
+ },
+});