Commit 7f972bf6 authored by Michael Lunøe's avatar Michael Lunøe

Merge branch 'upgrade-tiptap-fix-breaking-changes' into 'master'

Upgrade tiptap and fix breaking changes

See merge request gitlab-org/gitlab!70218
parents 5dbe7107 653d8e33
......@@ -18,9 +18,7 @@ export default Blockquote.extend({
(p) => p.nodeName.toLowerCase() === 'blockquote',
);
return {
multiline: source && !source.startsWith('>') && !parentsIncludeBlockquote,
};
return source && !source.startsWith('>') && !parentsIncludeBlockquote;
},
},
};
......
......@@ -11,7 +11,7 @@ export default BulletList.extend({
parseHTML(element) {
const bullet = getMarkdownSource(element)?.charAt(0);
return { bullet: '*+-'.includes(bullet) ? bullet : '*' };
return '*+-'.includes(bullet) ? bullet : '*';
},
},
};
......
......@@ -8,11 +8,7 @@ export default CodeBlockLowlight.extend({
return {
language: {
default: null,
parseHTML: (element) => {
return {
language: extractLanguage(element),
};
},
parseHTML: (element) => extractLanguage(element),
},
class: {
default: 'code highlight js-syntax-highlight',
......
......@@ -9,9 +9,7 @@ export default Node.create({
return {
isTerm: {
default: true,
parseHTML: (element) => ({
isTerm: element.tagName.toLowerCase() === 'dt',
}),
parseHTML: (element) => element.tagName.toLowerCase() === 'dt',
},
};
},
......
......@@ -17,30 +17,18 @@ export default Node.create({
return {
moji: {
default: null,
parseHTML: (element) => {
return {
moji: element.textContent,
};
},
parseHTML: (element) => element.textContent,
},
name: {
default: null,
parseHTML: (element) => {
return {
name: element.dataset.name,
};
},
parseHTML: (element) => element.dataset.name,
},
title: {
default: null,
},
unicodeVersion: {
default: '6.0',
parseHTML: (element) => {
return {
unicodeVersion: element.dataset.unicodeVersion,
};
},
parseHTML: (element) => element.dataset.unicodeVersion,
},
};
},
......
......@@ -44,7 +44,7 @@ export default marks.map((name) =>
...acc,
[attr]: {
default: null,
parseHTML: (element) => ({ [attr]: element.getAttribute(attr) }),
parseHTML: (element) => element.getAttribute(attr),
},
}),
{},
......
......@@ -28,27 +28,19 @@ export default Image.extend({
parseHTML: (element) => {
const img = resolveImageEl(element);
return {
src: img.dataset.src || img.getAttribute('src'),
};
return img.dataset.src || img.getAttribute('src');
},
},
canonicalSrc: {
default: null,
parseHTML: (element) => {
return {
canonicalSrc: element.dataset.canonicalSrc,
};
},
parseHTML: (element) => element.dataset.canonicalSrc,
},
alt: {
default: null,
parseHTML: (element) => {
const img = resolveImageEl(element);
return {
alt: img.getAttribute('alt'),
};
return img.getAttribute('alt');
},
},
title: {
......@@ -56,9 +48,7 @@ export default Image.extend({
parseHTML: (element) => {
const img = resolveImageEl(element);
return {
title: img.getAttribute('title'),
};
return img.getAttribute('title');
},
},
};
......
......@@ -14,11 +14,7 @@ export default Mark.create({
return {
type: {
default: 'addition',
parseHTML: (element) => {
return {
type: element.classList.contains('deletion') ? 'deletion' : 'addition',
};
},
parseHTML: (element) => (element.classList.contains('deletion') ? 'deletion' : 'addition'),
},
};
},
......
......@@ -36,27 +36,15 @@ export default Link.extend({
...this.parent?.(),
href: {
default: null,
parseHTML: (element) => {
return {
href: element.getAttribute('href'),
};
},
parseHTML: (element) => element.getAttribute('href'),
},
title: {
title: null,
parseHTML: (element) => {
return {
title: element.getAttribute('title'),
};
},
parseHTML: (element) => element.getAttribute('title'),
},
canonicalSrc: {
default: null,
parseHTML: (element) => {
return {
canonicalSrc: element.dataset.canonicalSrc,
};
},
parseHTML: (element) => element.dataset.canonicalSrc,
},
};
},
......
......@@ -8,9 +8,7 @@ export default OrderedList.extend({
parens: {
default: false,
parseHTML: (element) => ({
parens: /^[0-9]+\)/.test(getMarkdownSource(element)),
}),
parseHTML: (element) => /^[0-9]+\)/.test(getMarkdownSource(element)),
},
};
},
......
......@@ -16,9 +16,7 @@ export default Node.create({
parseHTML: (element) => {
const playable = queryPlayableElement(element, this.options.mediaType);
return {
src: playable.src,
};
return playable.src;
},
},
canonicalSrc: {
......@@ -26,9 +24,7 @@ export default Node.create({
parseHTML: (element) => {
const playable = queryPlayableElement(element, this.options.mediaType);
return {
canonicalSrc: playable.dataset.canonicalSrc,
};
return playable.dataset.canonicalSrc;
},
},
alt: {
......@@ -36,9 +32,7 @@ export default Node.create({
parseHTML: (element) => {
const playable = queryPlayableElement(element, this.options.mediaType);
return {
alt: playable.dataset.title,
};
return playable.dataset.title;
},
},
};
......
......@@ -19,43 +19,23 @@ export default Node.create({
return {
className: {
default: null,
parseHTML: (element) => {
return {
className: getAnchor(element).className,
};
},
parseHTML: (element) => getAnchor(element).className,
},
referenceType: {
default: null,
parseHTML: (element) => {
return {
referenceType: getAnchor(element).dataset.referenceType,
};
},
parseHTML: (element) => getAnchor(element).dataset.referenceType,
},
originalText: {
default: null,
parseHTML: (element) => {
return {
originalText: getAnchor(element).dataset.original,
};
},
parseHTML: (element) => getAnchor(element).dataset.original,
},
href: {
default: null,
parseHTML: (element) => {
return {
href: getAnchor(element).getAttribute('href'),
};
},
parseHTML: (element) => getAnchor(element).getAttribute('href'),
},
text: {
default: null,
parseHTML: (element) => {
return {
text: getAnchor(element).textContent,
};
},
parseHTML: (element) => getAnchor(element).textContent,
},
};
},
......
......@@ -13,7 +13,8 @@ export default TaskItem.extend({
default: false,
parseHTML: (element) => {
const checkbox = element.querySelector('input[type=checkbox].task-list-item-checkbox');
return { checked: checkbox?.checked };
return checkbox?.checked;
},
renderHTML: (attributes) => ({
'data-checked': attributes.checked,
......
......@@ -8,25 +8,17 @@ export default TaskList.extend({
return {
numeric: {
default: false,
parseHTML: (element) => ({
numeric: element.tagName.toLowerCase() === 'ol',
}),
parseHTML: (element) => element.tagName.toLowerCase() === 'ol',
},
start: {
default: 1,
parseHTML: (element) => ({
start: element.hasAttribute('start')
? parseInt(element.getAttribute('start') || '', 10)
: 1,
}),
parseHTML: (element) =>
element.hasAttribute('start') ? parseInt(element.getAttribute('start') || '', 10) : 1,
},
parens: {
default: false,
parseHTML: (element) => ({
parens: /^[0-9]+\)/.test(getMarkdownSource(element)),
}),
parseHTML: (element) => /^[0-9]+\)/.test(getMarkdownSource(element)),
},
};
},
......
......@@ -63,12 +63,12 @@
"@rails/ujs": "6.1.3-2",
"@sentry/browser": "5.30.0",
"@sourcegraph/code-host-integration": "0.0.60",
"@tiptap/core": "^2.0.0-beta.103",
"@tiptap/core": "^2.0.0-beta.105",
"@tiptap/extension-blockquote": "^2.0.0-beta.15",
"@tiptap/extension-bold": "^2.0.0-beta.15",
"@tiptap/extension-bullet-list": "^2.0.0-beta.15",
"@tiptap/extension-code": "^2.0.0-beta.16",
"@tiptap/extension-code-block-lowlight": "2.0.0-beta.36",
"@tiptap/extension-code-block-lowlight": "2.0.0-beta.37",
"@tiptap/extension-document": "^2.0.0-beta.13",
"@tiptap/extension-dropcursor": "^2.0.0-beta.19",
"@tiptap/extension-gapcursor": "^2.0.0-beta.19",
......@@ -78,18 +78,18 @@
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.19",
"@tiptap/extension-image": "^2.0.0-beta.15",
"@tiptap/extension-italic": "^2.0.0-beta.15",
"@tiptap/extension-link": "^2.0.0-beta.19",
"@tiptap/extension-link": "^2.0.0-beta.20",
"@tiptap/extension-list-item": "^2.0.0-beta.14",
"@tiptap/extension-ordered-list": "^2.0.0-beta.15",
"@tiptap/extension-ordered-list": "^2.0.0-beta.16",
"@tiptap/extension-paragraph": "^2.0.0-beta.17",
"@tiptap/extension-strike": "^2.0.0-beta.17",
"@tiptap/extension-subscript": "^2.0.0-beta.4",
"@tiptap/extension-superscript": "^2.0.0-beta.4",
"@tiptap/extension-table": "^2.0.0-beta.30",
"@tiptap/extension-table-cell": "^2.0.0-beta.14",
"@tiptap/extension-table-header": "^2.0.0-beta.16",
"@tiptap/extension-table-cell": "^2.0.0-beta.15",
"@tiptap/extension-table-header": "^2.0.0-beta.17",
"@tiptap/extension-table-row": "^2.0.0-beta.14",
"@tiptap/extension-task-item": "^2.0.0-beta.17",
"@tiptap/extension-task-item": "^2.0.0-beta.18",
"@tiptap/extension-task-list": "^2.0.0-beta.17",
"@tiptap/extension-text": "^2.0.0-beta.13",
"@tiptap/vue-2": "^2.0.0-beta.50",
......
......@@ -28,8 +28,7 @@ const SourcemapExtension = Extension.create({
source: {
parseHTML: (element) => {
const source = getMarkdownSource(element);
if (source) return { source };
return {};
return source;
},
},
},
......
......@@ -98,9 +98,7 @@ export const createTestContentEditorExtension = ({ commands = [] } = {}) => {
return {
labelName: {
default: null,
parseHTML: (element) => {
return { labelName: element.dataset.labelName };
},
parseHTML: (element) => element.dataset.labelName,
},
};
},
......
......@@ -1467,10 +1467,10 @@
dom-accessibility-api "^0.5.1"
pretty-format "^26.4.2"
"@tiptap/core@^2.0.0-beta.103":
version "2.0.0-beta.103"
resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.0.0-beta.103.tgz#f88f0217a26a3dc5413f44ffff246c4692709afb"
integrity sha512-tCU94zEJgv/mADMZ0dM1/+23uJoc2YyrRauEekt6Yd44TdPTJSDk7v82GJdmMLWj5mDjLbXVL7kvrJpi0/4zjg==
"@tiptap/core@^2.0.0-beta.105":
version "2.0.0-beta.105"
resolved "https://registry.yarnpkg.com/@tiptap/core/-/core-2.0.0-beta.105.tgz#3d758cbbf3e8c9b806d1017cd2e7444f192d8109"
integrity sha512-ut0ts9hrJXUJlSXZIN8iEt2TPbqYLFBanucUAr0ENLjIlpyyNVXz9IhS3bBEmo7vWExirZmY8O9oidQztesf2A==
dependencies:
"@types/prosemirror-commands" "^1.0.4"
"@types/prosemirror-inputrules" "^1.0.4"
......@@ -1517,22 +1517,22 @@
dependencies:
prosemirror-inputrules "^1.1.3"
"@tiptap/extension-code-block-lowlight@2.0.0-beta.36":
version "2.0.0-beta.36"
resolved "https://registry.yarnpkg.com/@tiptap/extension-code-block-lowlight/-/extension-code-block-lowlight-2.0.0-beta.36.tgz#f4d5fed298d376fb2dc33955a67e55ebcb04bc8d"
integrity sha512-Z/Oza3eaBJKYcE76d0zU5ScnQU31KAmzwb16G+lUKU5oYxGvWWLgseYiHdU1oQinf9FC1c7asMwI6x3ydkKIlA==
"@tiptap/extension-code-block-lowlight@2.0.0-beta.37":
version "2.0.0-beta.37"
resolved "https://registry.yarnpkg.com/@tiptap/extension-code-block-lowlight/-/extension-code-block-lowlight-2.0.0-beta.37.tgz#672b2f21d49077285a507c2e204b07085df93906"
integrity sha512-EN8MoCZKB23nHNqgvB/wOS84ySUY9ahB6oao7wDpKAYqBkAF/hEXmDsylDySvyCKXf824lS/vztfaF0hHQbQ/g==
dependencies:
"@tiptap/extension-code-block" "^2.0.0-beta.17"
"@tiptap/extension-code-block" "^2.0.0-beta.18"
"@types/lowlight" "^0.0.3"
lowlight "^1.20.0"
prosemirror-model "^1.14.3"
prosemirror-state "^1.3.4"
prosemirror-view "^1.20.0"
"@tiptap/extension-code-block@^2.0.0-beta.17":
version "2.0.0-beta.17"
resolved "https://registry.yarnpkg.com/@tiptap/extension-code-block/-/extension-code-block-2.0.0-beta.17.tgz#b12ab35561da08b359f4d8dced2b8c30eb62fcdb"
integrity sha512-u3RY991mXtjuw+trVaDwbAhuPPlU8l6kS4rXIxWJ5W/sNElbmfHLVu7RP++YwM8KOQrCrQl8TJbZTEIekMw61w==
"@tiptap/extension-code-block@^2.0.0-beta.18":
version "2.0.0-beta.18"
resolved "https://registry.yarnpkg.com/@tiptap/extension-code-block/-/extension-code-block-2.0.0-beta.18.tgz#3b43730cfca1ba26171530951b3cc324a500cb11"
integrity sha512-E2gz7ovl9nXLZzheqLyN3hi7A10fCaodDn4DvIl4wiEbKZpF7WFBNeb+FQetWNay9UWNeDO94SCX9+rT9H+yHA==
dependencies:
prosemirror-inputrules "^1.1.3"
......@@ -1608,10 +1608,10 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-italic/-/extension-italic-2.0.0-beta.15.tgz#9a81f686cf221110478935596f0b47a76d4c2f45"
integrity sha512-ZCz1vCysLdvOUrwODuyBP0BDaemCLh6ib7qTYoSDKdive9kfn0Vc5Fg3o8xgHrtrUfwKIJz/sWOknjDEGIc9cw==
"@tiptap/extension-link@^2.0.0-beta.19":
version "2.0.0-beta.19"
resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.0.0-beta.19.tgz#cba1bd266058fa25543d347a20fba1f9acef8538"
integrity sha512-XTj4w3TbkN8sGqoTr7XCtlyOojAkCWpufjLBpKmQnm2Cd8q6Gy7At0z93H0kx3vDKM8u1ELzXRsO/RiYrFK0lQ==
"@tiptap/extension-link@^2.0.0-beta.20":
version "2.0.0-beta.20"
resolved "https://registry.yarnpkg.com/@tiptap/extension-link/-/extension-link-2.0.0-beta.20.tgz#dbb2aa4f01212bbd0c3fb14b563e28f31140eae2"
integrity sha512-VljjF5Pmd8xeUxN+Wbypyh8zGEMBWJTwzHUVMbkAEU8IZTdk2gDDcAOiYPyU9+j0vAVbSXi1EAsBRIIlj0OaKQ==
dependencies:
prosemirror-state "^1.3.4"
......@@ -1620,10 +1620,10 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-list-item/-/extension-list-item-2.0.0-beta.14.tgz#65a9ff9daa11bc9ca8bc2989a891abe68081cfbd"
integrity sha512-t6xwEqP+d5443Ul2Jvqz9kXb3ro7bA7yY9HA0vskm3120WxxHW9jxgxZN+82Ot5Tm7nXOAlsN6vuqnt4idnxZQ==
"@tiptap/extension-ordered-list@^2.0.0-beta.15":
version "2.0.0-beta.15"
resolved "https://registry.yarnpkg.com/@tiptap/extension-ordered-list/-/extension-ordered-list-2.0.0-beta.15.tgz#5645efe300489d5ea2ed7f98eaa84fbdb6951af8"
integrity sha512-j9Xh8CYtV+C/wrTXEWN+U7NJIQ/cQrjta80Mm2hFiE2KDtFNkpsPqG6UBoky04EPFphR5xDUsO1nCT7T7Tei5A==
"@tiptap/extension-ordered-list@^2.0.0-beta.16":
version "2.0.0-beta.16"
resolved "https://registry.yarnpkg.com/@tiptap/extension-ordered-list/-/extension-ordered-list-2.0.0-beta.16.tgz#3ef25a8dd8ddbd2b1aa5ce89d5a2e5a3ecafcf4e"
integrity sha512-3n0h5FBfQqBrN/zqF/Ngoyd1bZxeIRLwWI7ak4KulpvOg5V/yw3sw5CSxr2f13ZI9AgGaTq8yOsTYs9dkCCnsQ==
dependencies:
prosemirror-inputrules "^1.1.3"
......@@ -1647,15 +1647,15 @@
resolved "https://registry.yarnpkg.com/@tiptap/extension-superscript/-/extension-superscript-2.0.0-beta.4.tgz#16906d71dd8f9892101cf792f42005f8cd404516"
integrity sha512-rTQCnSnloSf6UN1y3zhu6j41MxrcCVWm5JIPX8VEt60WsOXJLAc/YJHLYi2FWhh/Psq8k78sPrmZbjYUrj3Dkw==
"@tiptap/extension-table-cell@^2.0.0-beta.14":
version "2.0.0-beta.14"
resolved "https://registry.yarnpkg.com/@tiptap/extension-table-cell/-/extension-table-cell-2.0.0-beta.14.tgz#a164a82ba6e15ba95673a9a9d9cbd68fdaf0362b"
integrity sha512-VoZ8SF8urU1/I3XnjDez2pbDO0h4cow+o8Xi6mhkMTXbxr212T674W7lu5DVMJ4Y1NF1eLe9eJ9kGJE43cA0+Q==
"@tiptap/extension-table-cell@^2.0.0-beta.15":
version "2.0.0-beta.15"
resolved "https://registry.yarnpkg.com/@tiptap/extension-table-cell/-/extension-table-cell-2.0.0-beta.15.tgz#2059946b1657f0f22415bda84cee77fb1eb232b1"
integrity sha512-MyZHJlFOF2z4Y1DQ/uuFbDPYQxSrl/PW8TEpAh2UQI/PGVsKkjzHItTvLtWSgo7t+tuPHbEOvIBDfpQKSyfbWg==
"@tiptap/extension-table-header@^2.0.0-beta.16":
version "2.0.0-beta.16"
resolved "https://registry.yarnpkg.com/@tiptap/extension-table-header/-/extension-table-header-2.0.0-beta.16.tgz#7c200d8c64111b6d84f23888752b421b89c2428e"
integrity sha512-L/r+ez4G7ZlninS4MwK4tYoVuA6bMMCz7OLvHGBmp24vZm7OA3qyUP4+GGtOXtdhv3aydeBis03gSrrB50aRWw==
"@tiptap/extension-table-header@^2.0.0-beta.17":
version "2.0.0-beta.17"
resolved "https://registry.yarnpkg.com/@tiptap/extension-table-header/-/extension-table-header-2.0.0-beta.17.tgz#1bd008825146e6f5fc607a1d8682b5d47ba08f25"
integrity sha512-HctO608QQEPe29QBtxXcDfBKfv+m9u2jBJ5AYpo7HjYGfUYRxv5uQpGXX3RW/c50+AhyTF0skF6Td1jiZcEPPw==
"@tiptap/extension-table-row@^2.0.0-beta.14":
version "2.0.0-beta.14"
......@@ -1670,10 +1670,10 @@
prosemirror-tables "^1.1.1"
prosemirror-view "^1.20.0"
"@tiptap/extension-task-item@^2.0.0-beta.17":
version "2.0.0-beta.17"
resolved "https://registry.yarnpkg.com/@tiptap/extension-task-item/-/extension-task-item-2.0.0-beta.17.tgz#e4e010c321b8f9aa5f49847c48e4e3a0695a47a9"
integrity sha512-uV5f9rWo9NAZ+oyt/mkhFEZfcngr92pVL2sn291RiT0qw9NRvdIQ6PLH24il9zu+jjeWmh1cJnBuQos+MQqjyg==
"@tiptap/extension-task-item@^2.0.0-beta.18":
version "2.0.0-beta.18"
resolved "https://registry.yarnpkg.com/@tiptap/extension-task-item/-/extension-task-item-2.0.0-beta.18.tgz#f109c15c997038d8099b64dba4cfc4e219b426e4"
integrity sha512-SmXWdfpDFIBGxWH4Xhb9d6jRSK7jJqsw0GqC5KAtIQ9gNvAQS1j5FqAtWfxlb8FkunIfV6MNnxDP2ZgbKvaEug==
dependencies:
prosemirror-inputrules "^1.1.3"
......
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