|
48 | 48 | width: 100%;
|
49 | 49 | word-spacing: inherit;
|
50 | 50 | }
|
| 51 | + .text-center { |
| 52 | + text-align: center; |
| 53 | + } |
51 | 54 | .text-bold {
|
52 | 55 | font-weight: bold;
|
53 | 56 | }
|
|
69 | 72 | .hidden {
|
70 | 73 | display: none;
|
71 | 74 | }
|
| 75 | + .position-absolute { |
| 76 | + position: absolute; |
| 77 | + } |
72 | 78 | .opacity-0 {
|
73 | 79 | opacity: 0 !important;
|
74 | 80 | }
|
|
80 | 86 | pointer-events: none;
|
81 | 87 | }
|
82 | 88 | #serviceMessage {
|
83 |
| - position: absolute; |
84 | 89 | padding: 5px;
|
85 | 90 | background-color: var(--primary-background-color);
|
86 | 91 | border: 1px solid var(--primary-color);
|
|
110 | 115 | <textarea maxlength="${this.state.max_length !== -1 ? this.state.max_length : ""}" @keyup="${() => this.onKeyupTextarea()}" class="textarea" placeholder="${this.state.placeholder_text}">${this.getState()}</textarea>
|
111 | 116 | <span class="text-red text-small text-italic text-left" id="spanMinCharactersInfoText"></span>
|
112 | 117 | <span class="text-small text-italic text-right" id="spanMaxCharactersInfoText"></span>
|
| 118 | + ${!this.state.showButtons ? html`<div id="serviceMessage" class="text-center text-small invisible opacity-0"> </div>` : null} |
113 | 119 | </div>
|
114 | 120 | ${this.state.showButtons ? html`
|
115 | 121 | <div class="flex">
|
116 |
| - <div id="serviceMessage" class="text-small invisible opacity-0"></div> |
| 122 | + <div id="serviceMessage" class="position-absolute text-small invisible opacity-0"> </div> |
117 | 123 | ${Object.keys(this.state.buttons_ordered).map(this.renderButton.bind(this))}
|
118 | 124 | </div>` : null}
|
119 | 125 | </ha-card>` : null;
|
|
270 | 276 | }
|
271 | 277 |
|
272 | 278 | displayMessage(service, success) {
|
273 |
| - // todo: translations |
274 |
| - if(!this.shadowRoot || !service || service.length < 1) { |
| 279 | + if(!this.state.show_success_messages || !this.shadowRoot || !service || service.length < 1) { |
275 | 280 | return;
|
276 | 281 | }
|
277 | 282 |
|
278 | 283 | let serviceMessageContainer = this.shadowRoot.querySelector('#serviceMessage');
|
279 | 284 |
|
| 285 | + if(!serviceMessageContainer) { |
| 286 | + return; |
| 287 | + } |
| 288 | + |
| 289 | + // todo: translations |
280 | 290 | let message = "";
|
281 | 291 | if(success) {
|
282 | 292 | if(service == "save") {
|
|
302 | 312 | }, 1500);
|
303 | 313 | setTimeout(function() {
|
304 | 314 | serviceMessageContainer.classList.add("invisible");
|
305 |
| - serviceMessageContainer.innerHTML = ""; |
| 315 | + serviceMessageContainer.innerHTML = " "; |
306 | 316 | }, 2000);
|
307 | 317 | }
|
308 | 318 | }
|
|
382 | 392 | min_length: parseInt(config.min_length) || 0,
|
383 | 393 | placeholder_text: config.placeholder_text || "",
|
384 | 394 | save_on_clear: config.save_on_clear === true,
|
| 395 | + show_success_messages: config.show_success_messages !== false, |
385 | 396 | title: config.title,
|
386 | 397 |
|
387 | 398 | autosave_timeout: null,
|
|
0 commit comments