Skip to content

Update html.js#575

Open
sandeepgosavi wants to merge 1 commit into
crabbly:masterfrom
sandeepgosavi:patch-1
Open

Update html.js#575
sandeepgosavi wants to merge 1 commit into
crabbly:masterfrom
sandeepgosavi:patch-1

Conversation

@sandeepgosavi

Copy link
Copy Markdown

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
Copy Markdown

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? :)

Comment thread src/js/html.js
@@ -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)

@nelsonkuang nelsonkuang Sep 2, 2021

Copy link
Copy Markdown

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)

Comment thread src/js/html.js


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

@nelsonkuang nelsonkuang Sep 2, 2021

Copy link
Copy Markdown

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);
    }

@nelsonkuang nelsonkuang left a comment

Copy link
Copy Markdown

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