Merge branch 'dev' of gitea.51mars.com:Oak-Team/oak-general-business into dev
This commit is contained in:
commit
e64ce53334
|
|
@ -5,7 +5,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
||||||
tocPosition: "none" | "left" | "right";
|
tocPosition: "none" | "left" | "right";
|
||||||
highlightBgColor: string;
|
highlightBgColor: string;
|
||||||
onArticlePreview: (content?: string, title?: string) => void;
|
onArticlePreview: (content?: string, title?: string) => void;
|
||||||
origin: import("../../../types/Config").CosOrigin | null;
|
origin: null | EntityDict["extraFile"]["Schema"]["origin"];
|
||||||
scrollId: string;
|
scrollId: string;
|
||||||
height: number | "auto";
|
height: number | "auto";
|
||||||
activeColor: string | undefined;
|
activeColor: string | undefined;
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,8 @@ export default OakComponent({
|
||||||
async check() {
|
async check() {
|
||||||
if (this.state.name &&
|
if (this.state.name &&
|
||||||
this.state.name.length > 0 &&
|
this.state.name.length > 0 &&
|
||||||
this.state.content &&
|
this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>') {
|
this.state.html !== '<p><br></p>') {
|
||||||
const id = this.getId();
|
const id = this.getId();
|
||||||
await this.execute(undefined, {
|
await this.execute(undefined, {
|
||||||
|
|
@ -116,8 +116,8 @@ export default OakComponent({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (this.state.content &&
|
else if (this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>') {
|
this.state.html !== '<p><br></p>') {
|
||||||
this.setMessage({
|
this.setMessage({
|
||||||
content: this.t('check.no name'),
|
content: this.t('check.no name'),
|
||||||
|
|
@ -133,9 +133,6 @@ export default OakComponent({
|
||||||
this.setState({
|
this.setState({
|
||||||
html,
|
html,
|
||||||
});
|
});
|
||||||
if (html && html !== '<p><br></p>' && this.state.oakFullpath) {
|
|
||||||
this.update({ content: html });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
gotoPreview(content, title) {
|
gotoPreview(content, title) {
|
||||||
const { onArticlePreview } = this.props;
|
const { onArticlePreview } = this.props;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
|
||||||
tocClosed: boolean;
|
tocClosed: boolean;
|
||||||
execuable: boolean;
|
execuable: boolean;
|
||||||
activeColor?: string;
|
activeColor?: string;
|
||||||
|
html: string;
|
||||||
}, {
|
}, {
|
||||||
setHtml: (content: string) => void;
|
setHtml: (content: string) => void;
|
||||||
setEditor: (editor: any) => void;
|
setEditor: (editor: any) => void;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ function customCheckImageFn(src, alt, url) {
|
||||||
export default function Render(props) {
|
export default function Render(props) {
|
||||||
const { methods, data } = props;
|
const { methods, data } = props;
|
||||||
const { t, setEditor, check, uploadFile, update, setHtml, gotoPreview, clearContentTip, } = methods;
|
const { t, setEditor, check, uploadFile, update, setHtml, gotoPreview, clearContentTip, } = methods;
|
||||||
const { oakId, oakFullpath, id, name, content, editor, origin, tocPosition = 'none', highlightBgColor, scrollId, tocWidth, tocHeight, height = 600, tocClosed = false, execuable, activeColor, } = data;
|
const { oakId, oakFullpath, id, name, content, editor, origin, tocPosition = 'none', highlightBgColor, scrollId, tocWidth, tocHeight, height = 600, tocClosed = false, execuable, activeColor, html, oakLoading, oakExecuting, } = data;
|
||||||
const [articleId, setArticleId] = useState('');
|
const [articleId, setArticleId] = useState('');
|
||||||
const [toc, setToc] = useState([]);
|
const [toc, setToc] = useState([]);
|
||||||
const [showToc, setShowToc] = useState(false);
|
const [showToc, setShowToc] = useState(false);
|
||||||
|
|
@ -53,12 +53,14 @@ export default function Render(props) {
|
||||||
<div className={Style.title}>{name}</div>
|
<div className={Style.title}>{name}</div>
|
||||||
<Space>
|
<Space>
|
||||||
<Button onClick={() => {
|
<Button onClick={() => {
|
||||||
gotoPreview(content, data.name);
|
gotoPreview(html, data.name);
|
||||||
}} icon={<EyeOutlined />}>
|
}} icon={<EyeOutlined />}>
|
||||||
{t('preview')}
|
{t('preview')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button disabled={!data.oakDirty ||
|
<Button disabled={oakLoading || oakExecuting || !(name && name.length > 0 && html && html.length > 0 && html !== '<p><br></p>')} type="primary" onClick={() => {
|
||||||
data.oakExecuting || !execuable} type="primary" onClick={() => {
|
update({
|
||||||
|
content: html,
|
||||||
|
});
|
||||||
check();
|
check();
|
||||||
}}>
|
}}>
|
||||||
{t('save')}
|
{t('save')}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
||||||
tocPosition: "none" | "left" | "right";
|
tocPosition: "none" | "left" | "right";
|
||||||
highlightBgColor: string;
|
highlightBgColor: string;
|
||||||
onArticlePreview: (content?: string, title?: string) => void;
|
onArticlePreview: (content?: string, title?: string) => void;
|
||||||
origin: import("../../../types/Config").CosOrigin | null;
|
origin: EntityDict["extraFile"]["Schema"]["origin"] | null;
|
||||||
scrollId: string;
|
scrollId: string;
|
||||||
height: number | "auto";
|
height: number | "auto";
|
||||||
activeColor: string | undefined;
|
activeColor: string | undefined;
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,8 @@ export default OakComponent({
|
||||||
async check() {
|
async check() {
|
||||||
if (this.state.name &&
|
if (this.state.name &&
|
||||||
this.state.name.length > 0 &&
|
this.state.name.length > 0 &&
|
||||||
this.state.content &&
|
this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>') {
|
this.state.html !== '<p><br></p>') {
|
||||||
await this.execute();
|
await this.execute();
|
||||||
if (this.props.changeIsEdit) {
|
if (this.props.changeIsEdit) {
|
||||||
|
|
@ -105,8 +105,8 @@ export default OakComponent({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (this.state.content &&
|
else if (this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>') {
|
this.state.html !== '<p><br></p>') {
|
||||||
this.setMessage({
|
this.setMessage({
|
||||||
content: '请填写文章标题!',
|
content: '请填写文章标题!',
|
||||||
|
|
@ -114,17 +114,10 @@ export default OakComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async reset() {
|
|
||||||
// 重置
|
|
||||||
this.clean();
|
|
||||||
},
|
|
||||||
setHtml(html) {
|
setHtml(html) {
|
||||||
this.setState({
|
this.setState({
|
||||||
html,
|
html,
|
||||||
});
|
});
|
||||||
if (html && html !== '<p><br></p>' && this.state.oakFullpath) {
|
|
||||||
this.update({ content: html });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
gotoPreview(content, title) {
|
gotoPreview(content, title) {
|
||||||
const { onArticlePreview } = this.props;
|
const { onArticlePreview } = this.props;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
|
||||||
tocHeight?: number | string;
|
tocHeight?: number | string;
|
||||||
height?: number | string;
|
height?: number | string;
|
||||||
activeColor?: string;
|
activeColor?: string;
|
||||||
|
html: string;
|
||||||
}, {
|
}, {
|
||||||
setHtml: (content: string) => void;
|
setHtml: (content: string) => void;
|
||||||
setEditor: (editor: any) => void;
|
setEditor: (editor: any) => void;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ function customCheckImageFn(src, alt, url) {
|
||||||
export default function Render(props) {
|
export default function Render(props) {
|
||||||
const { methods, data } = props;
|
const { methods, data } = props;
|
||||||
const { t, setEditor, check, uploadFile, update, setHtml, gotoPreview, clearContentTip, } = methods;
|
const { t, setEditor, check, uploadFile, update, setHtml, gotoPreview, clearContentTip, } = methods;
|
||||||
const { oakId, oakFullpath, id, content, editor, origin, tocPosition = 'none', highlightBgColor, activeColor, scrollId, tocWidth, tocHeight, height = 600 } = data;
|
const { oakId, oakFullpath, id, content, editor, origin, tocPosition = 'none', highlightBgColor, activeColor, scrollId, tocWidth, tocHeight, height = 600, html, oakLoading, oakExecuting, } = data;
|
||||||
const [articleId, setArticleId] = useState('');
|
const [articleId, setArticleId] = useState('');
|
||||||
const [toc, setToc] = useState([]);
|
const [toc, setToc] = useState([]);
|
||||||
const [showToc, setShowToc] = useState(false);
|
const [showToc, setShowToc] = useState(false);
|
||||||
|
|
@ -154,14 +154,16 @@ export default function Render(props) {
|
||||||
</div>
|
</div>
|
||||||
<div className={Style.footer}>
|
<div className={Style.footer}>
|
||||||
<Space>
|
<Space>
|
||||||
<Button disabled={!data.oakDirty ||
|
<Button disabled={oakLoading || oakExecuting || !(data.name && data.name.length > 0 && html && html.length > 0 && html !== '<p><br></p>')} type="primary" onClick={() => {
|
||||||
data.oakExecuting} type="primary" onClick={() => {
|
update({
|
||||||
|
content: html,
|
||||||
|
});
|
||||||
check();
|
check();
|
||||||
}}>
|
}}>
|
||||||
保存
|
保存
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => {
|
<Button onClick={() => {
|
||||||
gotoPreview(content, data.name);
|
gotoPreview(html, data.name);
|
||||||
}} icon={<EyeOutlined />}>
|
}} icon={<EyeOutlined />}>
|
||||||
预览
|
预览
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -460,5 +460,24 @@ const triggers = [
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'application创建时,为其config附上对应的type',
|
||||||
|
entity: 'application',
|
||||||
|
action: 'create',
|
||||||
|
when: 'before',
|
||||||
|
fn: async ({ operation }, context, option) => {
|
||||||
|
const { data } = operation;
|
||||||
|
assert(!(data instanceof Array));
|
||||||
|
const { type, config } = data;
|
||||||
|
const config2 = config || {};
|
||||||
|
if (!config?.type) {
|
||||||
|
Object.assign(config2, {
|
||||||
|
type: type,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
data.config = config2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
export default triggers;
|
export default triggers;
|
||||||
|
|
|
||||||
|
|
@ -462,5 +462,24 @@ const triggers = [
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'application创建时,为其config附上对应的type',
|
||||||
|
entity: 'application',
|
||||||
|
action: 'create',
|
||||||
|
when: 'before',
|
||||||
|
fn: async ({ operation }, context, option) => {
|
||||||
|
const { data } = operation;
|
||||||
|
(0, assert_1.assert)(!(data instanceof Array));
|
||||||
|
const { type, config } = data;
|
||||||
|
const config2 = config || {};
|
||||||
|
if (!config?.type) {
|
||||||
|
Object.assign(config2, {
|
||||||
|
type: type,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
data.config = config2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
exports.default = triggers;
|
exports.default = triggers;
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,8 @@ export default OakComponent({
|
||||||
if (
|
if (
|
||||||
this.state.name &&
|
this.state.name &&
|
||||||
this.state.name.length > 0 &&
|
this.state.name.length > 0 &&
|
||||||
this.state.content &&
|
this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>'
|
this.state.html !== '<p><br></p>'
|
||||||
) {
|
) {
|
||||||
const id = this.getId()!;
|
const id = this.getId()!;
|
||||||
|
|
@ -126,8 +126,8 @@ export default OakComponent({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
} else if (
|
} else if (
|
||||||
this.state.content &&
|
this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>'
|
this.state.html !== '<p><br></p>'
|
||||||
) {
|
) {
|
||||||
this.setMessage({
|
this.setMessage({
|
||||||
|
|
@ -144,9 +144,6 @@ export default OakComponent({
|
||||||
this.setState({
|
this.setState({
|
||||||
html,
|
html,
|
||||||
});
|
});
|
||||||
if (html && html !== '<p><br></p>' && this.state.oakFullpath) {
|
|
||||||
this.update({ content: html });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
gotoPreview(content?: string, title?: string) {
|
gotoPreview(content?: string, title?: string) {
|
||||||
const { onArticlePreview } = this.props;
|
const { onArticlePreview } = this.props;
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ export default function Render(
|
||||||
tocClosed: boolean;
|
tocClosed: boolean;
|
||||||
execuable: boolean;
|
execuable: boolean;
|
||||||
activeColor?: string;
|
activeColor?: string;
|
||||||
|
html: string;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setHtml: (content: string) => void;
|
setHtml: (content: string) => void;
|
||||||
|
|
@ -110,6 +111,9 @@ export default function Render(
|
||||||
tocClosed = false,
|
tocClosed = false,
|
||||||
execuable,
|
execuable,
|
||||||
activeColor,
|
activeColor,
|
||||||
|
html,
|
||||||
|
oakLoading,
|
||||||
|
oakExecuting,
|
||||||
} = data;
|
} = data;
|
||||||
const [articleId, setArticleId] = useState('');
|
const [articleId, setArticleId] = useState('');
|
||||||
const [toc, setToc] = useState<TocItem[]>([]);
|
const [toc, setToc] = useState<TocItem[]>([]);
|
||||||
|
|
@ -140,19 +144,19 @@ export default function Render(
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
gotoPreview(content, data.name);
|
gotoPreview(html, data.name);
|
||||||
}}
|
}}
|
||||||
icon={<EyeOutlined />}
|
icon={<EyeOutlined />}
|
||||||
>
|
>
|
||||||
{t('preview')}
|
{t('preview')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={
|
disabled={oakLoading || oakExecuting || !(name && name.length > 0 && html && html.length > 0 && html !== '<p><br></p>')}
|
||||||
!data.oakDirty ||
|
|
||||||
data.oakExecuting || !execuable
|
|
||||||
}
|
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
update({
|
||||||
|
content: html,
|
||||||
|
})
|
||||||
check();
|
check();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ export default OakComponent({
|
||||||
if (
|
if (
|
||||||
this.state.name &&
|
this.state.name &&
|
||||||
this.state.name.length > 0 &&
|
this.state.name.length > 0 &&
|
||||||
this.state.content &&
|
this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>'
|
this.state.html !== '<p><br></p>'
|
||||||
) {
|
) {
|
||||||
await this.execute();
|
await this.execute();
|
||||||
|
|
@ -114,8 +114,8 @@ export default OakComponent({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
});
|
});
|
||||||
} else if (
|
} else if (
|
||||||
this.state.content &&
|
this.state.html &&
|
||||||
this.state.content.length > 0 &&
|
this.state.html.length > 0 &&
|
||||||
this.state.html !== '<p><br></p>'
|
this.state.html !== '<p><br></p>'
|
||||||
) {
|
) {
|
||||||
this.setMessage({
|
this.setMessage({
|
||||||
|
|
@ -124,17 +124,10 @@ export default OakComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async reset() {
|
|
||||||
// 重置
|
|
||||||
this.clean();
|
|
||||||
},
|
|
||||||
setHtml(html: string) {
|
setHtml(html: string) {
|
||||||
this.setState({
|
this.setState({
|
||||||
html,
|
html,
|
||||||
});
|
});
|
||||||
if (html && html !== '<p><br></p>' && this.state.oakFullpath) {
|
|
||||||
this.update({ content: html });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
gotoPreview(content?: string, title?: string) {
|
gotoPreview(content?: string, title?: string) {
|
||||||
const { onArticlePreview } = this.props;
|
const { onArticlePreview } = this.props;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ export default function Render(
|
||||||
tocHeight?: number | string;
|
tocHeight?: number | string;
|
||||||
height?: number | string;
|
height?: number | string;
|
||||||
activeColor?: string;
|
activeColor?: string;
|
||||||
|
html: string;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setHtml: (content: string) => void;
|
setHtml: (content: string) => void;
|
||||||
|
|
@ -104,7 +105,10 @@ export default function Render(
|
||||||
scrollId,
|
scrollId,
|
||||||
tocWidth,
|
tocWidth,
|
||||||
tocHeight,
|
tocHeight,
|
||||||
height = 600
|
height = 600,
|
||||||
|
html,
|
||||||
|
oakLoading,
|
||||||
|
oakExecuting,
|
||||||
} = data;
|
} = data;
|
||||||
const [articleId, setArticleId] = useState('');
|
const [articleId, setArticleId] = useState('');
|
||||||
const [toc, setToc] = useState<TocItem[]>([]);
|
const [toc, setToc] = useState<TocItem[]>([]);
|
||||||
|
|
@ -326,12 +330,12 @@ export default function Render(
|
||||||
<div className={Style.footer}>
|
<div className={Style.footer}>
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
disabled={
|
disabled={oakLoading || oakExecuting || !(data.name && data.name.length > 0 && html && html.length > 0 && html !== '<p><br></p>')}
|
||||||
!data.oakDirty ||
|
|
||||||
data.oakExecuting
|
|
||||||
}
|
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
update({
|
||||||
|
content: html,
|
||||||
|
})
|
||||||
check();
|
check();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
@ -339,7 +343,7 @@ export default function Render(
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
gotoPreview(content, data.name);
|
gotoPreview(html, data.name);
|
||||||
}}
|
}}
|
||||||
icon={<EyeOutlined />}
|
icon={<EyeOutlined />}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,25 @@ const triggers: Trigger<EntityDict, 'application', BRC<EntityDict>>[] = [
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} as CreateTrigger<EntityDict, 'application', BRC<EntityDict>>,
|
} as CreateTrigger<EntityDict, 'application', BRC<EntityDict>>,
|
||||||
|
{
|
||||||
|
name: 'application创建时,为其config附上对应的type',
|
||||||
|
entity: 'application',
|
||||||
|
action: 'create',
|
||||||
|
when: 'before',
|
||||||
|
fn: async ({ operation }, context, option) => {
|
||||||
|
const { data } = operation;
|
||||||
|
assert(!(data instanceof Array));
|
||||||
|
const { type, config } = data;
|
||||||
|
const config2 = config || {};
|
||||||
|
if (!config?.type) {
|
||||||
|
Object.assign(config2, {
|
||||||
|
type: type,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
data.config = (config2 as EntityDict['application']['Schema']['config']);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} as CreateTrigger<EntityDict, 'application', BRC<EntityDict>>,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue