Skip to content

Commit

Permalink
Merge pull request #82 from obgnail/dev
Browse files Browse the repository at this point in the history
updte fence_enhance, add disable_or_enable_indent button
  • Loading branch information
obgnail authored Aug 14, 2023
2 parents 868c9f9 + e923de2 commit ce84dd3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion plugin/fence_enhance.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
坏处是:绿皮
*/
const config = global._pluginUtils.getPluginSetting("fence_enhance");
const enableIndent = config.ENABLE_INDENT && !global._pluginUtils.isBetaVersion;
let enableIndent = config.ENABLE_INDENT && !global._pluginUtils.isBetaVersion;

(() => {
const css = `
Expand Down Expand Up @@ -227,6 +227,13 @@
},
];

if (enableIndent) {
callArgs.splice(2, 0, {
arg_name: "禁用/启用缩进调整按钮",
arg_value: "disable_or_enable_indent",
});
}

const callMap = {
disable_or_enable_fold: () => {
config.ENABLE_FOLD = !config.ENABLE_FOLD;
Expand All @@ -241,6 +248,11 @@
const display = (config.ENABLE_COPY) ? "block" : "none";
document.querySelectorAll(".fence-enhance .typora-copy-code").forEach(ele => ele.style.display = display);
},
disable_or_enable_indent: () => {
enableIndent = !enableIndent;
const display = (enableIndent) ? "block" : "none";
document.querySelectorAll(".fence-enhance .typora-indent-code").forEach(ele => ele.style.display = display);
},
fold_all: () => {
document.querySelectorAll(".typora-fold-code:not(.folded)").forEach(ele => ele.click());
config.FOLD_DEFAULT = true;
Expand Down

0 comments on commit ce84dd3

Please sign in to comment.