From d06fbad9c25bd781b2b0d29559f0e01529082f59 Mon Sep 17 00:00:00 2001 From: yanglbme Date: Thu, 7 Nov 2019 14:06:59 +0800 Subject: [PATCH] style: update font size list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新字号列表 --- assets/scripts/editor.js | 6 +-- assets/scripts/renderers/wx-renderer.js | 56 ++++++++++++------------- assets/scripts/sync-scroll.js | 3 +- assets/scripts/util.js | 1 + 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/assets/scripts/editor.js b/assets/scripts/editor.js index 7626509..894a491 100644 --- a/assets/scripts/editor.js +++ b/assets/scripts/editor.js @@ -22,9 +22,9 @@ let app = new Vue({ } ], sizeOption: [ + { label: '13px', value: '13px', desc: '稍小' }, { label: '14px', value: '14px', desc: '推荐' }, - { label: '15px', value: '15px', desc: '正常' }, - { label: '16px', value: '16px', desc: '稍大' }, + { label: '15px', value: '15px', desc: '稍大' }, ], colorOption: [ { label: '橘红', value: 'rgba(255, 95, 46, 0.9)', hex: '#FF5F2E' }, @@ -35,7 +35,7 @@ let app = new Vue({ }; d.currentEditorTheme = d.editorThemes[0].value; d.currentFont = d.builtinFonts[0].value; - d.currentSize = d.sizeOption[0].value; + d.currentSize = d.sizeOption[1].value; d.currentColor = d.colorOption[1].value; return d; }, diff --git a/assets/scripts/renderers/wx-renderer.js b/assets/scripts/renderers/wx-renderer.js index 2d9234f..df76110 100644 --- a/assets/scripts/renderers/wx-renderer.js +++ b/assets/scripts/renderers/wx-renderer.js @@ -49,7 +49,7 @@ let WxRenderer = function (opts) { for (const key in dict) { arr.push(key + ':' + dict[key]) } - return `style="${ arr.join(';') + (addition || '') }"` + return `style="${arr.join(';') + (addition || '')}"` }; let addFootnote = function (title, link) { @@ -61,11 +61,11 @@ let WxRenderer = function (opts) { this.buildFootnotes = function () { let footnoteArray = footnotes.map(function (x) { if (x[1] === x[2]) { - return `[${ x[0] }]: ${ x[1] }
` + return `[${x[0]}]: ${x[1]}
` } - return `[${ x[0] }] ${ x[1] }: ${ x[2] }
` + return `[${x[0]}] ${x[1]}: ${x[2]}
` }); - return `

引用链接

${ footnoteArray.join('\n') }

` + return `

引用链接

${footnoteArray.join('\n')}

` }; this.buildAddition = function () { @@ -103,21 +103,21 @@ let WxRenderer = function (opts) { renderer.heading = function (text, level) { switch (level) { case 1: - return `

${ text }

`; + return `

${text}

`; case 2: - return `

${ text }

`; + return `

${text}

`; case 3: - return `

${ text }

`; + return `

${text}

`; default: - return `

${ text }

`; + return `

${text}

`; } }; renderer.paragraph = function (text) { - return `

${ text }

` + return `

${text}

` }; renderer.blockquote = function (text) { - text = text.replace(//, `

`); - return `

${ text }
` + text = text.replace(//, `

`); + return `

${text}
` }; renderer.code = function (text, infoString) { text = text.replace(/${ (line || '
') }
`); + codeLines.push(`${(line || '
')}
`); numbers.push('
  • ') } let lang = infoString || ''; return `
    ` - + `
      ${ numbers.join('') }
    ` - + `
    `
    +        + `
      ${numbers.join('')}
    ` + + `
    `
             + codeLines.join('')
             + `
    ` }; renderer.codespan = function (text, infoString) { - return `${ text }` + return `${text}` }; renderer.listitem = function (text) { - return `<%s/>${ text }`; + return `<%s/>${text}`; }; renderer.list = function (text, ordered, start) { text = text.replace(/<\/*p.*?>/g, ''); let segments = text.split(`<%s/>`); if (!ordered) { text = segments.join('•'); - return `

    ${ text }

    `; + return `

    ${text}

    `; } text = segments[0]; for (let i = 1; i < segments.length; i++) { text = text + i + '.' + segments[i]; } - return `

    ${ text }

    `; + return `

    ${text}

    `; }; renderer.image = function (href, title, text) { let subText = ''; if (text) { - subText = `
    ${ text }
    ` + subText = `
    ${text}
    ` } let figureStyles = getStyles('figure'); let imgStyles = getStyles(ENV_STRETCH_IMAGE ? 'image' : 'image_org'); - return `
    ${ text }${ subText }
    ` + return `
    ${text}${subText}
    ` }; renderer.link = function (href, title, text) { if (href.indexOf('https://mp.weixin.qq.com') === 0) { - return `${ text }`; + return `${text}`; } else if (href === text) { return text; } else { if (ENV_USE_REFERENCES) { let ref = addFootnote(title || text, href); - return `${ text }[${ ref }]`; + return `${text}[${ref}]`; } else { - return `${ text }`; + return `${text}`; } } }; renderer.strong = function (text) { - return `${ text }`; + return `${text}`; }; renderer.em = function (text) { - return `

    ${ text }

    ` + return `

    ${text}

    ` }; - renderer.table = function (header, body) { - return `${ header }${ body }
    `; + renderer.table = function (header, body) { + return `${header}${body}
    `; }; renderer.tablecell = function (text, flags) { - return `${ text }`; + return `${text}`; }; renderer.hr = function () { return `
    `; diff --git a/assets/scripts/sync-scroll.js b/assets/scripts/sync-scroll.js index d1b4b40..cbcb5f3 100644 --- a/assets/scripts/sync-scroll.js +++ b/assets/scripts/sync-scroll.js @@ -1,7 +1,6 @@ // 左右栏同步滚动 - $(document).ready(function () { - + let timeout; $('div.CodeMirror-scroll, #preview').on("scroll", function callback() { diff --git a/assets/scripts/util.js b/assets/scripts/util.js index f7f44c5..3dac172 100644 --- a/assets/scripts/util.js +++ b/assets/scripts/util.js @@ -1,3 +1,4 @@ +// 设置自定义颜色 function setColorWithTemplate(template) { return function(color) { let custom_theme = JSON.parse(JSON.stringify(template));