@yuntijs/ui 1.0.0-beta.113 → 1.0.0-beta.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,7 +32,7 @@ export var useOptions = function useOptions(allOptions, queryString) {
|
|
|
32
32
|
var options = useMemo(function () {
|
|
33
33
|
var _addOnselect = function _addOnselect(option) {
|
|
34
34
|
var menuOption = _objectSpread(_objectSpread({}, option), {}, {
|
|
35
|
-
title: option.selectedLabel,
|
|
35
|
+
title: option.title || option.selectedLabel,
|
|
36
36
|
children: undefined,
|
|
37
37
|
onSelect: function onSelect() {
|
|
38
38
|
editor.dispatchCommand(INSERT_MENTION_COMMAND, option.value);
|
package/es/Mentions/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MentionMenuOptionInitParams } from './plugins/mention-picker/utils';
|
|
2
|
-
export interface MentionOption extends Omit<MentionMenuOptionInitParams, 'onSelect' | 'children'
|
|
2
|
+
export interface MentionOption extends Omit<MentionMenuOptionInitParams, 'onSelect' | 'children'> {
|
|
3
3
|
/** 选中后展示的 label 名称,不指定则直接使用 label */
|
|
4
4
|
selectedLabel?: string;
|
|
5
5
|
error?: string;
|
|
@@ -42,10 +42,12 @@ export interface IGeneralManacoEditorProps {
|
|
|
42
42
|
export interface ISingleMonacoEditorProps extends IGeneralManacoEditorProps {
|
|
43
43
|
onChange?: (input: string, event: IEditor.IModelContentChangedEvent) => void;
|
|
44
44
|
supportFullScreen?: boolean;
|
|
45
|
+
onFullScreenChange?: (isFullScreen: boolean) => void;
|
|
45
46
|
}
|
|
46
47
|
export interface IDiffMonacoEditorProps extends IGeneralManacoEditorProps {
|
|
47
48
|
onChange?: (input: string, event: IEditor.IModelContentChangedEvent) => void;
|
|
48
49
|
supportFullScreen?: boolean;
|
|
50
|
+
onFullScreenChange?: (isFullScreen: boolean) => void;
|
|
49
51
|
original?: string;
|
|
50
52
|
}
|
|
51
53
|
export declare const WORD_EDITOR_INITIALIZING: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Icon } from '@lobehub/ui';
|
|
2
2
|
import { Button } from 'antd';
|
|
3
3
|
import { Maximize2, Minimize2 } from 'lucide-react';
|
|
4
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
5
|
import { INITIAL_OPTIONS, WORD_EDITOR_INITIALIZING, useEditor, useFullScreen } from "./helper";
|
|
6
6
|
import { useStyles } from "./style";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -16,7 +16,8 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
16
16
|
width = props.width,
|
|
17
17
|
height = props.height,
|
|
18
18
|
language = props.language,
|
|
19
|
-
supportFullScreen = props.supportFullScreen
|
|
19
|
+
supportFullScreen = props.supportFullScreen,
|
|
20
|
+
onFullScreenChange = props.onFullScreenChange;
|
|
20
21
|
var onChangeRef = useRef(onChange);
|
|
21
22
|
var _useEditor = useEditor('single', props),
|
|
22
23
|
isEditorReady = _useEditor.isEditorReady,
|
|
@@ -86,6 +87,10 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
86
87
|
(_monacoRef$current = monacoRef.current) === null || _monacoRef$current === void 0 || _monacoRef$current.editor.setModelLanguage(model, language);
|
|
87
88
|
}
|
|
88
89
|
}, [editorRef, isEditorReady, language, monacoRef]);
|
|
90
|
+
var fullScreenChange = useCallback(function () {
|
|
91
|
+
onFullScreenChange === null || onFullScreenChange === void 0 || onFullScreenChange(!isFullScreen);
|
|
92
|
+
fullScreen();
|
|
93
|
+
}, [fullScreen, isFullScreen, onFullScreenChange]);
|
|
89
94
|
return /*#__PURE__*/_jsxs("div", {
|
|
90
95
|
className: className,
|
|
91
96
|
style: props.style,
|
|
@@ -101,7 +106,7 @@ var SingleMonacoEditor = function SingleMonacoEditor(props) {
|
|
|
101
106
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
102
107
|
icon: isFullScreen ? Minimize2 : Maximize2
|
|
103
108
|
}),
|
|
104
|
-
onClick:
|
|
109
|
+
onClick: fullScreenChange,
|
|
105
110
|
size: "small",
|
|
106
111
|
type: "text"
|
|
107
112
|
})
|
|
@@ -115,7 +120,8 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
115
120
|
language = props.language,
|
|
116
121
|
onChange = props.onChange,
|
|
117
122
|
original = props.original,
|
|
118
|
-
supportFullScreen = props.supportFullScreen
|
|
123
|
+
supportFullScreen = props.supportFullScreen,
|
|
124
|
+
onFullScreenChange = props.onFullScreenChange;
|
|
119
125
|
var onChangeRef = useRef(onChange);
|
|
120
126
|
var _useEditor2 = useEditor('diff', props),
|
|
121
127
|
isEditorReady = _useEditor2.isEditorReady,
|
|
@@ -184,6 +190,10 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
184
190
|
(_monacoRef$current2 = monacoRef.current) === null || _monacoRef$current2 === void 0 || _monacoRef$current2.editor.setModelLanguage(originalModel, language);
|
|
185
191
|
(_monacoRef$current3 = monacoRef.current) === null || _monacoRef$current3 === void 0 || _monacoRef$current3.editor.setModelLanguage(modifiedModel, language);
|
|
186
192
|
}, [editorRef, isEditorReady, language, monacoRef]);
|
|
193
|
+
var fullScreenChange = useCallback(function () {
|
|
194
|
+
onFullScreenChange === null || onFullScreenChange === void 0 || onFullScreenChange(!isFullScreen);
|
|
195
|
+
fullScreen();
|
|
196
|
+
}, [fullScreen, isFullScreen, onFullScreenChange]);
|
|
187
197
|
return /*#__PURE__*/_jsxs("div", {
|
|
188
198
|
className: className,
|
|
189
199
|
style: props.style,
|
|
@@ -199,7 +209,7 @@ var DiffMonacoEditor = function DiffMonacoEditor(props) {
|
|
|
199
209
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
200
210
|
icon: isFullScreen ? Minimize2 : Maximize2
|
|
201
211
|
}),
|
|
202
|
-
onClick:
|
|
212
|
+
onClick: fullScreenChange,
|
|
203
213
|
size: "small",
|
|
204
214
|
type: "text"
|
|
205
215
|
})
|