@teipublisher/pb-components 1.28.0 → 1.28.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/src/pb-view.js CHANGED
@@ -496,6 +496,15 @@ export class PbView extends pbMixin(LitElement) {
496
496
 
497
497
  _refresh(ev) {
498
498
  if (ev && ev.detail) {
499
+ if (ev.detail.hash && !(ev.detail.id || ev.detail.path || ev.detail.odd || ev.detail.view || ev.detail.position)) {
500
+ // if only the scroll target has changed: scroll to the element without reloading
501
+ this._scrollTarget = ev.detail.hash;
502
+ const target = this.shadowRoot.getElementById(this._scrollTarget);
503
+ if (target) {
504
+ setTimeout(() => target.scrollIntoView());
505
+ }
506
+ return;
507
+ }
499
508
  if (ev.detail.path) {
500
509
  const doc = this.getDocument();
501
510
  doc.path = ev.detail.path;
@@ -641,7 +650,7 @@ export class PbView extends pbMixin(LitElement) {
641
650
  if (target) {
642
651
  setTimeout(() => {
643
652
  target.scrollIntoView();
644
- });
653
+ }, 100);
645
654
  }
646
655
  this._scrollTarget = null;
647
656
  });