OrchardCoreContrib / OrchardCoreContrib.Modules

Unofficial Orchard Core modules that driven by the community who love Orchard Core CMS
BSD 3-Clause "New" or "Revised" License
38 stars 13 forks source link

Add GrapesJs Editor #35

Closed hishamco closed 2 years ago

hishamco commented 2 years ago

Adding Graphes JS editor in HTML Module

/cc @kudryavtsevda

kudryavtsevda commented 2 years ago

Thanks for looping me, I am waiting to check your module

hishamco commented 2 years ago

I already have a WIP PR, hope to submit it ASAP

kudryavtsevda commented 2 years ago

Could you provide me link regarding to this PR? if it is possible

hishamco commented 2 years ago

I will push a WIP PR today, I will keep you updated

hishamco commented 2 years ago

@kudryavtsevda a WIP PR is created

kudryavtsevda commented 2 years ago

@kudryavtsevda a WIP PR is created

Thanks, let me check BTW, do you know when it will be approved?

hishamco commented 2 years ago

For OCC I can publish a beta release but it needs some work to make the components show up in the blocks section

kudryavtsevda commented 2 years ago

For OCC I can publish a beta release but it needs some work to make the components show up in the blocks section

If it is possible please do it and then I will clone your module and will ask questions

hishamco commented 2 years ago

You can fork the repo and try the module and it will be nice if you want to push some commits

kudryavtsevda commented 2 years ago

I have been playing with your module and noticed that 1) uploaded images are not saved 2) background colors are not saved and 3) control panel in the right top cornet doesn't work at all (no preview, no code review) image

may be I did something wrong?

hishamco commented 2 years ago

Seems I disabled the storage. Regarding the last two points I notice that while I'm developing, I presume this a script issues, coz when I use GrapesJs in a blank html it works. I need to figure out why, if you can help on this it's much appreciated

That's why I told you we need a lot of work here, more interestingly adding components in blocks section

kudryavtsevda commented 2 years ago

Seems I disabled the storage.

do you mean it doesn't persist changes made by grapesjs? could you explain it a little bit?

kudryavtsevda commented 2 years ago

@hishamco I figured out that html body part should be setup with disabled if you want to allow to use local storage of grapes-js. otherwiese it may be required to setup remote storage. so as a result I managed to show my images uploaded by grapes-js from orchard end-user perspective. image

hishamco commented 2 years ago

Thanks, I really forgot to uncheck the santize option, but still I'm not sure sure why the preview and other icons not working

kudryavtsevda commented 2 years ago

I will go through "get started" https://grapesjs.com/docs/getting-started.html#import-the-library and I bet I will find answer there

hishamco commented 2 years ago

BTW I already downloaded the latest version, hope to use CDN resources in the upcoming update

kudryavtsevda commented 2 years ago

Have you noticed that these buttons are not working? image

hishamco commented 2 years ago

Let me know the content that you entered in the editor, so I can check. Probably the issue comes from scripts collision as I mentioned above

kudryavtsevda commented 2 years ago

it contains only such block: <div data-gjs-type="text">Insert your text here</div> image

hishamco commented 2 years ago

Custom block?

kudryavtsevda commented 2 years ago

Like this one image

kudryavtsevda commented 2 years ago

I noticed that toolbar button is replaced and commented in orchard due to some reason image compare with properly working toolbar here: image

hishamco commented 2 years ago

As I told you something weired happenning here, it needs time to investigate

kudryavtsevda commented 2 years ago

image I created new admin theme and disabled this two lines. after that grapes js was working BUT some styles were disappeared. I fixed it by adding new awesome-font of 4.7.0 version with small fix here image and I attached that awesomestyle. you can see it on 24th line in the first screenshot

hishamco commented 2 years ago

I fixed it by adding new awesome-font of 4.7.0 version with small fix here

Why we need to add .fas if you updated the font-awesome version?

kudryavtsevda commented 2 years ago

I fixed it by adding new awesome-font of 4.7.0 version with small fix here

Why we need to add .fas if you updated the font-awesome version?

because default orchard admin theme uses 'fas' instead of 'fa' Default admin theme without any changes: image

After adding 'fas' into css. As you see grapesJs is working properly in conjuction with orchard admin theme image

I don't claim that my solution is 100% correct BUT I found the reason and workaround

hishamco commented 2 years ago

Thanks so much for your efforts, we need to add your changes in the our HTML module

hishamco commented 2 years ago

I think upgrading the OC.Resources should solve the font awesome issue

hishamco commented 2 years ago

@kudryavtsevda could you surround the editor using iframe, then there's no need to introduce a new theme or removing a scripts from the admin theme

kudryavtsevda commented 2 years ago

@kudryavtsevda could you surround the editor using iframe, then there's no need to introduce a new theme or removing a scripts from the admin theme

Interesting idea. I thought about it as well. I will try on Wednesday BTW, I managed apply grapes js demo preset with grapes js web-plugin from the demo page. It looks great

hishamco commented 2 years ago

Hope if you can participate on this PR, because I'm quite busy with Data Localization Module. BTW I updated the related PR with the latest OC bits

Points to consider if you want to participate:

If all goes well then we can use OC widgets as blocks elements

hishamco commented 2 years ago

You can fork the repo and work on top of my PR, please let me know if you need help. I'm sure this will be one of the greate modules that we will have

hishamco commented 2 years ago

BTW, I managed apply grapes js demo preset with grapes js web-plugin from the demo page. It looks great

Oh really, hope if you can share a GIF screenshot

kudryavtsevda commented 2 years ago

Partial to isolate the GrapesJS Editor

Could you explain how to leverage partial views in OC? I thought it would be the same part of the DOM and would not help with CSS collisions

hishamco commented 2 years ago

Simple partial that contains iframe just to make the UI simple and clear

kudryavtsevda commented 2 years ago

Oh really, hope if you can share a GIF screenshot

Sorry for being late. I have a tough schedule. You can see my results here screen-capture (1)

hishamco commented 2 years ago

Very nice, did you bring the components / blocks from GrapesJS itself? I think we need to extend that in OC. This will be one of the coolest modules in OCC, the credits goes for you ;)

Thanks, hope to see some commits in the associated PR, or you can start another one

hishamco commented 2 years ago

So let us keep this going, by fixing the scripts issues, make the editor works as expected, then we can think about the components or blocks

kudryavtsevda commented 2 years ago

I am trying to move grapes js into iframe as you asked me and I almost done BUT suddenly I was stuck. Can I ask you to review these problems regarding GrapesJS module? https://github.com/OrchardCMS/OrchardCore/discussions/11364 https://github.com/OrchardCMS/OrchardCore/discussions/11362

May be you have an idea?

hishamco commented 2 years ago

Sure

kudryavtsevda commented 2 years ago

Very nice, did you bring the components / blocks from GrapesJS itself? I think we need to extend that in OC. This will be one of the coolest modules in OCC, the credits goes for you ;)

Thanks, hope to see some commits in the associated PR, or you can start another one

I tried to commit changes regarding https://github.com/OrchardCMS/OrchardCore/discussions/11364 in that PR but I got 403 error access denied. But I bet you can do it without my assistance

hishamco commented 2 years ago

No problem I can change the Id and commit into my PR, just try to complete what you have started and keep me posted, then I can merge my PR followed by another PR that contains your changes. If you need to start a new PR no problem I can close mine

Thanks

hishamco commented 2 years ago

BTW @kudryavtsevda seems you miss to decorate your controller with the Feature attribute, I already use the same thing in OCC.Users module

hishamco commented 2 years ago

Any updates on this?

kudryavtsevda commented 2 years ago

We solved it on friday when I figured out that feature id should be the same as module name

hishamco commented 2 years ago

Believe it or not even you didn't change the id it should works if you decorate your controller with Feature attribute, something like this https://github.com/OrchardCoreContrib/OrchardCoreContrib.Modules/blob/e54e130189f8e9e9b0083d9851e3c49b35c337d5/src/OrchardCoreContrib.Users/Controllers/ImpersonationController.cs#L18-L20

kudryavtsevda commented 2 years ago

I believe you but I haven't tried

hishamco commented 2 years ago

Anyway, could you please let me the progress of this module, coz we need to publish a beta release at least. Please let me know if you have a branch in your forked repo

kudryavtsevda commented 2 years ago

Anyway, could you please let me the progress of this module, coz we need to publish a beta release at least. Please let me know if you have a branch in your forked repo

as I said before I tried to commit right into your PR but it was not succesful due to lack of permissions

hishamco commented 2 years ago

Could you please create a branch on your repo, then I can commit what I have and let you create a new PR