All files / app/page/submit/text text.component.html

51.72% Statements 60/116
53.12% Branches 17/32
0% Functions 0/11
62.06% Lines 36/58

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 1017x 7x 22x         22x     7x           22x 22x 7x   7x   7x     22x     7x   22x 7x 7x 22x   22x                         22x 7x   18x   7x     22x 7x           7x       22x     7x             22x         7x 7x 22x 7x   7x     22x     22x 7x   22x        
<ng-container *mobxAutorun>
  <form class="form"
        [formGroup]="textForm"
        (ngSubmit)="submit()"
        [appLimitWidth]="limitWidth"
        [limitSibling]="true">
 
    @if (defaults?.url || loadingDefaults.length) {
      <span></span>
      <div>
        <span i18n>Loading defaults for <app-nav [url]="defaults?.url || ('tag:/' + loadingDefaults[0].tag)"></app-nav></span>
        @if (!defaults) {
          <app-loading [inline]="true"></app-loading>
        }
      </div>
    }
    @if (!advanced) {
      @if (store.submit.wiki) {
        <label for="title" i18n>Wiki:</label>
      } @else {
        <label for="title" i18n>Title:</label>
      }
      <input id="title"
             name="title"
             type="text"
             [formControl]="title"
             (blur)="validate($any($event.target))">
 
      <app-select-plugin #pluginSelect
                         class="shrink"
                         [text]="true"
                         i18n-title title="Add Plugin"
                         (pluginChange)="bookmarks.toggleTag($event); pluginSelect.plugin = ''"></app-select-plugin>
      <app-form-plugins #plugins id="plugins" [group]="textForm"></app-form-plugins>
 
      @if (customEditor) {
        <span><!-- Editor --></span>
        <div #fill class="fill-editor">
          <ngx-monaco-editor #ed
                             [formControl]="comment"
                             [options]="codeOptions"
                             [style.width]="'min(900px, 50vw)'"
                             [style.height]="'min(200px, 90vh)'"
                             [appFillWidth]="fill"
                             appResizeHandle
                             [hitArea]="config.mobile ? 48 : 20"></ngx-monaco-editor>
        </div>
      } @else {
        @if (store.submit.wiki) {
          <label [for]="ed.id" class="editor-label" i18n>Entry:</label>
        } @else {
          <label [for]="ed.id" class="editor-label" i18n>Comment:</label>
        }
        <div #fill class="fill-editor">
          <app-editor #ed
                      class="bubble"
                      [control]="comment"
                      (syncEditor)="syncEditor()"
                      [tags]="tags"
                      (syncTags)="setTags($event)"
                      (addSource)="addSource($event)"
                      (uploadCompleted)="completedUploads.push($event)"
                      [fillWidth]="fill"
                      [autoFocus]="true"></app-editor>
        </div>
      }
 
      <app-tags #tagsFormComponent [group]="textForm"></app-tags>
 
      <span><!-- Advanced --></span>
      <a class="fake-link no-select" (click)="showAdvanced()" i18n>show advanced</a>
    } @else {
      <app-ref-form #advancedForm
                    [group]="textForm"
                    (toggleTag)="bookmarks.toggleTag($event)"></app-ref-form>
    }
 
    @for (e of serverError; track e) {
      <span><!-- Unexpected Error --></span>
      <div class="error">{{ e }}</div>
    }
 
    <span><!-- Buttons --></span>
    <span class="buttons right">
      @if (randomURL && (addAnother || store.hotkey)) {
        <div class="add-more" i18n-title title="Will not clear form to all another Ref.">
          <input id="addAnother" type="checkbox" [checked]="addAnother" (input)="addAnother = !addAnother">
          <label for="addAnother" i18n>Add another</label>
        </div>
      }
      @if (submitting || saving) {
        <app-loading [inline]="true"></app-loading>
      }
      @if (admin.getPlugin('plugin/editing')) {
        <button type="button" [disabled]="submitting || saving || submitted || textForm.pristine" (click)="saveForLater(true)" i18n>Save for later</button>
      }
      <button type="submit" [disabled]="submitting || submitted && !textForm.valid" i18n>Submit</button>
    </span>
  </form>
</ng-container>