cec-nuxt-lib 0.7.4 → 0.7.6

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.7.4"
4
+ "version": "0.7.6"
5
5
  }
@@ -5,6 +5,9 @@ import { useState } from '#app';
5
5
  const searchTerm = useState('searchTerm', () => 'Enter keywords:');
6
6
  const showSiteSearch = useState('showSiteSearch');
7
7
  const questions = useState('questions');
8
+ const baseUrl = useState('baseUrl');
9
+ const title = useState('title');
10
+ const path = useState('path');
8
11
 
9
12
  const regex =
10
13
  /^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
@@ -129,10 +132,15 @@ onMounted(() => {
129
132
  if (hash) {
130
133
  hash = hash.toLowerCase().replace(/^#/, '').replace(/_/g, ' ');
131
134
  let l = Array.from(document.getElementsByTagName('LABEL')).filter((e) =>
132
- e.innerText.toLowerCase().includes(hash)
135
+ e.innerText.toLowerCase().startsWith(hash)
133
136
  );
134
- if (l.length && l[0].parentNode.tagName === 'SECTION') {
135
- let el = l[0].previousElementSibling;
137
+ let accs = l.filter(
138
+ (e) =>
139
+ e.parentNode.tagName === 'SECTION' ||
140
+ e.parentNode.tagName === 'TEMPLATE'
141
+ );
142
+ if (accs.length) {
143
+ let el = accs[0].previousElementSibling;
136
144
  if (el.tagName === 'INPUT') {
137
145
  el.checked = true;
138
146
  el.scrollIntoView();
@@ -143,7 +151,7 @@ onMounted(() => {
143
151
  let h3s = Array.from(document.getElementsByTagName('H3')).filter((e) =>
144
152
  e.innerHTML.toLowerCase().includes(hash)
145
153
  );
146
- if (h3s) {
154
+ if (h3s.length) {
147
155
  let parent = h3s[0].parentNode;
148
156
  if (parent.tagName === 'ARTICLE') {
149
157
  let el = parent.previousElementSibling;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.4",
2
+ "version": "0.7.6",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",