Extending Rich Text Editor (TinyMCE) / Working with Package Actions
Hi Umbracians,
I recently finished writing a TinyMCE extension that allows our content editors to add Bootstrap buttons into their Rich Text Editor. I want to make it available as a package, as it's really quite a useful addition.
In order for me to package this up, I need the ability to edit config/tinyMceConfig.config on the fly using Package Actions.
All the forum posts etc thus far point me to the official documentation that appears to have been taken down.
So, in short.. how do I edit this file during install?
Thanks in advance, I look forward to putting out more packages in the future!
Maybe also think about choosing any other way of doing it if you want to distrubute your package e.g. via NuGet. You can change the configuration on ApplicationStartup events for example in your own DLL shipped with it.
I had seen this package a little bit earlier, I didn't commit to it though because the wiki link is dead. In the spirit of moving forward, I am to include the PackageActionsContrib.dll and presumably from there I inherit from ApplicationStartup in a .cs file that's within my package directory?
I have been on an Umbraco project for only a few months, so I am sorry if I need a bit of hand-holding. Thanks again!
I am familiar with subscribing to ApplicationStartup, as I have written some code that automatically generates required nodes in the tree. My new and improved question is, is this okay to build a .cs class within the package directory? Is there any convention to doing this?
e.g. ~/App_Plugins/[Plugin_Name]/RegisterEvents.cs
If you're developing single website and it's a web application which is compiled, you can place it in any directory on your site and it will be stored in the DLL.
If you're developing package as a stand-alone application, then you can create a class library inside of it, reference Umbraco.Core and keep this class there. Then just ship the DLL to your website and it will take care of the rest.
You can also keep the C# code (classess etc.) in App_Code directory, which is compiled on the fly if you don't want to create any other DLLs.
My situation is kind of both, I am developing a single website but have in doing so developed a few handy things I can package up for the community. If I were to add a class library, that would sit alongside my current project is that right? So I cannot edit config/tinyMceConfig.config directly from the App_Plugins directory?
Thanks for all your help, I am just looking for the tidiest way to contribute :)
If you will package the library as an Umbraco / NuGet package you are able to place your items inside the App_Plugins (views, js code, css or anything else) and also add DLL to the existing Umbraco project. The logic will be inside of the DLL and will have access to the filesystem on your application. You can then modify whatever you want, so then you can access /config/tinymce.config and modify specific property / setting.
Okay, so I have created a new class library alongside my website's solution. Subscribed to ApplicationEventHandler and attempted to open the required config file.
Being that it's essentially a separate project, the breakpoint is not hit. Am I missing something? Possibly something really silly :)
Hmm you don't need to register additional event handler there. Check if you debugger stops on the ApplicationStarted method and execute your code there.
Extending Rich Text Editor (TinyMCE) / Working with Package Actions
Hi Umbracians,
I recently finished writing a TinyMCE extension that allows our content editors to add Bootstrap buttons into their Rich Text Editor. I want to make it available as a package, as it's really quite a useful addition.
In order for me to package this up, I need the ability to edit
config/tinyMceConfig.config
on the fly using Package Actions.All the forum posts etc thus far point me to the official documentation that appears to have been taken down.
So, in short.. how do I edit this file during install?
Thanks in advance, I look forward to putting out more packages in the future!
Check: https://our.umbraco.org/projects/backoffice-extensions/package-actions-contrib/
Maybe also think about choosing any other way of doing it if you want to distrubute your package e.g. via NuGet. You can change the configuration on ApplicationStartup events for example in your own DLL shipped with it.
Hi Marcin,
Thanks for replying so fast!
I had seen this package a little bit earlier, I didn't commit to it though because the wiki link is dead. In the spirit of moving forward, I am to include the
PackageActionsContrib.dll
and presumably from there I inherit from ApplicationStartup in a.cs
file that's within my package directory?I have been on an Umbraco project for only a few months, so I am sorry if I need a bit of hand-holding. Thanks again!
Hey, np!
You don't need this PackageActionContrib.dll if you won't be doing nothing using Package Actions.
Check: https://our.umbraco.org/documentation/reference/events/Application-Startup for a reference regarding events in Umbraco. You can hook up to any event and made a change in the file for the first time.
You can also check migrations well described by Cultiv here: https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/.
I hope it will help you :)
I am familiar with subscribing to
ApplicationStartup
, as I have written some code that automatically generates required nodes in the tree. My new and improved question is, is this okay to build a.cs
class within the package directory? Is there any convention to doing this?e.g.
~/App_Plugins/[Plugin_Name]/RegisterEvents.cs
Aaargh, no, it shouldn't be placed there.
If you're developing single website and it's a web application which is compiled, you can place it in any directory on your site and it will be stored in the DLL.
If you're developing package as a stand-alone application, then you can create a class library inside of it, reference Umbraco.Core and keep this class there. Then just ship the DLL to your website and it will take care of the rest.
You can also keep the C# code (classess etc.) in App_Code directory, which is compiled on the fly if you don't want to create any other DLLs.
My situation is kind of both, I am developing a single website but have in doing so developed a few handy things I can package up for the community. If I were to add a class library, that would sit alongside my current project is that right? So I cannot edit
config/tinyMceConfig.config
directly from theApp_Plugins
directory?Thanks for all your help, I am just looking for the tidiest way to contribute :)
If you will package the library as an Umbraco / NuGet package you are able to place your items inside the App_Plugins (views, js code, css or anything else) and also add DLL to the existing Umbraco project. The logic will be inside of the DLL and will have access to the filesystem on your application. You can then modify whatever you want, so then you can access /config/tinymce.config and modify specific property / setting.
Check how others are doing it, eg.:
etc.
Brilliant,
Thanks a lot Marcin - I have marked your answer as the solution.
Thank you. Happy coding!
Okay, so I have created a new class library alongside my website's solution. Subscribed to
ApplicationEventHandler
and attempted to open the requiredconfig
file.Being that it's essentially a separate project, the breakpoint is not hit. Am I missing something? Possibly something really silly :)
Hm did you reference this library in your web application? Are you attaching the debugger to the IIS / IIS Express process? :)
I added the
ReBootstrapButtons
Class Library to the Project Dependencies, I haven't touched the debugger.. this might be where I am going wrong.Hmm you don't need to register additional event handler there. Check if you debugger stops on the ApplicationStarted method and execute your code there.
I can confirm that the debugger still ignores the breakpoint :(
is working on a reply...