Closed ty1135 closed 5 months ago
Thank you for reaching out about the issue with the code copying functionality in this Dhiwise extension.
I understand the frustration caused by the mixed-up lines when copying code. It appears that this problem is related to display settings and screen size. Zooming out until the full code is visible can often resolve this issue for sure 100%, it can really work very good especially for users with larger screens. However, I recognize that this may not be an ideal solution for users with smaller screens. But I was manage even to use small screen PC by zooming out -50% up to -80% and copy the code it really worked fine
Also you may face that the spaces are not in UTF-8, please when you copy the code, copy a single space from the code you copied and replace the whole document with your keyboard space. I apologize for any confusion.
Your feedback is incredibly valuable as I continue to improve the extension to provide a smoother experience for all users. I will take your suggestions into consideration as I work on enhancements to prevent similar frustrations in the future.
If you have any further questions or suggestions, please don't hesitate to let me know. I'm here to assist you.
Best regards, @isaka-james
function getAllTextContent(element) { let elements = [];
// Function to collect "view-line" elements with their top values
function collectViewLineElements(node) {
for (let child of node.childNodes) {
if (child.nodeType === Node.ELEMENT_NODE) {
if (child.classList.contains('view-line')) {
let topValue = parseFloat(child.style.top);
elements.push({ element: child, top: topValue });
}
// Recursively collect from child nodes
collectViewLineElements(child);
}
}
}
collectViewLineElements(element);
// Sort elements by their top values
elements.sort((a, b) => a.top - b.top);
// Concatenate the text content in sorted order
let textContent = '';
for (let item of elements) {
textContent += item.element.textContent + '\n';
}
return textContent;
}
please provide the full information for your issue. I am struggling understanding you. You just posted code and what am I supposed to do?
But I said the you should zoom out max, and click the copy button, It should work.
function getAllTextContent(element) { let elements = [];
// Function to collect "view-line" elements with their top values function collectViewLineElements(node) { for (let child of node.childNodes) { if (child.nodeType === Node.ELEMENT_NODE) { if (child.classList.contains('view-line')) { let topValue = parseFloat(child.style.top); elements.push({ element: child, top: topValue }); } // Recursively collect from child nodes collectViewLineElements(child); } } } collectViewLineElements(element); // Sort elements by their top values elements.sort((a, b) => a.top - b.top); // Concatenate the text content in sorted order let textContent = ''; for (let item of elements) { textContent += item.element.textContent + '\n'; } return textContent;
}
replace with this function everything works perfectly.
can you make a pull request please?
the copied code seems to be reordered ramdomly...uh oh