chore: remove deprecated workflows and scripts

This commit is contained in:
wood chen 2024-11-20 00:03:28 +08:00
parent b9f6bfddbd
commit fd70e62fce
29 changed files with 53808 additions and 9743 deletions

View File

@ -1,46 +0,0 @@
name: Build and Deploy
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
if: github.repository == 'doocs/md'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: dist
sync-to-gitee:
runs-on: ubuntu-latest
if: github.repository == 'doocs/md'
needs: build-and-deploy
steps:
- name: Sync to Gitee
uses: wearerequired/git-mirror-action@v1
env:
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
with:
source-repo: git@github.com:doocs/md.git
destination-repo: git@gitee.com:Doocs/md.git

View File

@ -1,43 +0,0 @@
name: Preview Build
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-preview:
runs-on: ubuntu-latest
if: github.repository == 'doocs/md'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 20
- name: Build
run: |
npm install
npm run build:h5-netlify
- name: Upload dist artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: 5
- name: Save PR number
if: ${{ always() }}
run: echo ${{ github.event.number }} > ./pr-id.txt
- name: Upload PR number
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: pr
path: ./pr-id.txt

View File

@ -1,89 +0,0 @@
name: Preview Deploy
on:
workflow_run:
workflows: ["Preview Build"]
types:
- completed
jobs:
success:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' && github.repository == 'doocs/md'
steps:
- name: Download PR artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
- name: Save PR id
id: pr
run: echo "::set-output name=id::$(<pr-id.txt)"
- name: Download dist artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: dist
- name: Upload surge service
id: deploy
run: |
export DEPLOY_DOMAIN=https://doocs-md-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
npx surge --project ./ --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
- name: Upload status comment
uses: actions-cool/maintain-one-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎊 PR Preview has been successfully built and deployed to https://doocs-md-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
- name: The job failed
if: ${{ failure() }}
uses: actions-cool/maintain-one-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
failed:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' && github.repository == 'doocs/md'
steps:
- name: Download PR artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
- name: Save PR id
id: pr
run: echo "::set-output name=id::$(<pr-id.txt)"
- name: The job failed
uses: actions-cool/maintain-one-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}

View File

@ -1,18 +0,0 @@
name: Preview Start
on: pull_request_target
jobs:
preview:
runs-on: ubuntu-latest
if: github.repository == 'doocs/md'
steps:
- name: Create
uses: actions-cool/maintain-one-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
⚡️ Deploying PR Preview...
<img src="https://user-images.githubusercontent.com/507615/90240294-8d2abd00-de5b-11ea-8140-4840a0b2d571.gif" width="300" />
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'

View File

@ -1,24 +0,0 @@
name: Create Cli Release
on:
push:
tags:
- 'cli-v*'
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'doocs/md'
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build-cli
- run: cd md-cli && npm ci && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

View File

@ -1,32 +0,0 @@
name: Create Release
on:
push:
tags:
- "v*"
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
if: github.repository == 'doocs/md'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
# 微信 Markdown 编辑器 ${{ github.ref }} 发布🎈
[![github](https://badgen.net/badge/>>/GitHub/cyan)](https://github.com/doocs/md/releases) [![gitee](https://badgen.net/badge/>>/Gitee/cyan)](https://gitee.com/doocs/md/releases)
> Markdown 文档自动即时渲染为微信图文,让你不再为微信文章排版而发愁!
draft: false
prerelease: false

View File

@ -1,4 +0,0 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run lint

View File

@ -1,5 +0,0 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
}

View File

@ -1,44 +0,0 @@
(async function () {
const fs = require('fs');
const path = require('path');
const packageJson = require('../md-cli/package.json');
const child_process = require('child_process');
// 自动更新版本
// version可以传递如 6.1.1 | patch | minor | major
const execCommand = arr => (Array.isArray(arr) ? arr : [arr]).forEach(c => {
try {
console.log(`start: ${c}...`)
console.log(child_process.execSync(c).toString('utf8'))
} catch (error) {
console.log('\x1B[31m%s\x1B[0m', error.stdout.toString())
process.exit(1)
}
})
const getNewVersion = (oldVersion, version = 'patch') => {
// [<newversion> | major | minor | patch]
if (/^([0-9]+\.*)+$/.test(version)) return version
const types = ['major', 'minor', 'patch']
const index = types.indexOf(version)
if (index >= 0) {
const versionArr = oldVersion.split('.')
versionArr[index] = Number(versionArr[index]) + 1
return versionArr.map((e, i) => i > index ? 0 : e).join('.')
}
return getNewVersion(oldVersion)
}
const newVersionObj = {
version: getNewVersion(packageJson.version, process.argv[2]),
};
fs.writeFileSync(
path.resolve(__dirname, '../md-cli/package.json'),
JSON.stringify(Object.assign({}, packageJson, newVersionObj), null, 2) +
'\n'
);
console.log(newVersionObj);
execCommand([
`git commit -a -m 'chore: update version cli-v${newVersionObj.version}'`,
`git tag cli-v${newVersionObj.version}`,
'git push && git push --tags',
])
console.log('\x1B[32m%s\x1B[0m', '发布完成请关注github CI构建')
}())

1
md-cli/.gitignore vendored
View File

@ -1 +0,0 @@
doocs-md-cli-*

View File

@ -1,2 +0,0 @@
.tgz
httpData/

View File

@ -1 +0,0 @@
registry=https://registry.npmjs.org

View File

@ -1,38 +0,0 @@
#!/usr/bin/env node
const { ProcessManager } = require(`@wll8/process-manager`);
const getPort = require(`get-port`)
const {
handleSpace,
colors,
parseArgv,
} = require(`./util.js`)
const arg = parseArgv()
new Promise(async () => {
let { port = 8800, testPort, replayPort } = arg
port = Number(port)
;[port, testPort, replayPort] = await Promise.all([port, port+1, port+2].map(item => getPort({port: item}) )).catch(err => console.log(`err`, err))
const line = Object.entries({
...arg,
proxy: `https://doocs.gitee.io/`,
port,
testPort,
replayPort,
'--config': handleSpace(`${__dirname}/mm.config.js`),
}).map(([key, val]) => `${key}=${val}`)
const cliArg = [handleSpace(`${__dirname}/node_modules/mockm/run.js`), `--log-line`, ...line]
console.log(`doocs/md-cli v${require(`./package.json`).version}`)
console.log(`服务启动中...`)
const cp = new ProcessManager(cliArg)
cp.on(`stdout`, (info = ``) => {
if(info.match(`:${port}/`)) {
console.log(`服务已启动:`)
console.log(`打开链接 ${colors.green(`http://127.0.0.1:${port}/md/`)} 即刻使用吧~`)
}
if(info.match(`Port is occupied`)) {
process.exit()
}
})
}).catch(err => console.log(err))

View File

@ -1,55 +0,0 @@
const fs = require(`fs`)
const path = require(`path`)
const {
dcloud,
parseArgv,
} = require(`./util.js`)
const arg = parseArgv()
// unicloud 服务空间配置
const spaceInfo = {
spaceId: ``,
clientSecret: ``,
...arg,
}
/**
* 配置说明请参考文档:
* https://hongqiye.com/doc/mockm/config/option.html
* @type {import('mockm/@types/config').Config}
*/
module.exports = util => {
const port = Number(arg.port) || 9000
return {
api: {
async '/upload'(req, res) {
const multiparty = await util.toolObj.generate.initPackge(`multiparty`)
const form = new multiparty.Form({
uploadDir: `${__dirname}/public/upload/`,
})
form.parse(req, async (err, fields = [], files) => {
const file = files.file[0]
let url = `http://127.0.0.1:${port}/public/upload/${path.parse(file.path).base}`
try {
url = await dcloud(spaceInfo)({name: file.originalFilename, file: fs.createReadStream(file.path)})
} catch (err) {
// console.log(err)
}
res.json({url})
})
},
},
static: [
{
fileDir: `${__dirname}/dist`,
path: `/md`,
},
{ // 访问公共目录
fileDir: `${__dirname}/public`,
path: `/public`,
},
],
}
}

8610
md-cli/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
{
"name": "@doocs/md-cli",
"version": "0.0.7",
"description": "✍ 一款高度简洁的微信 Markdown 编辑器:支持 Markdown 所有基础语法、色盘取色、一键复制并粘贴到公众号后台、多图上传、一键下载文档、自定义 CSS 样式、一键重置等特性",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"md-cli": "index.js"
},
"files": [
"dist",
"public",
"index.js",
"mm.config.js",
"util.js"
],
"keywords": [],
"author": "wll8",
"license": "ISC",
"dependencies": {
"@wll8/process-manager": "^1.0.1",
"form-data": "4.0.0",
"get-port": "5.1.1",
"mockm": "^1.1.27-alpha.2",
"node-fetch": "^3.2.10"
}
}

View File

@ -1,218 +0,0 @@
const fetch = (...args) => import(`node-fetch`).then(({default: fetch}) => fetch(...args))
const FormData = require(`form-data`)
/**
* 判断端口是否可用
* @param {string|array} port 多个端口用数组
*/
function portIsOk (port) {
if(typeof(port) === `object`) { // 判断多个端口
return Promise.all(port.map(item => portIsOk(item)))
}
return new Promise(resolve => {
const net = require(`net`)
const server = net.createServer().listen(port)
server.on(`listening`, () => server.close(resolve(true)))
server.on(`error`, () => resolve(port))
})
}
/**
* 处理不同系统的命令行空格差异, cp.spawn 中的参数中, 如果包含空格, win 平台需要使用双引号包裹, unix 不需要
* @param {string} str
*/
function handleSpace(str = ``) {
const newStr = require('os').type() === 'Windows_NT' && str.match(` `) ? `"${str}"` : str
return newStr
}
/**
* 自定义控制台颜色
* https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
* nodejs 内置颜色: https://nodejs.org/api/util.html#util_foreground_colors
*/
function colors () {
const util = require('util')
function colorize (color, text) {
const codes = util.inspect.colors[color]
return `\x1b[${codes[0]}m${text}\x1b[${codes[1]}m`
}
let returnValue = {}
Object.keys(util.inspect.colors).forEach((color) => {
returnValue[color] = (text) => colorize(color, text)
})
const colorTable = new Proxy(returnValue, {
get (obj, prop) {
// 在没有对应的具名颜色函数时, 返回空函数作为兼容处理
const res = obj[prop] ? obj[prop] : (arg => arg)
return res
}
})
// 取消下行注释, 查看所有的颜色和名字:
// Object.keys(returnValue).forEach((color) => console.log(returnValue[color](color)))
return colorTable
}
/**
* Promise 方式运行 spawn
* @param {*} cmd 主程序
* @param {*} args 程序参数数组
* @param {*} opts spawn 选项
*/
function spawn (cmd, args, opts) {
opts = { stdio: `inherit`, ...opts }
opts.shell = opts.shell || process.platform === 'win32'
return new Promise((resolve, reject) => {
const cp = require('child_process')
const child = cp.spawn(cmd, args, opts)
let stdout = ''
let stderr = ''
child.stdout && child.stdout.on('data', d => { stdout += d })
child.stderr && child.stderr.on('data', d => { stderr += d })
child.on('error', reject)
child.on('close', code => {
resolve({code, stdout, stderr})
})
})
}
/**
* 解析命令行参数
* @param {*} arr
* @returns
*/
function parseArgv(arr) {
return (arr || process.argv.slice(2)).reduce((acc, arg) => {
let [k, ...v] = arg.split('=')
v = v.join(`=`) // 把带有 = 的值合并为字符串
acc[k] = v === '' // 没有值时, 则表示为 true
? true
: (
/^(true|false)$/.test(v) // 转换指明的 true/false
? v === 'true'
: (
/[\d|.]+/.test(v)
? (isNaN(Number(v)) ? v : Number(v)) // 如果转换为数字失败, 则使用原始字符
: v
)
)
return acc
}, {})
}
function dcloud(spaceInfo) {
if(Boolean(spaceInfo.spaceId && spaceInfo.clientSecret) === false) {
throw new Error(`请填写 spaceInfo`)
}
function sign(data, secret) {
const hmac = require(`crypto`).createHmac(`md5`, secret)
// 排序 obj 再转换为 key=val&key=val 的格式
const str = Object.keys(data).sort().reduce((acc, cur) => `${acc}&${cur}=${data[cur]}`, ``).slice(1)
hmac.update(str)
return hmac.digest(`hex`)
}
async function anonymousAuthorize() {
const data = {
method: `serverless.auth.user.anonymousAuthorize`,
params: `{}`,
spaceId: spaceInfo.spaceId,
timestamp: Date.now(),
}
return await fetch(`https://api.bspapp.com/client`, {
headers: {
'x-serverless-sign': sign(data, spaceInfo.clientSecret),
},
body: `{"method":"serverless.auth.user.anonymousAuthorize","params":"{}","spaceId":"${spaceInfo.spaceId}","timestamp":${data.timestamp}}`,
method: `POST`,
}).then((res) => res.json())
}
async function report({ id, token }) {
const reportReq = {
method: `serverless.file.resource.report`,
params: `{"id":"${id}"}`,
spaceId: spaceInfo.spaceId,
timestamp: Date.now(),
token: token,
}
return await fetch(`https://api.bspapp.com/client`, {
headers: {
'x-basement-token': reportReq.token,
'x-serverless-sign': sign(reportReq, spaceInfo.clientSecret),
},
body: JSON.stringify(reportReq),
method: `POST`,
}).then((res) => res.json())
}
async function generateProximalSign({ name, token }) {
const data = {
method: `serverless.file.resource.generateProximalSign`,
params: `{"env":"public","filename":"${name}"}`,
spaceId: spaceInfo.spaceId,
timestamp: Date.now(),
token,
}
const res = await fetch(`https://api.bspapp.com/client`, {
headers: {
'x-basement-token': data.token,
'x-serverless-sign': sign(data, spaceInfo.clientSecret),
},
body: JSON.stringify(data),
method: `POST`,
}).then((res) => res.json())
return res
}
async function upload({ data, file }) {
const formdata = new FormData()
Object.entries({
'Cache-Control': `max-age=2592000`,
'Content-Disposition': `attachment`,
OSSAccessKeyId: data.accessKeyId,
Signature: data.signature,
host: data.host,
id: data.id,
key: data.ossPath,
policy: data.policy,
success_action_status: 200,
file,
}).forEach(([key, val]) => formdata.append(key, val))
return await fetch(`https://${data.host}`, {
headers: {
'X-OSS-server-side-encrpytion': `AES256`,
},
body: formdata,
method: `POST`,
})
}
async function uploadFile({ name = `unnamed.file`, file }) {
const token = (await anonymousAuthorize()).data.accessToken
const res = await generateProximalSign({ name, token })
await upload({ data: res.data, file })
await report({ id: res.data.id, token })
const fileUrl = `https://${res.data.cdnDomain}/${res.data.ossPath}`
return fileUrl
}
return uploadFile
}
module.exports = {
portIsOk,
handleSpace,
colors: colors(),
spawn,
parseArgv,
dcloud,
}

741
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
"private": false,
"scripts": {
"release:cli": "node ./bin/release.js",
"prepare": "husky install",
"lint": "vue-cli-service lint src",
"start": "npm run lint -- --fix && run-p serve",
"serve": "vue-cli-service serve",

79
public/assets/css/css.css Normal file

File diff suppressed because one or more lines are too long

BIN
public/assets/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

53316
public/assets/js/js.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,33 +3,21 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta
name="keywords"
content="md,markdown,markdown-editor,wechat,official-account,yanglbme,doocs"
/>
<meta
name="description"
content="Wechat Markdown Editor | 一款高度简洁的微信 Markdown 编辑器"
/>
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<title>微信 Markdown 编辑器 | Doocs 开源社区</title>
<title>微信 Markdown 编辑器</title>
<link
rel="shortcut icon"
href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/md/images/favicon.png"
/>
<link
rel="apple-touch-icon-precomposed"
href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/md/images/1648303220922-7e14aefa-816e-44c1-8604-ade709ca1c69.png"
href="./assets/favicon.png"
/>
<link
rel="stylesheet"
href="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/wechatsync/article-syncjs@latest/dist/styles.css"
href="./assets/css/css.css"
/>
<!-- KaTeX CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
<link rel="stylesheet" href="https://i-aws.czl.net/jsdelivr/npm/katex@0.16.9/dist/katex.min.css" >
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prettify/r298/prettify.min.js"></script>
<style>
@ -50,11 +38,5 @@
<!-- built files will be auto injected -->
</body>
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/wechatsync/article-syncjs@latest/dist/main.js"></script>
<!-- 支持一下 mermaid -->
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
window.mermaid = mermaid;
</script>
</html>

View File

View File

@ -1,57 +0,0 @@
<template>
<el-dialog
title="关于"
class="about__dialog"
:visible="visible"
@close="$emit('close')"
width="30%"
center
>
<div style="text-align: center">
<h3>一款高度简洁的微信 Markdown 编辑器</h3>
<p>扫码关注公众号 Doocs原创技术文章第一时间推送</p>
<img
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/md/images/1648303220922-7e14aefa-816e-44c1-8604-ade709ca1c69.png"
style="width: 40%"
/>
</div>
<template slot="footer">
<el-button
type="primary"
@click="onRedirect('https://github.com/doocs/md')"
plain
>
GitHub 仓库
</el-button>
<el-button
type="primary"
@click="onRedirect('https://gitee.com/doocs/md')"
plain
>
Gitee 仓库
</el-button>
</template>
</el-dialog>
</template>
<script>
export default {
props: {
visible: {
type: Boolean,
default: false,
},
},
methods: {
onRedirect(url) {
window.open(url)
},
},
}
</script>
<style lang="less" scoped>
/deep/ .el-dialog {
min-width: 420px;
}
</style>

View File

@ -121,13 +121,6 @@
<el-dropdown-item class="padding-left-3" @click.native="customStyle">
自定义 CSS
</el-dropdown-item>
<el-dropdown-item divided @click.native="codeBlockChanged">
<i
class="el-icon-check"
:style="{ opacity: isMacCodeBlock ? 1 : 0 }"
></i>
Mac 代码块
</el-dropdown-item>
<el-dropdown-item
divided
class="padding-left-3"
@ -137,16 +130,6 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown>
<span class="el-dropdown-link">
帮助<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="$emit('show-about-dialog')">
关于
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-button plain size="medium" :type="btnType" @click="copy">
复制
@ -187,7 +170,6 @@ export default {
return {
config,
citeStatus: false,
isMacCodeBlock: true,
showResetConfirm: false,
selectFont: ``,
selectSize: ``,
@ -248,7 +230,6 @@ export default {
codeTheme: (state) => state.codeTheme,
nightMode: (state) => state.nightMode,
currentCiteStatus: (state) => state.citeStatus,
currentIsMacCodeBlock: (state) => state.isMacCodeBlock,
}),
},
methods: {
@ -328,11 +309,6 @@ export default {
this.setCiteStatus(this.citeStatus)
this.$emit(`refresh`)
},
codeBlockChanged() {
this.isMacCodeBlock = !this.isMacCodeBlock
this.setIsMacCodeBlock(this.isMacCodeBlock)
this.$emit(`refresh`)
},
//
copy() {
this.$emit(`startCopy`)
@ -351,12 +327,6 @@ export default {
// position translateY
.replace(/top:(.*?)em/g, `transform: translateY($1em)`)
if (this.isMacCodeBlock) {
clipboardDiv.innerHTML = clipboardDiv.innerHTML.replaceAll(
/(<code class="prettyprint[^>]*)(style=")/g,
`$1style="font-family: Menlo, 'Operator Mono', Consolas, Monaco, monospace;`
)
}
clipboardDiv.focus()
window.getSelection().removeAllRanges()
let range = document.createRange()
@ -412,8 +382,6 @@ export default {
this.selectSize = this.currentSize
this.selectColor = this.currentColor
this.selectCodeTheme = this.codeTheme
this.isMacCodeBlock = false
this.codeBlockChanged()
},
cancelReset() {
@ -429,7 +397,6 @@ export default {
`setCssEditorValue`,
`setCurrentCodeTheme`,
`setWxRendererOptions`,
`setIsMacCodeBlock`,
]),
},
mounted() {
@ -438,7 +405,6 @@ export default {
this.selectColor = this.currentColor
this.selectCodeTheme = this.codeTheme
this.citeStatus = this.currentCiteStatus
this.isMacCodeBlock = this.currentIsMacCodeBlock
const fileInput = this.$refs.fileInput
fileInput.onchange = () => {

View File

@ -165,36 +165,6 @@ export const useStore = defineStore(`store`, {
// 附加的一些 style
output += this.wxRenderer.buildAddition()
}
if (this.isMacCodeBlock) {
output += `
<style>
.hljs.code__pre::before {
position: initial;
padding: initial;
content: '';
display: block;
height: 25px;
background-color: transparent;
background-image: url("https://doocs.oss-cn-shenzhen.aliyuncs.com/img/123.svg");
background-position: 14px 10px;
background-repeat: no-repeat;
background-size: 40px;
}
.hljs.code__pre {
padding: 0!important;
}
.hljs.code__pre code {
display: -webkit-box;
padding: 0.5em 1em 1em;
overflow-x: auto;
text-indent: 0;
}
</style>
`
}
this.output = output
},
},

View File

@ -12,7 +12,6 @@
@download="downloadEditorContent"
@export="exportEditorContent"
@showCssEditor="showCssEditor = !showCssEditor"
@show-about-dialog="aboutDialogVisible = true"
@show-dialog-form="insertFormDialogVisible = true"
@show-dialog-upload-img="dialogUploadImgVisible = true"
@startCopy=";(isCoping = true), (backLight = true)"
@ -69,10 +68,6 @@
@uploadImage="uploadImage"
@uploaded="uploaded"
></upload-img-dialog>
<about-dialog
:visible="aboutDialogVisible"
@close="aboutDialogVisible = false"
></about-dialog>
<insert-form-dialog
:visible="insertFormDialogVisible"
@close="insertFormDialogVisible = false"
@ -94,7 +89,6 @@ import { mapState, mapActions } from 'pinia'
import { useStore } from '@/stores'
import EditorHeader from '@/components/CodemirrorEditor/EditorHeader/index'
import AboutDialog from '@/components/CodemirrorEditor/AboutDialog'
import InsertFormDialog from '@/components/CodemirrorEditor/InsertFormDialog'
import RightClickMenu from '@/components/CodemirrorEditor/RightClickMenu'
import UploadImgDialog from '@/components/CodemirrorEditor/UploadImgDialog'
@ -120,7 +114,6 @@ export default {
data() {
return {
showCssEditor: false,
aboutDialogVisible: false,
dialogUploadImgVisible: false,
insertFormDialogVisible: false,
isCoping: false,
@ -138,7 +131,6 @@ export default {
CssEditor,
RunLoading,
EditorHeader,
AboutDialog,
InsertFormDialog,
RightClickMenu,
UploadImgDialog,