All files / app/form/editor editor.component.html

25.84% Statements 46/178
28.3% Branches 15/53
7.4% Functions 2/27
35.18% Lines 38/108

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 16069x 5x   12x   24x   24x   29x 29x 57x       29x 29x   57x     29x 29x   57x     29x 29x   57x                 29x         29x     57x 57x                       57x             29x         24x 57x                                     29x                     29x           24x 57x     24x         11x   57x             24x 24x   24x 57x                       24x           24x                    
@if (addButton && !editing && !currentText) {
  <button type="button"
          (click)="addComment()"
          [title]="addCommentTitle">{{ addCommentLabel }}</button>
} @else {
  <div class="text-wrapper">
    <div class="toolbar">
      <button type="button"
              (click)="toggleFullscreen()"
              i18n-title title="Fullscreen editor"
              i18n>⛶</button>
      @if (helpLinks.length) {
        <button #helpButton
                type="button"
                (click)="toggleHelp()"
                i18n-title title="Help"
                i18n>❓️</button>
      }
      @if (fullscreen) {
        <button type="button"
                (click)="toggleStacked()"
                i18n-title title="Stacked or side by side layout toggle"
                i18n>/</button>
      }
      @if (fullscreen || currentText) {
        <button type="button"
                (click)="togglePreview()"
                i18n-title title="Show preview"
                i18n>📝️</button>
      }
      @for (button of editorPushButtons; track button) {
        @if (button.event) {
          @if (button.eventDone && loadingEvents[button.eventDone]) {
            <app-loading class="event-loading"
                         [inline]="true"
                         [title]="button.title || button.label || ''"></app-loading>
          } @else {
            <button type="button"
                    (click)="fireEvent(button)"
                    [title]="button.title || ''" i18n>{{ button.label }}</button>
          }
        } @else if (hasTags) {
          <button type="button"
                  (click)="toggleTag(button)"
                  [title]="button.title || ''" i18n>{{(button._on ? button.labelOn : button.labelOff) || button.label }}</button>
        }
      }
      @if (hasTags) {
        @for (button of editorRibbons; track button; let i = $index) {
          <div class="editor-toggle">
            <input type="checkbox"
                   [style.display]="'none'"
                   [id]="'ribbon-' + id + i"
                   [checked]="button._on"
                   (click)="toggleTag(button)">
            <label [for]="'ribbon-' + id + i"
                   [class.on]="button._on"
                   [title]="button.title || ''">{{ (button._on ? button.labelOn : button.labelOff) || button.label }}</label>
          </div>
        }
        @if (selectResponseType && responseButtons.length > 1) {
          <div class="toolbar-toggle toolbar-toggle-{{toggleIndex}}">
            @for (plugin of responseButtons; track plugin.tag; let i=$index) {
              <button type="button"
                      class="response-button"
                      (click)="setResponse(plugin.tag)"
                      [class.selected]="toggleIndex === i"
                      [title]="plugin.name || ''" i18n>{{ plugin.config?.responseButton }}</button>
            }
          </div>
        }
      }
    </div>
    @if (uploads.length) {
      <div class="upload-progress">
        <div class="upload-list">
          @for (upload of uploads; track upload.id) {
            <div class="upload-item">
              <div class="upload-filename">{{ upload.name }}</div>
              <div class="upload-controls">
                @if (upload.error) {
                  <span class="upload-error">{{ upload.error }}</span>
                } @else if (upload.completed) {
                  <span class="upload-complete">️ Complete</span>
                } @else {
                  <progress class="upload-progress-bar" max="100" [value]="upload.progress"></progress>
                  <span class="upload-percentage">{{ upload.progress }}%</span>
                }
                @if (!upload.completed && !upload.error) {
                  <button type="button"
                          class="upload-cancel"
                          (click)="cancelUpload(upload)"
                          i18n-title title="Cancel upload" i18n>&ndash;</button>
                }
              </div>
            </div>
          }
        </div>
        @if (uploads.length > 1) {
          <div class="upload-actions">
            <button type="button"
                    class="upload-cancel-all"
                    (click)="cancelAllUploads()"
                    i18n>&ndash; remove all</button>
          </div>
        }
      </div>
      <app-loading class="upload-loading" [batch]="true"></app-loading>
    }
    <textarea #editor
              [disabled]="!!uploads.length"
              [id]="id"
              [formControl]="control"
              (focusin)="editing = true"
              (pointerup)="onSelect($event)"
              (select)="onSelect()"
              (selectionchange)="onSelect()"
              (input)="setText($any($event).target.value)"
              (blur)="blurText($any($event).target.value)"
              (focus)="focusText()"
              [class.dropping]="dropping"
              (dragenter)="dropping = true"
              (dragleave)="dragLeave(editor, $any($event.target))"
              (drop)="drop($event, $event.dataTransfer?.items)"
              (paste)="drop($event, $event.clipboardData?.items)"
              [appFillWidth]="fillWidth"
              [padding]="padding"
              [appAutofocus]="autoFocus"></textarea>
    <div class="floating-toggles">
    </div>
  </div>
  @if (preview && (fullscreen || currentText)) {
    <app-md #md
            class="expand"
            [origin]="store.account.origin"
            [text]="currentText"
            [plugins]="allTags"
            [appLimitWidth]="editor"
            (postProcessMarkdown)="postProcessMarkdown()"
            (pointerup)="onSelectPreview()"></app-md>
    <textarea #hiddenMeasure
              class="measurer"></textarea>
  }
  <input #fileUpload
         type="file"
         accept="*"
         (change)="upload(fileUpload.files)"
         multiple/>
 
  <ng-template #help>
    <div class="context-menu" (click)="$event.stopPropagation()">
      @for (link of helpLinks; track link.url) {
        <div (click)="toggleHelp()">
          <a target="_blank" rel="noopener noreferrer" [href]="link.url">{{ link.label }}</a>
        </div>
      }
    </div>
  </ng-template>
}