@vdegenne/highlight-manager 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +14 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -100,11 +100,20 @@ export class HighLightManager {
|
|
|
100
100
|
// const highlightIndexStart = elements.findIndex((el) =>
|
|
101
101
|
// el.hasAttribute('highlight'),
|
|
102
102
|
// );
|
|
103
|
-
if (!highlightElements || highlightElements.length === 0) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
// if (!highlightElements || highlightElements.length === 0) {
|
|
104
|
+
// console.warn("The highlighted element couldn't be found")
|
|
105
|
+
// return {
|
|
106
|
+
// highlightIndexStart: -1,
|
|
107
|
+
// highlightIndexEnd: -1,
|
|
108
|
+
// elements: []
|
|
109
|
+
// }
|
|
110
|
+
// }
|
|
111
|
+
const highlightIndexStart = highlightElements.length
|
|
112
|
+
? elements.indexOf(highlightElements[0])
|
|
113
|
+
: -1;
|
|
114
|
+
const highlightIndexEnd = highlightElements.length
|
|
115
|
+
? elements.indexOf(highlightElements[highlightElements.length - 1])
|
|
116
|
+
: -1;
|
|
108
117
|
if (highlightElements.length === 1) {
|
|
109
118
|
// const highlightElement = elements[highlightIndex];
|
|
110
119
|
}
|