spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
813 stars 256 forks source link

Is there anyway to apply toolbar event apply only to the root node of the selection #267

Open fs-td-eitaro-ueda opened 4 years ago

fs-td-eitaro-ueda commented 4 years ago

Hi, I am using tinymce-rails (4.6.7).

I was wondering if the tinymce toolbar to only act on the root node of the selected element (highlighted by cursor).

Original selected elements:

<div>
    <table>
        <tbody>
            <tr>
                <td>
                    <div>some text here</div>
                </td>
            </tr>
        </tbody>
    </table>
</div>

Tinymce by default when used "bold" button on the toolbar:

<div>
    <table>
        <tbody>
            <tr>
                <td>
                    <strong>
                        <div>some text here</div>
                    </strong>
                </td>
            </tr>
        </tbody>
    </table>
</div>

Instead, I want it to be like below where the style is applied to the top element:

<div font-weight="bold">
    <table>
        <tbody>
            <tr>
                <td>
                    <div>some text here</div>
                </td>
            </tr>
        </tbody>
    </table>
</div>

Please let me know if anyone knows a solution to this.