Skip to content
Merged
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
@@ -1,6 +1,6 @@
import { Editor } from '../../externals.js';
import { UmbTiptapRteContext } from '../../contexts/tiptap-rte.context.js';
import type { Extensions } from '../../externals.js';
import type { AnyExtension } from '../../externals.js';
import type { UmbTiptapExtensionApi } from '../../extensions/types.js';
import type { UmbTiptapStatusbarValue, UmbTiptapToolbarValue } from '../types.js';
import {
Expand Down Expand Up @@ -156,30 +156,34 @@
this._toolbar = this.configuration?.getValueByAlias<UmbTiptapToolbarValue>('toolbar') ?? [[[]]];
this._statusbar = this.configuration?.getValueByAlias<UmbTiptapStatusbarValue>('statusbar') ?? [];

const tiptapExtensions: Extensions = [];
const tiptapExtensions = new Map<string, AnyExtension>();

this._extensions.forEach((ext) => {
const tiptapExt = ext.getTiptapExtensions({ configuration: this.configuration });
if (tiptapExt?.length) {
tiptapExtensions.push(...tiptapExt);
tiptapExt.forEach((extension) => {
if (!tiptapExtensions.has(extension.name)) {
tiptapExtensions.set(extension.name, extension);
}
});
}

const styles = ext.getStyles();
if (styles) {
this._styles.push(styles);
}
});

this._editor = new Editor({
element: element,
editable: !this.readonly,
editorProps: {
attributes: {
'aria-label': this.label || this.localize.term('rte_label'),
'aria-required': this.required ? 'true' : 'false',
},
},
extensions: tiptapExtensions,
extensions: Array.from(tiptapExtensions.values()),

Check warning on line 186 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 Code Health Review (main)

❌ Getting worse: Complex Method

UmbInputTiptapElement.loadEditor increases in cyclomatic complexity from 15 to 16, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
Comment thread
iOvergaard marked this conversation as resolved.
content: this.#value,
injectCSS: false, // Prevents injecting CSS into `window.document`, as it never applies to the shadow DOM. [LK]
//enableContentCheck: true,
Expand Down
Loading