fix(docs-ui): error display doc-toolbar on sheet (#4751)

This commit is contained in:
zhangw
2025-03-01 10:49:10 +08:00
committed by GitHub
parent 8ab1ef0492
commit bc3c3345a8
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ const MAX_UNIT_MEMORY_OVERFLOW = 1_000_000; // 1MB
const MAX_UNIVER_MEMORY_OVERFLOW = 6_000_000; // TODO@wzhudev: temporarily added 300KB
// there is a memory leak in the univer object, so we need to make sure that
const MAX_SECOND_INSTANCE_OVERFLOW = 100_000; // Only 100 KB
const MAX_SECOND_INSTANCE_OVERFLOW = 110_000; // Only 100 KB
interface HeapSnapshotChunk {
chunk: string;
@@ -88,11 +88,9 @@ export class DocUIController extends Disposable {
this.disposeWithMe(componentManager.register('TodoList', TodoList));
}
// TODO: @zhangwei, why add workbook to docs-ui?
private _initUiParts() {
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
const config = this._configService.getConfig<IUniverDocsUIConfig>(DOCS_UI_PLUGIN_CONFIG_KEY);
if (config?.layout?.docContainerConfig?.footer && !workbook) {
if (config?.layout?.docContainerConfig?.footer) {
this.disposeWithMe(this._uiPartsService.registerComponent(BuiltInUIPart.FOOTER, () => connectInjector(DocFooter, this._injector)));
}
}
@@ -14,12 +14,16 @@
* limitations under the License.
*/
import React from 'react';
import { CountBar } from '../count-bar';
import styles from './index.module.less';
import { useDependency, useObservable } from '@univerjs/ui';
import { IUniverInstanceService, UniverInstanceType, type Workbook } from '@univerjs/core';
export const DocFooter = () => {
return (
const univerInstanceService = useDependency(IUniverInstanceService);
const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), undefined, undefined, []);
return workbook ? null : (
<div className={styles.docFooterContainer}>
<div />
<CountBar />