Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit b0aaba3

Browse files
authored
refactor(editor): rich editor integrate (#1161)
* chore(editor): basic debug version * chore: editor plugin debug * chore: editor list debug * chore: editor table styles * chore(editor): plugin merge in * chore(editor): plugin debug wip * chore(editor): plugin debug wip * chore(editor): overwrite styles * chore(editor): update to latest * chore(editor): overwrite styles * refactor(comments): adjust heart emotion * style(editor): adjust image plugin * chore(editor): update * refactor(editor): re-org ArticleEditor * refactor(editor): basic publish note * refactor(editor): add community badge & adjust styles * refactor(editor): adjust rules & styles * chore: wip * refactor(blog-editor): basic UX * refactor(blog-editor): feeditem UX adjust * refactor(blog-editor): wip * chore: wip * refactor(blog-editor): improve error handler * refactor(error-box): style adjust * refactor: new site logo! * refactor: new site logo! * chore(editor): bump version * chore(editor): community badge & style adjust
1 parent bb12365 commit b0aaba3

File tree

116 files changed

+32455
-25679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+32455
-25679
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = {
4141
},
4242
},
4343
rules: {
44+
'react/require-default-props': 0,
4445
'@typescript-eslint/no-var-requires': 0,
4546
'@typescript-eslint/ban-ts-comment': 0,
4647
'no-setter-return': 0,

package-lock.json

Lines changed: 30009 additions & 12858 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@
4141
},
4242
"dependencies": {
4343
"@babel/core": "^7.13.14",
44-
"@editorjs/checklist": "^1.1.0",
45-
"@editorjs/delimiter": "^1.1.0",
46-
"@editorjs/editorjs": "^2.15.0",
47-
"@editorjs/header": "^2.3.0",
48-
"@editorjs/inline-code": "^1.3.0",
49-
"@editorjs/list": "^1.4.0",
50-
"@editorjs/marker": "^1.2.1",
51-
"@groupher/editor-header": "^2.3.0",
52-
"@groupher/editor-quote": "^2.3.0",
44+
"@groupher/react-editor": "^1.1.25",
5345
"@next/bundle-analyzer": "^9.4.4",
5446
"@sentry/browser": "5.17.0",
5547
"@sentry/node": "5.17.0",
@@ -66,10 +58,6 @@
6658
"cookie-parser": "^1.4.4",
6759
"core-js": "3.6.5",
6860
"cross-env": "^7.0.2",
69-
"draft-js": "^0.10.5",
70-
"draft-js-linkify-plugin": "^2.0.1",
71-
"draft-js-mention-plugin": "3.1.3",
72-
"draft-js-plugins-editor": "2.1.1",
7361
"express": "^4.16.4",
7462
"glob": "^7.1.2",
7563
"graphql": "^15.5.1",
@@ -94,7 +82,7 @@
9482
"promise-timeout": "^1.3.0",
9583
"prop-types": "^15.5.10",
9684
"pubsub-js": "^1.9.3",
97-
"qrcode-react": "^0.1.16",
85+
"qrcode.react": "^1.0.1",
9886
"ramda": "0.26.1",
9987
"react": "17.0.2",
10088
"react-animation": "^1.2.2",

server/routes.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ router.route('/create/article').get((req, res) => {
113113
return renderAndCache({ req, res, page: '/create/article' })
114114
})
115115

116-
// 创建新社区
116+
// 创建新博客
117+
router.route('/create/blog').get((req, res) => {
118+
return renderAndCache({ req, res, page: '/create/blog' })
119+
})
120+
121+
// 创建新作品
117122
router.route('/create/works').get((req, res) => {
118123
return renderAndCache({ req, res, page: '/create/works' })
119124
})

src/components/Buttons/styles/icon_button.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { theme } from '@/utils/themes'
99
import css from '@/utils/css'
1010

1111
import UpvoteIcon from '@/icons/Upvote'
12+
import EditPenIcon from '@/icons/EditPen'
1213
import LockIcon from '@/icons/Lock'
1314
import ExpandIcon from '@/icons/Expand'
1415
import FoldIcon from '@/icons/Fold'
@@ -49,6 +50,10 @@ export const getIcon = (type: string): FC<TIcon> => {
4950
return getStyledIcon(UpvoteIcon)
5051
}
5152

53+
case SVG.EDIT_PEN: {
54+
return getStyledIcon(EditPenIcon)
55+
}
56+
5257
case SVG.LOCK: {
5358
return getStyledIcon(LockIcon)
5459
}

src/components/CommunityFaceLogo/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import { FC, memo } from 'react'
88
import { isEmpty } from 'ramda'
99

10-
import { SITE_LOGO } from '@/config'
1110
import { HCN } from '@/constant'
1211
// import { ICON_BASE } from '@/config'
1312
import { buildLog } from '@/utils/logger'
@@ -33,7 +32,7 @@ const CommunityFaceLogo: FC<TProps> = ({
3332
className = 'community-facelogo-class',
3433
}) => {
3534
if (raw === HCN || isEmpty(src)) {
36-
return <HomeLogo src={SITE_LOGO} className={className} />
35+
return <HomeLogo className={className} />
3736
}
3837

3938
return (

src/components/CommunityFaceLogo/styles/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import styled from 'styled-components'
22

33
import { theme } from '@/utils/themes'
44
import Img from '@/Img'
5+
import SiteLogo from '@/icons/CPLogo'
56

67
export const Logo = styled(Img)<{ noFill?: boolean }>`
78
fill: ${({ noFill }) => (noFill ? '' : theme('banner.desc'))};
89
display: block;
910
`
1011

11-
export const HomeLogo = styled(Logo)`
12-
transform: rotate(20deg);
12+
export const HomeLogo = styled(SiteLogo)`
13+
fill: #007fa8;
14+
filter: saturate(0.8);
1315
`

src/components/EmotionSelector/Panel.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@ import { values } from 'ramda'
33

44
import { EMOTION } from '@/constant'
55
import { ICON } from '@/config'
6-
import { Wrapper, EIcon } from './styles/panel'
6+
import { Wrapper, Item, EIcon, Name } from './styles/panel'
7+
8+
const Trans = {
9+
downvote: '踩',
10+
beer: '啤酒',
11+
heart: '感谢',
12+
confused: '狗头',
13+
popcorn: '吃瓜',
14+
pill: '药丸',
15+
}
716

817
const EmojiPanel: FC = () => {
918
return (
1019
<Wrapper>
1120
{values(EMOTION).map((item) => (
12-
<EIcon
13-
key={item}
14-
src={`${ICON}/emotion/${item}.png`}
15-
name={item}
16-
noLazy
17-
/>
21+
<Item key={item} name={item}>
22+
<EIcon src={`${ICON}/emotion/${item}.png`} name={item} noLazy />
23+
<Name>{Trans[item]}</Name>
24+
</Item>
1825
))}
1926
</Wrapper>
2027
)

src/components/EmotionSelector/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const EmotionSelector: FC<TProps> = ({
4646
return (
4747
<Wrapper testid={testid}>
4848
<SelectedEmotions emotions={emotionsCoverter(emotions)} />
49-
<Tooltip content={<Panel />} trigger="click">
49+
<Tooltip content={<Panel />} trigger="click" noPadding>
5050
<IconButton path="emotion/emotion.svg" mRight={0} mTop={1} />
5151
</Tooltip>
5252
</Wrapper>

src/components/EmotionSelector/styles/panel.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,40 @@ import styled from 'styled-components'
22

33
import Img from '@/Img'
44
import css from '@/utils/css'
5+
import { theme } from '@/utils/themes'
56

67
export const Wrapper = styled.div`
78
${css.flex('align-center', 'justify-center')};
8-
width: 200px;
9+
width: 230px;
10+
padding: 8px 10px;
11+
padding-top: 12px;
12+
`
13+
export const Item = styled.div<{ name: string }>`
14+
${css.flexColumn('align-center', 'justify-center')};
15+
margin-right: ${({ name }) => (name === 'pill' ? 0 : '15px')};
916
`
1017
export const EIcon = styled(Img)<{ name: string }>`
1118
margin-top: ${({ name }) => (name === 'downvote' ? '2px' : 0)};
1219
${({ name }) =>
1320
name === 'confused' || name === 'popcorn' ? css.size(21) : css.size(20)};
14-
margin-right: ${({ name }) => (name === 'pill' ? 0 : '15px')};
1521
1622
filter: saturate(0.6);
1723
opacity: 0.9;
1824
z-index: 1;
1925
20-
&:hover {
26+
${Item}:hover & {
2127
cursor: pointer;
2228
filter: saturate(1);
2329
opacity: 1;
2430
}
2531
`
32+
export const Name = styled.div`
33+
font-size: 11px;
34+
margin-top: 5px;
35+
color: ${theme('thread.articleDigest')};
36+
37+
${Item}:hover & {
38+
cursor: pointer;
39+
color: ${theme('thread.articleTitle')};
40+
}
41+
`

0 commit comments

Comments
 (0)