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

Update html.js #575

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sandeepgosavi
Copy link

It is not always possible to send id of the html. In such cases we can use data-printid attribute.

It is not always possible to send id of the html. In such cases we can use data-printid attribute.
@nelsonkuang
Copy link

It is not always possible to send id of the html. In such cases we can use data-printid attribute.

i prefer using a common css selector, not just a data-printid attribute. can you please update your PR for me? :)

@@ -5,7 +5,12 @@ export default {
print: (params, printFrame) => {
// Get the DOM printable element
const printElement = isHtmlElement(params.printable) ? params.printable : document.getElementById(params.printable)
Copy link

@nelsonkuang nelsonkuang Sep 2, 2021

Choose a reason for hiding this comment

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

let printElement = isHtmlElement(params.printable) ? params.printable : document.getElementById(params.printable)



// check if data-printid for the element exist
if (!printElement) {
Copy link

@nelsonkuang nelsonkuang Sep 2, 2021

Choose a reason for hiding this comment

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

    if (!printElement && document.querySelector) {
      printElement = document.querySelector(params.printable);
    }

Copy link

@nelsonkuang nelsonkuang left a comment

Choose a reason for hiding this comment

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

See my code below :)

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.

2 participants