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

Integration of a WYSIWYG editor #1

Open
stollr opened this issue Dec 3, 2020 · 20 comments
Open

Integration of a WYSIWYG editor #1

stollr opened this issue Dec 3, 2020 · 20 comments

Comments

@stollr
Copy link

stollr commented Dec 3, 2020

An WYSIWYG editor is quite often needed in a Symfony application where things has to be administrated. I had hard times to integrate tinymce (in a clean way) into a Symfony application.

First I tried to use stfalcon/tinymce-bundle but it isn't maintained anymore and I think nowadays the way of the integration is not optimal anymore. So i used Encore to achieve that. I think this was a good decision, but it was very tricky. It took some time for me to get it working (here's a small how-to that I have written down: stfalcon/TinymceBundle#221 (comment)).

Of course tinymce is very heavy and there are other editors, which may be enough for most of the projects. I think of

Would be great if at least one editor would be integrated.

@guillaumesmo
Copy link

guillaumesmo commented Dec 3, 2020

friendsofsymfony/ckeditor-bundle works pretty well

maybe updating the flex recipe for that would be sufficient
or maybe by adding a thin package to bridge it

@disjfa
Copy link

disjfa commented Dec 4, 2020

This is such a loaded question. One thing i like to as is what happens when we paste an image in the text. Also, WYSIWYG , markdown, or one of 24.000 other questions come in mind.

I also was playing with a markdown editor in a project of mine, maybe when i have more i can mangle this in a bundle and share.
https://simplemde.com

@tgalopin
Copy link
Contributor

tgalopin commented Dec 4, 2020

Hi! Thanks for your idea, I agree we should investigate on integrating a content editor in Symfony.

My general point of view regarding the addition of packages to Symfony UX is that:

1/ We should have ideally only one core option for each library in a given category. In this case, we should choose one editor and go with it. Having an opinionated take here matters: it helps people to choose a tool, it reduces our workload and it incentivizes us to make a conscious choice about which library to rely on.

2/ We should almost always go for the most popular/mature library available in a given category. In the editors category, several of them are reaching the popularity and maturity threshold IMO, but in other categories, there are many small libraries: we should always ensure a library won't change a lot in the coming years, as it would have a big impact on our reliability.

3/ Finally, we should always try to provide a package in a way that will make Backward Compatibility feasible. That's one of the reason why the current packages rely on events and not on inheritance: they help ensure the application code using these packages won't break if they upgrade, as we provide a small public API.

Other than that, I'm very open to adding new packages to Symfony UX. We should consider how generic something can be, but in the case of editors, that's definitely something very nice we could do.

Regarding this specific idea, I also have some thoughts:

  • we are going to need to think about file/image upload, so that the editor can use it
  • there is a topic to discuss about XSS/sanitizing so that it's safe to use the result of the editor by default
  • IMO we should aim for a usage similar to the Dropzone component: a plug-and-play replacement for the TextareaType

@sebaherrera
Copy link

Hi. Please consider https://editorjs.io/. It already has a PHP implementation, is actively developed and block-based like WordPress. Thank you.

@tgalopin
Copy link
Contributor

I worked with it a bit already in the past, and unfortunately it still has some important limitations (the inability to add target=_blank on links comes to mind first but I remember there were others I noted). Not sure it's mature enough but I do like its approach indeed.

dunglas referenced this issue in dunglas/ux Mar 2, 2021
refactor: decouple Broadcast from Twig and Mercure
@excitedbox
Copy link

CKeditor is no longer free for commercial use and CKeditor4 is no longer supported.

Suneditor is a very powerful editor and is actively maintained. It is also easy to configure through their interactive configuration.
http://suneditor.com/sample/index.html

nicolas-grekas pushed a commit to nicolas-grekas/ux that referenced this issue Mar 26, 2021
norkunas added a commit to norkunas/ux that referenced this issue Aug 18, 2023
I have a custom hydration extension that in `supports` method checks if the provided class has my custom marker attribute through Reflection, but SA complains:

> Parameter symfony#1 $objectOrClass of class ReflectionClass constructor expects class-string<T of object>|T of object, string given.
weaverryan added a commit that referenced this issue Aug 23, 2023
…onInterface (norkunas)

This PR was merged into the 2.x branch.

Discussion
----------

[LiveComponent] Add missing typehints to HydrationExtensionInterface

| Q             | A
| ------------- | ---
| Bug fix?      | no /not sure
| New feature?  | no /not sure
| Tickets       | N/A
| License       | MIT

I have a custom hydration extension that in `supports` method checks if the provided class has my custom marker attribute through Reflection, but SA complains:

> Parameter `#1` $objectOrClass of class ReflectionClass constructor expects class-string<T of object>|T of object, string given.

Commits
-------

7f8279c [LiveComponent] Add missing typehints to HydrationExtensionInterface
@kasali
Copy link

kasali commented Sep 9, 2023

friendsofsymfony/ckeditor-bundle works pretty well

maybe updating the flex recipe for that would be sufficient or maybe by adding a thin package to bridge it

Yeah but I hardly display the content! Can you help me?

@Jesmaster
Copy link

With the release of Symfony 7 there is currently no supported wysiwg editor bundle for Symfony projects.

The FOSCKEditor bundle is still using CKEditor 4 which was EoL back in June 2023 and the bundle itself seems to have been abandoned shortly after Symfony 6 support was added FriendsOfSymfony/FOSCKEditorBundle#254

I'm currently working on a project rebuilding a Symfony 3 site to the latest version and I've been using some of the new UX components and they are working great. I was looking to see if a new wysiwyg editor integration was part of the UX initiative and found this issue. My new site rebuild is stuck on Symfony 6 until I can remove the dependency on the FOSCKeditor package so I'm highly anticipating a new official UX wysiwyg component that will be supported for many versions to come!

@Jesmaster
Copy link

The FOSCKEditor bundle recently issued a new release adding Symfony 7 support. It's still using CKEditor 4 though so adding a modern WYSIWYG editor as part of the Symfony UX initiative is still an open issue.

@radiz13
Copy link

radiz13 commented Feb 8, 2024

Hi !
I've a problem with Turbo and wysiwyg editors (tried FOSCKEditor bundle & Quill).
After removing cache, on first load, I've an error "Uncaught ReferenceError: CKEDITOR is not defined".
The editor only loads on page refreshes.
Has anyone ever encountered this issue before? Thx.

Uncaught ReferenceError: CKEDITOR is not defined
    renderElement https://***.wip/assets/vendor/@hotwired/turbo/turbo.index-810f44ef1a202a441e4866b7a4c72d11.js:21
    assignNewBody https://***.wip/assets/vendor/@hotwired/turbo/turbo.index-810f44ef1a202a441e4866b7a4c72d11.js:21
    replaceBody https://***.wip/assets/vendor/@hotwired/turbo/turbo.index-810f44ef1a202a441e4866b7a4c72d11.js:21
    ...

@jrushlow
Copy link
Contributor

jrushlow commented Feb 8, 2024

I've had success with ProseMirror https://prosemirror.net/ which is a cousin of CodeMirror https://codemirror.net/. Pretty modular and configurable. And it's all open source... I have not tried implementing it with anything ux || asset_map, but did have a lot of success w/ WebpackEncore

kbond added a commit that referenced this issue Apr 24, 2024
…e parent $loader is null (vesselind)

This PR was merged into the 2.x branch.

Discussion
----------

#1770 [Autocomplete] Ignore the ExtraLazyChoiceLoader if the parent $loader is null

| Q             | A
| ------------- | ---
| Bug fix?      | yes/no
| New feature?  | no
| Issues        | Fix #1770
| License       | MIT

When a custom autoload field class is created and `choices` option is passed, an error occurs: `Symfony\UX\Autocomplete\Form\ChoiceList\Loader\ExtraLazyChoiceLoader::__construct(): Argument #1 ($decorated) must be of type Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface, null given`.

This should fix the problem, described in #1770.

Commits
-------

28af7fc #1770 ignore the ExtraLazyChoiceLoader if the parent $loader is null
@carsonbot
Copy link

Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?

@carsonbot
Copy link

Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.

@jmsche
Copy link
Contributor

jmsche commented Aug 26, 2024

@carsonbot Please leave this issue open, I think a UX component for WYSIWYG would be great.

@carsonbot carsonbot removed the Stalled label Aug 26, 2024
@ikerib
Copy link

ikerib commented Aug 26, 2024

@carsonbot Please leave this issue open, I think a UX component for WYSIWYG would be great.

+1

1 similar comment
@walterbak
Copy link

@carsonbot Please leave this issue open, I think a UX component for WYSIWYG would be great.

+1

@wkania
Copy link

wkania commented Sep 2, 2024

In the PR people also mention:

Looks like too many options. Maybe we need a common interface and choice like in the Notifier services or Mailer services?

Such a choice already exists in the UX Map.

@smnandre
Copy link
Member

smnandre commented Sep 2, 2024

Maybe we need a common interface and choice like in the Notifier services or Mailer services

This would be the best option indeed, but this would require a lot of work to create a small abstraction of an "editor" .. that different editors would implement (like Notifier or Mailer "bridges"... and indeed what was started with Maps)

And many features would be out of the scope of first versions, because they would require additional code that should not be imho in an Editor packages (ex: uploads).

In particular, data format should be taken in account as some editor use pure HTML, some other some specific intermediary syntax, some other use some JSON nodes format.. and in the server side too.

So this is really on the Form / DataTransformer / HtmlSanitizer that a lot of work should probably be done to create a secure and smooth DX... while creating way to use it in a generic way. This is for me where this potential package could really be usefull.

Because in the end, if every editor require specific code, i'm not sure a component could be very useful.. and if the PHP part is just a 1:1 mapping of the JS code i'm not sure either it brings real value to the table.

And i'm not even talking of all the differences in the HTML and/or JS code required on the front-end..

So in my mind this is a very interesting idea, but not an easy one at all.. it would require a lot of work that I personnaly cannot invest at the moment... (but i'd be glad to help / have a look / answer questions if asked to :) )

@faizanakram99
Copy link

A markdown editor would also be a good alternative imo.

There is already a markdown_to_html filter in twig/markdown-extra package, and with another opinionated php markdown package like the one from thephpleague or erusev/parsedown along with some stimulus/turbo thingy should do the trick.

@Kocal
Copy link
Member

Kocal commented Sep 20, 2024

I would like to suggest Lexical, an extensible text editor framework from Meta (Facebook), it sounds very very pleasant to use and custom, while being enough performant.

EDIT: didn't see it was already mentioned

EDIT 2: it's much much harder than expected :D
I've started to look around to https://tiptap.dev, already mentioned above, but everything is so much simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests