|
@@ -5,15 +5,17 @@ import {
|
|
|
} from 'reactstrap';
|
|
} from 'reactstrap';
|
|
|
import { parseISO, format } from 'date-fns';
|
|
import { parseISO, format } from 'date-fns';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
-import { UnControlled as CodeMirror } from 'react-codemirror2';
|
|
|
|
|
|
|
+// TODO: consider whether to use codemirrorEditor
|
|
|
|
|
+import { UnControlled as CodeMirrorAny } from 'react-codemirror2';
|
|
|
import PageContainer from '../../client/services/PageContainer';
|
|
import PageContainer from '../../client/services/PageContainer';
|
|
|
import EditorContainer from '../../client/services/EditorContainer';
|
|
import EditorContainer from '../../client/services/EditorContainer';
|
|
|
|
|
|
|
|
require('codemirror/mode/htmlmixed/htmlmixed');
|
|
require('codemirror/mode/htmlmixed/htmlmixed');
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
const DMP = require('diff_match_patch');
|
|
const DMP = require('diff_match_patch');
|
|
|
|
|
|
|
|
|
|
+// avoid typescript type error
|
|
|
|
|
+const CodeMirror:any = CodeMirrorAny;
|
|
|
|
|
+
|
|
|
Object.keys(DMP).forEach((key) => { window[key] = DMP[key] });
|
|
Object.keys(DMP).forEach((key) => { window[key] = DMP[key] });
|
|
|
|
|
|
|
|
type ConflictDiffModalProps = {
|
|
type ConflictDiffModalProps = {
|
|
@@ -25,7 +27,7 @@ type ConflictDiffModalProps = {
|
|
|
|
|
|
|
|
export const ConflictDiffModal: FC<ConflictDiffModalProps> = (props) => {
|
|
export const ConflictDiffModal: FC<ConflictDiffModalProps> = (props) => {
|
|
|
const { t } = useTranslation('');
|
|
const { t } = useTranslation('');
|
|
|
- const resolvedRevision = useRef<string>(t('modal_resolve_conflict.resolve_conflict_message'));
|
|
|
|
|
|
|
+ const resolvedRevision = useRef<string>('');
|
|
|
const [isRevisionselected, setIsRevisionSelected] = useState<boolean>(false);
|
|
const [isRevisionselected, setIsRevisionSelected] = useState<boolean>(false);
|
|
|
|
|
|
|
|
const { pageContainer, editorContainer } = props;
|
|
const { pageContainer, editorContainer } = props;
|
|
@@ -169,6 +171,7 @@ export const ConflictDiffModal: FC<ConflictDiffModalProps> = (props) => {
|
|
|
lineNumbers: true,
|
|
lineNumbers: true,
|
|
|
tabSize: 2,
|
|
tabSize: 2,
|
|
|
indentUnit: 2,
|
|
indentUnit: 2,
|
|
|
|
|
+ placeholder: t('modal_resolve_conflict.resolve_conflict_message'),
|
|
|
}}
|
|
}}
|
|
|
onChange={(editor, data, pageBody) => {
|
|
onChange={(editor, data, pageBody) => {
|
|
|
if (pageBody === '') setIsRevisionSelected(false);
|
|
if (pageBody === '') setIsRevisionSelected(false);
|