Skip to content

Commit

Permalink
fix: 修复缺陷 - issues(#47) - 配置参数 showCode 默认值调整为:false
Browse files Browse the repository at this point in the history
  • Loading branch information
yaohaixiao committed Jun 20, 2024
1 parent 3a5943a commit 5bba55f
Show file tree
Hide file tree
Showing 24 changed files with 84 additions and 78 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ Outline.DEFAULTS = {
position: 'relative',
parentElement: '#aside',
placement: 'rtl',
showCode: true,
// 注意:3.38.2 开始 showCode 默认为 false
showCode: false,
animationCurrent: true,
hasToolbar: true,
anchorURL: '',
Expand Down
4 changes: 2 additions & 2 deletions anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Anchors extends Base {
render() {
const articleElement = this.attr('articleElement')
const selector = this.attr('selector')
const showCode = this.attr('showCode') || true
const showCode = this.attr('showCode')
const chapterTextFilter = this.attr('chapterTextFilter')
const mounted = this.attr('mounted')
const chapters = getChapters({
Expand Down Expand Up @@ -181,7 +181,7 @@ class Anchors extends Base {
refresh(chapters) {
const articleElement = this.attr('articleElement')
const selector = this.attr('selector')
const showCode = this.attr('showCode') || true
const showCode = this.attr('showCode')
const chapterTextFilter = this.attr('chapterTextFilter')

this.$headings = this.getHeadings()
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.

2 changes: 1 addition & 1 deletion api/pug/options/section.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
section.section
header.section__header
h2.section__title Options
h2.section__title 1. Options
div.section__content
p outline.js 有者丰富的配置选项,以便适应不同的展示方式。
include ./articleElement
Expand Down
6 changes: 3 additions & 3 deletions api/pug/options/showCode.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ section.section
dl.section__dl
dt.section__dt Default:
dd.section__dd true
p 可选,是否显示段落章节编号:
p 可选,是否显示段落章节编号(注意:3.38.2 开始 showCode 默认为 false)
ul
li true - 显示编号(默认值)
li false - 不显示编号;
li false - 显示编号;
li false - 不显示编号(默认值)
4 changes: 2 additions & 2 deletions api/pug/properties/defaults.pug
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ section.section
// 说明:outline.js 主要用于文章详情页面,
// 因此 stickyHeight 仅针对 top: 0,且 sticky 定位元素在文章内容区域上方的位置;
stickyHeight: 0,
// 是否显示标题编号
showCode: true,
// 是否显示标题编号(注意:3.38.2 开始 showCode 默认为 false)
showCode: false,
// 是否显示侧边的按钮工具栏
hasToolbar: true,
// 指定是否采用动画定位高亮当前的章节标题,默认值:true
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/fixed.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
// 调整位直接在文章内生成导航
position: 'sticky',
articleElement: '#article'
})</code></pre><section class="section"><header class="section__header"><h2 class="section__title">Options</h2></header><div class="section__content"><p>outline.js 有者丰富的配置选项,以便适应不同的展示方式。</p></div><section class="section"><header class="section__header"><h3 class="section__h3">articleElement</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">String|HTMLElement</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">'#article'</dd></dl><ul><li>String:选择器字符串,默认值:html,body(即 window 窗口);</li><li>HTMLElement:'DOM 元素;</li></ul><p>可选,用来指定页面中显示文章正文的 DOM 节点或者选择器字符串。</p><pre class="section__pre"><code class="section__code">// Default Selector
})</code></pre><section class="section"><header class="section__header"><h2 class="section__title">1. Options</h2></header><div class="section__content"><p>outline.js 有者丰富的配置选项,以便适应不同的展示方式。</p></div><section class="section"><header class="section__header"><h3 class="section__h3">articleElement</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">String|HTMLElement</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">'#article'</dd></dl><ul><li>String:选择器字符串,默认值:html,body(即 window 窗口);</li><li>HTMLElement:'DOM 元素;</li></ul><p>可选,用来指定页面中显示文章正文的 DOM 节点或者选择器字符串。</p><pre class="section__pre"><code class="section__code">// Default Selector
const outline = new Outline(Outline.DEFAULTS)

// Customize Selector
Expand Down Expand Up @@ -120,7 +120,7 @@
// 设置 stickyHeight(outline.js 的示例页面的主标题元素的高度)
defaults.stickyHeight = 86
// 默认生成独立的侧滑弹窗导航菜单
new Outline(defaults)</code></pre></div></section><section class="section"><header class="section__header"><h3 class="section__h3">showCode</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,是否显示段落章节编号:</p><ul><li>true - 显示编号(默认值);</li><li>false - 不显示编号;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">animationCurrent</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,是否采用动画定位高亮当前的章节标题:</p><ul><li>true - 采用动画定位高亮(默认值);</li><li>false - 采用高亮当前章节标题的链接文字并加粗文字;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">hasToolbar</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,是否显示侧边的按钮工具栏:</p><ul><li>true - 显示按钮工具栏(默认值);</li><li>false - 不显示按钮工具栏;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">closeOnClickModal</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,点击空白处(非独立导航菜单),收起导航菜单:</p><ul><li>true - 点击空白处,收起菜单(默认值);</li><li>false - 点击空白处,不收起菜单;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">showNavModalFirst</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">false</dd></dl><p>可选,有独立导航菜单时,是否默认显示菜单:</p><ul><li>false - 默认先显示按钮工具栏(默认值);</li><li>true - 默认先显示独立导航菜单弹窗;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">anchorURL</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">String</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">''</dd></dl><p>可选,用来指定文章标题锚点链接图标的链接地址:</p><pre class="section__pre"><code class="section__code">// Default URL - 默认链接,点击图标,页面会滚动到当前标题位置
new Outline(defaults)</code></pre></div></section><section class="section"><header class="section__header"><h3 class="section__h3">showCode</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,是否显示段落章节编号(注意:3.38.2 开始 showCode 默认为 false):</p><ul><li>false - 显示编号;</li><li>false - 不显示编号(默认值);</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">animationCurrent</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,是否采用动画定位高亮当前的章节标题:</p><ul><li>true - 采用动画定位高亮(默认值);</li><li>false - 采用高亮当前章节标题的链接文字并加粗文字;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">hasToolbar</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,是否显示侧边的按钮工具栏:</p><ul><li>true - 显示按钮工具栏(默认值);</li><li>false - 不显示按钮工具栏;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">closeOnClickModal</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">true</dd></dl><p>可选,点击空白处(非独立导航菜单),收起导航菜单:</p><ul><li>true - 点击空白处,收起菜单(默认值);</li><li>false - 点击空白处,不收起菜单;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">showNavModalFirst</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">Boolean</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">false</dd></dl><p>可选,有独立导航菜单时,是否默认显示菜单:</p><ul><li>false - 默认先显示按钮工具栏(默认值);</li><li>true - 默认先显示独立导航菜单弹窗;</li></ul></div></section><section class="section"><header class="section__header"><h3 class="section__h3">anchorURL</h3></header><div class="section__content"><h4 class="section__h4">Description</h4><dl class="section__dl"><dt class="section__dt">Type:</dt><dd class="section__dd">String</dd></dl><dl class="section__dl"><dt class="section__dt">Default:</dt><dd class="section__dd">''</dd></dl><p>可选,用来指定文章标题锚点链接图标的链接地址:</p><pre class="section__pre"><code class="section__code">// Default URL - 默认链接,点击图标,页面会滚动到当前标题位置
new Outline()

// Customize URL - 直接打开链接了
Expand Down Expand Up @@ -858,8 +858,8 @@
// 说明:outline.js 主要用于文章详情页面,
// 因此 stickyHeight 仅针对 top: 0,且 sticky 定位元素在文章内容区域上方的位置;
stickyHeight: 0,
// 是否显示标题编号
showCode: true,
// 是否显示标题编号(注意:3.38.2 开始 showCode 默认为 false)
showCode: false,
// 是否显示侧边的按钮工具栏
hasToolbar: true,
// 指定是否采用动画定位高亮当前的章节标题,默认值:true
Expand Down
Loading

0 comments on commit 5bba55f

Please sign in to comment.