dom-highlight-range icon indicating copy to clipboard operation
dom-highlight-range copied to clipboard

Customize the element used for highlighting

Open jmakeig opened this issue 8 years ago • 6 comments
trafficstars

Changes the exported highlightRange function signature to accept an HTMLElement, a callback function, or a string as the second parameter. This is used to create the highlight wrapper nodes. This is useful for adding context from the calling application to each logical highlight. This is backward-compatible with the current behavior (string).

Fixes #1.

jmakeig avatar Nov 10 '17 17:11 jmakeig

Argh. I screwed up the whitespace, so the diff is messier than it should be. I’ll clean this up later and push to this PR.

jmakeig avatar Nov 10 '17 17:11 jmakeig

@Treora, OK, I think I’ve cleaned up my commits, if you want to take a look. I’ll try to put together an HTML test page to exercise the new capabilities this weekend.

jmakeig avatar Nov 10 '17 23:11 jmakeig

@Treora, I’ve added example.html to illustrate the four options and fixed a few bugs in the early PR (oops!). Please let me know if this works for you.

jmakeig avatar Nov 11 '17 22:11 jmakeig

Thanks for taking a look. All good suggestions. I’ll address these and update the PR (hopefully this weekend).

I’d been avoiding ES2015, such as arrow functions, because it looks like you’d stuck to ES5. Is ES5 a goal?

Also, did you have any feedback on example.html. It’s not unit tests, but it exercises the functionality and provides some implementation guidance.

jmakeig avatar Nov 16 '17 17:11 jmakeig

I’d been avoiding ES2015, such as arrow functions, because it looks like you’d stuck to ES5. Is ES5 a goal?

Oh yes I forgot this module is plain ES5, so let's indeed stick with that. :)

Also, did you have any feedback on example.html

Had to try that still; looks pretty cool! Needs a <meta charset="utf-8"> still for the pencil to render correctly.

Treora avatar Nov 16 '17 18:11 Treora

OK, I think I’ve incorporated your feedback. Let me know how this looks.

jmakeig avatar Nov 16 '17 21:11 jmakeig