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: clone and copy styles #184

Merged
merged 3 commits into from
May 15, 2023
Merged

fix: clone and copy styles #184

merged 3 commits into from
May 15, 2023

Conversation

kptdobe
Copy link
Contributor

@kptdobe kptdobe commented May 12, 2023

Fix #183

2 options to fix the issue:

  • revert the document.cloneNode(true) and use the original. This would require the enduser to click on import each time they want to get a fresh document to work on
  • copy the styles we need - since document.cloneNode(true) does not copy the style, we need to inline them in the clone

With this PR, we need to traverse the document to copy and inline the style properties defined as required. By default, only background-image is defined. But the list could be controlled in import.js via:

export default {
  transformDOM() {...},
  REQUIRED_STYLES: ['background-image', /* add more here if needed */],

Copy link
Collaborator

@catalan-adobe catalan-adobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Though I think it deserves an entry in the import guidelines to explain how to add style properties to clone.

Copy link
Collaborator

@catalan-adobe catalan-adobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested on a bacom url + importer, issue fixed. And thanks for the documentation :)

@kptdobe kptdobe merged commit a750087 into main May 15, 2023
@kptdobe kptdobe deleted the copy-styles branch May 15, 2023 09:34
github-actions bot pushed a commit that referenced this pull request May 19, 2023
## [1.39.1](v1.39.0...v1.39.1) (2023-05-19)

### Bug Fixes

* clone and copy styles ([#184](#184)) ([a750087](a750087))
* **deps:** update dependency @adobe/helix-importer to v2.9.7 ([#188](#188)) ([a9f7907](a9f7907))
@github-actions
Copy link

🎉 This PR is included in version 1.39.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[import] Styles not available anymore
2 participants