CKEditor内联选择包装 [英] CKEditor Inline selection wrapping
问题描述
我正在寻找一种方法来添加带有属性的内联span元素到选择。
这个很难的部分是使用通过多个块级元素的选择。
我在StyleCombobox的源代码中找到了这行。
var style = styles [value],
elementPath = editor.elementPath
editor [style.checkActive(elementPath)? 'removeStyle':'applyStyle'](style);
这样,它已经在多个块级元素上工作了。
唯一的一点是,我想将属性应用到跨不同块级元素的多个选择的span,而不是应用样式元素。
我使用这个作为溶液。
确实可以设置属性和元素类型。
这没有在api中定义。我在CKEditor 3.0 api(旧版本)中找到了这个。
var style = new CKEDITOR.style({attributes:{name: changed}});
editor.applyStyle(style);
I'm looking for a way to add a inline span element with attributes to a selection. The hard part of this is getting it working with selections that pass over multiple block level elements.
I was looking in the sourcecode of the StyleCombobox and found this line.
var style = styles[ value ],
elementPath = editor.elementPath();
editor[ style.checkActive( elementPath ) ? 'removeStyle' : 'applyStyle' ]( style );
This way it already works on multiple block level elements.
The only thing is that i would like to apply attributes to the span that is made around the multiple selections for different block level elements instead of applying a style element.
Does anyone know how this can be done?
I used this as solution. It is indeed possible to set attributes and element type. this wasn't defined in the api. I found this in the CKEditor 3.0 api (older version)
var style = new CKEDITOR.style({attributes: {name:"changed"}});
editor.applyStyle(style);
这篇关于CKEditor内联选择包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!