Skip to content

Frontend Editing not working if the field "Summary" is empty #2188

@bluellyr

Description

@bluellyr

Hi,
I am having an issue with the Frontend Editing module:

The module wire/modules/Page/PageFrontEdit/PageFrontEdit.module have the following on the function hookPageRender:

// loine: 431
if(strpos($out, "id=pw-edit-") === false && !$hasEditTags && !$hasEditAttr) return;

This line is only checking for the string "id=pw-edit-" and do not check for 'id="pw-edit-' so in some pages do render/load all the necessary html, css and javascript to be possible to edit the pages on the frontend.

In my case, I am using the Multi Language Profile. The Summary field is used to create the meta description and the following is what happens if the Summary is empty or not:

  • If empty: It isn't possible to edit the body. The necessary html to edit the Summary field is not rendered even if the html necessary to edit the Body is present on the page.
  • If not empty: It is possible to edit the Body and the necessary html to edit the Summary field is rendered

If the Summary is empty, only renders:

<meta name="description" content="">

And it can't find the string id=pw-edit-and because of that is not possible to edit the other fields like the Body.

If the Summary is not empty, renders:

<meta name="description" content="<div id=pw-edit-5 class='pw-edit pw-edit-InputfieldTextarea' data-name=summary data-page=1167 data-lang='1035' style='position:relative'><div class=pw-edit-orig>Aperçu du blog.</div><div class=pw-edit-copy id=pw-editor-summary-1167 style='display:none;-webkit-user-select:text;user-select:text;' contenteditable>Aperçu du blog.</div></div>" />

It is possible to edit the Bodyon the frontend.

To try to fix this, the only way I found was to patched the wire/modules/Page/PageFrontEdit/PageFrontEdit.module with the following:

  • ORIGINAL: if(strpos($out, "id=pw-edit-") === false && !$hasEditTags && !$hasEditAttr) return;
  • PATCH: if((strpos($out, "id=pw-edit-") === false && strpos($out, 'id="pw-edit-') === false) && !$hasEditTags && !$hasEditAttr) return;

With this patch it works even if the Summary is empty.

I don't know if I am doing something wrong with this approach or not but I would like to have a solution for this.

@ryancramerdesign, it is possible for you to look into this?

I am starting a new project and this is critical.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions