Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 166 additions & 166 deletions src/Umbraco.Web.UI.Client/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,21 @@ export const umbRteBlockInline = umbRteBlock.extend({
return [{ tag: `umb-rte-block-inline[${UMB_BLOCK_RTE_DATA_CONTENT_KEY}]` }];
},

// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
renderHTML({ HTMLAttributes }) {
return ['umb-rte-block-inline', HTMLAttributes];
},

addCommands() {
return {
setBlockInline:
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
(options) =>
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
({ commands }) => {
const attrs = { [UMB_BLOCK_RTE_DATA_CONTENT_KEY]: options.contentKey };
return commands.insertContent({
type: this.name,
attrs,
});
},
({ commands }) => {
const attrs = { [UMB_BLOCK_RTE_DATA_CONTENT_KEY]: options.contentKey };
return commands.insertContent({
type: this.name,
attrs,
});
},
};
},
});
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import { Link } from '../../externals.js';

// TODO: [LK] Look to use a NodeView to render the link, so that we remove the `data-router-slot` attribute from the HTML value.
// https://tiptap.dev/docs/editor/extensions/custom-extensions/node-views/javascript

export const UmbLink = Link.extend({
name: 'umbLink',

addAttributes() {
return {
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
...this.parent?.(),
'data-anchor': { default: null },
title: { default: null },
type: { default: 'external' },
};
},

// TODO: [LK] Look to use a NodeView to render the link
// https://tiptap.dev/docs/editor/extensions/custom-extensions/node-views/javascript

// TODO: [LK] Review why `addOptions()` is not typed correctly here.
// ref: https://github.com/ueberdosis/tiptap/issues/6670
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
addOptions() {
return {
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
...this.parent?.(),
HTMLAttributes: {
target: '',
Expand All @@ -33,35 +31,20 @@ export const UmbLink = Link.extend({

addCommands() {
return {
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
ensureUmbLink: (attributes) => {
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
return ({ editor, chain }) => {
if (editor.isActive(this.name)) {
return true;
}
return chain().setMark(this.name, attributes).setMeta('preventAutolink', true).run();
};
},
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
setUmbLink: (attributes) => {
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
return ({ chain }) => {
return chain().setMark(this.name, attributes).setMeta('preventAutolink', true).run();
};
},
unsetUmbLink: () => {
// TODO: [v17] Remove the `@ts-expect-error` once Tiptap has resolved the TypeScript definitions. [LK:2025-10-01]
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
return ({ chain }) => {
return chain().unsetMark(this.name, { extendEmptyMarkRange: true }).setMeta('preventAutolink', true).run();
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { UmbTiptapExtensionApiBase } from '../tiptap-extension-api-base.js';
import { TextDirection } from './text-direction.tiptap-extension.js';

/** @deprecated No longer required, (since it comes default with Tiptap). This will be removed in Umbraco 19. [LK] */
export default class UmbTiptapTextDirectionExtensionApi extends UmbTiptapExtensionApiBase {
getTiptapExtensions = () => [
TextDirection.configure({
types: ['heading', 'paragraph', 'blockquote', 'orderedList', 'bulletList'],
}),
];
// NOTE: `TextDirection` is now bundled with Tiptap since v3.11.0. [LK]
// https://github.com/ueberdosis/tiptap/pull/7207
getTiptapExtensions = () => [];
}
Original file line number Diff line number Diff line change
@@ -1,58 +1,14 @@
import { Extension } from '../../externals.js';
// NOTE: `TextDirection` is now bundled with Tiptap since v3.11.0. [LK]
// https://github.com/ueberdosis/tiptap/pull/7207

// eslint-disable-next-line local-rules/enforce-umbraco-external-imports
import { extensions as TiptapExtensions } from '@tiptap/core';

/** @deprecated No longer used internally. This will be removed in Umbraco 19. [LK] */
export interface UmbTiptapTextDirectionOptions {
directions: Array<'auto' | 'ltr' | 'rtl'>;
types: Array<string>;
}

export const TextDirection = Extension.create<UmbTiptapTextDirectionOptions>({
name: 'textDirection',

addOptions() {
return {
directions: ['ltr', 'rtl', 'auto'],
types: ['heading', 'paragraph'],
};
},

addGlobalAttributes() {
return [
{
types: this.options.types,
attributes: {
textDirection: {
parseHTML: (element) => element.dir,
renderHTML: (attributes) =>
this.options.directions.includes(attributes.textDirection) ? { dir: attributes.textDirection } : null,
},
},
},
];
},

addCommands() {
return {
setTextDirection:
(direction) =>
({ commands }) => {
return this.options.directions.includes(direction)
? this.options.types.every((type) => commands.updateAttributes(type, { textDirection: direction }))
: false;
},
unsetTextDirection:
() =>
({ commands }) => {
return this.options.types.every((type) => commands.resetAttributes(type, 'textDirection'));
},
};
},
});

declare module '@tiptap/core' {
interface Commands<ReturnType> {
textDirection: {
setTextDirection: (direction: 'auto' | 'ltr' | 'rtl') => ReturnType;
unsetTextDirection: () => ReturnType;
};
}
}
/** @deprecated No longer required, (since it comes default with Tiptap). This will be removed in Umbraco 19. [LK] */
export const TextDirection = TiptapExtensions.TextDirection.extend<UmbTiptapTextDirectionOptions>();
5 changes: 1 addition & 4 deletions src/Umbraco.Web.UI.Client/src/packages/tiptap/externals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// Work-in-progress upgrade to Tiptap v3. [LK]
// Watch this issue: https://github.com/ueberdosis/tiptap/issues/6670
//
// Docs:
// Tiptap v3 Docs:
// https://tiptap.dev/docs/guides/upgrade-tiptap-v2
// https://tiptap.dev/docs/resources/whats-new
// https://github.com/ueberdosis/tiptap/issues
Expand Down
20 changes: 10 additions & 10 deletions src/Umbraco.Web.UI.Client/src/packages/tiptap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"build": "vite build"
},
"dependencies": {
"@tiptap/core": "3.6.2",
"@tiptap/extension-image": "3.6.2",
"@tiptap/extension-subscript": "3.6.2",
"@tiptap/extension-superscript": "3.6.2",
"@tiptap/extension-table": "3.6.2",
"@tiptap/extension-text-align": "3.6.2",
"@tiptap/extension-text-style": "3.6.2",
"@tiptap/starter-kit": "3.6.2",
"@tiptap/extensions": "3.6.2",
"@tiptap/pm": "3.6.2"
"@tiptap/core": "3.16.0",
"@tiptap/extension-image": "3.16.0",
"@tiptap/extension-subscript": "3.16.0",
"@tiptap/extension-superscript": "3.16.0",
"@tiptap/extension-table": "3.16.0",
"@tiptap/extension-text-align": "3.16.0",
"@tiptap/extension-text-style": "3.16.0",
"@tiptap/starter-kit": "3.16.0",
"@tiptap/extensions": "3.16.0",
"@tiptap/pm": "3.16.0"
}
}
Loading