@forgeroute/ui 0.4.61 → 0.4.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50452,7 +50452,7 @@ var ConversationRichBodyComponent = class ConversationRichBodyComponent {
50452
50452
  ngImport: i0,
50453
50453
  template: "",
50454
50454
  isInline: true,
50455
- styles: [".cv-rich{display:block;font-size:.875rem;line-height:1.45;word-break:break-word}.cv-rich p,.cv-rich div{margin:0}.cv-rich ul,.cv-rich ol{margin:0;padding-inline-start:1.25rem}.cv-rich a{color:inherit;text-decoration:underline}\n"],
50455
+ styles: [".cv-rich{display:block;font-size:.875rem;line-height:1.45;word-break:break-word}.cv-rich p,.cv-rich div{margin:0}.cv-rich ul,.cv-rich ol{margin:0;padding-inline-start:1.25rem}.cv-rich a{color:inherit;text-decoration:underline;text-underline-offset:2px}.cv-rich strong,.cv-rich b{font-weight:700}.cv-rich blockquote{margin:4px 0;padding-inline-start:10px;border-inline-start:3px solid currentColor;opacity:.9}.cv-rich h1,.cv-rich h2,.cv-rich h3,.cv-rich h4{margin:0;font-size:1rem;font-weight:700;line-height:1.35}.cv-rich hr{border:0;border-top:1px solid currentColor;opacity:.4;margin:6px 0}\n"],
50456
50456
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
50457
50457
  encapsulation: i0.ViewEncapsulation.None
50458
50458
  });
@@ -50475,7 +50475,7 @@ i0.ɵɵngDeclareClassMetadata({
50475
50475
  "[innerHTML]": "safe()"
50476
50476
  },
50477
50477
  template: "",
50478
- styles: [".cv-rich{display:block;font-size:.875rem;line-height:1.45;word-break:break-word}.cv-rich p,.cv-rich div{margin:0}.cv-rich ul,.cv-rich ol{margin:0;padding-inline-start:1.25rem}.cv-rich a{color:inherit;text-decoration:underline}\n"]
50478
+ styles: [".cv-rich{display:block;font-size:.875rem;line-height:1.45;word-break:break-word}.cv-rich p,.cv-rich div{margin:0}.cv-rich ul,.cv-rich ol{margin:0;padding-inline-start:1.25rem}.cv-rich a{color:inherit;text-decoration:underline;text-underline-offset:2px}.cv-rich strong,.cv-rich b{font-weight:700}.cv-rich blockquote{margin:4px 0;padding-inline-start:10px;border-inline-start:3px solid currentColor;opacity:.9}.cv-rich h1,.cv-rich h2,.cv-rich h3,.cv-rich h4{margin:0;font-size:1rem;font-weight:700;line-height:1.35}.cv-rich hr{border:0;border-top:1px solid currentColor;opacity:.4;margin:6px 0}\n"]
50479
50479
  }]
50480
50480
  }],
50481
50481
  propDecorators: { html: [{
@@ -50636,9 +50636,16 @@ var ConversationsComponent = class ConversationsComponent {
50636
50636
  this.emptyText = computed(() => this.filtering() ? this.filteredEmptyMessage() : this.canWrite() ? this.emptyMessage() : this.emptyReadOnlyMessage(), ...ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []);
50637
50637
  this.messageRows = computed(() => groupMessagesByDay(this.messages(), this.clock()), ...ngDevMode ? [{ debugName: "messageRows" }] : /* istanbul ignore next */ []);
50638
50638
  this.contextVisible = computed(() => this.hasContext() && this.contextOpen() && !!this.selected(), ...ngDevMode ? [{ debugName: "contextVisible" }] : /* istanbul ignore next */ []);
50639
- this.canSend = computed(() => !this.composerDisabled() && !this.sendBlocked() && !this.sending() && (this.draftText().length > 0 || !!this.attachment()), ...ngDevMode ? [{ debugName: "canSend" }] : /* istanbul ignore next */ []);
50640
- this.draftText = computed(() => this.richText() ? conversationHtmlToText(this.draft()) : this.draft().trim(), ...ngDevMode ? [{ debugName: "draftText" }] : /* istanbul ignore next */ []);
50639
+ this.canSend = computed(() => !this.composerDisabled() && !this.sendBlocked() && !this.sending() && (this.draft().trim().length > 0 || !!this.attachment()) && this.draft().trim().length <= this.maxLength(), ...ngDevMode ? [{ debugName: "canSend" }] : /* istanbul ignore next */ []);
50640
+ this.editorHtml = signal("", ...ngDevMode ? [{ debugName: "editorHtml" }] : /* istanbul ignore next */ []);
50641
50641
  this.richHide = RICH_COMPOSER_HIDE;
50642
+ effect(() => {
50643
+ const text = this.draft();
50644
+ if (!this.richText()) return;
50645
+ untracked(() => {
50646
+ if (text !== conversationHtmlToText(this.editorHtml())) this.editorHtml.set(plainTextToHtml(text));
50647
+ });
50648
+ });
50642
50649
  effect(() => {
50643
50650
  const id = this.selected()?.id ?? null;
50644
50651
  const count = this.messages().length;
@@ -50694,16 +50701,21 @@ var ConversationsComponent = class ConversationsComponent {
50694
50701
  this.fileInput()?.open();
50695
50702
  }
50696
50703
  onComposeKeydown(event) {
50697
- if (event.key === "Enter" && !event.shiftKey && !event.isComposing) {
50704
+ if (event.key !== "Enter" || event.isComposing) return;
50705
+ if (this.richText() ? event.ctrlKey || event.metaKey : !event.shiftKey) {
50698
50706
  event.preventDefault();
50699
50707
  this.sendMessage();
50700
50708
  }
50701
50709
  }
50710
+ onEditorChange(html) {
50711
+ this.editorHtml.set(html);
50712
+ this.draft.set(conversationHtmlToText(html));
50713
+ }
50702
50714
  sendMessage() {
50703
50715
  if (!this.canSend()) return;
50704
50716
  this.send.emit(this.richText() ? {
50705
- text: this.draftText(),
50706
- html: sanitizeRichTextHtml(this.draft(), { mode: "paste" })
50717
+ text: this.draft().trim(),
50718
+ html: sanitizeRichTextHtml(this.editorHtml(), { mode: "paste" })
50707
50719
  } : { text: this.draft().trim() });
50708
50720
  }
50709
50721
  clock() {
@@ -51606,12 +51618,12 @@ var ConversationsComponent = class ConversationsComponent {
51606
51618
  }
51607
51619
  @if (richText()) {
51608
51620
  <ui-rich-text-editor class="cv-compose-input cv-compose-rich" [ariaLabel]="composeLabel()" [placeholder]="composePlaceholder()" [hide]="richHide"
51609
- [minHeight]="44" [maxHeight]="160" [ngModel]="draft()" (ngModelChange)="draft.set($event)" [disabled]="composerDisabled()" [error]="composerError()"
51621
+ [minHeight]="44" [maxHeight]="160" [ngModel]="editorHtml()" (ngModelChange)="onEditorChange($event)" [disabled]="composerDisabled()" [error]="composerError()"
51610
51622
  (keydown)="onComposeKeydown($event)" data-testid="compose-input" />
51611
51623
  } @else {
51612
- <ui-textarea-input class="cv-compose-input" [ariaLabel]="composeLabel()" [placeholder]="composePlaceholder()" [rows]="1" [maxlength]="maxLength()"
51613
- [ngModel]="draft()" (ngModelChange)="draft.set($event)" [disabled]="composerDisabled()" [error]="composerError()"
51614
- (keydown)="onComposeKeydown($event)" data-testid="compose-input" />
51624
+ <ui-textarea-input class="cv-compose-input" [ariaLabel]="composeLabel()" [placeholder]="composePlaceholder()" [rows]="1" [maxlength]="maxLength()"
51625
+ [ngModel]="draft()" (ngModelChange)="draft.set($event)" [disabled]="composerDisabled()" [error]="composerError()"
51626
+ (keydown)="onComposeKeydown($event)" data-testid="compose-input" />
51615
51627
  }
51616
51628
  <ui-button class="cv-send-btn" variant="primary" [ariaLabel]="sendLabel()" [disabled]="!canSend()" [loading]="sending()" (click)="sendMessage()" data-testid="send-btn">
51617
51629
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
@@ -52186,12 +52198,12 @@ i0.ɵɵngDeclareClassMetadata({
52186
52198
  }
52187
52199
  @if (richText()) {
52188
52200
  <ui-rich-text-editor class="cv-compose-input cv-compose-rich" [ariaLabel]="composeLabel()" [placeholder]="composePlaceholder()" [hide]="richHide"
52189
- [minHeight]="44" [maxHeight]="160" [ngModel]="draft()" (ngModelChange)="draft.set($event)" [disabled]="composerDisabled()" [error]="composerError()"
52201
+ [minHeight]="44" [maxHeight]="160" [ngModel]="editorHtml()" (ngModelChange)="onEditorChange($event)" [disabled]="composerDisabled()" [error]="composerError()"
52190
52202
  (keydown)="onComposeKeydown($event)" data-testid="compose-input" />
52191
52203
  } @else {
52192
- <ui-textarea-input class="cv-compose-input" [ariaLabel]="composeLabel()" [placeholder]="composePlaceholder()" [rows]="1" [maxlength]="maxLength()"
52193
- [ngModel]="draft()" (ngModelChange)="draft.set($event)" [disabled]="composerDisabled()" [error]="composerError()"
52194
- (keydown)="onComposeKeydown($event)" data-testid="compose-input" />
52204
+ <ui-textarea-input class="cv-compose-input" [ariaLabel]="composeLabel()" [placeholder]="composePlaceholder()" [rows]="1" [maxlength]="maxLength()"
52205
+ [ngModel]="draft()" (ngModelChange)="draft.set($event)" [disabled]="composerDisabled()" [error]="composerError()"
52206
+ (keydown)="onComposeKeydown($event)" data-testid="compose-input" />
52195
52207
  }
52196
52208
  <ui-button class="cv-send-btn" variant="primary" [ariaLabel]="sendLabel()" [disabled]="!canSend()" [loading]="sending()" (click)="sendMessage()" data-testid="send-btn">
52197
52209
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>