1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 01:12:03 +00:00

repair code bug, Compatible with previous versions (#4265)

* repair code bug, Compatible with previous versions

* repair bug
This commit is contained in:
杨顺强
2019-11-16 19:21:15 +08:00
committed by Daniel Pan
parent d528cdd04b
commit 9926e2870c
5 changed files with 38 additions and 26 deletions

View File

@@ -1,13 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import getPreviewContent from '../../utils/markdown-utils';
import { SimpleEditor } from '@seafile/seafile-editor';
import { gettext } from '../../utils/constants';
const propTypes = {
title: PropTypes.string,
content: PropTypes.object,
content: PropTypes.string,
onCommit: PropTypes.func.isRequired,
onCloseEditorDialog: PropTypes.func.isRequired,
};
@@ -16,7 +15,6 @@ class TermsEditorDialog extends React.Component {
static defaultProps = {
title: gettext('Terms'),
content: {text: '', preview: ''}
}
onKeyDown = (event) => {
@@ -37,9 +35,7 @@ class TermsEditorDialog extends React.Component {
getCurrentContent = () => {
let markdownContent = this.simpleEditor.getMarkdown();
let { previewText , images, links } = getPreviewContent(markdownContent);
let content = Object.assign({}, this.value, { text: markdownContent, preview: previewText, images: images, links: links });
return content;
return markdownContent;
}
setSimpleEditorRef = (editor) => {
@@ -63,7 +59,7 @@ class TermsEditorDialog extends React.Component {
<ModalBody className={'conditions-editor-dialog-main'}>
<SimpleEditor
onRef={this.setSimpleEditorRef.bind(this)}
value={content.text || ''}
value={content || ''}
/>
</ModalBody>
</Modal>