【问题标题】:CKEditor placeholder angular 2CKEditor 占位符角 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';

但它不起作用

【问题讨论】:

标签: angular typescript ckeditor placeholder


【解决方案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>
    

    希望这会有所帮助!

    【讨论】:

    • 感谢您的回复,但它不起作用您知道如何在此占位符中定义任何文本并添加具有其他配置的占位符吗?
    • 好的,这是一些误解,我需要在常见输入中包含类似占位符之类的内容,例如“将文本放在这里...”,只要我在其中放置任何文本,它就会消失
    • 我觉得对你有帮助:stackoverflow.com/questions/28301703/…
    猜你喜欢
    • 2023-04-06
    • 2018-03-19
    • 1970-01-01
    • 2017-10-25
    • 2019-03-27
    • 2015-06-29
    • 2015-08-15
    • 2023-04-10
    • 1970-01-01
    相关资源
    最近更新 更多