From e96e1ff2b4c5b2e0f29e6acae6eebbc5cd5b6fc4 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:16:27 +0200 Subject: [PATCH] fix: adds a check in the tinymce blockpicker plugin to ensure the entries context is available and if not to warn about it, since the whole plugin does not work without it --- .../tiny-mce-plugin/tiny-mce-block-picker.plugin.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts index 66fbd90b8c..380b62b1b1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-rte/tiny-mce-plugin/tiny-mce-block-picker.plugin.ts @@ -59,14 +59,19 @@ export default class UmbTinyMceMultiUrlPickerPlugin extends UmbTinyMcePluginBase } #createBlock() { + if (!this.#entriesContext) { + console.error('[Block Picker] No entries context available.'); + return; + } + // TODO: Missing solution to skip catalogue if only one type available. [NL] let createPath: string | undefined = undefined; if (this._blocks?.length === 1) { const elementKey = this._blocks[0].contentElementTypeKey; - createPath = this.#entriesContext?.getPathForCreateBlock() + 'modal/umb-modal-workspace/create/' + elementKey; + createPath = this.#entriesContext.getPathForCreateBlock() + 'modal/umb-modal-workspace/create/' + elementKey; } else { - createPath = this.#entriesContext?.getPathForCreateBlock(); + createPath = this.#entriesContext.getPathForCreateBlock(); } if (createPath) {