Bump version to 1.1.2 and update TaxonomyNavigationService to hide tags not available for tagging

- Updated TaxonomyNavigationService to set hideTagsNotAvailableForTagging to true.
- Modified getAllTerms call to include the updated parameter for hiding unavailable tags.
- Removed external CSS loading functionality from MegaMenuApplicationCustomizer.
- Updated cache prefixes in SPTermStorePickerService for versioning.
- Bumped version in package.json and package-lock.json to 1.1.2.
- Updated deployment manifest files to reflect the new version.
This commit is contained in:
Torsten Brendgen
2026-07-19 21:11:29 +02:00
parent 0ab514ca21
commit 5f1d26c7f6
20 changed files with 34 additions and 158 deletions

View File

@@ -25,7 +25,6 @@ export interface IMegaMenuApplicationCustomizerProperties {
termSetName?: string;
termSetId?: string;
cacheMinutes?: number;
cssUrl?: string;
debug?: boolean;
}
@@ -40,10 +39,6 @@ export default class MegaMenuApplicationCustomizer
public onInit(): Promise<void> {
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Initialized ' + strings.Title);
if (this.properties.cssUrl) {
this._loadExternalCss(this.properties.cssUrl);
}
this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
this._renderPlaceHolders();
@@ -134,51 +129,12 @@ export default class MegaMenuApplicationCustomizer
return placeholder.domElement;
}
private _loadExternalCss(cssUrl?: string, debug: boolean = this._isDebugEnabled()): void {
const externalCssLinkId: string = 'mega-menu-additional-css-34FAB720';
let link: HTMLLinkElement = document.getElementById(externalCssLinkId) as HTMLLinkElement;
if (cssUrl && cssUrl.trim() !== '') {
const validatedUrl: string | undefined = this._validateCssUrl(cssUrl);
if (!validatedUrl) {
debugWarn(debug, LOG_SOURCE, 'Rejected unsafe external CSS URL:', cssUrl);
if (link) {
link.remove();
}
return;
}
if (!link) {
const head: HTMLHeadElement = document.getElementsByTagName('head')[0];
link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.id = externalCssLinkId;
link.onload = () => {
debugLog(debug, LOG_SOURCE, 'External CSS loaded successfully from:', cssUrl);
};
link.onerror = () => {
debugWarn(debug, LOG_SOURCE, 'Failed to load external CSS from:', cssUrl);
};
head.appendChild(link);
}
link.href = validatedUrl;
} else if (link) {
link.remove();
}
}
private _onDispose = (): void => {
this.context.placeholderProvider.changedEvent.remove(this, this._renderPlaceHolders);
if (this._renderer) {
this._renderer.dispose();
this._renderer = undefined;
}
const externalCssLink: HTMLElement = document.getElementById('mega-menu-additional-css-34FAB720');
if (externalCssLink) {
externalCssLink.remove();
}
this._menuContainer = undefined;
this._topPlaceholder = undefined;
debugLog(this._isDebugEnabled(), LOG_SOURCE, 'Disposed custom top placeholder.');
@@ -201,20 +157,6 @@ export default class MegaMenuApplicationCustomizer
return isFinite(value) ? Math.min(Math.max(Math.floor(value), 1), 1440) : 15;
}
private _validateCssUrl(cssUrl: string): string | undefined {
try {
const parsed: URL = new URL(cssUrl.trim(), window.location.origin);
const isHttp: boolean = parsed.protocol === 'http:' || parsed.protocol === 'https:';
const isSameOrigin: boolean = parsed.origin === window.location.origin;
if (!isHttp || (!isSameOrigin && parsed.protocol !== 'https:')) {
return undefined;
}
return parsed.href;
} catch (error) {
return undefined;
}
}
private _renderStatus(message: string): void {
if (!this._topPlaceholder) {
return;

View File

@@ -12,8 +12,8 @@ import { ApplicationCustomizerContext } from '@microsoft/sp-application-base';
import { debugError } from './MegaMenuDebug';
const EmptyGuid: string = '00000000-0000-0000-0000-000000000000';
const TermCachePrefix: string = 'MegaMenu:TermSet:';
const PickerCachePrefix: string = 'MegaMenu:PickerTerms:';
const TermCachePrefix: string = 'MegaMenu:TermSet:v2:';
const PickerCachePrefix: string = 'MegaMenu:PickerTerms:v2:';
interface ITermCacheEntry {
expiresAt: number;

View File

@@ -27,7 +27,7 @@ export class TaxonomyNavigationService implements ITaxonomyNavigationService {
termsetNameOrID: termSetNameOrId,
useSessionStorage: true,
hideDeprecatedTags: true,
hideTagsNotAvailableForTagging: false,
hideTagsNotAvailableForTagging: true,
cacheMinutes: cacheMinutes
},
this.context,
@@ -40,7 +40,7 @@ export class TaxonomyNavigationService implements ITaxonomyNavigationService {
const termset: ITermSet = await this._taxonomyPickerService.getAllTerms(
this.termSetNameOrId,
true,
false,
true,
true,
this.cacheMinutes
);