@arsedizioni/ars-utils 18.2.230 → 18.2.232

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.
@@ -2054,7 +2054,7 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
2054
2054
  }
2055
2055
  else
2056
2056
  this.navigateByUrl(this.clipperService.serviceUri +
2057
- "/documents/render/?query=&id=" + id + "&theme=" + this.dialogData.theme);
2057
+ "/documents/render/?query=&id=" + id);
2058
2058
  }
2059
2059
  /**
2060
2060
  * Navigate by url
@@ -2063,29 +2063,37 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
2063
2063
  navigateByUrl(url) {
2064
2064
  if (!url || url.length === 0 || url === 'about:blank')
2065
2065
  return; // Nothing to do
2066
- // Clean url
2066
+ // Clean url, take only the first anchor
2067
2067
  let parts = url.split('#');
2068
2068
  url = parts[0];
2069
2069
  if (parts.length > 1) {
2070
2070
  url += '#' + parts[1];
2071
2071
  }
2072
2072
  // Handle free text query
2073
- let q = '';
2074
- let pos = url.indexOf('query=');
2075
- if (pos !== -1) {
2076
- pos += 6;
2077
- while (url.length > pos && url[pos] !== '&' && url[pos] !== '#')
2078
- q += url[pos++];
2079
- }
2080
- if (q.length > 0) {
2081
- // Reset
2082
- this.relevants.hit = 0;
2083
- try {
2084
- // Assign query to enable search for fragments
2085
- this.lastQuery = decodeURIComponent(encodeURIComponent(q));
2086
- }
2087
- catch {
2088
- this.lastQuery = q;
2073
+ let query = '';
2074
+ let p = url.indexOf('query=');
2075
+ if (p !== -1) {
2076
+ p += 6;
2077
+ while (url.length > p && url[p] !== '&' && url[p] !== '#') {
2078
+ query += url[p++];
2079
+ }
2080
+ if (query.length > 0) {
2081
+ // Reset
2082
+ this.relevants.hit = 0;
2083
+ try {
2084
+ // Assign query to enable search for fragments
2085
+ this.lastQuery = decodeURIComponent(encodeURIComponent(query));
2086
+ }
2087
+ catch {
2088
+ this.lastQuery = query;
2089
+ }
2090
+ }
2091
+ }
2092
+ // Theme
2093
+ if (url.indexOf('theme=') === -1) {
2094
+ p = url.indexOf('id=');
2095
+ if (p !== -1) {
2096
+ url = url.substring(0, p) + 'theme=' + this.dialogData.theme + '&' + url.substring(p);
2089
2097
  }
2090
2098
  }
2091
2099
  let navigateToFile = url.indexOf('&file=true') !== -1;