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

[add-resource] New Plugin Studioeditor #3816

Open
leotiger opened this issue Apr 11, 2024 · 31 comments
Open

[add-resource] New Plugin Studioeditor #3816

leotiger opened this issue Apr 11, 2024 · 31 comments

Comments

@leotiger
Copy link

Hi there.

Please take a look at the Studioeditor plugin for GRAV, a complex one...

I would like to add the Studioeditor plugin to the Grav Repository.
Here are the project details: Studioeditor

Thx.

u

@leotiger leotiger changed the title [add-resource] New Plugin [add-resource] New Plugin Studioeditor Apr 11, 2024
@rhukster
Copy link
Member

This looks like an interseting plugin. However as it currently has an issue with Flex Objects, and Flex is a required plugin for admin, I cannot approve it.

The reaon is that people will enevitably come to the admin plugin and raise issues that the admin is broken. You need to find a way to resolve your issue so that it works without any manual modification to Grav and the standard required plugins.

NOTE: if it has an issue with some other non-standard plugin, I would let it slide, but as it stands is evectively saying it's not compatible with a base Grav install unless you do these manual steps. And you would only find that information if you went to your repo and read the README.

@leotiger
Copy link
Author

leotiger commented Apr 12, 2024

No problem at all, probably it's not even Studioeditor, smartypants shows a blueprint errror that may be the cause. Good job. Will keep you updated here about my findings. One question: Seems that you are the only person doing quality management, Grav needs a dedicated community manager and a team offering the quality checks... I exposed the problem, I'm quite sure you wouldn't have been aware of the problem without my hint... :-)

@leotiger
Copy link
Author

Community help appreciated, as stated by @rhukster, the plugin is worth the effort and the community will benefit. Anybody out there?

@leotiger
Copy link
Author

Whoever wants to be invited as a colloaborator, even as an owner of the plugin, hands up. I'm getting far too old and I'm doing clean up now... Studioeditor is more than 6 years old... and I'm not really working with computers anymore.... I'm doing a last effort to publish things to the wild I've done over the years...

@leotiger
Copy link
Author

@rhukster: in fact, this plugin (or something similar) should be part of Admin... Would help to open up Grav for many people that feel insecure offering GRAV as a solution to companies, etc. I'll invite you too.

@leotiger
Copy link
Author

Problem is a flex-objects issue already open: Blueprints that extend default cause a memory overflow.

@leotiger
Copy link
Author

I've tested this error creating a new plugin to see if I can reproduce the error, answer is yes.

@leotiger
Copy link
Author

leotiger commented Apr 13, 2024

Ok, found a fix. Probably it's documented somewhere, to extend default blueprint via a plugin the extending blueprint shouldn't be named default.yaml, in my case renaming it to studioeditor.yaml the problems gone away, or you can use default.yaml in your plugin but in needs to be full-fledged, no extending. There may be other solutions but that's what I've figured out, all related to Types.php for Page in my case in the system core of GRAV. Studioeditor needs a full-fledged default.yaml to work.

@leotiger
Copy link
Author

leotiger commented Apr 13, 2024

I will publish v1.1.4 later which includes a fix for the media resizer as well

@leotiger
Copy link
Author

v1.1.4 published. Including fixes for the issues formerly mentioned in README. Please check again.

@01Kuzma
Copy link

01Kuzma commented Apr 14, 2024

Cool plugin!
Definitely must be in Grav repo!

@leotiger
Copy link
Author

Published right now v1.1.7 as there was still a mention to problems with Flex Objects in the README file.

@leotiger
Copy link
Author

v1.1.8 released. Can we get this reviewed again?

@leotiger
Copy link
Author

v1.1.9 released with additional language sets, fixes for notices, an updated Markdown guide within the editor, etc. Would be nice to get some feedback these days. Thanks.

@rhukster
Copy link
Member

Traveling at the mo. Will check in this as soon as I have better access.

@leotiger
Copy link
Author

leotiger commented Apr 18, 2024

Finally found what's causing blueprint inheritance errors. Will update the issue for Flex Objects. v1.2.0 of StudioEditor will include the inheritence fix which allows that inheritance change won't break from system over admin/flex/plugins to themes... placing a non-inherited default.yaml like I did before fixed the problem partially as I found out now as this fix didn't make it to theme blueprints. What's working is exposed in the update for the corresponding flex-objects issue.

@leotiger
Copy link
Author

leotiger commented Apr 18, 2024

Summarized: You cannot approve before I publish v1.2.0 :-) (Doing a bit of quality management for myself...)

@leotiger
Copy link
Author

v1.2.0 released, includes improved bugfix for blueprint inheritance.

@leotiger
Copy link
Author

You've arrived? :-)

@rhukster
Copy link
Member

Will look again today.

@rhukster
Copy link
Member

Testing again in a fresh install with Admin, and it's got problems.. No Editor in view and translations missing?

CleanShot 2024-04-22 at 14 13 40@2x

@rhukster
Copy link
Member

Also, you probably should use the onAdminListContentEditors() event to have the contet editor show up in the list of editors the user can pick from (rather than forcing it as the default):

example from nextgen editor:

    public function onAdminListContentEditors($event)
    {
        $options = $event['options'];
        $options['nextgen-editor'] = 'NextGen Content Editor (WYSIWYM Editor)';
        $event['options']  = $options;
        return $event;
    }

@rhukster
Copy link
Member

here's some more logic from the onPluginsInitialize() method of the nextgen editor plugin:

            if (method_exists($user, 'getContentEditor')) {
                // Preferred 1.7+ FlexUsers approach
                $markdown_editor = $user->getContentEditor();
            } else {
                // Grav 1.6 compatibility
                $markdown_editor = $user->content_editor ?? 'default';
            }

            if (($this->configs['default_for_all'] && $markdown_editor === 'default') || $markdown_editor === 'nextgen-editor') {
                // Enable the main event we are interested in
                $this->enable([
                    'onAdminTwigTemplatePaths' => ['onAdminTwigTemplatePathsDefaultEditor', -10],
                ]);
            }
            ...

This basically allows the plugin to override the forms/fields/markdown/markdown.html.twig file to use your own (by adding it to twig template path before admin plugin) only when the user has the editor selected OR if you have enabled for all in the plugin configuration.

@leotiger
Copy link
Author

leotiger commented Apr 23, 2024

If you save, editor shows perfectly. That's not even strange but I can add this behavior. Simply save as with any new page, that's it and you'll see the editor. Thx for your recommendations, will check/implement recommendations in 2.0 on which I started to work.

Right now the default blueprint approach is perfectly valid and at least for this version as I don't want to rewrite the whole plugin. The current implementation is perfectly possible and transparent extending blueprints. Will provide v1.2.1 which will include editor support for new files.

@leotiger
Copy link
Author

v1.2.1 released, includes fix for the editor display problem for newly created pages.

Please test again.

@rhukster
Copy link
Member

Same problem for me in 1.2.1

@leotiger
Copy link
Author

leotiger commented Apr 24, 2024 via email

@leotiger
Copy link
Author

@rhukster, the solution is pure js as the editor did not initialize given that there's no upload field available for new pages before they've been saved for the first time. This said, you may have to clear the cache of your browser and of the GRAV instance for this reason.

@leotiger
Copy link
Author

Screenshot 2024-04-26 at 09 12 54

@rhukster
Copy link
Member

rhukster commented May 6, 2024

Tried with latest in github and it doesn't show even when I hit save.

@leotiger
Copy link
Author

leotiger commented May 6, 2024

Will check again, bit strange as I've installed from scratch using github... but who knows... shit happens... working heavily on 2.0... complete re-write... providing most of the chunk editors myself...

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

No branches or pull requests

3 participants