[英]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. 当我尝试更改链接的颜色时(如在演示页上所做的那样 ),则文本的颜色已更改,但下划线仍为蓝色。
Is there any way to make Ckeditor to also change the color of underline too? 有没有办法使Ckeditor也改变下划线的颜色? I want to make Ckeditor to change the color of underline too by default without any movements from the user. 我想让Ckeditor默认也更改下划线的颜色,而无需用户进行任何移动。
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. 在“高级”选项中,有一个称为样式的字段,您可以在其中提及color:red
或text-decoration:none
。
This will solve your issue. 这样可以解决您的问题。
there is a property called text-decoration-color
: 有一个称为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 当前的浏览器不支持它: https : //developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color
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. 当文本更改时,我通过样式设置颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.