CKEditor 占位符角 2

Posted

技术标签:

【中文标题】CKEditor 占位符角 2【英文标题】:CKEditor placeholder angular 2 【发布时间】:2018-02-23 07:52:58 【问题描述】:

我在使用 ng2-ckeditor 时遇到了一些问题,我需要在上面放置占位符,但我真的不知道如何在 angular 2 中做到这一点

 <ckeditor
            [config]="config"
            [(ngModel)]="text"
            [ngModelOptions]="standalone: true"
            (change)="updateRemainingCharacters()"
 >
 </ckeditor>

是否有使用配置的解决方案?我试过了

    this.config.placeholder = 'some value';

但它不起作用

【问题讨论】:

查看这篇文章,链接库中也提供了完整的示例:***.com/questions/46119865/… 【参考方案1】:

以下是如何在CKEditor-5 中添加placeholder

  <ckeditor [config]=" placeholder:'Placeholder Text', toolbar: [ 'bold', 'italic', 'bulletedList' ] ">
  </ckeditor>

See docs

【讨论】:

【参考方案2】:

添加JS:

<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>

这里添加extraPlugins:'placeholder' in [config]

<ckeditor
  [(ngModel)]="text"
  [config]="extraPlugins:'placeholder'">
</ckeditor>

希望这会有所帮助!

【讨论】:

感谢您的回复,但它不起作用您知道如何在此占位符中定义任何文本并添加具有其他配置的占位符吗? 好的,这是一些误解,我需要在常见输入中包含类似占位符之类的内容,例如“将文本放在这里...”,只要我在其中放置任何文本,它就会消失 我觉得对你有帮助:***.com/questions/28301703/…

以上是关于CKEditor 占位符角 2的主要内容,如果未能解决你的问题,请参考以下文章

如何在 React CKEDITOR 中添加占位符

试图将占位符添加到CKeditor 4,但没有任何运气

占位符怎么设置

占位符

销毁 2 个 UITextViews 中的占位符

占位符