When creating a custom block, do you still create the manager view in _~/Areas/Manager/Views/Shared/EditorTemplates_?
I created a simple custom block following the docs at http://piranhacms.org/docs/extensions/custom-blocks but when I add my block to a page in the Manager, it does not show the template I created in EditorTemplates.
I looked through the source code for the standard blocks that come with Piranha and it looks like all of the templates were deleted from EditorTemplates and moved into Vue components? Is this the way it should be done now? If so, how would I add my Vue component from my library into the Manager?
Hi there! The documentation on the website applies to the latest official release on NuGet (6.1). Like you noticed when looking in the repo fields and blocks are rendered using global Vue components, and you specify the name of the component with the Component property on the FieldTypeAttribute or BlockTypeAttribute.
The class of the block is registered in the same way as in 6.1, but to add your custom components you need to follow the guidelines for adding custom resources, see here:
http://piranhacms.org/docs/manager-extensions/custom-resources
So if you have a js file in your wwwroot/assets/js called custom-blocks.min.js the syntax would be:
App.Modules.Get<Piranha.Manager.Module>()
.Scripts.Add("~/assets/js/custom-blocks.min.js");
Best regards
And the documentation will be updated accordingly when 7.0 is out of pre-release!
Thanks, @tidyui! I'll give that a try tonight.
That worked! Thanks!
Hi where do you add component vue for manager please ?
In a .js file anywhere in your wwwroot. Then you add the script in the manager module with it's virtual path.
Ok thanks top !
De : HÃ¥kan Edling notifications@github.com
Répondre à : "PiranhaCMS/piranha.core" reply@reply.github.com
Date : mercredi 9 octobre 2019 Ã 16:39
À : "PiranhaCMS/piranha.core" piranha.core@noreply.github.com
Cc : Laurent Fontaine laurent@monticket.re, Comment comment@noreply.github.com
Objet : Re: [PiranhaCMS/piranha.core] Custom Blocks in Manager View (#736)
In a .js file anywhere in your wwwroot. Then you add the script in the manager module with it's virtual path.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/PiranhaCMS/piranha.core/issues/736?email_source=notifications&email_token=AB46QHN6HC3IMIEDY5WXS3LQNXGHXA5CNFSM4IJN7JS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAXXTKA#issuecomment-539982248, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AB46QHKHQFDPVYFM6M2NPJLQNXGHXANCNFSM4IJN7JSQ.
Laurent FONTAINE
Directeur d'exploitation & Co-Fondateur
+262 692 88 23 24
[email protected]
www.monticket.re