training-body-editor.component.html 1.4 KB

1234567891011121314
  1. <div class="editor" [attr.aria-busy]="disabled">
  2. <div class="tools" role="group" aria-label="正文编辑工具">
  3. <button type="button" class="add-images" [disabled]="disabled" (mousedown)="$event.preventDefault()" (click)="chooseImages(images)">添加多张图片</button>
  4. <input #images type="file" hidden multiple accept="image/jpeg,image/png,image/webp,image/gif" [disabled]="disabled" (change)="filesChanged($event)"/>
  5. @for (tool of tools; track tool.label) {
  6. <button type="button" [disabled]="disabled" (mousedown)="$event.preventDefault()" (click)="format(tool.command, tool.value)">{{tool.label}}</button>
  7. }
  8. </div>
  9. <div #body class="body" role="textbox" aria-label="图文正文" aria-multiline="true" aria-describedby="training-body-help" tabindex="0"
  10. [attr.contenteditable]="!disabled" [attr.aria-disabled]="disabled" data-placeholder="在这里输入正文,或添加多张图片…"
  11. (input)="changed()" (keyup)="rememberSelection()" (mouseup)="rememberSelection()" (blur)="rememberSelection()"
  12. (paste)="paste($event)" (dragover)="$event.preventDefault()" (drop)="drop($event)"></div>
  13. </div>
  14. <small id="training-body-help">支持多选、粘贴或拖入图片,每次最多 20 张、每张不超过 10 MB(GIF 不超过 2 MB)。图片保留比例,大图自动压缩;选中图片后可按删除键移除。粘贴文字时自动去除外部格式。</small>