Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Torben Warberg Rohde 35 posts 89 karma points
    Jun 22, 2016 @ 08:54
    Torben Warberg Rohde
    0

    Adding caption to images inserted in the RTE

    I'm trying to add a caption to images inserted into the TinyMCE editor (using the alt-text as the text). Doing it in front end output is fairly easy using javascript, but getting it displayed in the TinyMCE editor is not (for me at least).

    Browsing throught the source there is a lot of legacy stuff, so it is hard to see what is used, and what is not. Most examples I find are for TinyMCE 3.x, but it seems Umbraco 7 uses TinyMCE 4.1.

    Does anyone know where to start? (or even better, have done the same thing :-)

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Jun 22, 2016 @ 14:30
    Dennis Adolfi
    100

    Hi Torben.

    One way could be to create a macro partial that has a Mediapicker and a string for caption as parameters. Then allowing it to be rendered in RTE.

    That way you dont need to mix with Umbraco source code that might be overwritten in future upgrades.

    Take care, best of luck to you! / Dennis

  • Torben Warberg Rohde 35 posts 89 karma points
    Jun 22, 2016 @ 14:41
    Torben Warberg Rohde
    1

    Hi Dennis,

    Thanks. That could be a solution, but it would be a bit of a compromise. I've seen how this works in Wordpress, and that is a much nicer experience.

    The macro would however also cover another problem with the Umbraco RTE at the moment: Once you have inserted an image, it is not possible to edit the alt-text (as far as I can tell).

    Best,

    Torben

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Jun 22, 2016 @ 14:48
    Dennis Adolfi
    0

    Sounds like a win for the Marco! :)

    Take care!!

  • Torben Warberg Rohde 35 posts 89 karma points
    Jun 24, 2016 @ 06:16
    Torben Warberg Rohde
    2

    Sounds like a win for the Marco! :)

    Well, at the current state of Umbraco, that might be true, but I really think it is suboptimal that it should require a macro to insert an image and define its aligment, size and caption. Macros also don't display as nicely in the RTE, especially if you where to define floating images.

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Jun 24, 2016 @ 11:46
    Dennis Adolfi
    0

    Yes, you have a point. Im not sure however if this is due to Umbraco or TinyMCE. Maybe make a feature request?

    Take care!

Please Sign in or register to post replies

Write your reply to:

Draft