WoltLab / WCF

WoltLab Suite Core (previously WoltLab Community Framework)
https://www.woltlab.com
GNU Lesser General Public License v2.1
238 stars 145 forks source link

make WoltlabCoreNoticeElement accessible for TypeScript/JavaScript usage #6067

Closed mutec closed 1 week ago

mutec commented 1 week ago

Making WoltlabCoreNoticeElement available for TypeScript would make it possible to display notices dynamically based on some previously executed code. Example:

Executing the check and showing an error after the user clicked on some buttons would be pretty bad user experience. Creating a notice statically using the template engine produces another unused DOM-element.

This would also be a good way to handle status indicators dynamically like you'd use for a monitoring system without a lot of overhead in 3rdparty code (like checking the set classes, removing them and adding the new status class in case a notice changes from error to success).

It should be possible to attach the notice to the default notice location right before the page's content / after the pagination.

dtdesign commented 1 week ago

The element is available for use through document.createElement("woltlab-core-notice") just like any other element?

mutec commented 1 week ago

Okay, I'll check my IDE's cache. I didn't find it in global.d.ts as Type or Interface.

dtdesign commented 1 week ago

You are correct. I was under the impression that it had been added but I failed to check if beforehand.

mutec commented 1 week ago

Thanks! :)