Skip to content
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

fix: Ensure necessary scripts are loaded into page #210

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

mcollovati
Copy link
Contributor

Description

In Liferay "Content Page" edit mode, Vaadin portlets are not directly
added to the main page, but loaded into an iframe requesting the same
page in preview mode, and then added to the main page through javascript,
but they are detached from iframe before initialization is completed.
This way, scripts needed to register the portlet web component are not
added to the main document, so the webcomponent is not correctly rendered.
This patch add an additional script to BootstrapHandler response that
takes care to add needed script to main page and to postpone element
registration until they are loaded.

Fixes #202

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

In Liferay "Content Page" edit mode, Vaadin portlets are not directly
added to the main page, but loaded into an iframe requesting the same
page in preview mode, and then added to the main page through javascript,
but they are detached from iframe before initialization is completed.
This way, scripts needed to register the portlet web component are not
added to the main document, so the webcomponent is not correctly rendered.
This patch add an additional script to BootstrapHandler response that
takes care to add needed script to main page and to postpone element
registration until they are loaded.

Fixes #202
@vaadin-bot
Copy link

SonarQube analysis reported 5 issues

  1. MAJOR PortletBootstrapHandler.java#L119: Either log or rethrow this exception. rule
  2. MAJOR VaadinLiferayPortlet.java#L49: Take the required action to fix the issue indicated by this comment. rule
  3. MAJOR VaadinPortlet.java#L641: A "NullPointerException" could be thrown; "portlet" is nullable here. rule
  4. MAJOR VaadinPortlet.java#L643: Define and throw a dedicated exception instead of using a generic one. rule
  5. MAJOR VaadinPortlet.java#L667: Remove these unused method parameters. rule

@mcollovati mcollovati marked this pull request as ready for review March 11, 2022 12:51
@mshabarov
Copy link
Contributor

Tested with Liferay 7.3, works as expected.

@mshabarov mshabarov merged commit f1a96b0 into master Mar 14, 2022
@mshabarov mshabarov deleted the issues/202_content_not_visible_in_edit_mode branch March 14, 2022 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vaadin Portlet content is blank in Liferay 7 page editing mode
4 participants