1 Commits

Author SHA1 Message Date
renovate[bot]
2da76caabb chore(deps): update dependency electron to v22 [security] 2023-10-05 22:15:33 +00:00
14 changed files with 101 additions and 129 deletions

3
.github/FUNDING.yml vendored
View File

@@ -1,3 +0,0 @@
ko_fi: jaywcjlove
buy_me_a_coffee: jaywcjlove
custom: ["https://www.paypal.me/kennyiseeyou", "https://jaywcjlove.github.io/#/sponsor"]

View File

@@ -8,16 +8,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build
- run: npm run doc
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
name: webiste
path: |
@@ -41,7 +41,7 @@ jobs:
uses: jaywcjlove/changelog-generator@main
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
uses: peaceiris/actions-gh-pages@v3
with:
commit_message: ${{ github.event.head_commit.message }} ${{steps.tag_version.outputs.tag}}
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -67,8 +67,8 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
@@ -78,62 +78,54 @@ jobs:
- run: echo "outputs.create_tag_versionNumber - ${{ needs.build.outputs.create_tag_versionNumber }}"
- run: echo "outputs.tag - ${{ needs.build.outputs.tag }}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Create Docker Image
- name: Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
# - name: Build wxmp image
# working-directory: website
# run: docker image build -t wxmp .
- name: Build and push multi-platform image
- name: Build wxmp image
working-directory: website
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ${{ secrets.DOCKER_USER }}/wxmp:latest \
--push .
run: docker image build -t wxmp .
- name: Build and push multi-platform image (with tag)
- name: Tags & Push image (latest)
run: |
echo "outputs.tag - ${{ needs.build.outputs.version }}"
docker tag wxmp ${{ secrets.DOCKER_USER }}/wxmp:latest
docker push ${{ secrets.DOCKER_USER }}/wxmp:latest
- name: Tags & Push image
if: needs.build.outputs.successful
working-directory: website
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ${{ secrets.DOCKER_USER }}/wxmp:${{ needs.build.outputs.version }} \
--push .
echo "outputs.tag - ${{ needs.build.outputs.version }}"
docker tag wxmp ${{ secrets.DOCKER_USER }}/wxmp:${{needs.build.outputs.version}}
docker push ${{ secrets.DOCKER_USER }}/wxmp:${{needs.build.outputs.version}}
# # Create Docker Image in GitHub
# - name: Login to GitHub registry
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Create Docker Image in GitHub
- name: Login to GitHub registry
run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# - name: Build docker image
# working-directory: website
# run: docker build -t ghcr.io/jaywcjlove/wxmp:latest .
- name: Build docker image
working-directory: website
run: docker build -t ghcr.io/jaywcjlove/wxmp:latest .
# - name: Publish to GitHub registry
# run: docker push ghcr.io/jaywcjlove/wxmp:latest
- name: Publish to GitHub registry
run: docker push ghcr.io/jaywcjlove/wxmp:latest
# - name: Tag docker image (beta) and publish to GitHub registry
# if: needs.build.outputs.successful
# run: |
# echo "version: v${{ needs.build.outputs.version }}"
# docker tag ghcr.io/jaywcjlove/wxmp:latest ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
# docker push ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
- name: Tag docker image (beta) and publish to GitHub registry
if: needs.build.outputs.successful
run: |
echo "version: v${{ needs.build.outputs.version }}"
docker tag ghcr.io/jaywcjlove/wxmp:latest ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
docker push ghcr.io/jaywcjlove/wxmp:${{needs.build.outputs.version}}
build_windows:
needs: [build]
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18
- name: Install
run: npm install --build-from-source
@@ -142,7 +134,7 @@ jobs:
- run: npm run build
# - run: npm run electron
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
@@ -155,8 +147,7 @@ jobs:
- working-directory: electron/app/dist
run: ls -R
- uses: actions/upload-artifact@v4
if: needs.build.outputs.successful == 'true'
- uses: actions/upload-artifact@v3
with:
name: wxmp-windows
path: |
@@ -167,16 +158,16 @@ jobs:
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18
- run: npm install
- run: npm run hoist
- run: npm run build
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
@@ -189,8 +180,7 @@ jobs:
- working-directory: electron/app/dist
run: ls -R
- uses: actions/upload-artifact@v4
if: needs.build.outputs.successful == 'true'
- uses: actions/upload-artifact@v3
with:
name: wxmp-macos
path: |
@@ -201,16 +191,16 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18
- run: npm install
- run: npm run hoist
- run: npm run build
# - run: npm run electron
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
@@ -223,8 +213,7 @@ jobs:
- working-directory: electron/app/dist
run: ls -R
- uses: actions/upload-artifact@v4
if: needs.build.outputs.successful == 'true'
- uses: actions/upload-artifact@v3
with:
name: wxmp-linux
path: |
@@ -234,26 +223,26 @@ jobs:
create_release:
needs: [build, build_windows, build_macos, build_linux]
if: needs.build.outputs.successful == 'true'
if: needs.build.outputs.successful
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: wxmp-linux
path: dist/linux
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: wxmp-macos
path: dist/macos
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v3
with:
name: wxmp-windows
path: dist/windows
@@ -272,9 +261,8 @@ jobs:
- name: Create Release
uses: ncipollo/release-action@v1
if: needs.build.outputs.successful == 'true'
if: needs.build.outputs.successful
with:
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.changelog.outputs.tag }}
tag: ${{ steps.changelog.outputs.tag }}
@@ -307,16 +295,17 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- run: echo "outputs.version - ${{ needs.build.outputs.create_tag_version }}"
- uses: dev-drprasad/delete-tag-and-release@v1.1
if: needs.build.outputs.successful == 'true'
- uses: dev-drprasad/delete-tag-and-release@v0.2.0
if: needs.build.outputs.successful
with:
delete_release: true
repo: jaywcjlove/wxmp
tag_name: '${{ needs.build.outputs.create_tag_version }}'
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -2,9 +2,6 @@
<h1 align="center">微信公众号 Markdown 编辑器</h1>
</div>
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![CI](https://github.com/jaywcjlove/wxmp/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/wxmp/actions/workflows/ci.yml)
[![微信公众号 Markdown 编辑器](https://user-images.githubusercontent.com/1680273/188264183-a6b8cb6a-92e1-4a73-afc5-4f0234b26ed3.png)](https://jaywcjlove.github.io/wxmp)
微信公众号文章 Markdown 在线编辑器,使用 markdown 语法创建一篇简介美观大方的微信公众号图文。由于发版本麻烦,和一些功能无法扩展停滞开发了,未来不再开发 Chrome 的插件(暂存在 chrome 分支),通过 web 版本定制更丰富的功能。

View File

@@ -2,7 +2,7 @@
"name": "wxmp",
"description": "微信公众号 Markdown 编辑器",
"homepage": "https://github.com/jaywcjlove/wxmp.git",
"version": "2.4.0",
"version": "2.3.3",
"main": "main.js",
"author": "Kenny Wong <398188662@qq.com>",
"private": true,
@@ -18,13 +18,13 @@
"build": "npm run copy && cross-env NODE_ENV=production electron-builder build --publish=never --config config.json"
},
"dependencies": {
"@wcj/wxmp-main": "2.4.0"
"@wcj/wxmp-main": "2.3.3"
},
"devDependencies": {
"@wcj/wxmp-preload": "2.4.0",
"@wcj/wxmp-preload": "2.3.3",
"cpy-cli": "^5.0.0",
"electron": "20.1.3",
"electron": "22.3.25",
"electron-builder": "23.3.3",
"website": "2.4.0"
"website": "2.3.3"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@wcj/wxmp-main",
"version": "2.4.0",
"version": "2.3.3",
"main": "./lib/index.js",
"private": true,
"scripts": {
@@ -11,6 +11,6 @@
"lib"
],
"devDependencies": {
"electron": "20.1.3"
"electron": "22.3.25"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@wcj/wxmp-preload",
"version": "2.4.0",
"version": "2.3.3",
"main": "./lib/index.js",
"private": true,
"scripts": {
@@ -11,6 +11,6 @@
"lib"
],
"devDependencies": {
"electron": "20.1.3"
"electron": "22.3.25"
}
}

View File

@@ -1,4 +1,4 @@
{
"version": "2.4.0",
"version": "2.3.3",
"packages": ["website", "electron/*"]
}

View File

@@ -14,14 +14,12 @@
},
"license": "MIT",
"devDependencies": {
"@lerna/legacy-package-management": "^8.0.0",
"@lerna/legacy-package-management": "^7.1.5",
"cross-env": "^7.0.3",
"husky": "^8.0.1",
"lerna": "^8.0.0",
"lerna": "^7.1.5",
"prettier": "^3.0.2",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"tsbb": "~4.4.0"
"tsbb": "~4.1.0"
},
"workspaces": {
"packages": [

View File

@@ -20,8 +20,6 @@ export default (conf: Configuration, env: 'development' | 'production', options:
}),
);
/** https://github.com/kktjs/kkt/issues/446 */
conf.ignoreWarnings = [{ module: /node_modules[\\/]parse5[\\/]/ }];
conf.module!.exprContextCritical = false;
if (env === 'production') {
conf.output = { ...conf.output, publicPath: './' };

View File

@@ -1,6 +1,6 @@
{
"name": "website",
"version": "2.4.0",
"version": "2.3.3",
"private": true,
"scripts": {
"start": "kkt start",
@@ -25,23 +25,23 @@
"@uiw/codemirror-theme-xcode": "^4.11.6",
"@uiw/react-back-to-top": "^1.2.0",
"@uiw/react-github-corners": "^1.5.15",
"@uiw/react-markdown-editor": "^6.0.0",
"@uiw/react-markdown-editor": "^5.11.2",
"@wcj/dark-mode": "^1.0.15",
"css-tree": "^2.2.1",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.3.0",
"react-router-dom": "^6.3.0",
"rehype-attr": "^3.0.0",
"rehype-ignore": "^2.0.0",
"rehype-prism-plus": "^2.0.0",
"rehype-raw": "^7.0.0",
"rehype-stringify": "^10.0.0",
"remark-gfm": "^4.0.0",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.0.0",
"styled-components": "~6.1.0",
"unified": "^11.0.0"
"rehype-attr": "^2.0.8",
"rehype-ignore": "^1.0.1",
"rehype-prism-plus": "^1.5.0",
"rehype-raw": "^6.1.1",
"rehype-stringify": "^9.0.3",
"remark-gfm": "^3.0.1",
"remark-parse": "^10.0.1",
"remark-rehype": "^10.1.0",
"styled-components": "~6.0.7",
"unified": "^10.1.2"
},
"devDependencies": {
"@kkt/less-modules": "^7.2.0",

View File

@@ -13,22 +13,16 @@ const Button = styled.button`
const CopyView: React.FC<{ command: ICommand; editorProps: IMarkdownEditor & ToolBarProps }> = (props) => {
const { editorProps } = props;
const handleClick = () => {
const dom: HTMLDivElement | null = editorProps.preview.current;
if (!dom) {
toast.error(<div>dom is null</div>);
return;
}
dom.focus();
const htmlContent = dom.innerHTML;
navigator.clipboard
.writeText(htmlContent)
.then(() => {
toast.success(<div></div>);
})
.catch((err) => {
toast.error(<div>{JSON.stringify(err)}</div>);
console.error('Failed to copy: ', err);
});
const dom = editorProps.preview.current;
dom?.focus();
window.getSelection()?.removeAllRanges();
let range = document.createRange();
range.setStartBefore(dom?.firstChild!);
range.setEndAfter(dom?.lastChild!);
window.getSelection()?.addRange(range);
document.execCommand(`copy`);
window.getSelection()?.removeAllRanges();
toast.success(<div></div>);
};
return (
<Button type="button" onClick={handleClick}>

View File

@@ -1,6 +1,5 @@
import MarkdownEditor, { getCommands } from '@uiw/react-markdown-editor';
import { useContext } from 'react';
// @ts-ignore
import { EditorView } from '@codemirror/view';
import { Preview } from './Preview';
import { copy } from '../../commands/copy';

View File

@@ -129,7 +129,7 @@ export const footnotesLabel = (node: Element) => {
];
};
export const imagesStyle = (node: Element, parent: Root | Element | undefined) => {
export const imagesStyle = (node: Element, parent: Root | Element | null) => {
if (
parent?.type === 'element' &&
/(p|a)/.test(parent.tagName) &&

View File

@@ -26,21 +26,21 @@ export function markdownToHTML(md: string, css: string, opts: MarkdownToHTMLOpti
parseCustomProperty: false,
positions: false,
});
// @ts-ignore
const data = cssdata(ast.children.head, {}, { color: opts.preColor, theme: opts.previewTheme });
const processor = unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkRehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(rehypePrism, {
ignoreMissing: true,
})
.use(rehypeRaw)
.use(rehypeIgnore, {})
.use(rehypeAttrs, { properties: 'attr' })
.use(rehypeRewrite, {
rewrite: (node, _index, parent) => {
// @ts-ignore
if (
node?.type === 'element' &&
node?.tagName === 'code' &&