Showing posts with label Content Editor. Show all posts
Showing posts with label Content Editor. Show all posts

Monday, May 10, 2021

Sitecore TinyMCE: New Life

It is a copy of my article initially posted here to keep all things in one place.

Sitecore uses Telerik Rich Text Editor for a long time. It is quite a powerful and reliable editor. But sometimes it is really hard to extend it if you want to do something complex. And also, there are a lot of free open-source alternatives that could be better. And it is not a new idea, people from time to time ask, how to replace Sitecore RTE with something else.

One of the options is TinyMCE. This advanced rich text editor has different pricing plans. But even the free plan has too many features. It can cover 95% of editing cases.

And the idea to integrate Sitecore with TinyMCE also is not new. After a quick search, we are able to find:

Both modules are open-source and have Github repositories(1, 2). We are more interested in the extension of Content Editor that is why I took the Emanuele module as a basis. Then I started to work on improvements:

  1. There was added Unicorn serialization. It allows developers to work easier with Sitecore content items that are required for this module.
  2. The way, how TinyMCE is included in the project was changed. Instead of adding static frontend files, now Tiny MCE is installed as npm module.
  3. Version of TinyMCE was updated to 5.6.1
  4. Continuous integration and continuous delivery were configured using AppVeyor. Now, each commit to GitHub triggers AppVeyor build and provides Sitecore .update package as an artifact. This package could be installed on any Sitecore CM instance. If you are interested in how it was done, I described it in detail in my blog for another Sitecore module.
  5. SonarCloud was configured to ensure code quality. And, yeah, there are still many things that could be improved in code. Contributions are welcome!
  6. Added one more Sitecore field type. Now you should not choose between classic Sitecore RTE and TinyMCE. Now you have both at once. Rich Text editor has buttons to open Sitecore RTE as well as TinyMCE RTE.
  7. Added Sitecore 10 support.
  8. Changed the way how references are used. Locally copied assemblies were replaced with Nuget packages.
  9. Added style formats support.
  10. Improved local development experience: added publishing profiles and proper development setup description.
  11. Many other small improvements.

I hope all these changes will bring this module to a new life. But there is still room for other improvements. Contributions to the Github repository are welcomed. If you find any bugs - report them. If you fixed bugs or added new functionality - create pull requests.

Friday, February 3, 2017

Return MouseWheel Event to Sitecore 8+ Ribbon

Do you know that there was  nice feature in Sitecore 6 - 7.2 that allows use mouse scroll on Content Editor Ribbon?

Once working on project based on Sitecore 7.2 I accidentally scrolls mouse wheel when cursor was on Content Editor ribbon. Sitecore behavior surprised me: it switched to the next Content Editor tab. I found it nice useful feature that speed up work in Content Editor, especially when you are looking for some button and forgot where it is located. It saves time and nerves and I used to utilize this feature day to day.

But, when I switched to project based on Sitecore 8, I was disappointed. Scroll doesn't work on ribbon any more... And I decided return this feature into Sitecore and even a little bit improve it.

All that you need, find \sitecore\shell\Applications\Content Manager\Content Editor.js file and put this JavaScript to the end:

jQuery(document).ready(function () {
    jQuery("#RibbonPanel").bind("mousewheel", function (event) {
        var array = jQuery(event.currentTarget).find(".scRibbonNavigatorButtonsGroupButtons a");
        if (array.length > 1) {
            var active = jQuery(event.currentTarget).find(".scRibbonNavigatorButtonsGroupButtons a.scRibbonNavigatorButtonsActive");
            var index = array.index(active);
            var delta = (event.originalEvent.wheelDelta > 0 ? 1 : -1);
            if (index === array.length - delta) {
                if (delta < 0) {
                    array[0].click();
                }
                else {
                    array[1].click();
                }
            }
            else {
                if (index === 0) {
                    array.last().click();
                }
                else {
                    array[index + delta].click();
                }
            }
        }
    });
});

Voila, you can use scroll for ribbon navigation again!