Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From 4 to 5 Problems #664

Closed
liyincheng opened this issue Nov 14, 2017 · 5 comments
Closed

From 4 to 5 Problems #664

liyincheng opened this issue Nov 14, 2017 · 5 comments
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).

Comments

@liyincheng
Copy link

liyincheng commented Nov 14, 2017

Feature request

The API editor.insertHtml is gone from CKEditor 5,so what if I want to insert multiple html tags? As far as I know, the only insert method is:
editor.data.insertContent(item, selection)
Should I instanced all the html tag to corresponding ckeditor Element?
Is there similar API like ckeditor 4 provided ?

Bug report

When I want to insert such html:
editor.setData('<a style="display:block"><img src="xxx" style="width:200px"></a>')
The generated html is:
<figure><img src="xxx"></figure>
As you can see, the A tag is missing, the img style is gone and it add a figure tag. So why it drops my a tag and I don't want a figure tag, because I used this editor as an email editor so the figure tag is not well surpported by the email client.

The new concept of ckeditor 5 is exciting, but the basic functionarity which 5 edition provided is missing and there very few documentation or Q&A for 5 edition. Thus, I feel difficult to make it work supporting may custom features.

I may want to use ckeditor 4 back if problems could not be solved.

@scofalik
Copy link
Contributor

scofalik commented Nov 14, 2017

CKEditor 5 is much different than CKEditor 4 - architecturally and conceptually. As you may know, CKE5 features custom data model. Data that is loaded in the editor is stored as custom elements in that data model tree. Then, that data model is translated to semantically correct HTML. We want to provide an editor that will be easily extensible by 3rd party plugins and that will produce semantically correct content in a nice and easy way. Providing abstract data model that is rendered to view is the only way to ensure that we can provide cutting-edge software.

Because of CKE5 architecture, the content set in editor has to be recognized by the editor. Since style="width:200px" or style="display:block" aren't features of editor, they are dropped. Moreover, links on images right now are not supported, that's why the whole link is dropped. (Mind you I am not saying this will never be supported, however, we only launched first alpha version so a lot of features are missing).

The image feature of CKE5 produces <figure><img /></figure> HTML. All images read and recognized by the editor are transpiled to this form. You could provide your own feature for images, that would not wrap them with <figure>. Then, you might use that feature instead of the original one.

Of course, there is a possibility to provide a plugin/feature, that will introduce converters, which will convert all the unrecognized tags and attributes to the model on a 1-to-1 basis (and then convert it back to HTML, of course). This is not, however, something we are looking forward to introducing.

CKEditor5 is supposed to be rather a content editor, than HTML editor. We are aware that requests like yours will show, because many use CKEditor4 as WYSIWYG HTML editor.

More on our approach can be read here: #592 (comment)

@Reinmar Reinmar added the resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). label Nov 14, 2017
@Reinmar
Copy link
Member

Reinmar commented Nov 14, 2017

As you can see, the A tag is missing, the img style is gone and it add a figure tag. So why it drops my a tag and I don't want a figure tag, because I used this editor as an email editor so the figure tag is not well surpported by the email client.

This means that you need a quite different feature than the one which CKEditor 5 provides, as @scofalik wrote or that you can process the content after retrieving it from the editor.

CKEditor produces a semantical, optimised HTML in a standard and completely predictable way. This is the best format for storing this data and for processing it later, before sending it to the users. Different channels (email, RSS, web, small devices, etc) may require some tweaks. There's no problem with parsing this HTML using any of the available parsers, modifying this tree to fit your usecase and stringifying it back to an HTML string. That's how advanced CMS (like Drupal) handle serving the content for multiple channels.

@liyincheng
Copy link
Author

Yes, I understood. The 5 edition introduces a data model to reflect the dom structure. Anyway, can you not stop developing the 4 edition? Because I think many developers are used to make ckeditor as an wysiwyg editor. For example, such features are preferred:

  1. Use webpack to package the resources instead of an jar tool, as it can generate a single file. I think the 4 editor now load too many resources files. It’s difficult to handle them on my CDN with version control. While if all the resources can be packaged into to a single file like the 5 edition does, it will be much more convenient.
  2. Replace the png images in the toolbar with svg image like 5.
    What do you think?

@luzfcb
Copy link

luzfcb commented Nov 15, 2017

Anyway, can you not stop developing the 4 edition?

I think you as a user, can not demand this. Ckeditor maintainers have the right to stop the development of v4 if they so wish. I think, anyone who wants to continue using v4, when v5 is stable enough to replace v4, should pay for it. ( I'm included in that. )

I have been following the development of ckedito 5 for a long time, and I believe it is the right way. I hope at some point, to be able to migrate to ckeditor 5 (and implement something similar to google docs writter with ckeditor 5, to be used within my organization.)

@fredck
Copy link
Contributor

fredck commented Nov 15, 2017

@liyincheng, we'll continue working on CKEditor 4 for now but we understand that CKEditor 5 is its natural successor. We don't see reasonable limitations for this to not happen.

Some of the perceived limitations that developers are identifying right now are mainly related to the fact that they were used to things in a certain way with v4 and now it must be done differently in v5.

There is not much limitation really, but it requires more attention to the editor itself, by developing plugins to satisfy all specific cases. The point is that, in v5, things don't work in the editor just "by case". For example, throwing whichever HTML into it without having a feature developed to support that HTML is not an option.

Something similar has already been discussed in #592. I recommend you to check that thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).
Projects
None yet
Development

No branches or pull requests

5 participants