Opened 6 years ago

Closed 23 months ago

#9978 closed New Feature (duplicate)

Shift+space doesn't insert nbsp

Reported by: Rémi Pigeyre Owned by:
Priority: Normal Milestone:
Component: Core : Keystrokes Version: 3.0
Keywords: Cc:

Description

If I press shift+space bar, it should insert a   and it is actually not working : only a regular space is inserted.

nbsp is inserted only after I pressed at least 2 times the space bar (or 2 times shift+space or shift+space + space) and it is inserting one nbsp + one regular space that is no use to make 2 words not being separated.

I can reproduce this bug in : http://ckeditor.com/demo

I'm aware this is a browser behaviour to change more than 1 space into a nbsp + regular spaces. But I just want one single nbsp and browsers do accept it with regular textfields (not CKEditor fields).

I'm also aware of this similar issue : "dev.ckeditor.com/ticket/2247" but this is a pretty old issue, concerning a previous version but I don't know if this can be apply to the current version and how...

By now the only solution I found to insert nbsp is to press space bar 2 times and delete the regular space into source code, that is not very user friendly.

THanks for your help.

I'm using CKEditor 3.6.4 with Drupal CKEditor module (7.x-1.9+14-dev) Mac 10.7 - same issue with : Firefox 18 / Safari 5 / Chrome 24

Change History (6)

comment:1 Changed 6 years ago by Jakub Ś

Component: GeneralCore : Keystrokes
Keywords: nbsp removed
Status: newconfirmed
Type: BugNew Feature
Version: 3.6.43.0

@remaye - currently this is being handled the same way as pressing space bar (It doesn't matter whether you press shift or not). Please also note taht Webkit and Opera insert   on single space press while IE na FF do that on second space press - this is default browser behaviour.


Since #2247 was fixed once for FCKeditor this should probably be fixed in CKEditor but this is feature, not bug.


Please also note there are two tickets that might get in the way (or not :) ) when implementing this #7137 and #8236.

Last edited 6 years ago by Jakub Ś (previous) (diff)

comment:2 Changed 6 years ago by Rémi Pigeyre

Thanks for your answer.

Actually I don't totally agree this is a browser behaviour. What is a browser behaviour is that various consecutive regular spaces are displayed as a single regular space. This is a display behaviour.

But this doesn't affect what is returned by textfield and textarea in a form :

In a regular textfield or textarea :

  • if various regular spaces or nbsp are typed, whatever their number and order, the exact sequence of regular spaces and   is returned

(here I made a mistake in my initial post, on Mac, this is not shift+space but alt+space that is supposed to produce a nbsp)

  • if only 1 alt+space is typed a single   is returned.

With CKEditor the textarea return :

  • only a single regular space whether 1 regular space or 1 alt+space is typed
  • [regular space +  ] (or [  + regular space] depending on browser) when 2 spaces are typed whatever the kind of space is typed (regular space or alt+space)
  • various   + 1 regular space on every sequence of more than 2 regular spaces or alt+space (whatever the order and number)

And this results are immediately produced in the source as text is typed (checking the source code of the textarea with CKEditor "source" button)

1- the behaviour of texterea is different that regular textarea in the form

2- CKEditor doesn't permit to have a single   between 2 words making them unseparable although simple textarea does, what is for me the main use of nbsp.

So I still think that CKEditor is doing "things bellow" that make it behave differently than simple textarea. And whatever the reasons I think this should be considered as a bug because this is not a desirable effect and it is a loss of functionality compared to the regular textarea functionalities...

I do not forget of course that CKEditor is doing much more than textereas and remains the best web text editor I know... and that's why I wish this point was solved soon ;-)

comment:3 Changed 6 years ago by Jakub Ś

  1. Don't compare CKEditor with textarea. Compare it with div having contenteditable="true". This is big difference.
  1. Instead of switching to source (yes CKEditor trims white spaces), try looking at the code with dev-tools. Best tool to check the soource code is IHMO in Chrome. (Firebug doesn't do well with live updates)
  1. "CKEditor doesn't permit to have a single   between 2 word" - this is browser behaviour. Try it in chrome in contenteditable="true", you’ll see. Type "abc " and you will get abc  in Webkit and Opera. Type def behind it and browser will change it to "abc def".

@remaye this is feature reaquest so please let's not continue this discusson anymore. How space is handled by browsers in contenteditable elements is different story. I have spent some time analysing it and don't want to put all my findings here as this has nothing to do with SHIFT+Space inserting backspace.

Last edited 23 months ago by Jakub Ś (previous) (diff)

comment:4 Changed 5 years ago by Danil

Must-have feature, I think. Additionally Ctrl+Shift+- should insert nonbreaking hyphen. It would be nice to have a shortcut for optional hyphens (­). Libre Office uses Ctr+-, but this shortcut is occupied by a browser.

comment:5 Changed 23 months ago by Jakub Ś

Duplicate of #5523

Last edited 23 months ago by Jakub Ś (previous) (diff)

comment:6 Changed 23 months ago by Jakub Ś

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