I uses the CKEditor. I'd like to make an incredibly simple plugin: when a user selects text and then hits MyPluginIcon, the editor surrounds the text in a mytag tag with a specific class.
So it's just like the Bold or Italic button, but for:
tata
I am far from a JS expert, so I have been looking for a plugin to copy. I cant get data from selected range :(. My code is:
var cked = $("#" + part_id).ckeditorGet();
var select = cked.getSelection();
var ranges = select.getRanges( true );
if ( ranges.length == 1 ) {
range = ranges[0];
var el = CKEDITOR.dom.element.createFromHtml( '<mytag"'+ $("#link").val() + 开发者_C百科'" >' + range.extractContents() + '</mytag>' );
cked.insertElement(el);
}
What did I do wrong?
Thanks!
There is some way given by CKEDITOR for defining custom style in styes plugin code. And how to use that go to basicstyles plugin. I think you will be benefited.
精彩评论