mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-28 08:10:58 +00:00
Merge pull request #782 from SISheogorath/feature/showFullTitle
Add title attribute in table of contents
This commit is contained in:
commit
2ed2a08f66
1 changed files with 2 additions and 1 deletions
3
public/vendor/md-toc.js
vendored
3
public/vendor/md-toc.js
vendored
|
@ -54,6 +54,7 @@
|
||||||
var j = i + 1
|
var j = i + 1
|
||||||
this._elTitleElement = this.elTitleElements[i]
|
this._elTitleElement = this.elTitleElements[i]
|
||||||
this._elTitleElementName = this._elTitleElement.tagName
|
this._elTitleElementName = this._elTitleElement.tagName
|
||||||
|
this._elTitleElementTitle = this._elTitleElement.textContent.replace(/"/g, '"')
|
||||||
this._elTitleElementText = (typeof this.process === 'function' ? this.process(this._elTitleElement) : this._elTitleElement.innerHTML).replace(/<(?:.|\n)*?>/gm, '')
|
this._elTitleElementText = (typeof this.process === 'function' ? this.process(this._elTitleElement) : this._elTitleElement.innerHTML).replace(/<(?:.|\n)*?>/gm, '')
|
||||||
var id = this._elTitleElement.getAttribute('id')
|
var id = this._elTitleElement.getAttribute('id')
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
@ -63,7 +64,7 @@
|
||||||
id = '#' + id
|
id = '#' + id
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tocContent += '<li><a href="' + id + '">' + this._elTitleElementText + '</a>'
|
this.tocContent += '<li><a href="' + id + '" title="'+ this._elTitleElementTitle +'">' + this._elTitleElementText + '</a>'
|
||||||
|
|
||||||
if (j !== this._elTitleElementsLen) {
|
if (j !== this._elTitleElementsLen) {
|
||||||
this._elNextTitleElementName = this.elTitleElements[j].tagName
|
this._elNextTitleElementName = this.elTitleElements[j].tagName
|
||||||
|
|
Loading…
Reference in a new issue