Merge branch 'nocobase-next' of https://github.com/nocobase/nocobase into nocobase-next
This commit is contained in:
commit
02ff296178
@ -22,7 +22,7 @@ const MarkdownEditor = (props: any) => {
|
|||||||
<Space style={{ position: 'absolute', bottom: 5, right: 5 }}>
|
<Space style={{ position: 'absolute', bottom: 5, right: 5 }}>
|
||||||
<Button
|
<Button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
props.onCancel && props.onCancel(e);
|
props.onCancel?.(e);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Cancel')}
|
{t('Cancel')}
|
||||||
@ -30,7 +30,7 @@ const MarkdownEditor = (props: any) => {
|
|||||||
<Button
|
<Button
|
||||||
type={'primary'}
|
type={'primary'}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.onSubmit && props.onSubmit(value);
|
props.onSubmit?.(value);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Save')}
|
{t('Save')}
|
||||||
|
@ -4,7 +4,7 @@ import { Input as AntdInput } from 'antd';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ReadPretty as InputReadPretty } from '../input';
|
import { ReadPretty as InputReadPretty } from '../input';
|
||||||
import { MarkdownVoid } from './Markdown.Void';
|
import { MarkdownVoid } from './Markdown.Void';
|
||||||
import { markdown } from './util';
|
import { convertToText, markdown } from './util';
|
||||||
|
|
||||||
export const Markdown: any = connect(
|
export const Markdown: any = connect(
|
||||||
AntdInput.TextArea,
|
AntdInput.TextArea,
|
||||||
@ -19,7 +19,7 @@ export const Markdown: any = connect(
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
mapReadPretty((props) => {
|
mapReadPretty((props) => {
|
||||||
let text = props.value;
|
let text = convertToText(props.value);
|
||||||
let value = <div className={'nb-markdown'} dangerouslySetInnerHTML={{ __html: markdown(text) }} />;
|
let value = <div className={'nb-markdown'} dangerouslySetInnerHTML={{ __html: markdown(text) }} />;
|
||||||
return <InputReadPretty.TextArea {...props} text={text} value={value} />;
|
return <InputReadPretty.TextArea {...props} text={text} value={value} />;
|
||||||
}),
|
}),
|
||||||
|
@ -6,3 +6,11 @@ export function markdown(text) {
|
|||||||
}
|
}
|
||||||
return marked.parse(text);
|
return marked.parse(text);
|
||||||
}
|
}
|
||||||
|
export function convertToText(markdownText: string) {
|
||||||
|
const content = markdown(markdownText);
|
||||||
|
let temp = document.createElement('div');
|
||||||
|
temp.innerHTML = content;
|
||||||
|
const text = temp.innerText;
|
||||||
|
temp = null;
|
||||||
|
return text.replace(/[\n\r]/g, '');
|
||||||
|
}
|
||||||
|
@ -64,9 +64,13 @@ export const useTableColumnInitializerFields = () => {
|
|||||||
.filter((field) => field?.interface && field?.interface !== 'subTable')
|
.filter((field) => field?.interface && field?.interface !== 'subTable')
|
||||||
.map((field) => {
|
.map((field) => {
|
||||||
const componentProps = {};
|
const componentProps = {};
|
||||||
if (field?.uiSchema['x-component']?.startsWith?.('Input')) {
|
if (
|
||||||
|
field?.uiSchema['x-component']?.startsWith?.('Input') ||
|
||||||
|
field?.uiSchema['x-component']?.startsWith?.('Markdown')
|
||||||
|
) {
|
||||||
componentProps['ellipsis'] = true;
|
componentProps['ellipsis'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.interface === 'attachment') {
|
if (field.interface === 'attachment') {
|
||||||
componentProps['size'] = 'small';
|
componentProps['size'] = 'small';
|
||||||
return {
|
return {
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
SchemaInitializerButtonProps,
|
SchemaInitializerButtonProps,
|
||||||
SchemaInitializerItemComponent,
|
SchemaInitializerItemComponent,
|
||||||
SchemaInitializerItemOptions,
|
SchemaInitializerItemOptions,
|
||||||
SchemaInitializerItemProps
|
SchemaInitializerItemProps,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
const defaultWrap = (s: ISchema) => s;
|
const defaultWrap = (s: ISchema) => s;
|
||||||
@ -88,7 +88,6 @@ SchemaInitializer.Button = observer((props: SchemaInitializerButtonProps) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const menu = <Menu>{renderItems(items)}</Menu>;
|
const menu = <Menu>{renderItems(items)}</Menu>;
|
||||||
|
|
||||||
if (!designable && props.designable !== true) {
|
if (!designable && props.designable !== true) {
|
||||||
|
Loading…
Reference in New Issue
Block a user