ExiRe
ExiRe

Reputation: 4767

Ckeditor 4 - how can I change the color of the link including underline?

When I try to change color of the link (as you can do on demo page) then color of the text is changed but underline is still blue.

enter image description here

Is there any way to make Ckeditor to also change the color of underline too? I want to make Ckeditor to change the color of underline too by default without any movements from the user.

Upvotes: 1

Views: 2654

Answers (3)

ExiRe
ExiRe

Reputation: 4767

I found the solution. Here is my code:

  editor = CKEDITOR.inline(editable_text_element)

  # This event called when text is updated in current editor.
  editor.on 'change', ->
    links = iframe().find('a')
    links.each () ->
      current_link = $(this)
      links_children = current_link.children()

    # Our case is when <a> has only 1 child and this is <span>
    if links_children.size() is 1
      child = links_children.first()
      child_color = child.css('color')
      current_link_color = current_link.css('color')

      current_link.css('color': child_color) if current_link_color isnt child_color

This is not ideal but it works. I set color via style when text has changed.

Upvotes: 1

yonatanmn
yonatanmn

Reputation: 1600

there is a property called text-decoration-color:

Example:

p {
    text-decoration: underline;
    -moz-text-decoration-color: red; /* Code for Firefox */
    text-decoration-color: red;
}

But! it is not Supported in current browsers: https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color

Upvotes: 1

Roy Sonasish
Roy Sonasish

Reputation: 4599

if you double click on the link a small popup window will open, there you found the Advance option(last tab)

Inside Advance option there is a field called style, you can mention color:red or text-decoration:none there.

This will solve your issue.

Upvotes: 2

Related Questions