gpt4 book ai didi

ckeditor - 当对话框元素被渲染到 DOM 中时?

转载 作者:行者123 更新时间:2023-12-01 06:25:20 25 4
gpt4 key购买 nike

我有 CkEditor 插件的以下代码片段(只是为了说明问题,它不是完整的生产代码):

onOk: function() {
var dialog = this,
element = dialog.element;
.........
element.setStyle('width', width+'%');
element.setStyle('text-align', align)
dialog.commitContent(element);
}

在这个小代码片段中,使用 setStyle() 修改了一个对话框元素。方法,之后 commitContent被触发。

所以,问题是:
  • 我理解正确吗,每个setStyle在这里调用触发器
    元素重新渲染(重绘)自此 element已经存在于
    DOM?
  • commitContent()的目的是什么? ckEditor 方法?只是一个用于存储一些数据的对话框元素的事件?
  • 最佳答案

    设置样式

    我相信 setStyle重新绘制组件 已存在于 DOM 中 ,看看这个例子(我取自官方 documentation ):

    var element = CKEDITOR.document.getById( 'myElement' );
    element.setStyle( 'background-color', '#ff0000' );
    element.setStyle( 'margin-top', '10px' );
    element.setStyle( 'float', 'right' );

    它首先从文档 中获取元素然后设置样式,所以基本上是 返修它触发事件。

    提交内容

    来自官方 documentation :

    Calls the CKEDITOR.dialog.definition.uiElement.commit method of each of the UI elements, with the arguments passed through it. It is usually being called when the user confirms the dialog, to process the values.



    希望这对你有帮助!

    关于ckeditor - 当对话框元素被渲染到 DOM 中时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29508095/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com