Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | 92x 114x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 70x 70x 70x 70x 70x 181x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 174x 92x 480x 480x 480x 480x 205x 205x 205x 205x 205x 205x 205x 205x 205x 22x 22x 183x 183x 183x 183x 92x 92x 92x 174x 174x 174x 174x 174x 10x 10x 10x 174x 5x 5x 5x 5x 174x 174x 174x 174x 9x 9x 174x 174x 174x 174x 174x 174x 4x 4x 174x 174x 174x 174x 174x 92x 92x 92x 92x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 316x 264x 264x 381x 381x 381x 4x 381x 381x 381x 381x 72x 72x 72x 453x 453x 421x 421x 421x 421x 421x 421x 421x 421x 218x 218x 218x 218x 218x 218x 218x 218x 421x 421x 316x 44x 44x 92x 92x 92x 92x 92x 92x 92x 92x 21x 21x 21x 20x 20x 20x 20x 20x 21x 21x 14x 14x 14x 14x 14x 14x 92x 1x 92x 1x 1x 1x 1x 92x 92x 16x 16x 16x 16x 16x 16x 16x 16x 92x 1x 1x 1x 1x 1x 1x 1x 1x 92x 1x 1x 92x 92x 92x 92x 92x 11x 11x 11x 17x 17x 17x 17x 17x 17x 17x 16x 17x 17x 17x 17x 1x 1x 1x 1x 16x 16x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 92x 10x 10x 10x 10x 92x 92x 92x 92x 92x 92x 92x 19x 19x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 92x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 92x 37x 27x 27x 27x 27x 27x 27x 92x 92x 92x 92x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 92x 92x 100x 100x 92x 92x 92x 6x 6x 6x 92x 59x 59x 92x 92x 92x 92x 92x 210x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x 92x | import { TemplateResult, css, html } from 'lit';
import { property } from 'lit/decorators.js';
import { FieldElement } from './FieldElement';
import { CompletionOption, CustomEventType, Position } from '../interfaces';
import { tokenize, TokenType } from '../excellent/tokenizer';
import {
messageParser,
sessionParser,
renderCompletionOption,
executeCompletionQuery,
updateInputElementWithCompletion
} from '../excellent/helpers';
import { getStore } from '../store/Store';
import { styleMap } from 'lit-html/directives/style-map.js';
import { msg } from '@lit/localize';
import {
getCaretOffset,
getCaretEndOffset,
setCaretOffset,
setCaretRange,
getTextFromEditableDiv
} from '../excellent/caret-utils';
import {
EXPRESSION_TOKENS,
getTokenClass,
tokenCss
} from '../excellent/token-styles';
// Token type → CSS class mapping and caret utilities are now shared modules.
// See ../excellent/token-styles.ts and ../excellent/caret-utils.ts
// ---------------------------------------------------------------------------
// RichEditor component
// ---------------------------------------------------------------------------
export class RichEditor extends FieldElement {
static get styles() {
return css`
${super.styles}
:host {
display: block;
min-width: 0;
contain: inline-size;
}
.comp-container {
position: relative;
height: 100%;
}
#anchor {
position: absolute;
visibility: hidden;
width: 250px;
height: 20px;
}
.input-container {
border-radius: var(--curvature-widget);
background: var(--color-widget-bg);
border: 1px solid var(--color-widget-border);
transition: all ease-in-out var(--transition-speed);
box-shadow: var(--widget-box-shadow);
}
.input-container.xsmall {
--temba-textinput-padding: 6px 8px;
--temba-textinput-font-size: 13px;
}
.input-container.small {
--temba-textinput-padding: 6px 8px;
--temba-textinput-font-size: 14px;
}
.input-container:focus-within {
border-color: var(--color-focus);
background: var(--color-widget-bg-focused);
box-shadow: var(--widget-box-shadow-focused);
}
.highlight-editor {
padding: var(--temba-textinput-padding);
border: none;
margin: 0;
background: transparent;
color: var(--color-widget-text);
font-family: var(--font-family);
font-size: var(--temba-textinput-font-size);
line-height: normal;
width: 100%;
box-sizing: border-box;
outline: none;
white-space: pre-wrap;
word-break: break-word;
overflow-y: auto;
min-height: var(--textarea-min-height, 100px);
resize: none;
}
:host(:not([textarea])) {
min-width: 0;
}
:host(:not([textarea])) .highlight-editor {
white-space: pre;
overflow-x: auto;
overflow-y: hidden;
min-height: 0;
scrollbar-width: none;
}
:host(:not([textarea])) .highlight-editor::-webkit-scrollbar {
display: none;
}
.highlight-editor:empty::before {
content: attr(data-placeholder);
color: var(--color-placeholder, #999);
pointer-events: none;
}
/* Token styles (shared) */
${tokenCss}
/* Completion popup styles */
temba-options {
--widget-box-shadow-focused: 0 0 4px rgba(0, 0, 0, 0.15);
--color-focus: #e6e6e6;
}
.current-fn {
padding: 10px;
margin: 5px;
background: var(--color-primary-light);
color: rgba(0, 0, 0, 0.5);
border-radius: var(--curvature-widget);
font-size: 90%;
max-width: 216px;
overflow: hidden;
word-wrap: break-word;
}
.footer {
padding: 5px 10px;
background: var(--color-primary-light);
color: rgba(0, 0, 0, 0.5);
font-size: 80%;
border-bottom-left-radius: var(--curvature-widget);
border-bottom-right-radius: var(--curvature-widget);
}
code {
padding: 1px 5px;
border-radius: var(--curvature);
}
`;
}
// -- Properties matching Completion's API --
@property({ type: String })
placeholder = '';
@property({ type: Boolean })
textarea: boolean;
@property({ type: Boolean })
autogrow = false;
@property({ type: Boolean })
gsm: boolean;
@property({ type: String })
counter: string;
@property({ type: Number })
maxLength: number;
@property({ type: String })
flavor = 'default';
@property({ type: Boolean })
session: boolean;
@property({ type: Boolean })
submitOnEnter = false;
@property({ type: Boolean })
disableCompletion: boolean;
@property({ type: Number })
minHeight: number;
// -- Completion state --
@property({ type: Array })
options: any[] = [];
@property({ type: Object })
anchorPosition: Position = { left: 0, top: 0 };
@property({ attribute: false })
currentFunction: CompletionOption;
// -- Internal state --
private editableDiv: HTMLDivElement;
private anchorElement: HTMLDivElement;
private hiddenElement: HTMLInputElement;
private query: string;
private _skipRender = false;
private _composing = false;
// Undo/redo: native browser undo doesn't work because syntax highlighting
// replaces innerHTML on every input, destroying the browser's undo history.
private undoStack: { value: string; caret: number }[] = [];
private redoStack: { value: string; caret: number }[] = [];
// -- Lifecycle --
public firstUpdated() {
this.editableDiv = this.shadowRoot.querySelector('.highlight-editor');
this.anchorElement = this.shadowRoot.querySelector('#anchor');
// Create hidden input for form serialization
this.hiddenElement = document.createElement('input');
this.hiddenElement.setAttribute('type', 'hidden');
this.hiddenElement.setAttribute('name', this.getAttribute('name') || '');
this.hiddenElement.setAttribute('value', this.getAttribute('value') || '');
this.appendChild(this.hiddenElement);
// Patch the contenteditable div with HTMLInputElement-like API
this.patchEditableAsInput();
// Initial render
if (this.value) {
this.renderHighlightedContent(this.value);
}
}
public updated(changedProperties: Map<string, any>) {
super.updated(changedProperties);
if (changedProperties.has('value')) {
if (this.hiddenElement) {
this.hiddenElement.setAttribute('value', this.value || '');
}
if (this._skipRender) {
this._skipRender = false;
} else if (this.editableDiv) {
this.renderHighlightedContent(this.value || '');
}
}
}
// -- HTMLInputElement adapter --
private patchEditableAsInput(): void {
const div = this.editableDiv as any;
// eslint-disable-next-line @typescript-eslint/no-this-alias
const host = this;
Object.defineProperty(div, 'value', {
get() {
return host.value || '';
},
set(val: string) {
host._skipRender = true;
host.value = val;
host.renderHighlightedContent(val);
},
configurable: true
});
Object.defineProperty(div, 'selectionStart', {
get() {
return getCaretOffset(div);
},
configurable: true
});
Object.defineProperty(div, 'selectionEnd', {
get() {
return getCaretEndOffset(div);
},
configurable: true
});
div.setSelectionRange = (start: number, end: number) => {
setCaretRange(div, start, end);
};
}
// -- Highlighted content rendering --
public renderHighlightedContent(text: string): void {
const div = this.editableDiv;
if (!div) return;
if (this.disableCompletion) {
div.textContent = text || '';
return;
}
const parser = this.session ? sessionParser : messageParser;
const tokens = tokenize(text || '', parser);
// Build set of valid function names for validation
const validFunctions = new Set<string>();
try {
const store = getStore();
if (store) {
for (const fn of store.getFunctions()) {
const name = fn.signature?.substring(0, fn.signature.indexOf('('));
if (name) validFunctions.add(name.toLowerCase());
}
}
} catch {
// Store may not have getFunctions in some contexts
}
// Clear
div.textContent = '';
for (const token of tokens) {
const cls = getTokenClass(token);
const isMono = EXPRESSION_TOKENS.has(token.type);
// Check if function name is invalid
const isInvalidFn =
token.type === TokenType.FunctionName &&
validFunctions.size > 0 &&
!validFunctions.has(token.text.toLowerCase());
// Split token text on newlines; newlines become styled spans with \n
const parts = token.text.split('\n');
for (let i = 0; i < parts.length; i++) {
if (i > 0) {
const nlSpan = document.createElement('span');
nlSpan.className = 'tok-newline';
nlSpan.textContent = '\n';
div.appendChild(nlSpan);
}
if (parts[i].length > 0) {
const span = document.createElement('span');
span.textContent = parts[i];
let className = isMono ? `${cls} tok-mono` : cls;
if (isInvalidFn) className += ' tok-fn-invalid';
span.className = className;
if (isMono) span.setAttribute('spellcheck', 'false');
div.appendChild(span);
}
}
}
// Ensure there's at least an empty text node for cursor placement
if (!text || text === '') {
div.appendChild(document.createTextNode(''));
}
}
// -- Event handlers --
/**
* Primary input handler. The browser has already modified the DOM;
* we read the text back, re-render with highlighting, and restore the cursor.
*/
private handleInput(): void {
if (this.disabled || this._composing) return;
const text = getTextFromEditableDiv(this.editableDiv);
const currentValue = this.value || '';
if (text === currentValue) return;
const caretPos = getCaretOffset(this.editableDiv);
this.undoStack.push({ value: currentValue, caret: caretPos });
this.redoStack = [];
this.applyValue(text, Math.min(caretPos, text.length));
}
private handleCompositionStart(): void {
this._composing = true;
}
private handleCompositionEnd(): void {
this._composing = false;
this.handleInput();
}
/** Applies a new value, re-renders, restores caret, and fires events. */
private applyValue(newValue: string, caretPos: number): void {
this._skipRender = true;
this.value = newValue;
this.renderHighlightedContent(newValue);
setCaretOffset(this.editableDiv, caretPos);
this.executeQuery();
this.fireEvent('input');
this.fireEvent('change');
}
private performUndo(): void {
if (this.undoStack.length > 0) {
const caret = getCaretOffset(this.editableDiv);
this.redoStack.push({ value: this.value || '', caret });
const state = this.undoStack.pop();
this.applyValue(state.value, state.caret);
}
}
private performRedo(): void {
if (this.redoStack.length > 0) {
const caret = getCaretOffset(this.editableDiv);
this.undoStack.push({ value: this.value || '', caret });
const state = this.redoStack.pop();
this.applyValue(state.value, state.caret);
}
}
// Handles undo/redo from Edit menu and context menu
private handleBeforeInput(e: InputEvent): void {
if (e.inputType === 'historyUndo') {
e.preventDefault();
this.performUndo();
} else if (e.inputType === 'historyRedo') {
e.preventDefault();
this.performRedo();
}
}
private handleKeydown(e: KeyboardEvent): void {
// On macOS, Cmd is the undo/redo modifier; leave Ctrl alone so Cocoa
// text bindings like Ctrl+K (kill) and Ctrl+Y (yank) keep working.
const isMac = /Mac|iPhone|iPad/.test(navigator.userAgent);
const mod = isMac ? e.metaKey : e.ctrlKey;
// Undo/redo via keyboard: preventDefault here suppresses the subsequent
// beforeinput event, avoiding double-handling
if (mod && e.key === 'z' && !e.shiftKey) {
e.preventDefault();
this.performUndo();
return;
}
if (mod && ((e.key === 'z' && e.shiftKey) || e.key === 'y')) {
e.preventDefault();
this.performRedo();
return;
}
// Enter
if (e.key === 'Enter') {
// If completion popup is visible, let temba-options handle the selection
if (this.hasVisibleOptions()) {
e.preventDefault();
return;
}
if (this.submitOnEnter || !this.textarea) {
e.preventDefault();
const modax = this.closest('temba-modax') as any;
if (modax) {
modax.submit();
} else {
this.fireCustomEvent(CustomEventType.Submitted);
}
return;
}
// Insert newline via string manipulation to avoid browser div-wrapping
e.preventDefault();
const selStart = getCaretOffset(this.editableDiv);
const selEnd = getCaretEndOffset(this.editableDiv);
const current = this.value || '';
this.undoStack.push({ value: current, caret: selStart });
this.redoStack = [];
const newValue =
current.substring(0, selStart) + '\n' + current.substring(selEnd);
this.applyValue(newValue, selStart + 1);
}
}
private handleKeyUp(evt: KeyboardEvent): void {
if (this.disableCompletion) return;
// If we have options, ignore keys that are meant for them
if (this.options && this.options.length > 0) {
if (evt.key === 'ArrowUp' || evt.key === 'ArrowDown') {
return;
}
if (evt.ctrlKey && (evt.key === 'n' || evt.key === 'p')) {
return;
}
if (
evt.key === 'Enter' ||
evt.key === 'Escape' ||
evt.key === 'Tab' ||
evt.key.startsWith('Control')
) {
evt.stopPropagation();
evt.preventDefault();
return;
}
}
this.executeQuery();
}
private handlePaste(e: ClipboardEvent): void {
e.preventDefault();
const pastedText = e.clipboardData?.getData('text/plain') || '';
const selStart = getCaretOffset(this.editableDiv);
const selEnd = getCaretEndOffset(this.editableDiv);
const current = this.value || '';
this.undoStack.push({ value: current, caret: selStart });
this.redoStack = [];
const newValue =
current.substring(0, selStart) + pastedText + current.substring(selEnd);
this.applyValue(newValue, selStart + pastedText.length);
}
private handleClick(): void {
this.executeQuery();
}
private handleBlur(): void {
this.handleOptionCanceled();
}
// -- Completion integration --
private executeQuery(): void {
if (this.disableCompletion) return;
if (!this.editableDiv) return;
const result = executeCompletionQuery(
this.editableDiv as unknown as HTMLInputElement,
this.session
);
if (result) {
this.query = result.query;
this.options = result.options;
this.anchorPosition = result.anchorPosition;
this.currentFunction = result.currentFunction;
}
}
private handleOptionSelection(evt: CustomEvent): void {
const option = evt.detail.selected as CompletionOption;
const tabbed = evt.detail.tabbed;
const currentValue = this.value || '';
const caretPos = getCaretOffset(this.editableDiv);
// Mirror typing/paste behavior: completion insertion should be undoable
// back to the exact pre-completion editor state.
this.undoStack.push({ value: currentValue, caret: caretPos });
this.redoStack = [];
updateInputElementWithCompletion(
this.query,
this.editableDiv as unknown as HTMLInputElement,
option
);
// Sync value from the patched div and notify consumers
this.value = (this.editableDiv as any).value;
this.query = '';
this.options = [];
this.fireEvent('input');
this.fireEvent('change');
if (tabbed) {
this.executeQuery();
}
}
private handleOptionCanceled(): void {
window.setTimeout(() => {
this.options = [];
this.query = '';
}, 100);
}
// -- Consumer compatibility API --
public getTextInput(): any {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const host = this;
return {
get inputElement() {
return host.editableDiv;
},
get value() {
return host.value;
},
updateValue(val: string) {
host._skipRender = true;
host.value = val;
host.renderHighlightedContent(val);
}
};
}
public get inputElement(): HTMLDivElement {
return this.editableDiv;
}
public getText(): string {
return this.value || '';
}
public getCaretPosition(): number {
if (!this.editableDiv) return 0;
return getCaretOffset(this.editableDiv);
}
public getCaretScreenPosition(): { top: number; left: number } | null {
if (!this.editableDiv) return null;
const sel = this.editableDiv.getRootNode() as ShadowRoot;
const selection = (sel as any).getSelection
? (sel as any).getSelection()
: window.getSelection();
if (!selection || selection.rangeCount === 0) return null;
const range = selection.getRangeAt(0).cloneRange();
range.collapse(true);
const rect = range.getBoundingClientRect();
if (rect.top === 0 && rect.left === 0) return null;
return { top: rect.bottom, left: rect.left };
}
public insertTextAt(text: string, position: number): number {
const current = this.value || '';
const newValue =
current.substring(0, position) + text + current.substring(position);
const newCaret = position + text.length;
this.applyValue(newValue, newCaret);
return newCaret;
}
public hasVisibleOptions(): boolean {
return this.options.length > 0;
}
public focus(): void {
super.focus();
if (this.editableDiv) {
this.editableDiv.focus();
}
}
public click(): void {
super.click();
if (this.editableDiv) {
this.editableDiv.click();
}
}
// -- Template --
protected renderWidget(): TemplateResult {
const anchorStyles = this.anchorPosition
? {
top: `${this.anchorPosition.top}px`,
left: `${this.anchorPosition.left}px`
}
: {};
const visible = this.options && this.options.length > 0;
return html`
<div class="comp-container">
<div id="anchor" style=${styleMap(anchorStyles)}></div>
<div
class="input-container ${this.flavor !== 'default'
? this.flavor
: ''}"
style=${this.minHeight
? `--textarea-min-height: ${this.minHeight}px`
: ''}
>
<div
class="highlight-editor"
contenteditable="true"
spellcheck="true"
data-placeholder=${this.placeholder}
@input=${this.handleInput}
@beforeinput=${this.handleBeforeInput}
@compositionstart=${this.handleCompositionStart}
@compositionend=${this.handleCompositionEnd}
@keydown=${this.handleKeydown}
@keyup=${this.handleKeyUp}
@click=${this.handleClick}
@paste=${this.handlePaste}
@blur=${this.handleBlur}
></div>
</div>
<temba-options
@temba-selection=${this.handleOptionSelection}
@temba-canceled=${this.handleOptionCanceled}
.renderOption=${renderCompletionOption}
.anchorTo=${this.anchorElement}
.options=${this.options}
?visible=${visible}
>
${this.currentFunction
? html`
<div class="current-fn">
${renderCompletionOption(this.currentFunction, true)}
</div>
`
: null}
<div class="footer" style="${!visible ? 'display:none' : null}">
${msg('Tab to complete, enter to select')}
</div>
</temba-options>
</div>
`;
}
public render(): TemplateResult {
return this.renderField();
}
}
|