Page 1 of 1

spaces are getting trimmed from content

Posted: Wed Dec 21, 2022 4:48 pm
by SmitaPatil
Hi Team,
when I am inserting fragment using insertXMLFragmentSchemaAware method, space present in text content is getting trimmed.
Can you please tell if there is any to avoid it while using this method or any other method which will work better to insert string fragment in document.

Thanks & Regards,
Smita

Re: spaces are getting trimmed from content

Posted: Thu Dec 22, 2022 2:33 pm
by Bogdan Dumitru
Hi Smita,

Your spaces are inside the elements within your fragment, or around them? Could you please share the fragment?
If the spaces are inside an element, the element has the "white-space: pre" CSS property specified? Note that spaces are preserved only if the "white-space" property says so.

Re: spaces are getting trimmed from content

Posted: Thu Dec 22, 2022 2:51 pm
by Bogdan Dumitru
Hi again,

Do you encounter this problem if you insert the fragment manually in the text page (Edit as XML) and then switch to author mode? If after the switch you don't see whitespaces preserved inside the element, then check that you have the "white-space: pre" specified in the framework's CSS files.

Re: spaces are getting trimmed from content

Posted: Fri Dec 23, 2022 8:47 am
by SmitaPatil
Hi Bogdan,
I have tried by doing edit xml and adding following xml fragment

Code: Select all

<tgroup cols="3">
	<colspec colname="col1"/>
	<colspec colname="col2"/>
	<colspec colname="col3"/>
	<tbody>
		<row>
			<entry>
				<para>
					<paratext>check                   for                     space </paratext>
				</para>
			</entry>
			<entry/>
			<entry/>
		</row>
		<row>
			<entry/>
			<entry/>
			<entry/>
		</row>
	</tbody>
</tgroup>
but in author mode it is showing as below only one one white space and others are getting trimmed :
image.png
and for that css property for text inside entry is as below:
image.png
We don't want to loose any space from content while inserting fragment.
Please let me know if you need any other information.

Thanks & Regards,
Smita

Re: spaces are getting trimmed from content

Posted: Fri Dec 23, 2022 12:08 pm
by mihaela
Hi,

It seems that there are some missing images in your message. Can you please add them so that we better understand your use case?

Best Regards,
Mihaela

Re: spaces are getting trimmed from content

Posted: Fri Dec 23, 2022 12:18 pm
by SmitaPatil
Hi Mihaela,
Sorry I haven't seen it properly.
I have updated image in last post.

Thanks & Regards,
Smita

Re: spaces are getting trimmed from content

Posted: Fri Dec 23, 2022 3:20 pm
by cristi_talau
You need to add the "white-space: pre" property in the CSS of your framework. The rule should be:

Code: Select all

paratext {
  white-space: pre;
}
The rule that you see in the browser applied to the rendering of the XML text node that is a child of the "paratext" element.

Re: spaces are getting trimmed from content

Posted: Tue Dec 27, 2022 10:28 am
by SmitaPatil
Hi,
Thank you!
It helped to resolved the issue.

Thanks,
Smita