Skip to content

Commit

Permalink
Merge pull request #13 from techvalidate/blanktooltip
Browse files Browse the repository at this point in the history
SOLN-11751: Blank tooltip after browser navigation
  • Loading branch information
suzukia authored May 23, 2019
2 parents daf672b + 7ff8d4a commit 9d8801f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
22 changes: 21 additions & 1 deletion pano.js
Original file line number Diff line number Diff line change
Expand Up @@ -23645,7 +23645,10 @@ var _class = function (_Controller) {
key: 'setContent',
value: function setContent() {
if (this.element.hasAttribute('title')) {
this.content = this.element.getAttribute('title');
var title = this.element.getAttribute('title');
this.content = title;
// Add back the title attribute in disconnect(), so the title is present when navigating browser hsitory.
this.title = title;
this.element.removeAttribute('title');
}

Expand Down Expand Up @@ -23729,6 +23732,15 @@ var _class = function (_Controller) {
this.element.setAttribute('data-target', this.type + '.hover');
}
}
}, {
key: 'disconnect',
value: function disconnect() {
// reset the element title navigating back/forward in the browser history will show the inital title
var title = this.title;
if (this.title) {
this.element.setAttribute('title', title);
}
}
}, {
key: 'container',
get: function get() {
Expand All @@ -23752,6 +23764,14 @@ var _class = function (_Controller) {
get: function get() {
return $('#' + this.id);
}
}, {
key: 'title',
get: function get() {
return this._title;
},
set: function set(title) {
this._title = title;
}
}]);

return _class;
Expand Down
2 changes: 1 addition & 1 deletion pano.js.map

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion src/controllers/tooltips/tooltipController.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,20 @@ export default class extends Controller {
return $(`#${this.id}`)
}

get title() {
return this._title
}

set title(title) {
this._title = title
}

setContent() {
if (this.element.hasAttribute('title')) {
this.content = this.element.getAttribute('title')
const title = this.element.getAttribute('title')
this.content = title
// Add back the title attribute in disconnect(), so the title is present when navigating browser hsitory.
this.title = title
this.element.removeAttribute('title')
}

Expand Down Expand Up @@ -122,4 +133,12 @@ export default class extends Controller {
this.element.setAttribute('data-target', `${this.type}.hover`)
}
}

disconnect() {
// reset the element title navigating back/forward in the browser history will show the inital title
const title = this.title
if (this.title) {
this.element.setAttribute('title', title)
}
}
}

0 comments on commit 9d8801f

Please sign in to comment.