Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ckeditor javascript文档包装器_Ckeditor - Fatal编程技术网

ckeditor javascript文档包装器

ckeditor javascript文档包装器,ckeditor,Ckeditor,在查找用于导航编辑器文本区域元素的代码时,我找到了以下答案。。代码是有效的,唯一的问题是我不明白为什么 var documentWrapper = editorname.document; //replace by your CKEDitor instance ID var documentNode = documentWrapper.$; // or documentWrapper['$'] ; 答案来自以下stackOverflow链接: 特别是有人能给我解释一下documentWra

在查找用于导航编辑器文本区域元素的代码时,我找到了以下答案。。代码是有效的,唯一的问题是我不明白为什么

var documentWrapper = editorname.document; //replace by your CKEDitor instance ID 
var documentNode = documentWrapper.$; // or documentWrapper['$'] ; 
答案来自以下stackOverflow链接:

特别是有人能给我解释一下documentWrapper的语法吗

我不知道这意味着什么

谢谢

@oggiemc

“$”表示CKEDITOR类对象所指向的实际DOM对象。 在本例中,您使用的是“CKEDITOR.dom.document”类。请在此处查找文档:

名为“documentWrapper”的对象是CKEDITOR对象。它将具有该类对象的CKEDITOR API文档中描述的任何属性。您还可以对其使用CKEDITOR方法

使用“documentWrapper.$”时,您使用的是文档对象模型规范中描述的DOM对象。请参见此处的规格:

此对象将具有DOM规范中为此对象类型描述的属性。您不会在此对象上使用CKEDITOR方法,而是使用DOM规范中描述的方法来处理此对象类型

所以“$”是CKEDITOR类对象指向的任何DOM对象(document、head、body、div、span、p等)的通用表示

documentWrapper.someFunction();将在CKEDITOR类对象上使用CKEDITOR方法。 documentWrapper.$.someFunction();将在DOM对象上使用DOM方法


Joe

作为参数传递给插件/对话框的编辑器和getParentEditor()返回的编辑器之间的差异

它们通常是同一个对象。但是,如果一个页面上有多个编辑器实例,则需要使用getParentEditor来确保使用正确的编辑器实例

特别是如果多个编辑器共享一个toobar:如何让多个CKEditor实例共享同一个工具栏?

您可以查看CKEditor目录中对话框单选按钮的代码: ckeditor\\u source\plugins\forms\dialogs\radio.js

或在文档网站上:


加载插件时,它使用活动编辑器实例加载标题和标签的文本,因为它们对于共享工具栏的所有实例都是相同的:

ckeditor\u source\plugins\forms\dialogs\radio.js(5): CKEDITOR.dialog.add('radio',函数(编辑器)

(42)标签:editor.lang.checkboxAndRadio.radioTitle, (43)标题:editor.lang.checkboxAndRadio.radioTitle


但对于对话框中使用的方法,它使用getParentEditor(),以便在正确的编辑器实例上执行操作: ckeditor\u source\plugins\forms\dialogs\radio.js(30): editor=this.getParentEditor()

(22)onOk:function()……editor=this.getParentEditor()


Joe

codewaggle谢谢你的回答..这或多或少地澄清了问题:)嗨Joe,你能给我解释一下作为参数传递给所有插件/对话框的编辑器之间的区别吗:CKEDITOR.dialog.add('radio',function(editor),以及由getParentEditor返回的编辑??ThanksHi oggiemc,我为新问题添加了一个新的答案,因为答案相当长。谢谢joe,这很有意义。我想知道你是否可以看一看你能帮我解决的另一个问题?