Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sheet-ui): find & replace #1349

Merged
merged 17 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: rollback unexpected changes
  • Loading branch information
wzhudev committed Mar 14, 2024
commit 3f2cd6ff93c6155cf80a3938c85e7c09143bfff6
12 changes: 3 additions & 9 deletions packages/ui/src/components/editor/TextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC

const [active, setActive] = useState(false);

const onChangeRef = useRef<Nullable<((value: Nullable<string>) => void)>>(onChange);

const onActiveRef = useRef<Nullable<((state: boolean) => void)>>(onActive);

const onValidRef = useRef<Nullable<((state: boolean) => void)>>(onValid);

useEffect(() => {
const editor = editorRef.current;

Expand Down Expand Up @@ -170,7 +164,7 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC

const activeChange = debounce((state: boolean) => {
setActive(state);
onActiveRef.current && onActiveRef.current(state);
onActive && onActive(state);
}, 30);

const focusStyleSubscription = editorService.focusStyle$.subscribe((unitId: Nullable<string>) => {
Expand All @@ -195,9 +189,9 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC
setValidationContent(localeService.t('textEditor.rangeError'));
}

onValidRef.current && onValidRef.current(isLegality);
onValid && onValid(isLegality);

onChangeRef.current && onChangeRef.current(editorService.getValue(id));
onChange && onChange(editorService.getValue(id));
}, 30);

const valueChangeSubscription = editorService.valueChange$.subscribe((editor) => {
Expand Down
15 changes: 10 additions & 5 deletions packages/ui/src/services/editor/editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ export class Editor {

private _valueLegality = true;

constructor(private _param: IEditorSetParam) {
private _openForSheetUnitId: Nullable<string>;

private _openForSheetSubUnitId: Nullable<string>;

constructor(private _param: IEditorSetParam) {
this._openForSheetUnitId = this._param.openForSheetUnitId;
this._openForSheetSubUnitId = this._param.openForSheetSubUnitId;
}

get documentDataModel() {
Expand All @@ -99,19 +104,19 @@ export class Editor {
}

setOpenForSheetUnitId(unitId: Nullable<string>) {
this._param.openForSheetUnitId = unitId;
this._openForSheetUnitId = unitId;
}

getOpenForSheetUnitId() {
return this._param.openForSheetUnitId;
return this._openForSheetUnitId;
}

setOpenForSheetSubUnitId(subUnitId: Nullable<string>) {
this._param.openForSheetSubUnitId = subUnitId;
this._openForSheetSubUnitId = subUnitId;
}

getOpenForSheetSubUnitId() {
return this._param.openForSheetSubUnitId;
return this._openForSheetSubUnitId;
}

isValueLegality() {
Expand Down
Loading