-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling of inline images in text web part broken on export #653
Comments
Just checked the page directly using PnP.PowerShell. It seems that the required property "RichTextEditorInstanceId" won't be set - no matter what. Checking the instance in PowerShell it seems to be empty despite the fact that I've filled in the value in the PnP template: ❯ Get-PnPPageComponent -Page $page
InstanceId Type Title Section Column Position PropertiesJson
---------- ---- ----- ------- ------ -------- --------------
70afffa9-d190-4548-acf8-12709bc58b51 PageWebPart Image 1 1 1 {"id":"d8945a5c-2e09-454f-a6dd-e27f614d8c1e","linkUrl":"","isInlineImage":true,"alignment":"Cen…
8b1409d6-0919-4b1f-b659-05bb96112c25 PageText 1 1 2
❯ $image.RichTextEditorInstanceId
❯ $image.RichTextEditorInstanceId = $text.InstanceId
InvalidOperation: 'RichTextEditorInstanceId' is a ReadOnly property. So maybe if you just can make that value writable we would have kind of a solution - maybe not for template operations, but at least for direct page operations. |
…ike PnP.Framework) to generate inline images as well (could be the basis for fixing pnp/pnpframework#653)
Getting the same issue, when I configure the text webpart with the image, basically in the export is coming with 2 web parts duplicating the image. Is there a solution for this? Thanks |
Using the PowerShell function to export a page and then importing the same template file again (e. g. with another page name), I've noticed that inline images in text parts still seemed somehow broken afterwards.
Here are some screenshots to show the effect:
This is the 'orginal' page I've then exported using PnP.PowerShell's Cmdlet Export-PnPPage:
I've then modified page name and title and imported the page to the same site with PnP.PowerShell Cmdlet Invoke-PnPSiteTemplate. Now the inline image will be shown twice: Once above the rte web part (where it's technically located in the page structure) and the second timer where it's supposed to be shown (inside the rte web part, where the image web part's corresponding placeholder resides):
I'm currently having the same issues adding inline images directly using PnP.PowerShell commands and having more or less the same issues. Despite setting the cross-reference from the HTML placeholder in the rich text content back to the instance id of the image web part and having the image web part having the instance id of the rte web part and being tagged as "InlineImage" I've still the same outcome. That's no big surprise, because for my researches I was of course relying on the web part properties returned by PnP ...
I guess there must be something else that PnP.Framework is missing out on, that will do the trick. Unfortunately I've no clue how to proceed here as comparing the web part properties shows no difference between the original page and the "broken" re-import.
The rte web part text content looks like this. Relevant attribute here seems to be the "data-instance-id" referencing the acutal image web part to be shown "inline":
I already found out, that the inline images json extracted by PnP.Framework obviously needs some other additional parameter "rteInstanceId", defining the reference to the rte web part where it's supposed to be displayed. This looks then e. g. like that:
Unfortunately this still seems to be missing something. In view mode we still have the "double image". In edit mode it looks just fine on the first glance, but there are issues like misplaced border for resizing and such, if you try to edit the inline-image:
The text was updated successfully, but these errors were encountered: