如何在 ckeditor 对话框中使输入只读

How to make input readonly in ckeditor dialog

本文关键字:输入 只读 对话框 ckeditor      更新时间:2023-09-26

我正在尝试找到一种方法使ckeditor对话框中的输入只读。

我已经初始化了这样的元素:

type: 'hbox',
widths: ['25%', '75%'],
children:
    [{
        type: 'text',
        id: 'moduleId',
        label: 'Module',

查看文档,我想唯一的方法是将一些 css 样式应用于输入?

我在ckeditor源代码中找到了一个解决方案。只需要将其添加到元素初始化中

onLoad : function()
{
    this.getInputElement().setAttribute( 'readOnly', true );
}

我不确定是否可以在定义上将元素设置为禁用,但是您可以在加载对话框后获取该元素并禁用它:http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ui.dialog.uiElement.html#disable