I'm writing my own link plug-in, and I've run into something that has stumped me. In my plug-in, I'm trying to guess what color a link will be by using the getComputedStyle function, like this:
This returns the text color of the highlighted text that will be linked, which works great to get the text color. But I'm looking to show the user what color the linked text will be AFTER it's applied (and when the user clicks the link button, the link hasn't been applied yet).
When the dialog opens, I need to show the user the link color that will be applied by default. This means I need to trick CKEditor into thinking it's doing a getComputedStyle function on an <a> tag that doesn't exist yet.
Is there a way to temporarily wrap a selection (range) in an <a> tag, and then run that getComputedStyle function on what's inside that <a> tag?
var color = CKEDITOR.instances.contentEditor.getSelection().getStartElement().getComputedStyle('color');
This returns the text color of the highlighted text that will be linked, which works great to get the text color. But I'm looking to show the user what color the linked text will be AFTER it's applied (and when the user clicks the link button, the link hasn't been applied yet).
When the dialog opens, I need to show the user the link color that will be applied by default. This means I need to trick CKEditor into thinking it's doing a getComputedStyle function on an <a> tag that doesn't exist yet.
Is there a way to temporarily wrap a selection (range) in an <a> tag, and then run that getComputedStyle function on what's inside that <a> tag?