指南Univer Sheets功能Uniscript

Uniscript

Facade API可付费升级需要 Univer 服务端Univer on Node.jsPreset
----❌ 通过 plugin 引入

Uniscript 插件提供了快速添加或编辑 Facade API 的能力。安装之后,工具栏会出现一个新的按钮,点击后会弹出一个侧边栏,可以在其中输入代码并执行。我们文档中任何 univerAPI 开头的代码均可在此处执行。

该功能包含以下插件包:

Presets 安装

npm install @univerjs/uniscript
import { createUniver, defaultTheme, LocaleType, merge } from '@univerjs/presets';
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
import UniverPresetSheetsCoreZhCN from '@univerjs/presets/preset-sheets-core/locales/zh-CN';
import { UniverUniscriptPlugin } from '@univerjs/uniscript';
import UniscriptZhCN from '@univerjs/uniscript/locale/zh-CN';
 
import '@univerjs/presets/lib/styles/preset-sheets-core.css'
import '@univerjs/uniscript/lib/index.css';
 
const { univerAPI } = createUniver({
  locale: LocaleType.ZH_CN,
  locales: {
    [LocaleType.ZH_CN]: merge(
      {},
      UniverPresetSheetsCoreZhCN,
      UniscriptZhCN 
    ),
  },
  theme: defaultTheme,
  presets: [
    UniverSheetsCorePreset(),
  ],
  plugins: [
    UniverUniscriptPlugin 
  ],
});

手动组合安装

npm install @univerjs/uniscript
import { LocaleType, merge, Univer } from '@univerjs/core';
import { defaultTheme } from "@univerjs/design";
import { UniverUniscriptPlugin } from '@univerjs/uniscript';
import UniscriptZhCN from '@univerjs/uniscript/locale/zh-CN';
 
import '@univerjs/uniscript/lib/index.css';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.ZH_CN,
  locales: {
    [LocaleType.ZH_CN]: merge(
      UniscriptZhCN
    ),
  },
});
 
univer.registerPlugin(UniverUniscriptPlugin);

这个页面对您有帮助吗?