dream-num / univer

Univer is an open-source alternative to Google Sheets, Slides, and Docs
https://univer.ai
Apache License 2.0
5.68k stars 469 forks source link

[Bug] The docs ui plugin provides a layout.toolbarConfig to control the display of toolbars, but in reality, this feature has not been implemented #2630

Closed Delan1026 closed 5 days ago

Delan1026 commented 6 days ago

Before you submit this issue, have you checked the following

Affected packages and versions

0.1.16

Reproduction link

The docs ui plugin provides a layout. toolbarConfiguration configuration to control the display of toolbars, but in reality, this feature has not been implemented

packages/docs-ui/src/controllers/doc-ui.controller.ts

private _initMenus(): void {
       // 实际没有用到layout.toolbarConfig配置
      const { menu = {} } = this._config;

      // init menus
      (
          [
              BoldMenuItemFactory,
              ItalicMenuItemFactory,
              UnderlineMenuItemFactory,
              StrikeThroughMenuItemFactory,
              SubscriptMenuItemFactory,
              SuperscriptMenuItemFactory,
              FontSizeSelectorMenuItemFactory,
              FontFamilySelectorMenuItemFactory,
              TextColorSelectorMenuItemFactory,
              AlignLeftMenuItemFactory,
              AlignCenterMenuItemFactory,
              AlignRightMenuItemFactory,
              AlignJustifyMenuItemFactory,
              OrderListMenuItemFactory,
              BulletListMenuItemFactory,
              ResetBackgroundColorMenuItemFactory,
              BackgroundColorSelectorMenuItemFactory,
          ] as IMenuItemFactory[]
      ).forEach((factory) => {
          this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));
      });
  }

Expected behavior

I want to hide the font and fontSize selections, pass toolbarConfig as below:

  univer.registerPlugin(UniverDocsUIPlugin, {
      layout: {
          toolbarConfig: {
              font: false,
              fontSize: false
          }
      }
  });

Actual behavior

Although I have set the font and fontSize parameters, the 2 menus are not hidden

System information

No response

univer-bot[bot] commented 6 days ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Bug] The docs ui plugin provides a layout.toolbarConfig to control the display of toolbars, but in reality, this feature has not been implemented

Title: [Bug] The docs ui plugin provides a layout.toolbarConfig to control the display of toolbars, but in reality, this feature has not been implemented


Before you submit this issue, have you checked the following

Affected packages and versions

0.1.16

Reproduction link

The docs ui plugin provides a layout. toolbarConfiguration configuration to control the display of toolbars, but in reality, this feature has not been implemented

packages/docs-ui/src/controllers/doc-ui.controller.ts

private _initMenus(): void {
       // 实际没有用到layout.toolbarConfig配置
      const { menu = {} } = this._config;

      // init menus
      (
          [
              BoldMenuItemFactory,
              ItalicMenuItemFactory,
              UnderlineMenuItemFactory,
              StrikeThroughMenuItemFactory,
              SubscriptMenuItemFactory,
              SuperscriptMenuItemFactory,
              FontSizeSelectorMenuItemFactory,
              FontFamilySelectorMenuItemFactory,
              TextColorSelectorMenuItemFactory,
              AlignLeftMenuItemFactory,
              AlignCenterMenuItemFactory,
              AlignRightMenuItemFactory,
              AlignJustifyMenuItemFactory,
              OrderListMenuItemFactory,
              BulletListMenuItemFactory,
              ResetBackgroundColorMenuItemFactory,
              BackgroundColorSelectorMenuItemFactory,
          ] as IMenuItemFactory[]
      ).forEach((factory) => {
          this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory), menu));
      });
  }

Expected behavior

I want to hide the font and fontSize selections, pass toolbarConfig as below:

  univer.registerPlugin(UniverDocsUIPlugin, {
      layout: {
          toolbarConfig: {
              font: false,
              fontSize: false
          }
      }
  });

Actual behavior

Although I have set the font and fontSize parameters, the 2 menus are not hidden

System information

No response

jikkai commented 5 days ago

This is not a bug.

If you need to customize the UI, please refer to https://univer.ai/guides/sheet/customization/ui for guidance on how to customize menu items and hide existing menu items through configuration.

Delan1026 commented 5 days ago

https://univer.ai/guides/sheet/customization/ui is 404

the new page is : https://univer.ai/zh-CN/guides/sheet/advanced/custom-ui#%E5%AE%9A%E5%88%B6%E8%8F%9C%E5%8D%95%E9%A1%B9%E9%9A%90%E8%97%8F%E8%8F%9C%E5%8D%95%E9%A1%B9