如何在Angular6中没有内容可编辑的情况下为div标签实现复制和粘贴事件?

时间:2018-10-10 07:01:46

标签: typescript angular6

这是我的html

<div class="playground-component" (click)="handleBoardClick()" >
  <div class="actions">
    <div (click)="clear()">Clear</div>
    <div (click)="serialize()">Serialize</div>
    <div (click)="saveTask()">Save</div>
  </div>
  <div class="component" *ngFor="let node of nodes; index as i">
    <div class="header">
      <div class="title">{{node.name}}</div>
      <div class="icons">
        <div class="action settings" (click)="detachConnectionsForElement(node)">
          <i class="fa fa-unlink"></i>
        </div>
        <div class="action settings" (click)="togglePropertiesPopup(node,i)">
          <i class="fa fa-cog"></i>
        </div>
        <div class="action del" (click)="deleteComponent(node)">
          <i class="fa fa-trash"></i>
        </div>
      </div>
    </div>
  </div>
</div>

在上面的html主div中包含两个div标签,内部div根据我的数组重复。当用户右键单击重复的(* ngFor)div标签显示复制和粘贴选项时,然后用户单击复制div并粘贴,而无需使用angular6使用contenteditable选项。

0 个答案:

没有答案