Simple Image module

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
7/30/2009 9:20:09 AM
Gravatar
Total Posts 108

Simple Image module

Me again,

Another suggestion.

I'm doing a site at the moment, and currently when the user wants to add say a  page. They create the page, choose a skin(template)

Then add html contents to left pane and center. They add a level 1 graphic above the left menu, and a level 2 graphic to the center one, but so the images align, you have to go to the source code in the html module and remove the <p> tags from the images otherwise they will have the padding around them (i dont want to remove margin and padding for all <p> as its helpful for content)


What would be very handy would be a simple image module which just requires the path to an image and directly adds it to the page.

Not that this is a major hassle, however a lot of the sites i want to create will have a similar method to creating pages, when creating a large site it would cut down page production quite a lot i feel.

I can do this myself, but thought i'd share the idea with the rest of the community and see if i'm not alone

Cheers

Tim

 

7/30/2009 9:27:13 AM
Gravatar
Total Posts 2253

Re: Simple Image module

I've had similar issues but I think if fckEditor didn't put those darn <p> tags around content automatically, the issue would go away and it would make things easier on many fronts. I have sites where I have used the Content Template feature to allow users to bring in a page headers and some boiler-plate text. The template works fine but after it is saved, fckEditor adds those darn <p> tags and the user has to go in and remove them from the source. I have used fckEditor in other apps and it does the same thing so I think it is a problem with it and not mojo. If that is the case, not much can be done from the mojoPortal point-of-view so I guess your suggestion is the answer.

-Joe D.

7/30/2009 9:50:19 AM
Gravatar
Total Posts 108

Re: Simple Image module

Good to hear Joe i'm not the only one.

I dont mind it putting <p> tags on content in general, its just in specific cases where i need the user to insert some kinda of header image that must sit tightly to the edge of my design.

For example i have a page with a main horizontal nav, and lower level left column nav

The left column has a image with the name of the section, then the left nav, and then a html slot under the nav with a couple of promo images. I dont mind the promo images having <p> tags as they need a bit of padding because the left column have a vertical background shade. But the header image above the nav must always be the width of the column.

So i think its ok for the fck editor to add the <p> tags so all content has some padding to keep it all in line, its just those specific parts of the page which id like an option to just add a image module

Sure its not difficult to do, might be handy for others in future releases, lets see what Joe Audette thinks :)

Thanks

Tim

 

7/30/2009 1:38:25 PM
Gravatar
Total Posts 18439

Re: Simple Image module

I read this post and spent the last few hours looking into how to make the FCKeditor not put that <p>&#160;</p> in there (instead of what I planned on working on  ;-))

What I found was a way to solve it in IE but not other browsers.

By changing the /ClientScript/mojofckconfig.js like this:

FCKConfig.EnterMode = 'br'; // p | div | br
FCKConfig.ShiftEnterMode = 'p'; // p | div | br
FCKConfig.FillEmptyBlocks = false ;

(Whereas previously EnterMode was p and ShiftEnterMode was br)

I now get different bahavior in 3 browsers.

IE does what I want and puts nothing in there.

Chrome puts &#160; but no more <p>

Firefox puts a <br /> there

weird!

I chased all around the javascript trying to figure out if I could fix it tobe the same in other browsers but have not been able to figure it out and giving up for now.

So my question is should I keep these changes and have different behavior in different browsers or switch it back so its consistently <p>&#160;</p> in all browsers? Opinions?

Best,

Joe

7/30/2009 2:16:33 PM
Gravatar
Total Posts 2253

Re: Simple Image module

 I think the behavior should be the same in all browsers (at least FF and IE). Also, most WYSIWYG style editors insert a <br /> with Shift+Enter and a <p> with Enter so that behavior should be the same.

Thank you for taking the time to look at it Joe.

-Joe D.

7/30/2009 2:23:02 PM
Gravatar
Total Posts 18439

Re: Simple Image module

I'm inclined to agree its better to keep it the same in all browsers. Users can override it using a custom config file for FCK anyway if they want to.

Most editors do use p for enter and br for shift enter, problem with FCKeditor is its putting that in when we haven't typed anything.

So one possible solutions is I can check if the content starts with <p>&#160;</p> and remove it using server side code when it is being saved. I guess the thing is to try adding an image, does it put it inside the <p> or after the <p>&#160;</p>, if the latter this strategy may work but if the former it won't.  Just need to experiment and see what actually happens.

Best,

Joe

7/30/2009 2:40:06 PM
Gravatar
Total Posts 2253

Re: Simple Image module

From what I am finding on the FCKeditor forums this issue is due to the way the browser reads the contents. A site admin there said the only way they have to retrieve the editor contents is by looking at the browser DOM and it doesn't look at the original source. 

I did find this: http://www.fckeditor.net/forums/viewtopic.php?f=6&t=8291&p=21712&hilit=+extra+tags#p21712. Maybe it will lead you in the right direction. I tried it but I can't see that it helped me at all.

-Joe D.

7/31/2009 4:23:35 AM
Gravatar
Total Posts 108

Re: Simple Image module

eek, i'm a bit confused (possibly due to excess drinking the night before)

The <p>&#160;</p> was not what i was referring to, and i personally dont have a problem with is putting <p> tags around imgs in general.

A Image module that just popped up a simple file manager box to select an image would solve my scenerios (which i can do myself)

Glad its sparked a bit of a debate though!

 

 

7/31/2009 12:38:23 PM
Gravatar
Total Posts 2253

Re: Simple Image module

Hey Tim,

I think the idea is that if we can make FCKeditor quit putting those extra <p> tags in the content, we could kill two birds with one stone. The <p> tag issue frustrates a lot of people but it has been accepted as just the way thing are with FCKeditor and personally, I would love to see it fixed.

If it proves to be way too much of a hassle, your suggestion for a simple image control would probably be the best idea.

Joe, I hope I haven't mis-spoke here. Please correct me if I am wrong.

Thanks,
Joe D.

7/31/2009 5:58:41 PM
Gravatar
Total Posts 18439

Re: Simple Image module

Hi Joe,

No you've spoken it just the way I grok it. If not for the pesky p tag that FCKeditor insists on wrapping things in then there would be no need at all for an Image Module, we could awlays just use the Html module since it already has the ability to browse and upload images, the only pesky part is having to train users how to work around the FCKeditor issue by going to source view removing the wrapping p and saving without switching back to wysiwyg view. So the html module can be used today as an image module its just this pesky problem that takes an expert or some training to work around.

I think the future is the new CKeditor, but it doesn't have the image browse and upload stuff out of the box like FCKeditor I think because thats how he's trying to make his living by selling the add on CKFinder. Once I can figure out how to make my own .NET upload/browse dialog that can work with CKeditor then I will focus on it going forward and hopefully they will or have solved this issue.

Best,

Joe 

8/7/2009 5:52:51 AM
Nux
Gravatar
Total Posts 183

Re: Simple Image module

Hi,

I haven't checked it, but itsn't it possible to have your own css classes in the "style" dropdownlist work with that?
So you don't have to change the settings for all <p>'s, but just those from specific class? But again, I'm not sure if this is possible.

Stef

8/7/2009 7:41:28 AM
Gravatar
Total Posts 108

Re: Simple Image module

Well theres no reason why you couldnt just set <p> tags with a margin and padding of 0px for everything that appears within the content slots i suppose.

8/7/2009 8:54:12 AM
Gravatar
Total Posts 2253

Re: Simple Image module

Stef,
It is possible to add your own custom styles to the Styles dropdown but that wouldn't fix the issue at hand. FCKeditor randomly adds extra <p>&#160</p> tags to end of content. You would have to then edit the content and set the style for the extra <p> element to the style you have created that removes the extra space. At this point, you might as well just remove the extra <p> element.

Tim,
Setting the margin and padding to 0px for all <p> elements inside the content areas is not desireable because this would create a lot of issues with content whitespace and confuse users.

-Joe D.

8/7/2009 9:04:50 AM
Gravatar
Total Posts 108

Re: Simple Image module

Hey Joe,

How would you percieve it to confuse users? I thought when they hit return the editor just adds a <br/> which would create the white space between paragraphs.

Thanks

Tim

8/7/2009 9:25:07 AM
Gravatar
Total Posts 18439

Re: Simple Image module

Using the enter key creates a <p>, using shift enter creates a br

In the grand scheme usually its desireable to have some padding or margins on p elements so we wouldn't typically remove it from all p elements.

We just don't want it to affect the layout of the image but the extra p that fckeditor wraps around the img by default is problmatic. Its not needed and it affects the layout of the img. If you remove the p that surrrounds the img using source view and you save without switching back to wysiwyg view its possible to get rid of the p, but then that becomes a user training issue. If we could find a way to fix this behavior in fckeditor it would be better all the way around, but its not an easy thing t figure out how to fix it.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.