mirror of https://github.com/chaitin/PandaWiki.git
Compare commits
8 Commits
2bdb56ef4c
...
fe60e2924d
| Author | SHA1 | Date |
|---|---|---|
|
|
fe60e2924d | |
|
|
edb7e01085 | |
|
|
a4679f0ada | |
|
|
5e93e9da73 | |
|
|
d630567a3c | |
|
|
20a0a4ded4 | |
|
|
38383b983d | |
|
|
030a8ac25d |
|
|
@ -385,14 +385,14 @@ const ThemeWrapper = ({ children }: { children: React.ReactNode }) => {
|
|||
const { appPreviewData } = useAppSelector(state => state.config);
|
||||
|
||||
const theme = useMemo(() => {
|
||||
const themeName =
|
||||
appPreviewData?.settings?.web_app_landing_theme?.name || 'blue';
|
||||
return createTheme(
|
||||
// @ts-expect-error themeOptions is not typed
|
||||
{
|
||||
...themeOptions[0],
|
||||
palette:
|
||||
THEME_TO_PALETTE[
|
||||
appPreviewData?.settings?.web_app_landing_theme?.name || 'blue'
|
||||
].palette,
|
||||
THEME_TO_PALETTE[themeName]?.palette || THEME_TO_PALETTE.blue.palette,
|
||||
},
|
||||
...themeOptions.slice(1),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -269,7 +269,9 @@ const ComponentBar = ({
|
|||
<Stack sx={{ pr: '20px', marginTop: '15px' }}>
|
||||
<Select
|
||||
value={
|
||||
appPreviewData.settings?.web_app_landing_theme?.name || 'blue'
|
||||
THEME_TO_PALETTE[
|
||||
appPreviewData.settings?.web_app_landing_theme?.name || 'blue'
|
||||
]?.value || 'blue'
|
||||
}
|
||||
renderValue={value => {
|
||||
return THEME_TO_PALETTE[value]?.label;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ const History = () => {
|
|||
);
|
||||
const [characterCount, setCharacterCount] = useState(0);
|
||||
|
||||
const [isMarkdown, setIsMarkdown] = useState(false);
|
||||
|
||||
const editorRef = useTiptap({
|
||||
content: '',
|
||||
editable: false,
|
||||
|
|
@ -49,10 +51,26 @@ const History = () => {
|
|||
},
|
||||
});
|
||||
|
||||
const editorMdRef = useTiptap({
|
||||
content: '',
|
||||
contentType: 'markdown',
|
||||
editable: false,
|
||||
immediatelyRender: true,
|
||||
onUpdate: ({ editor }) => {
|
||||
setCharacterCount((editor.storage as any).characterCount.characters());
|
||||
},
|
||||
});
|
||||
|
||||
const getDetail = (v: DomainNodeReleaseListItem) => {
|
||||
getApiProV1NodeReleaseDetail({ id: v.id!, kb_id: kb_id! }).then(res => {
|
||||
setCurNode(res);
|
||||
editorRef.setContent(res.content || '');
|
||||
if (res.meta?.content_type === 'md') {
|
||||
setIsMarkdown(true);
|
||||
editorMdRef.setContent(res.content || '');
|
||||
} else {
|
||||
setIsMarkdown(false);
|
||||
editorRef.setContent(res.content || '');
|
||||
}
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
};
|
||||
|
|
@ -207,7 +225,7 @@ const History = () => {
|
|||
gap={0.5}
|
||||
sx={{ cursor: 'pointer' }}
|
||||
>
|
||||
<Icon type='icon-tianjiawendang' />
|
||||
<Icon type='icon-tianjiawendang' sx={{ fontSize: 9 }} />
|
||||
{curNode.editor_account} 编辑
|
||||
</Stack>
|
||||
</Tooltip>
|
||||
|
|
@ -249,13 +267,6 @@ const History = () => {
|
|||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
{/* <EditorThemeProvider
|
||||
colors={{ light }}
|
||||
mode='light'
|
||||
theme={{
|
||||
components: componentStyleOverrides,
|
||||
}}
|
||||
> */}
|
||||
<Box
|
||||
sx={{
|
||||
'.tiptap': {
|
||||
|
|
@ -267,9 +278,12 @@ const History = () => {
|
|||
},
|
||||
}}
|
||||
>
|
||||
<Editor editor={editorRef.editor} />
|
||||
{isMarkdown ? (
|
||||
<Editor editor={editorMdRef.editor} />
|
||||
) : (
|
||||
<Editor editor={editorRef.editor} />
|
||||
)}
|
||||
</Box>
|
||||
{/* </EditorThemeProvider> */}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ const HomePage = () => {
|
|||
cssVariables: {
|
||||
cssVarPrefix: 'welcome',
|
||||
},
|
||||
palette: THEME_TO_PALETTE[themeMode].palette,
|
||||
palette:
|
||||
THEME_TO_PALETTE[themeMode]?.palette ||
|
||||
THEME_TO_PALETTE['blue'].palette,
|
||||
typography: {
|
||||
fontFamily: 'var(--font-gilory), PingFang SC, sans-serif',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ export const THEME_LIST = [
|
|||
value: 'darkDeepForest',
|
||||
palette: darkDeepForestPalette,
|
||||
},
|
||||
{
|
||||
label: '深邃黑',
|
||||
value: 'white',
|
||||
palette: whitePalette,
|
||||
},
|
||||
// {
|
||||
// label: '深邃黑',
|
||||
// value: 'white',
|
||||
// palette: whitePalette,
|
||||
// },
|
||||
{
|
||||
label: '电光蓝',
|
||||
value: 'electricBlue',
|
||||
|
|
|
|||
|
|
@ -18,9 +18,10 @@ interface BlockGridProps {
|
|||
}
|
||||
const StyledBlockGridItem = styled(Stack)(({ theme }) => ({
|
||||
aspectRatio: '1 / 1',
|
||||
position: 'relative',
|
||||
border: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`,
|
||||
borderRadius: '10px',
|
||||
padding: theme.spacing(2),
|
||||
padding: theme.spacing(1),
|
||||
boxShadow: `0px 5px 20px 0px ${alpha(theme.palette.text.primary, 0.06)}`,
|
||||
transition: 'all 0.2s ease',
|
||||
'&:hover': {
|
||||
|
|
@ -44,14 +45,22 @@ export const StyledBlockGridItemImg = styled('img')(({ theme }) => ({
|
|||
}));
|
||||
|
||||
const StyledBlockGridItemTitle = styled('div')(({ theme }) => ({
|
||||
position: 'absolute',
|
||||
bottom: '24px',
|
||||
left: '50%',
|
||||
maxWidth: 'calc(100% - 24px)',
|
||||
transform: 'translateX(-50%)',
|
||||
padding: theme.spacing(0.5, 1),
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
flexShrink: 0,
|
||||
whiteSpace: 'nowrap',
|
||||
fontSize: 16,
|
||||
fontSize: 14,
|
||||
textAlign: 'center',
|
||||
fontWeight: 700,
|
||||
color: theme.palette.text.primary,
|
||||
color: theme.palette.background.default,
|
||||
backgroundColor: alpha(theme.palette.text.primary, 0.5),
|
||||
borderRadius: '6px',
|
||||
}));
|
||||
|
||||
// 单个卡片组件,带动画效果
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const StyledSwiperSlideDesc = styled('div')(({ theme }) => ({
|
|||
fontSize: 14,
|
||||
fontWeight: 400,
|
||||
color: theme.palette.background.default,
|
||||
borderRadius: '12px',
|
||||
borderRadius: '6px',
|
||||
overflow: 'hidden',
|
||||
whiteSpace: 'nowrap',
|
||||
zIndex: 0,
|
||||
|
|
@ -113,7 +113,7 @@ const StyledTabs = styled(Tabs)(({ theme }) => ({
|
|||
const StyledTab = styled(Tab)(({ theme }) => ({
|
||||
minHeight: 'auto',
|
||||
padding: theme.spacing(1, 2),
|
||||
borderRadius: '10px',
|
||||
borderRadius: '6px',
|
||||
backgroundColor: theme.palette.background.default,
|
||||
color: theme.palette.text.secondary,
|
||||
fontSize: 14,
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ interface ImgTextProps {
|
|||
const StyledImgTextItem = styled(Stack)(({ theme }) => ({}));
|
||||
|
||||
export const StyledImgTextItemImg = styled('img')(({ theme }) => ({
|
||||
maxWidth: 350,
|
||||
maxHeight: 350,
|
||||
maxWidth: '100%',
|
||||
maxHeight: '100%',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
objectFit: 'cover',
|
||||
|
|
@ -28,7 +28,7 @@ export const StyledImgTextItemImg = styled('img')(({ theme }) => ({
|
|||
}));
|
||||
|
||||
const StyledImgTextItemTitle = styled('h3')(({ theme }) => ({
|
||||
fontSize: 20,
|
||||
fontSize: 24,
|
||||
fontWeight: 700,
|
||||
color: theme.palette.text.primary,
|
||||
}));
|
||||
|
|
@ -73,7 +73,7 @@ const ImgText: React.FC<ImgTextProps> = React.memo(
|
|||
<StyledTopicBox>
|
||||
<StyledTopicTitle ref={titleRef}>{title}</StyledTopicTitle>
|
||||
<StyledImgTextItem
|
||||
gap={mobile ? 4 : { xs: 4, sm: 6, md: 38 }}
|
||||
gap={mobile ? 4 : { xs: 4, sm: 6, md: 16 }}
|
||||
direction={
|
||||
mobile
|
||||
? 'column-reverse'
|
||||
|
|
@ -96,9 +96,36 @@ const ImgText: React.FC<ImgTextProps> = React.memo(
|
|||
gap={1}
|
||||
sx={{ width: '100%' }}
|
||||
ref={cardRightRef as React.Ref<HTMLDivElement>}
|
||||
alignItems={
|
||||
mobile
|
||||
? 'flex-start'
|
||||
: direction === 'row'
|
||||
? 'flex-start'
|
||||
: 'flex-end'
|
||||
}
|
||||
>
|
||||
<StyledImgTextItemTitle>{item.name}</StyledImgTextItemTitle>
|
||||
<StyledImgTextItemSummary>{item.desc}</StyledImgTextItemSummary>
|
||||
<StyledImgTextItemTitle
|
||||
sx={{
|
||||
textAlign: mobile
|
||||
? 'left'
|
||||
: direction === 'row'
|
||||
? 'left'
|
||||
: 'right',
|
||||
}}
|
||||
>
|
||||
{item.name}
|
||||
</StyledImgTextItemTitle>
|
||||
<StyledImgTextItemSummary
|
||||
sx={{
|
||||
textAlign: mobile
|
||||
? 'left'
|
||||
: direction === 'row'
|
||||
? 'left'
|
||||
: 'right',
|
||||
}}
|
||||
>
|
||||
{item.desc}
|
||||
</StyledImgTextItemSummary>
|
||||
</Stack>
|
||||
</StyledImgTextItem>
|
||||
</StyledTopicBox>
|
||||
|
|
|
|||
Loading…
Reference in New Issue