mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-12 00:08:50 +08:00
style: modify theme style.
This commit is contained in:
@@ -2,10 +2,12 @@
|
|||||||
<h1 align="center">微信公众号 Markdown 编辑器</h1>
|
<h1 align="center">微信公众号 Markdown 编辑器</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||

|
[](https://jaywcjlove.github.io/wxmp)
|
||||||
|
|
||||||
微信公众号文章 Markdown 在线编辑器,使用 markdown 语法创建一篇简介美观大方的微信公众号图文。由于发版本麻烦,和一些功能无法扩展停滞开发了,未来不再开发 Chrome 的插件(暂存在 chrome 分支),通过 web 版本定制更丰富的功能。
|
微信公众号文章 Markdown 在线编辑器,使用 markdown 语法创建一篇简介美观大方的微信公众号图文。由于发版本麻烦,和一些功能无法扩展停滞开发了,未来不再开发 Chrome 的插件(暂存在 chrome 分支),通过 web 版本定制更丰富的功能。
|
||||||
|
|
||||||
|
[](https://jaywcjlove.github.io/wxmp)
|
||||||
|
|
||||||
## 功能特性
|
## 功能特性
|
||||||
|
|
||||||
开发计划和一些功能介绍,有需求可以在 issue 中提,使得工具变得更加完善。下面示例用于 web 应用中效果展示。
|
开发计划和一些功能介绍,有需求可以在 issue 中提,使得工具变得更加完善。下面示例用于 web 应用中效果展示。
|
||||||
@@ -19,7 +21,7 @@
|
|||||||
- [ ] 支持色盘取色,快速替换文章整体色调
|
- [ ] 支持色盘取色,快速替换文章整体色调
|
||||||
- [x] 支持 URL 参数加载 Markdown 内容。
|
- [x] 支持 URL 参数加载 Markdown 内容。
|
||||||
- [x] 支持 URL 参数选择预览主题。
|
- [x] 支持 URL 参数选择预览主题。
|
||||||
- [x] 使用 electron 生成桌面应用。
|
- [x] CI 自动生成 Electron 桌面应用。
|
||||||
|
|
||||||
### 支持代码块样式
|
### 支持代码块样式
|
||||||
|
|
||||||
@@ -126,7 +128,7 @@ Markdown URL 地址: https://raw.githubusercontent.com/jaywcjlove/c-tutorial/mas
|
|||||||
|
|
||||||
## 主题定制
|
## 主题定制
|
||||||
|
|
||||||
在目录 `src/themes` 中存放默认主题,在 `src/store/context.tsx` 中配置主题,主题使用 css 定义样式,不支持复杂的选择器。提供在线主题编辑器,欢迎修改并 PR 进仓库供大家使用。
|
在目录 `website/src/themes` 中存放默认主题,在 `website/src/store/context.tsx` 中配置主题,主题使用 `css` 定义样式,不支持复杂的选择器。提供在线主题编辑器,欢迎修改并 `PR` 进仓库供大家使用。
|
||||||
|
|
||||||
```css
|
```css
|
||||||
/* 1~6 标题样式定义 */
|
/* 1~6 标题样式定义 */
|
||||||
|
|||||||
@@ -14,15 +14,16 @@ export class App {
|
|||||||
async createWindow(options: Options = {}, loadURL?: string) {
|
async createWindow(options: Options = {}, loadURL?: string) {
|
||||||
await app.whenReady();
|
await app.whenReady();
|
||||||
const opts: Options = {
|
const opts: Options = {
|
||||||
titleBarStyle: 'hidden', // 无标题栏
|
// titleBarStyle: 'hiddenInset', // 无标题栏
|
||||||
frame: false, // 创建无边窗口
|
// frame: false, // 创建无边窗口
|
||||||
width: 800,
|
width: 850,
|
||||||
height: 600,
|
height: 600,
|
||||||
minWidth: 850,
|
minWidth: 850,
|
||||||
|
minHeight: 600,
|
||||||
center: true,
|
center: true,
|
||||||
maximizable: true,
|
// maximizable: true,
|
||||||
minimizable: true,
|
// minimizable: true,
|
||||||
resizable: true,
|
// resizable: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
// 多线程
|
// 多线程
|
||||||
nodeIntegrationInWorker: true,
|
nodeIntegrationInWorker: true,
|
||||||
|
|||||||
@@ -1,18 +1,4 @@
|
|||||||
const styleStr = `.siderbar {
|
const styleStr = `.header .logo {}`;
|
||||||
-webkit-app-region: drag;
|
|
||||||
}
|
|
||||||
.siderbar header h1 a, github-corners {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
article.content:before {
|
|
||||||
-webkit-app-region: drag;
|
|
||||||
position: absolute;
|
|
||||||
content: ' ';
|
|
||||||
display: block;
|
|
||||||
height: 41px;
|
|
||||||
width: 100%;
|
|
||||||
z-index: -1;
|
|
||||||
}`;
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const head = document.querySelector('head');
|
const head = document.querySelector('head');
|
||||||
|
|||||||
@@ -8,14 +8,22 @@ import { ReactComponent as Loading } from '../assets/tail-spin.svg';
|
|||||||
import { Context } from '../store/context';
|
import { Context } from '../store/context';
|
||||||
|
|
||||||
const Warpper = styled.div``;
|
const Warpper = styled.div``;
|
||||||
|
const HeaderPlace = styled.div`
|
||||||
|
position: relative;
|
||||||
|
height: 2.8rem;
|
||||||
|
`;
|
||||||
|
|
||||||
const Header = styled.header`
|
const Header = styled.header`
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
background: var(--color-canvas-default);
|
||||||
border-bottom: 1px solid var(--color-border-muted);
|
border-bottom: 1px solid var(--color-border-muted);
|
||||||
padding: 0.5rem 0.6rem 0.5rem 1rem;
|
padding: 0.5rem 0.6rem 0.5rem 0.8rem;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 9;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Article = styled.article`
|
const Article = styled.article`
|
||||||
@@ -82,8 +90,9 @@ export function Layout() {
|
|||||||
const { isLoading } = useContext(Context);
|
const { isLoading } = useContext(Context);
|
||||||
return (
|
return (
|
||||||
<Warpper className="wmde-markdown-color">
|
<Warpper className="wmde-markdown-color">
|
||||||
<Header>
|
<HeaderPlace>
|
||||||
<Article>
|
<Header className="header">
|
||||||
|
<Article className="logo">
|
||||||
<Logo width={28} height={28} />
|
<Logo width={28} height={28} />
|
||||||
<Title>
|
<Title>
|
||||||
微信公众号排版编辑器
|
微信公众号排版编辑器
|
||||||
@@ -101,6 +110,7 @@ export function Layout() {
|
|||||||
</a>
|
</a>
|
||||||
</Section>
|
</Section>
|
||||||
</Header>
|
</Header>
|
||||||
|
</HeaderPlace>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Warpper>
|
</Warpper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ import { Context } from '../../store/context';
|
|||||||
|
|
||||||
import { markdownToHTML } from '../../utils/markdownToHTML';
|
import { markdownToHTML } from '../../utils/markdownToHTML';
|
||||||
|
|
||||||
const Warpper = styled.div`
|
export const Warpper = styled.div`
|
||||||
width: 375px;
|
width: 375px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-shadow: 0 0 60px rgb(0 0 0 / 10%);
|
box-shadow: 0 0 60px rgb(0 0 0 / 10%);
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
font-size: 17px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Preview = (props: MarkdownPreviewProps) => {
|
export const Preview = (props: MarkdownPreviewProps) => {
|
||||||
|
|||||||
@@ -1,24 +1,18 @@
|
|||||||
import MarkdownEditor, { getCommands } from '@uiw/react-markdown-editor';
|
import MarkdownEditor, { getCommands } from '@uiw/react-markdown-editor';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { EditorView } from '@codemirror/view';
|
import { EditorView } from '@codemirror/view';
|
||||||
import styled from 'styled-components';
|
|
||||||
import { Preview } from './Preview';
|
import { Preview } from './Preview';
|
||||||
import { copy } from '../../commands/copy';
|
import { copy } from '../../commands/copy';
|
||||||
import { theme as themeCommand, previeTheme } from '../../commands/theme';
|
import { theme as themeCommand, previeTheme } from '../../commands/theme';
|
||||||
import { cssCommand } from '../../commands/css';
|
import { cssCommand } from '../../commands/css';
|
||||||
import { Context, themes } from '../../store/context';
|
import { Context, themes } from '../../store/context';
|
||||||
|
|
||||||
export const Warpper = styled.div`
|
|
||||||
height: calc(100vh - 2.9rem);
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const HomePage = () => {
|
export const HomePage = () => {
|
||||||
const commands = [...getCommands(), themeCommand];
|
const commands = [...getCommands(), themeCommand];
|
||||||
const { theme, markdown, isLoading, setMarkdown } = useContext(Context);
|
const { theme, markdown, isLoading, setMarkdown } = useContext(Context);
|
||||||
const themeValue = themes[theme].value;
|
const themeValue = themes[theme].value;
|
||||||
const handleChange = (value: string) => setMarkdown(value);
|
const handleChange = (value: string) => setMarkdown(value);
|
||||||
return (
|
return (
|
||||||
<Warpper>
|
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
value={markdown}
|
value={markdown}
|
||||||
toolbars={commands}
|
toolbars={commands}
|
||||||
@@ -30,8 +24,7 @@ export const HomePage = () => {
|
|||||||
previewWidth="420px"
|
previewWidth="420px"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
visible={true}
|
visible={true}
|
||||||
height="calc(100vh - 4.70rem)"
|
height="calc(100vh - 4.6rem)"
|
||||||
/>
|
/>
|
||||||
</Warpper>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
import { MarkdownPreviewProps } from '@uiw/react-markdown-preview';
|
import { MarkdownPreviewProps } from '@uiw/react-markdown-preview';
|
||||||
import styled from 'styled-components';
|
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { Context } from '../../store/context';
|
import { Context } from '../../store/context';
|
||||||
|
|
||||||
import { markdownToHTML } from '../../utils/markdownToHTML';
|
import { markdownToHTML } from '../../utils/markdownToHTML';
|
||||||
|
import { Warpper } from '../home/Preview';
|
||||||
const Warpper = styled.div`
|
|
||||||
width: 375px;
|
|
||||||
padding: 20px;
|
|
||||||
box-shadow: 0 0 60px rgb(0 0 0 / 10%);
|
|
||||||
min-height: 100%;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const Preview = (props: MarkdownPreviewProps) => {
|
export const Preview = (props: MarkdownPreviewProps) => {
|
||||||
const { css, markdown } = useContext(Context);
|
const { css, markdown } = useContext(Context);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { previousCommand } from '../../commands/css';
|
|||||||
import { themeTitle } from '../../commands/title';
|
import { themeTitle } from '../../commands/title';
|
||||||
import { theme as themeCommand, previeTheme } from '../../commands/theme';
|
import { theme as themeCommand, previeTheme } from '../../commands/theme';
|
||||||
import { Context, themes } from '../../store/context';
|
import { Context, themes } from '../../store/context';
|
||||||
import { Warpper } from '../home';
|
|
||||||
|
|
||||||
export const EditorPage = () => {
|
export const EditorPage = () => {
|
||||||
const commands = [themeTitle, themeCommand, previousCommand];
|
const commands = [themeTitle, themeCommand, previousCommand];
|
||||||
@@ -17,7 +16,6 @@ export const EditorPage = () => {
|
|||||||
const value = themes[theme].value;
|
const value = themes[theme].value;
|
||||||
const handleChange = (value: string) => setCss(value);
|
const handleChange = (value: string) => setCss(value);
|
||||||
return (
|
return (
|
||||||
<Warpper>
|
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
value={css}
|
value={css}
|
||||||
theme={value}
|
theme={value}
|
||||||
@@ -29,8 +27,7 @@ export const EditorPage = () => {
|
|||||||
previewWidth="420px"
|
previewWidth="420px"
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
visible={true}
|
visible={true}
|
||||||
height="calc(100vh - 4.92rem)"
|
height="calc(100vh - 4.6rem)"
|
||||||
/>
|
/>
|
||||||
</Warpper>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ h4 {
|
|||||||
p {
|
p {
|
||||||
color: initial;
|
color: initial;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
@@ -46,12 +47,14 @@ ol {
|
|||||||
li {
|
li {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ h2 {
|
|||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
@@ -64,11 +65,11 @@ li {
|
|||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
color: rgb(30 41 59);
|
color: rgb(30 41 59);
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1.75;
|
|
||||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
@@ -78,6 +79,7 @@ blockquote {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: rgba(27, 31, 35, 0.05);
|
background: rgba(27, 31, 35, 0.05);
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
@@ -143,7 +145,7 @@ th {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
white-space: initial;
|
white-space: initial;
|
||||||
color: #009874;
|
color: #333;
|
||||||
background: rgba(27, 31, 35, 0.05);
|
background: rgba(27, 31, 35, 0.05);
|
||||||
padding: 0.1em 0.3em;
|
padding: 0.1em 0.3em;
|
||||||
border-radius: 0.3em;
|
border-radius: 0.3em;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ h2 {
|
|||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
@@ -64,11 +65,11 @@ li {
|
|||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
color: rgb(30 41 59);
|
color: rgb(30 41 59);
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1.75;
|
|
||||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
@@ -78,6 +79,7 @@ blockquote {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: rgba(27, 31, 35, 0.05);
|
background: rgba(27, 31, 35, 0.05);
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ h2 {
|
|||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
@@ -65,7 +66,7 @@ li {
|
|||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1.75;
|
line-height: 1.5em;
|
||||||
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
font-family: -apple-system-font, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB',
|
||||||
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
'Microsoft YaHei UI', 'Microsoft YaHei', Arial, sans-serif;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
@@ -140,12 +141,12 @@ th {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
white-space: initial;
|
white-space: initial;
|
||||||
color: #ffb11b;
|
color: #333;
|
||||||
background: rgba(27, 31, 35, 0.05);
|
background: rgba(27, 31, 35, 0.05);
|
||||||
padding: 0.1em 0.3em;
|
padding: 0.1em 0.3em;
|
||||||
border-radius: 0.3em;
|
border-radius: 0.3em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1em;
|
font-size: 0.85em;
|
||||||
top: -0.1em;
|
top: -0.1em;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user