I also had to create a custom ApiController to retrieve my description.
[PluginController("RTE")]
public class RTEApiController : UmbracoAuthorizedJsonController
{
public string getDescription(int id)
{
var query = new Sql().Select("Description").From("[TABLE NAME]").Where("Id = @0", id);
return DatabaseContext.Database.First<string>(query);
}
}
Just realised I spent so much time trying to get the edit step to work - I didn't test the controller when creating. Please find the revised code below.
Thanks for the instructions, I've just tried adding my files as per your instructions. I've added rte.html, rte.controller.js and modified package.manifest to include the controller.
I still have a PluginController to add, however I'm not sure I can add this one as it's specific to our database.
Can you confirm if I've done this first bit correctly.
Thanks for confirming, however the control won't work without this code:-
[PluginController("RTE")]
public class RTEApiController : UmbracoAuthorizedJsonController
{
public string getDescription(int id)
{
var query = new Sql().Select("Description").From("[TABLE NAME]").Where("Id = @0", id);
return DatabaseContext.Database.First
Is there a place for this or should it be excluded for the project?
It's in the same table, however we noticed the TinyMCE editor loads in a way that you can't set the value of it. So we noticed that by using the $http.get we could slow it down enough to set the value of the editor.
I'm currently looking at better ways of doing this, but no joy so far.
Do you know how I can add a directive to one of the controllers, from what I've been reading it should be possible to add a directive in order to add a priority and make it less of a priority to add the TinyMCE editor.
Once it's added to the package manifest you should be able to use it...(if it isn't a default Umbraco one)
And if you want to register it you can do the following
var app = angular.module("umbraco");
//This is my Angular module that I want to inject/require
app.requires.push('tableSort');
app.controller("Analytics.BrowserController", function ($scope, $location, statsResource) {
//Do stuff here...
});
I've managed to update the controller, with out the need for the Plugin Controller. I've created a new pull request with the updated rte.controller.js file.
Rich Text Editor
Hi, How possible is it to add a Rich Text editor to the list of available controls?
I have read http://www.enkelmedia.se/blogg/2013/12/4/umbraco-7-use-the-rich-text-editor-tinymce-in-a-custom-section.aspx but have no joy in either option.
Many thanks Jon
Hi Jon,
While it may not be perfect, I did manage to get this working.
Here's my rte.controller.js
And this is rte.html file
I also had to create a custom ApiController to retrieve my description.
Hope this helps.
Thanks
Paul
Just realised I spent so much time trying to get the edit step to work - I didn't test the controller when creating. Please find the revised code below.
Comment author was deleted
Awesome, thanks for sharing (if you are up for it you can also create a pull request so we can include it in the default distro)
Hi Tim,
Happy to do this - could you point me in the right direction, I've not done one of these before.
Thanks
Paul
Comment author was deleted
Hey Paul, that would be awesome!!!
The code lives at https://github.com/TimGeyssens/UIOMatic
Then you can follow these instructions https://help.github.com/articles/using-pull-requests/
You basically fork the existing repo, make the necessary changes, push and then there should be a button "new pull request"
Hi Tim,
Thanks for the instructions, I've just tried adding my files as per your instructions. I've added rte.html, rte.controller.js and modified package.manifest to include the controller.
I still have a PluginController to add, however I'm not sure I can add this one as it's specific to our database.
Can you confirm if I've done this first bit correctly.
Thanks
Paul
Comment author was deleted
Yup that's ace! Thanks!
Thanks for confirming, however the control won't work without this code:-
[PluginController("RTE")] public class RTEApiController : UmbracoAuthorizedJsonController { public string getDescription(int id) { var query = new Sql().Select("Description").From("[TABLE NAME]").Where("Id = @0", id); return DatabaseContext.Database.First
Is there a place for this or should it be excluded for the project?
Thanks
Paul
Comment author was deleted
So it stores it's value in a separate table?
It's in the same table, however we noticed the TinyMCE editor loads in a way that you can't set the value of it. So we noticed that by using the $http.get we could slow it down enough to set the value of the editor.
I'm currently looking at better ways of doing this, but no joy so far.
Thanks
Paul
Comment author was deleted
Ok thanks for the explanation
Hi Tim,
Do you know how I can add a directive to one of the controllers, from what I've been reading it should be possible to add a directive in order to add a priority and make it less of a priority to add the TinyMCE editor.
Thanks
Paul
Comment author was deleted
Once it's added to the package manifest you should be able to use it...(if it isn't a default Umbraco one)
And if you want to register it you can do the following
Comment author was deleted
More details on this thread https://our.umbraco.org/forum/umbraco-7/developing-umbraco-7-packages/47905-Including-an-angular-module
Hi Tim,
I've managed to update the controller, with out the need for the Plugin Controller. I've created a new pull request with the updated rte.controller.js file.
Cheers
Paul
Comment author was deleted
Awesome, will check that out!
is working on a reply...