2024-10-22 16:33:12: merge [main:c526b811773c7f55cd6092d974e8fc8b4847e75c];
This commit is contained in:
1 parent
d9543c4a24
commit
a1c96ab2e7
8 files changed
+145
-145
No files matched your search
@@ -20,9 +20,9 @@
|
||||
}
|
||||
|
||||
&__content {
|
||||
.cm-merge-theme {
|
||||
.monaco-diff-editor {
|
||||
overflow-y: scroll;
|
||||
height: calc(90vh - 150px);
|
||||
height: calc(90vh - 150px) !important;
|
||||
}
|
||||
|
||||
&__table {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { EditorState, EditorView } from '@uiw/react-codemirror'
|
||||
import { DiffEditor } from '@monaco-editor/react'
|
||||
import { Button, Spin, Table } from 'antd'
|
||||
import { ColumnsType } from 'antd/es/table'
|
||||
import dayjs from 'dayjs'
|
||||
import { FC, memo, useContext, useState } from 'react'
|
||||
import CodeMirrorMerge from 'react-codemirror-merge'
|
||||
|
||||
import { dateFormats } from '@constants/date.ts'
|
||||
|
||||
@@ -24,9 +23,6 @@ import { VersionType } from '@type/version.type'
|
||||
|
||||
import './compare-version-modal.scss'
|
||||
|
||||
const Original = CodeMirrorMerge.Original
|
||||
const Modified = CodeMirrorMerge.Modified
|
||||
|
||||
const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
||||
open,
|
||||
onClose,
|
||||
@@ -90,21 +86,17 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
|
||||
: `Версия: ${config?.configVersion}`}
|
||||
</span>
|
||||
</div>
|
||||
<CodeMirrorMerge
|
||||
orientation="a-b"
|
||||
theme={changeTheme ? 'dark' : 'light'}
|
||||
>
|
||||
<Original
|
||||
value={JSON.stringify(sortObject(selectedItem.data), null, 2)}
|
||||
/>
|
||||
<Modified
|
||||
value={JSON.stringify(sortObject(config?.data), null, 2)}
|
||||
extensions={[
|
||||
EditorView.editable.of(false),
|
||||
EditorState.readOnly.of(true)
|
||||
]}
|
||||
/>
|
||||
</CodeMirrorMerge>
|
||||
<DiffEditor
|
||||
original={JSON.stringify(sortObject(selectedItem.data), null, 2)}
|
||||
modified={JSON.stringify(sortObject(config?.data), null, 2)}
|
||||
theme={changeTheme ? 'vs-dark' : 'vs-white'}
|
||||
options={{
|
||||
readOnly: true,
|
||||
domReadOnly: true,
|
||||
renderOverviewRuler: false,
|
||||
autoClosingOvertype: 'auto'
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="compare-version-modal__content__table">
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import Editor, { loader } from '@monaco-editor/react'
|
||||
import * as monaco from 'monaco-editor'
|
||||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
||||
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'
|
||||
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'
|
||||
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
||||
import Editor from '@monaco-editor/react'
|
||||
import { FC, useContext } from 'react'
|
||||
|
||||
import { ConfigurationEditorPropsType } from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts'
|
||||
@@ -11,8 +6,6 @@ import { ConfigType } from '@pages/ModulesPage/module.type.ts'
|
||||
|
||||
import { Context } from '@stores/index.tsx'
|
||||
|
||||
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'
|
||||
|
||||
const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({
|
||||
setDisableBtn = () => {},
|
||||
bufConfig,
|
||||
@@ -20,28 +13,6 @@ const ConfigurationEditorCode: FC<ConfigurationEditorPropsType> = ({
|
||||
}) => {
|
||||
const { changeTheme } = useContext(Context)
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker(_, label) {
|
||||
if (label === 'json') {
|
||||
return new jsonWorker()
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return new cssWorker()
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return new htmlWorker()
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return new tsWorker()
|
||||
}
|
||||
return new editorWorker()
|
||||
}
|
||||
}
|
||||
|
||||
loader.config({ monaco })
|
||||
|
||||
loader.init().then()
|
||||
|
||||
const handleChange = (data: string | undefined) => {
|
||||
if (data) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user