Unplanned
Last Updated: 26 Sep 2023 07:39 by Luca
Luca
Created on: 26 Sep 2023 07:39
Category: Editor
Type: Feature Request
0
Add the ability to customize the messages of the merge/split cells horizontally/vertically buttons of the Editor

Currently out of all buttons the mentioned above can't have custom tooltip messages given to them with the .Messages() method. If a user wants to localize the buttons to a different language, they won't be able to do it without the use of additional JS logic for these 4 specific buttons (see attached screenshot).

As a workaround, the following code is used to achieve this behavior:  

<script>
    $(document).ready(function () {
        changeBtnMessages()
    })   

    function changeBtnMessages() {
        var mergeCellsHorizontallyBtn = document.querySelector('[aria-label="Merge cells horizontally"]'); // Get the first button with this specific aria-label property
        var parent = mergeCellsHorizontallyBtn.parentElement // Get its parent element which is being also a parent to the other 3 buttons
        var children = parent.children // Get all the 4 buttons alltogether

        var customTitles = ["sample title 1", "sample title 2", "sample title 3", "sample title 4"] // Here are the custom messages(title) that will be applied, be sure to change them in your application
        for (var i = 0; i <= children.length; i++) {
            $(children[i]).prop('title', customTitles[i]) // Iterate through them and set the message to each one of them
        }
    }
</script>

Attached Files:
0 comments