PnP-Sites-Core icon indicating copy to clipboard operation
PnP-Sites-Core copied to clipboard

Set-PnPClientSideText causing additional <p> tag to be added

Open prawnz opened this issue 6 years ago • 8 comments

Category

[X] Bug [ ] Enhancement

Environment

[X] Office 365 / SharePoint Online [ ] SharePoint 2016 [ ] SharePoint 2013

Expected or Desired Behavior

Set-PnPClientSideText to set the text as according to the text passed in via the -Text parameter

Observed Behavior

The following text is to be loaded using Set-PnPClientSideText

<h2>Policy Objective</h2><p>The policy establishes the development requirements for constructing
 vehicle crossovers in road reserves.</p>

The command used is where $textToUpdate contained the above Set-PnPClientSideText -Page $PageName -InstanceId $control.InstanceId -Text $textToUpdate

The following text what appears after using Set-PnPClientSideText

Text              : <p></p><h2>Policy Objective</h2><p>The policy establishes the development 
                    requirements for constructing vehicle crossovers in road reserves.</p><p></p>
Rte               : 
PreviewText       : 
Type              : OfficeDevPnP.Core.Pages.ClientSideText
SpControlData     : OfficeDevPnP.Core.Pages.ClientSideTextControlData
Section           : OfficeDevPnP.Core.Pages.CanvasSection
Column            : OfficeDevPnP.Core.Pages.CanvasColumn
DataVersion       : 1.0
CanvasDataVersion : 1.0
CanvasControlData : 
ControlType       : 4
JsonControlData   : 
InstanceId        : d47cf563-b88b-42af-859b-cd6665da358d
Order             : 1

Steps to Reproduce

Use the following command Set-PnPClientSideText -Page $PageName -InstanceId $InstanceId -Text "<h2>Policy Objective</h2><p>The policy establishes the development requirements for constructing vehicle crossovers in road reserves.</p>"

Note : You will have to use your own page and section with a Text Webpart to set it up. Same error also appears using the following which I believe both cmdlet uses the same api calls Add-PnPClientSideText -Page $PageName -Text "<h2>Policy Objective</h2><p>The policy establishes the development requirements for constructing vehicle crossovers in road reserves.</p>" -Column 1 -Order 1 -Section 1

prawnz avatar Dec 01 '18 13:12 prawnz

The text control internally wraps the contents in a P tag, provide <p><h2>Policy Objective</h2>The policy establishes the development requirements for constructing vehicle crossovers in road reserves.</p> as input and see if that works

jansenbe avatar Dec 02 '18 09:12 jansenbe

Hey @jansenbe , tried your method, however it added the close tag in the beginning and added the opening p tag at the end <p></p><h2>Policy Objective</h2>The policy establishes the development requirements for constructing vehicle crossovers in road reserves.<p></p>

Even editing in SharePoint showed the additional space on the top and bottom. So now I don't know if this is a SharePoint RTE thingy or something else

prawnz avatar Dec 02 '18 13:12 prawnz

Any updates on this?

prawnz avatar Feb 11 '19 05:02 prawnz

Same issue for me - this seems like a bug - compared to how it's working in the UI.

Looks to be a problem with the checking for "DIV" and "P" tags - in this code ; OfficeDevPnP.Core.Pages.ClientSideText

kachihro avatar Mar 22 '19 03:03 kachihro

I'm also seeing the same behaviour using PnP Provisioning for Client-side pages.

phillipharding avatar Mar 22 '19 09:03 phillipharding

We are also seeing this space appear in text webparts when we provision new sites. This looks to be a bug in the provisioning engine where an empty

class is generated before the heading text. Do we have an eta on when this will be resolved? It actually presents quite an issue when you want to template intranet based sites for end users

mag210 avatar Nov 06 '19 16:11 mag210

I'm still experiencing this same issue with the additional

tag at the top. I tried wrapping everything in a

tag but that just added one to the top and bottom.

Looks like the issue is happening only in the default section. I have other sections/columns that aren't producing this issue.

zshane15 avatar Jan 21 '20 14:01 zshane15

I Have the exact same problem, it is a bit annoying and my OCD is killing me, anybody find a workaround?

lassealfastsen avatar Aug 28 '20 13:08 lassealfastsen