【问题标题】:How do you make an anchor link non-clickable or disabled in text editor如何在文本编辑器中使锚链接不可点击或禁用
【发布时间】:2021-12-06 03:53:32
【问题描述】:

还需要在文本编辑器中禁用超链接。 该字段已被禁用为 [readonly]="true"。 但是附加到 p 编辑器的超链接是可点击的。

代码:

<label for="notice">Notice<span class="mandatory">*</span></label>
<p-editor [readonly]="isViewDisable" [attr.disabled]="(isViewDisable)" formControlName="noticeText" [(ngModel)]="noticeText" [style]="{'height':'320px'}" [ngClass]="{ 'is-invalid': submitted && p.noticeText.errors }" #editor appRequired>
  <ng-template pTemplate="header">
    <span class="ql-formats">
      <select class="ql-size">
         <option value="small"></option>
         <option selected></option>
         <option value="large"></option>
         <option value="huge"></option>
      </select>
      <button class="ql-bold" aria-label="Bold"></button>
      <button class="ql-italic" aria-label="Italic"></button>
      <button class="ql-underline" aria-label="Underline"></button>
      <span class="ql-formats">
         <button class="ql-list" value="ordered"></button>
         <button class="ql-list" value="bullet"></button>                                    
         <select title="Text Alignment" class="ql-align" >
            <option selected>Gauche</option>
            <option value="center" label="Center"></option>
            <option value="right" label="Right"></option>
            <option value="justify" label="Justify"></option>
         </select>
      </span>
    <span class="ql-formats">
      <button class="ql-link" aria-label="Link"></button>
      </span>
    </span>
  </ng-template>
</p-editor>
</div>

【问题讨论】:

  • 没有“禁用”链接。您可以做的是设置一个 css pointer-events: none 这将阻止用户与元素进行交互。

标签: javascript angular typescript validation primeng


【解决方案1】:

你需要添加一个禁用类请看下面

.disabled {
   pointer-events: none
 }


<p-editor [ngClass]="{'disabled':isViewDisable}" [readonly]="isViewDisable" [attr.disabled]="(isViewDisable)" formControlName="noticeText" [(ngModel)]="noticeText" [style]="{'height':'320px'}" [ngClass]="{ 'is-invalid': submitted && p.noticeText.errors }" #editor appRequired>
  <ng-template pTemplate="header">

【讨论】:

  • 每次有人在同一个输入标签[(ngModel)]formControlName中使用一只小猫死了
猜你喜欢
  • 2011-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-06
  • 2015-11-28
  • 1970-01-01
  • 2022-07-28
相关资源
最近更新 更多