Copied to clipboard

Flag this post as spam?

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


  • Lesley 284 posts 143 karma points
    Oct 01, 2011 @ 21:03
    Lesley
    0

    Applying style to image in tinymce

    Hi all,

    I have a class defined in the style dropdown of tinymce. When I select this for an image that is the only content of a paragraph, it applys the style to the paragraph rather than the image:

    <p class="left"><img src="foo.jpg" /></p>   <!-- wrong -->

    It works fine if there is other content in the paragraph:

    <p>My image: <img class="left" src="foo.jpg" /></p>   <!-- This is where I want the class -->

    Am I doing something wrong? Anyone know how to get the style on the image rather than the paragraph?

    ---
    Lesley

  • Nigel Wilson 945 posts 2077 karma points
    Oct 02, 2011 @ 23:32
    Nigel Wilson
    0

    Hi there

    I have just tried Firefox, Chrome and IE8 on an Umbraco 4.7.0 install.

    If I click on the image and then select a style from the dropdown list of styles it is inserting the class correctly.

    What browser are you using and can you test it on different browser ?

    HTH

    Nigel

  • Lesley 284 posts 143 karma points
    Oct 02, 2011 @ 23:57
    Lesley
    0

    Hi - thanks for trying to reproduce this.

    I've tried Chrome, Firefox (5.0) and IE (9) - all the same. This is a 4.7.0 install, but was an upgrade from 4.5.2. Could I have missed something for tinymce in the upgrade?

    To confirm the steps I am taking in the RTE:

    Typing away, make a new paragraph. Click the image button to insert an image on the page. Click the image so it is selected. Choose the style from the dropdown. The class is applied to the paragraph but I want it applied to the image.

    Cheers,
    Lesley

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 03, 2011 @ 00:46
    Fuji Kusaka
    0

    Hi Lesley,

    What if you change some of the properties in your css styleshee when

    My image: class="left"src="foo.jpg"/>   

    You will tell your div around which you umbrao:Item is wrapped to somthing like

    .imgWraper p > img {float:left;} 


  • Nigel Wilson 945 posts 2077 karma points
    Oct 03, 2011 @ 01:32
    Nigel Wilson
    0

    Hi Lesley

    I have just done what you describe and it worked fine for me.

    My site is a clean install of 4.7.0 as opposed to an upgrade. 

    Go out on a limb and if it's a bad suggestion then I trust someone can assist, but:

    1. Take a copy of your site files.

    2. Delete the Umbraco folder

    3. Copy/paste the umbraco folder from a copy of 4.7.0

    I guess you may need to check the likes of /umbraco/plugins/ directory to see what you packages you may have installed, but maybe this will help resolve the problems.

    Good luck

    Nigel

  • Jason Provence 12 posts 32 karma points
    Oct 04, 2011 @ 18:30
    Jason Provence
    0

    Lesley, I am having the same issue.

    Did you ever find a resolution to this?

     

    Thanks, Jason

  • Lesley 284 posts 143 karma points
    Oct 04, 2011 @ 18:51
    Lesley
    0

    Hi Jason,

    Glad it's not just me! Are you also on an upgraded install?

    I have already done a work around so my css selector is:

    img.left, p.left img{...}

    ... but I'm not really happy with that as a solution so if I get a chance this evening I'm going to attempt Nigel's suggestion and reinstall my umbraco directory. I'll let you know how it goes.

    Cheers,
    Lesley

  • Nigel Wilson 945 posts 2077 karma points
    Oct 04, 2011 @ 20:49
    Nigel Wilson
    0

    Hi Lesley & Jason

    I have just made a quick screen cast of a site I am working on - it may be helpful, it may be a waste of time, but feel free to take a look anyway!

    Cheers

    Nigel

     

  • Lesley 284 posts 143 karma points
    Oct 05, 2011 @ 00:26
    Lesley
    0

    Hi Nigel,

    The difference between what you're doing there and the problem I have is that you've put your image in a paragraph that already has content in it, a situation which is fine for me too. But make an empty paragraph and see if you get any difference.

    So before applying the class you have:

    <p><img src="foo.jpg"/></p>


    Appreciate your efforts :)
    Lesley

  • Nigel Wilson 945 posts 2077 karma points
    Oct 05, 2011 @ 02:16
    Nigel Wilson
    0

    Hi Lesley

    Yep I too have the same issue - sorry, I didn't read your initial posts properly.

    The simplest workaround I see is to insert the paragraph, insert the image, add a space to the right of the image, apply the style to the image and then delete the space.

    Obviously telling a client this is how you need to do it in an empty paragraph would be confusing.

    Cheers

    Nigel

  • Lesley 284 posts 143 karma points
    Oct 05, 2011 @ 11:35
    Lesley
    0

    Ok... So does anyone know whether this would count as a bug or is it like this by design? Is it a tinymce or an umbraco thing? My Googling of the issue hasn't turned up much useful.

    Thanks,
    Lesley

     

  • Mike Cooper 10 posts 50 karma points
    Nov 19, 2012 @ 22:18
    Mike Cooper
    0

    This is a TinyMCE setting and is fairly painless to resolve. Not only will this stop the annoying <p> tag wrap around your images, but this will let you select and apply styles to your images in the WYSIWYG as you'd expect.

    1. Open: /umbraco_client/tinymce3/tiny_mce_src.js
    2. Find this: forced_root_block : 'p' 
    3. Change to: forced_root_block : false
    4. Restart your app / Refresh your browser

    http://our.umbraco.org/forum/using/ui-questions/11583-Paragraph-Tags-and-force_p_newlines-setting

Please Sign in or register to post replies

Write your reply to:

Draft