Skip Navigation

[Résolu] CRED wysiwyg input has unwanted leading space in first p tag

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 10 réponses, has 2 voix.

Last updated by Eric Il y a 7 années et 6 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#197546

For posts written on the frontend with a CRED form I noticed that there was a space appearing before the first word of the post. I've been trying to find a way to remove that space because it looks a little sloppy.

Here's what's generated on a frontend page for creating posts:

<iframe frameborder="0" src="javascript:true;" style="width: 654px; height: 217px;">
	<html>
		<head></head>
		<body style="position:relative;">
			<p>&nbsp;</p><!-- how can we kill that leading space?-->
		</body>
	</html>
</iframe>

I understand (from this post https://toolset.com/forums/topic/cred-wysiwyg-field-is-pre-populating-with/) that the p with the empty space is necessary for autop to work on subsequent paragraphs, but is there some way to remove that leading space?

Thanks,
Eric

#197704

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi Eric,

I can not duplicate same problem in my localhost, here is a test site for you:
hidden link
user/pass: xgren/111111

CRED form using:
hidden link

Could you duplicate same problem in it?

#197727
Screen Shot 2014-02-14 at 11.08.25 AM.png

Hi Iuoy,

Actually, you did duplicate the problem on your test site. It behaves exactly as mine. See my screen grab. There's a p tag in the editor with a leading space. If the user doesn't manually delete that leading space (and they really shouldn't have to do that!) it ends up in the post.

Take a peek and let me know if there's something that can be done. I really don't want a leading space in the first paragraph of every post written with the CRED form.

Thanks,
Eric

#198090

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

That is wordpress default setting for a wysiwyg editor, just like when you add a post:
hidden link

I don't think there is any workarround for it.

#198163
Screen Shot 2014-02-17 at 11.03.18 AM.png

No, it's not the same... Please look at the source code.

The WP default wysiwyg editor (see screengrab) has an empty paragraph with a special break tag in it, like this:

<p><br data-mce-bogus="1"></p>

Your CRED wysiwyg editor has an empty paragraph with a space in it, like this:

<p> </p>

When the CRED wysiwyg editor loads, the cursor insertion point is after that space, meaning that space gets added to the database, and every post ends up with an unwanted space before the first word, which is not good. That's definitely not how the WP default editor works.

How can we get rid of that unwanted space?

#198250

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I test create a post with above CRED form,
hidden link
there isn't empty p tag before the content
hidden link

What browser are you using? I am using Chrome browser

#198254
Screen Shot 2014-02-18 at 12.29.11 AM.png

I didn't say there was an empty p tag before the content. I said there's a p tag with a leading space, which gets included in the post unless the user specifically deletes it before typing into the editor.

I'm using Chrome.

I've attached another screengrab of your test site, showing the non-breaking space in the p tag. Please look at the source. You can also see the insertion point immediately after the space in the highlighted wysiwyg area.

I'm not sure why you sent the second URL (hidden link). That's not a wysiwyg editor...

I created a post with that CRED form. Here's the URL: hidden link If you look at the source code you can see a leading space before the first word. That's what I'm talking about. That space is automatically appearing in the empty CRED wysiwyg editor, and unless the user knows about it (and why would they?), and takes the opportunity to delete it, it'll appear like a one-space indent in the published post.

#198598

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Are we talking about the space " ";
If it is, yes I can see it in HTML source, and you can remove it by click "show source" button,
And current version of CRED is using zebra-form for post content, and it will be removed in CRED version 1.3, replaced with Types plugin GUI,

#199079

Yes, that's the space I've been describing in every post, as well as the title of this thread...

Unfortunately, I can't rely on my users to click the "show source" button to remove an unwanted space that they're not even aware of. That's unrealistic. Also, 99% of them won't know HTML or have any reason to use the "show source" feature, so that's just not a viable solution.

I'm glad to hear it'll be removed in CRED 1.3. Do you have a rough idea of when CRED 1.3 will be available?

Thanks,
Eric

#199479

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Our developers are working on it, I guess it will be released in weeks, but it can not be sure.

#199834

I guess I'll wait, and hope for the best.