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

repair code bug

This commit is contained in:
shanshuirenjia
2022-05-23 18:24:19 +08:00
parent 51fc99d370
commit 6c89f2c11d

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Text } from 'slate';
import { deserialize, serialize, PlainMarkdownEditor } from '@seafile/seafile-editor'; import { deserialize, serialize, PlainMarkdownEditor } from '@seafile/seafile-editor';
import toaster from '../../../components/toast'; import toaster from '../../../components/toast';
import { gettext } from '../../../utils/constants'; import { gettext } from '../../../utils/constants';
@@ -39,6 +40,7 @@ class SeafileEditor extends React.Component {
const { mode, markdownContent, isDraft } = this.props; const { mode, markdownContent, isDraft } = this.props;
const isEditMode = mode === 'editor' || isDraft; const isEditMode = mode === 'editor' || isDraft;
const richValue = isEditMode ? deserialize(markdownContent) : deserialize(''); const richValue = isEditMode ? deserialize(markdownContent) : deserialize('');
console.log(richValue);
this.state = { this.state = {
initialPlainValue: '', initialPlainValue: '',
currentContent: markdownContent, currentContent: markdownContent,
@@ -54,6 +56,7 @@ class SeafileEditor extends React.Component {
componentWillMount() { componentWillMount() {
if (this.props.editorMode === 'rich') { if (this.props.editorMode === 'rich') {
const document = this.state.richValue; const document = this.state.richValue;
console.log(document, 'dadad');
const firstNode = document[0]; const firstNode = document[0];
/** /**
* if the markdown content is empty, the rich value contains * if the markdown content is empty, the rich value contains