Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32744 closed defect (bug) (invalid)

Post Editor Automatically Deletes Soft Hyphens

Reported by: chriki's profile Chriki Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2.2
Component: Editor Keywords: close
Focuses: Cc:

Description

Wordpress 4.2.2 automatically deletes soft hyphens from my posts. This happens either:

  • when I switch between the visual and text views of the editor, or
  • when I save the post.

I have tried to add soft hyphens in various ways:

  • added using the “Select custom character” pop-up window from the visual view
  • added by copy and paste into both the visual and text views
  • added in the text view using the ­ HTML entity

In all cases the soft hyphens were automatically deleted by the editor. This shouldn’t happen since soft hyphens are required for suggesting line break opportunities for web browsers when automatic hyphenation is in use.

Change History (3)

#1 @azaozz
9 years ago

  • Keywords close added

Hi Chriki, welcome to the WordPress core trac.

Adding soft hyphen (U+00AD) characters in the editor is working properly here. They are normally invisible. From Wikipedia:

(The U+00AD character) serves as an invisible marker used to specify a place in text where a hyphenated break is allowed.
It becomes visible only after word wrapping at the end of a line.

In WordPress TinyMCE is set to convert almost all HTML entities to characters, so even if you paste ­ in the Text editor, it will be converted to the U+00AD character after switching to the Visual editor. There's no good way to see these characters other than to preview the content and resize the window until a word is wrapped.

You can also check if they exist from the browser console:

tinymce.activeEditor.getContent().replace(/\u00ad/g, '$shy;');

TinyMCE has a menu item to (temporarily) show invisible characters, but the menu is not used in WordPress by default. A plugin can be installed to enable it. Perhaps we can add a keyboard shortcut for that (although it seems a bit buggy)?

#2 @Chriki
9 years ago

Thank you, azaozz, for the quick and thorough reply!

You are absolutely right, I should have researched this better. My browser simply ignores the soft hyphens for some reason and I blamed the Wordpress editor … I’m sorry.

The soft hyphens are still there (more than needed by now). So, a way of showing non-printing (i.e., both invisible and whitespace) characters would indeed have been quite helpful here – something like the “Non-printing characters” toolbar button in LibreOffice Writer. But that’s probably a different ticket.

This ticket can be closed, I guess. Should I do this myself?

Thanks again!

#3 @samuelsidler
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.