You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add Notification.getText(). There's setText() already, so it makes sense to have the getText() function.
Also, I'm trying to create an utility function to add a close button (see vaadin/web-components#438 for details), but I am unable to do so. Adding a component clears the text, so I need to get the text, wrap it in a Span, then add the Span. However, I can't do that since there's no getText().
Describe the solution you'd like
getText() which would return the current text set via setText() or an empty string if the notification has children components.
Describe alternatives you've considered
privateval_Notification_templateElement:Field by lazy(LazyThreadSafetyMode.PUBLICATION) {
val f:Field=Notification::class.java.getDeclaredField("templateElement")
f.isAccessible =true
f
}
publicvalNotification._templateElement:Element
get() =_Notification_templateElement.get(this) asElement/** * Returns the notification text.*/publicfun Notification.getText(): String {
if (isNotEmpty) {
// adding components to the notification clears the notification textreturn""
}
val e:Element=_templateElementreturn e.getProperty("innerHTML") ?:""
}
But it doesn't work as well since it will return a <template foo bar text if there are child components.
Additional context
Is there anything else you can add about the proposal?
The text was updated successfully, but these errors were encountered:
Describe your motivation
Please add
Notification.getText()
. There'ssetText()
already, so it makes sense to have thegetText()
function.Also, I'm trying to create an utility function to add a close button (see vaadin/web-components#438 for details), but I am unable to do so. Adding a component clears the text, so I need to get the text, wrap it in a Span, then add the Span. However, I can't do that since there's no
getText()
.Describe the solution you'd like
getText()
which would return the current text set viasetText()
or an empty string if the notification has children components.Describe alternatives you've considered
But it doesn't work as well since it will return a
<template foo bar
text if there are child components.Additional context
Is there anything else you can add about the proposal?
The text was updated successfully, but these errors were encountered: