GuidesUniver SheetsFeaturesUniscript

Uniscript

Facade APIHas Paid PlanUniver ServerUniver on Node.jsPreset
----❌ import via plugins

The Uniscript plugin provides the ability to quickly add or edit a Facade API. After installation, a new button will appear in the toolbar. Clicking it will pop up a sidebar where you can enter code and execute it. Any code starting with univerAPI in our document can be executed here.

This feature includes the following plugin packages:

Presets Installation

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

Piecemeal Installation

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

Was this page helpful?