Opened 8 years ago

Closed 5 years ago

Last modified 3 years ago

#8369 closed Bug (invalid)

Unable to unbold text that has inline style

Reported by: Michael Camden Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.6
Keywords: Cc: mcamden@…

Description (last modified by Jakub Ś)

I've confirmed this in Chrome on Windows 7, not sure of other browsers. If text is bolded using the strong tag, and has an inline style, it cannot be unbolded.

Steps to reproduce:

  1. Goto ckeditor.com/demo and clear out the content
  2. Press the 'source' button, and insert the following html:

<p>

<strong style="color:#40e0d0;">The quick brown fox.</strong></p>

  1. Press the 'source' button again to enter WYSIWYG mode.
  2. Select the text 'The quick brown fox' and press the 'bold' button. The text will not be unbolded.

UPDATE: Both original issue and the one from comment:5 can be reproduced

Change History (15)

comment:1 Changed 8 years ago by Jakub Ś

Keywords: chrome unbold removed
Status: newconfirmed
Summary: Chrome - Unable to unbold text that has inline styleUnable to unbold text that has inline style
Version: 3.63.0

Issue has been reproducible in all browsers from CKEditor 3.0.

comment:2 Changed 8 years ago by Michael Camden

I have a possible patch for this bug.

File: _source/plugins/styles/plugin.js Line: 1158

		// If the style attributes defined don't apply to this style element, convert to span
		if(removeEmpty && !styles && element.hasAttributes() && element.getAttribute('style')) {
			element.renameNode('span');
		}

This patch works with the following test cases;

<p>
<strong>Bolded text with no other style applied</strong>
</p>
<p>
<strong style="color: red">Bolded text with a red color style</strong>
</p>
<p>
<strong><span style="color: red">Bolded text with red color style in span</span></strong>
</p>

This patch should also resolve similar bugs with other style elements like 'em'. In fact, in my testing the following similar test cases are also work:

<p>
<em>Italic text with no other style applied</em>
</p>
<p>
<em style="color: red">Italic text with a red color style</em>
</p>
<p>
<em><span style="color: red">Italic text with red color style in span</span></em>
</p>

comment:3 Changed 7 years ago by Jakub Ś

#6026 was marked as duplicate.

I believe this issue is related to #8686 and perhaps a little bit to #9295.

comment:4 Changed 6 years ago by Jakub Ś

Resolution: fixed
Status: confirmedclosed

This is no longer an issue in CKEditor 4.x. I have tested this in latest CKE 4.1 and unbolding worked as expected.

comment:5 Changed 6 years ago by Kevin Berridge

This bug is NOT fixed in the latest CKE 4.1.1 (at the time of this writing). You can reproduce it on the demo page as follows:

  1. Clear all the text
  2. Change the format to Normal
  3. Type in 3 headings with an empty paragraph below them like:

H1

H2

H3

  1. Bold each heading
  2. Put your cursor in front of H2, shift + arrow up, arrow, up to select H1.
  3. Delete the selected test
  4. Put your cursor at the end of H2, hit enter
  5. Type something, notice it is bold.
  6. Try to unbold the text you just typed

RESULT: It refuses to unbold.

NOTE: If you click the "Source" button, then switch back to WYSIWYG, it will start working. This appears to be why the original steps to reproduce in the op's post work now. But in fact, the bug is not completely fixed.

comment:6 Changed 6 years ago by Jakub Ś

Resolution: fixed
Status: closedreopened

comment:7 Changed 6 years ago by Jakub Ś

Status: reopenedconfirmed
Version: 3.03.5.3

TC mentioned in comment:5 can be reproduced from CKEditor 3.5.3 rev. [6461] (when applying inline styles for collapsed selection in Webkit was implemented) and is reproducible in both branches 3.x and 4.x.

This TC is only reproducible in Chrome - other browsers don’t seem to add any inline styles.

comment:8 Changed 6 years ago by Kevin Berridge

Any update on this issue? It's a pretty severe problem for our clients.

Thanks.

comment:9 Changed 6 years ago by Jakub Ś

Description: modified (diff)

comment:10 Changed 6 years ago by Jakub Ś

Version: 3.5.33.6

Test created under branch t\8369 under commit: 967f8a3.

comment:11 Changed 6 years ago by Jakub Ś

#10721 was marked as duplicate.

comment:12 Changed 6 years ago by Jakub Ś

#10760 was marked as duplicate

comment:13 Changed 6 years ago by Jakub Ś

#10496 was marked as duplicate.

In CKEditor 4.x

CKEDITOR.replace( 'editor1', {
	coreStyles_bold: { element: 'b', overrides: 'strong' },
	allowedContent: true
});

below content

<strong class="test">Apollo 11</strong>

won't get converted or unbloded if Bold button is used.

comment:14 Changed 5 years ago by Piotrek Koszuliński

Resolution: invalid
Status: confirmedclosed

I'm not sure that this is a valid ticket. A strong tag with other attributes isn't anymore the bold style defined by the basicstyles plugin. This is a different style and the feature which makes it possible to create it should also remove it. None of the editor features create such style.

Note that this is a very similar situation to having <span class="something"> and .something {font-style:bold} in the stylesheet. The text will be bolded, but that's not a bold style at all.

Moreover, when the ACF is enabled (and it is by default) then it will filter out all attributes and styles from the strong tag, so the problem doesn't exist. The problem only exist when the editor is incorrectly configured.

comment:15 Changed 3 years ago by Jakub Ś

#14681 was marked as duplicate.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy