Skip to content

Commit

Permalink
fix: 修复文章无标题标签 anchors.js 和 chapters.js 子组件事件绑定的逻辑错误导致的报错;
Browse files Browse the repository at this point in the history
  • Loading branch information
yaohaixiao committed Jan 23, 2024
1 parent 96cce1a commit c853bb1
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 23 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


## [3.30.3](https://github.com/yaohaixiao/outline.js/compare/3.20.2...3.30.3) (2024-01-17)


Expand Down
8 changes: 8 additions & 0 deletions anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ class Anchors extends Base {
addListeners() {
const $articleElement = this.$articleElement

if (this.count() < 1) {
return this
}

on(
$articleElement,
'.outline-heading__anchor',
Expand All @@ -232,6 +236,10 @@ class Anchors extends Base {
removeListeners() {
const $articleElement = this.$articleElement

if (this.count() < 1) {
return this
}

off($articleElement, 'click', this.onAnchorTrigger)

return this
Expand Down
2 changes: 1 addition & 1 deletion anchors.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion anchors.min.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions chapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,10 @@ class Chapters extends Base {
const tagName = $scrollElement.tagName.toLowerCase()
let $element = $scrollElement

if (this.count() < 1) {
return this
}

if (tagName === 'html' || tagName === 'body') {
$element = window
}
Expand All @@ -640,6 +644,10 @@ class Chapters extends Base {
const tagName = $scrollElement.tagName.toLowerCase()
let $element = $scrollElement

if (this.count() < 1) {
return this
}

if (tagName === 'html' || tagName === 'body') {
$element = window
}
Expand Down
2 changes: 1 addition & 1 deletion chapters.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion chapters.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/anchors.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/anchors.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/chapters.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/chapters.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/outline.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/outline.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion outline.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion outline.min.js.map

Large diffs are not rendered by default.

12 changes: 2 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yaohaixiao/outline.js",
"version": "3.30.3",
"version": "3.30.4",
"description": "outline.js - 自动生成文章导读(Table of Contents)导航的 JavaScript 工具。",
"main": "outline.min.js",
"files": [
Expand Down

0 comments on commit c853bb1

Please sign in to comment.