Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiptap RTE: Ensure core extension is loaded #18382

Merged
merged 1 commit into from
Feb 19, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,21 @@
}

async #loadExtensions() {
await new Promise<void>((resolve) => {
this.observe(umbExtensionsRegistry.byType('tiptapExtension'), async (manifests) => {
let enabledExtensions = this.configuration?.getValueByAlias<string[]>('extensions') ?? [];
const enabledExtensions = this.configuration?.getValueByAlias<string[]>('extensions') ?? [];

// Ensures that the "Rich Text Essentials" extension is always enabled. [LK]
if (!enabledExtensions.includes(TIPTAP_CORE_EXTENSION_ALIAS)) {
enabledExtensions = [TIPTAP_CORE_EXTENSION_ALIAS, ...enabledExtensions];
}
// Ensures that the "Rich Text Essentials" extension is always enabled. [LK]
if (!enabledExtensions.includes(TIPTAP_CORE_EXTENSION_ALIAS)) {
const { api } = await import('../../extensions/core/rich-text-essentials.tiptap-api.js');
this._extensions.push(new api(this));
}

await new Promise<void>((resolve) => {
this.observe(umbExtensionsRegistry.byTypeAndAliases('tiptapExtension', enabledExtensions), async (manifests) => {
for (const manifest of manifests) {
if (manifest.api) {
const extension = await loadManifestApi(manifest.api);
if (extension) {
// Check if the extension is enabled
if (enabledExtensions.includes(manifest.alias)) {
this._extensions.push(new extension(this));
}
this._extensions.push(new extension(this));

Check notice on line 83 in src/Umbraco.Web.UI.Client/src/packages/tiptap/components/input-tiptap/input-tiptap.element.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v15/dev)

✅ No longer an issue: Deep, Nested Complexity

UmbInputTiptapElement.loadExtensions is no longer above the threshold for nested complexity depth
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TextStyle,
} from '@umbraco-cms/backoffice/external/tiptap';

export default class UmbTiptapRichTextEssentialsExtensionApi extends UmbTiptapExtensionApiBase {
export class UmbTiptapRichTextEssentialsExtensionApi extends UmbTiptapExtensionApiBase {
#localize = new UmbLocalizationController(this);

getTiptapExtensions = () => [
Expand Down Expand Up @@ -55,3 +55,7 @@ export default class UmbTiptapRichTextEssentialsExtensionApi extends UmbTiptapEx
Span,
];
}

export default UmbTiptapRichTextEssentialsExtensionApi;

export { UmbTiptapRichTextEssentialsExtensionApi as api };
Loading