Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#28044 closed defect (bug) (duplicate)

TinyMCE still adding span tags with attributes from style-editor.css hardcoded in them. WP 3.9

Reported by: gallantfish's profile gallantfish Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: TinyMCE Keywords:
Focuses: javascript Cc:

Description

This is a follow-up to #14218.

My editor KEEPS adding span tags with line-height attributes and I narrowed it down to some hidden original text preserved somewhere even though a clean and correct version is shown in the TEXT version/tab.

1) Paste text from TextEdit.app in the visual editor (with single-line titles made with b tags)
2) Select the title (b tag, entirely, partial, or the whole line with triple-click)
3) Do ANYTHING with that, and the span will be added. Either removing the B or deleting the selection.

In other words, it's NOT code brought form TextEdit.app, BUT code added to text which CAME from TextEdit.app.

I say it's some remembered version of the pasted text the extra span tags are NOT added if the bolded text was entered manually in the TEXT tab.

When pasted from TextEdit.app (didn't test other apps) the text shows FINE, even shwitching back and forth between VISUAL and TEXT tabs, even doing changes somewhere else. It always returns to the right clean version.

At least not I KNOW how to keep bringing the formatting from Mac TextEdit.app (Wordpress and the Mac OS keep the text beautifully clean this days) without ruining it later in the WP editor. (I used to think it was WP to blame)

It looks like TinyMCE REMEMBERS the span with font-width: bold attribute, but it shows it as b tag instead, so when you make any change to the text, the change is made to the span tag, rather than to the b tag.

Change History (6)

#1 @gallantfish
10 years ago

  • Summary changed from TinyMCE remembers pasted text while showing fixed text? to TinyMCE still adding span tags (narrowed down)

#2 in reply to: ↑ description @gallantfish
10 years ago

  • Summary changed from TinyMCE still adding span tags (narrowed down) to TinyMCE still adding span tags (narrowed down to editing new lines in local dev)

It seems I haven't tested properly because a security plugin reporting me different versions of WP (to prevent hacking).

Actually an older version of WP was managing the deleted empty lines better.
I just installed the new WP and this one doesn't keep the empty lines with nbsp so it doesn't add the spans with line-height style, BUT it keeps grabbing the style from the editor-style.css rules and hard-coding them in the edited text.

New example:

Define a editor-style.css with

.someclass li li {
background-color: #FFF;
}

Then create a UL.someclass bullet list with at least two levels, and while in VISUAL view, outdent a li.

The resulting text will get hardcoded the white background in a SPAN tag.

Also the new li will be wrongly nested until the TEXT view is visited (the current li stays under its former parent li) and I just posted a bug for that too)

Last edited 10 years ago by gallantfish (previous) (diff)

#3 @gallantfish
10 years ago

  • Focuses ui added
  • Summary changed from TinyMCE still adding span tags (narrowed down to editing new lines in local dev) to TinyMCE still adding span tags with attributes in style-editor.css hardcoded in them. WP 3.9

Should I open it as a new bug? I'm affraid it's been seen and discarded because of the initial text (before I narrow it down to rules in the editor-style.css stylesheet being hardcoded in span tags)

#4 @gallantfish
10 years ago

  • Summary changed from TinyMCE still adding span tags with attributes in style-editor.css hardcoded in them. WP 3.9 to TinyMCE still adding span tags with attributes from style-editor.css hardcoded in them. WP 3.9

#5 @azaozz
10 years ago

Yes, it is the same WebKit/Blink feature (or rather a bug). It's quite hard to find workarounds/fix/avoid all the cases where these spans are inserted. The only 100% solution is to stop using these browsers until this is finally fixed...

The improper nesting should be fixed now.

Last edited 10 years ago by azaozz (previous) (diff)

#6 @iseulde
9 years ago

  • Focuses ui administration removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from 3.8.3 to 3.8

Duplicate of #26975.

Note: See TracTickets for help on using tickets.