-
Notifications
You must be signed in to change notification settings - Fork 10
T/52: Code #55
T/52: Code #55
Conversation
There are some problems with single space handling:
It looks like space handling at the beggining/end of the code element is broken. |
I tried to change the name of the element in view (tested on IMO it looks like the |
This problem with spaces deserves a separate ticket in ckeditor5-engine. And should not block this ticket. |
Reported in https://github.com/ckeditor/ckeditor5-engine/issues/1116. So, could we merge this PR? |
I added some styles but I am not CSS master, so it may require some changes. |
theme/theme.scss
Outdated
@@ -0,0 +1,27 @@ | |||
// Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleq, do you think we could ship with such code styles? They fix <code>
rendering (GH and Umberto use similar ones).
theme/theme.scss
Outdated
@import '~@ckeditor/ckeditor5-theme-lark/theme/helpers/_rounded.scss'; | ||
@import '~@ckeditor/ckeditor5-theme-lark/theme/helpers/_spacing.scss'; | ||
|
||
// It's a darker shade of u-color( 'background-hue' ) so it looks good in info-boxes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like... what?
theme/theme.scss
Outdated
content: "\00a0"; | ||
} | ||
|
||
// To remove an empty line when `code` is empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is unclear. This line is needed to fix empty code rendering in empty block.
But it was a good catch :)
I'll fix the those two issues that I found in the theme.scss. |
On Safari an error is thrown when typing spaces at the end of the |
@oleq, could you take a look at that SASS file and on how it affects FF? I mean – are we fine with that? |
Hm, I have a better idea, actually:
|
To make it clear, with the proposed changes, such data will be generated: <p>Fo <code>o b bom </code>ar</p> Is it ok? |
I think that not only this is ok but it is also the very right way to do it, in the HTML point of view. I was just wondering what happens if one copies and pastes this code into real code... would nbsp characters end up there? |
In the model you'll have normal spaces. In the DOM you'll have the same as I showed above. Basically – on DOM -> view conversion (upon pasting) unnecessary |
This doesn't help much, because one will still have to render the output HTML inside browsers... and the only way to do that is doing exactly how we do it. |
??? But you get data through <p><i>This</i> <code>is an</code> <strong>editor</strong> <u>ins</u><code>is an</code><u>tance</u>.</p> Which renders correctly. |
Actually, what HTML the editor itself would output for this? |
Ok then... so we have to confirm that copy and paste from that produces "pure" spaces. |
@fredck please see my above comments ;) I confirmed exactly that: And also what data will be returned: |
That's wonderful then... so your proposal is the very right way for it ;) |
To note that other converters, like Markdown, will have a sequence of plain spaces there instead. It'll be the job of the third-party MD-to-HTML libraries to convert those spaces on something that renders right inside browsers. |
@pomek – let's close https://github.com/ckeditor/ckeditor5-engine/issues/1126 first. And then, let's clean up this PR. |
Haha, it's not like that. GFM e.g. leaves spaces as they are and GH or other websites using it need to fix this using that hacky CSS I posted in https://github.com/ckeditor/ckeditor5-engine/issues/1116#issuecomment-326243007. We've been there with Umberto too ;< |
Yes, ofc. What I meant to say is that systems that use CKEditor 5 to output Markdown will have to implement their MD-to-HTML scripts in a way that spaces are properly converted IF they want to have browsers rendering their data in the way their users see it in the editor. This means that we can already predict that many systems will be incompatible with that and that a plugin that avoids multiple spaces will be born to "solve" this problem, the other way around. |
This reverts commit 0a4b9b7.
@Reinmar, after merging changes in engine, this PR is ready to review once again. |
Suggested merge commit message (convention)
Feature: Introduced the
Code
plugin. Closes ckeditor/ckeditor5#5547.Additional information
Autoformatting will be done in https://github.com/ckeditor/ckeditor5-autoformat/issues/35.