build: rename `code-block-tools` -> `code-block`

This commit is contained in:
XPoet 2022-10-17 21:54:21 +08:00
parent 39b82e84e7
commit e56f5718d2
8 changed files with 41 additions and 41 deletions

View File

@ -153,10 +153,10 @@ post:
custom_label_list: ["Trainee", "Engineer", "Architect"] custom_label_list: ["Trainee", "Engineer", "Architect"]
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# Code block tools # Code block
# Support code copy and code block collapse # Support code copy and code block collapse
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
code_block_tools: code_block:
enable: false # Option values: true | false enable: false # Option values: true | false
style: default # Option values: default | mac style: default # Option values: default | mac

View File

@ -10,7 +10,7 @@
const { const {
local_search: t_local_search, local_search: t_local_search,
code_copy: t_code_copy, code_copy: t_code_copy,
code_block_tools: t_code_block_tools, code_block: t_code_block,
lazyload: t_lazyload, lazyload: t_lazyload,
toc: t_toc, toc: t_toc,
pjax: t_pjax pjax: t_pjax
@ -21,8 +21,8 @@ const {
<%- __js('js/local-search.js') %> <%- __js('js/local-search.js') %>
<% } %> <% } %>
<% if (t_code_block_tools?.enable === true || t_code_copy?.enable === true) { %> <% if (t_code_block?.enable === true || t_code_copy?.enable === true) { %>
<%- __js('js/code-block-tools.js') %> <%- __js('js/code-block.js') %>
<% } %> <% } %>
<% if (t_lazyload?.enable === true) { %> <% if (t_lazyload?.enable === true) { %>

View File

@ -40,7 +40,7 @@ hexo.extend.helper.register('export_config', function () {
style: theme.style || {}, style: theme.style || {},
local_search: theme.local_search || {}, local_search: theme.local_search || {},
code_copy: theme.code_copy || {}, code_copy: theme.code_copy || {},
code_block_tools: theme.code_block_tools || {}, code_block: theme.code_block || {},
side_tools: theme.side_tools || {}, side_tools: theme.side_tools || {},
pjax: theme.pjax || {}, pjax: theme.pjax || {},
lazyload: theme.lazyload || {}, lazyload: theme.lazyload || {},

View File

@ -54,7 +54,7 @@
} }
if (hexo-config('code_block_tools.style') == 'mac' || hexo-config('code_copy.style') == 'mac') { if (hexo-config('code_block.style') == 'mac' || hexo-config('code_copy.style') == 'mac') {
margin 1.4rem 0 1.8rem 0 margin 1.4rem 0 1.8rem 0
box-shadow 0 0.8rem 2rem 0 rgba(0, 0, 0, 0.4) box-shadow 0 0.8rem 2rem 0 rgba(0, 0, 0, 0.4)

View File

@ -17,38 +17,38 @@ $highlight-purple = #8959a8
$highlight-deletion = #fdd $highlight-deletion = #fdd
$highlight-addition = #dfd $highlight-addition = #dfd
$night-code-foreground = lighten($dark-text-color-3, 2%) $dark-code-foreground = lighten($dark-text-color-3, 2%)
$night-code-background = darken($dark-background-color-1, 10%) $dark-code-background = darken($dark-background-color-1, 10%)
$night-highlight-foreground = lighten($dark-text-color-3, 2%) $dark-highlight-foreground = lighten($dark-text-color-3, 2%)
$night-highlight-background = darken($dark-background-color-1, 8%) $dark-highlight-background = darken($dark-background-color-1, 8%)
$night-highlight-gutter-color = lighten($dark-text-color-3, 5%) $dark-highlight-gutter-color = lighten($dark-text-color-3, 5%)
$night-highlight-gutter-bg-color = darken($dark-background-color-1, 10%) $dark-highlight-gutter-bg-color = darken($dark-background-color-1, 10%)
$night-highlight-comment = #969896 $dark-highlight-comment = #969896
$night-highlight-red = #cc6666 $dark-highlight-red = #cc6666
$night-highlight-orange = #de935f $dark-highlight-orange = #de935f
$night-highlight-yellow = #f0c674 $dark-highlight-yellow = #f0c674
$night-highlight-green = #b5bd68 $dark-highlight-green = #b5bd68
$night-highlight-aqua = #8abeb7 $dark-highlight-aqua = #8abeb7
$night-highlight-blue = #81a2be $dark-highlight-blue = #81a2be
$night-highlight-purple = #b294bb $dark-highlight-purple = #b294bb
$night-highlight-deletion = #008000 $dark-highlight-deletion = #008000
$night-highlight-addition = #800000 $dark-highlight-addition = #800000
code-theme(mode) { code-theme(mode) {
--code-foreground mode == 'light' ? $code-foreground : $night-code-foreground --code-foreground mode == 'light' ? $code-foreground : $dark-code-foreground
--code-background mode == 'light' ? $code-background : $night-code-background --code-background mode == 'light' ? $code-background : $dark-code-background
--highlight-background mode == 'light' ? $highlight-background : $night-highlight-background --highlight-background mode == 'light' ? $highlight-background : $dark-highlight-background
--highlight-foreground mode == 'light' ? $highlight-foreground : $night-highlight-foreground --highlight-foreground mode == 'light' ? $highlight-foreground : $dark-highlight-foreground
--highlight-comment mode == 'light' ? $highlight-comment : $night-highlight-comment --highlight-comment mode == 'light' ? $highlight-comment : $dark-highlight-comment
--highlight-red mode == 'light' ? $highlight-red : $night-highlight-red --highlight-red mode == 'light' ? $highlight-red : $dark-highlight-red
--highlight-orange mode == 'light' ? $highlight-orange : $night-highlight-orange --highlight-orange mode == 'light' ? $highlight-orange : $dark-highlight-orange
--highlight-yellow mode == 'light' ? $highlight-yellow : $night-highlight-yellow --highlight-yellow mode == 'light' ? $highlight-yellow : $dark-highlight-yellow
--highlight-green mode == 'light' ? $highlight-green : $night-highlight-green --highlight-green mode == 'light' ? $highlight-green : $dark-highlight-green
--highlight-aqua mode == 'light' ? $highlight-aqua : $night-highlight-aqua --highlight-aqua mode == 'light' ? $highlight-aqua : $dark-highlight-aqua
--highlight-blue mode == 'light' ? $highlight-blue : $night-highlight-blue --highlight-blue mode == 'light' ? $highlight-blue : $dark-highlight-blue
--highlight-purple mode == 'light' ? $highlight-purple : $night-highlight-purple --highlight-purple mode == 'light' ? $highlight-purple : $dark-highlight-purple
--highlight-gutter-color mode == 'light' ? $highlight-gutter-color : $night-highlight-gutter-color --highlight-gutter-color mode == 'light' ? $highlight-gutter-color : $dark-highlight-gutter-color
--highlight-gutter-bg-color mode == 'light' ? $highlight-gutter-bg-color : $night-highlight-gutter-bg-color --highlight-gutter-bg-color mode == 'light' ? $highlight-gutter-bg-color : $dark-highlight-gutter-bg-color
} }

View File

@ -1,7 +1,7 @@
@import "common/basic.styl" @import "common/basic.styl"
@import "common/markdown.styl" @import "common/markdown.styl"
@import "common/code-block/highlight.styl" @import "common/code-block/highlight.styl"
@import "common/code-block/code-block-tools.styl" @import "common/code-block/code-block.styl"
@import "common/code-block/code-theme.styl" @import "common/code-block/code-theme.styl"
@import "layout/page.styl" @import "layout/page.styl"
@import "layout/_partial/local-search.styl" @import "layout/_partial/local-search.styl"

View File

@ -8,7 +8,7 @@ KEEP.initCodeBlockTools = () => {
} }
const { style: codeCopyStyle } = KEEP.theme_config?.code_copy const { style: codeCopyStyle } = KEEP.theme_config?.code_copy
const { style: codeBlockStyle } = KEEP.theme_config?.code_block_tools const { style: codeBlockStyle } = KEEP.theme_config?.code_block
const isMac = (codeBlockStyle || codeCopyStyle || 'default') === 'mac' const isMac = (codeBlockStyle || codeCopyStyle || 'default') === 'mac'
const foldedIconClassName = isMac ? 'fas fa-chevron-left' : 'fas fa-chevron-right' const foldedIconClassName = isMac ? 'fas fa-chevron-left' : 'fas fa-chevron-right'
const { const {

View File

@ -1,7 +1,7 @@
/* global KEEP */ /* global KEEP */
window.addEventListener('DOMContentLoaded', () => { window.addEventListener('DOMContentLoaded', () => {
const { version, local_search, code_block_tools, code_copy, lazyload } = KEEP.theme_config const { version, local_search, code_block, code_copy, lazyload } = KEEP.theme_config
KEEP.themeInfo = { KEEP.themeInfo = {
theme: `Keep v${version}`, theme: `Keep v${version}`,
@ -56,7 +56,7 @@ window.addEventListener('DOMContentLoaded', () => {
KEEP.initLocalSearch() KEEP.initLocalSearch()
} }
if (code_block_tools?.enable === true || code_copy?.enable === true) { if (code_block?.enable === true || code_copy?.enable === true) {
KEEP.initCodeBlockTools() KEEP.initCodeBlockTools()
} }