Uniscript

GitHubEdit on GitHub
Plugins Info
@univerjs/uniscript
Server Required
No

Uniscript provides the ability to quickly add or edit Facade APIs online. After installation, a new button will appear in the toolbar. Clicking it will open a sidebar where you can enter and execute code. Any code starting with univerAPI in our documentation can be executed here.

Good to Know

The panel of Uniscript injects an instance object of the Facade API called univerAPI, which can be used directly to call the Facade APIs mentioned in the documentation.

Preset Mode

Uniscript does not provide a preset, but it supports mixing with its plugins.

Installation

npm install @univerjs/uniscript

Usage

import { UniverUniscriptPlugin } from '@univerjs/uniscript'

import '@univerjs/uniscript/lib/index.css'

const { univerAPI } = createUniver({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: merge(
      {},
      UniverPresetSheetsCoreEnUS,
      UniscriptEnUS, 
    ),
  },
  presets: [
    UniverSheetsCorePreset(),
  ],
  plugins: [
    UniverUniscriptPlugin, 
  ],
})

Plugin Mode

Installation

npm install @univerjs/uniscript

Usage

import { LocaleType, merge, Univer } from '@univerjs/core'
import { UniverUniscriptPlugin } from '@univerjs/uniscript'

import '@univerjs/uniscript/lib/index.css'

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: merge(
      {},
      UniscriptEnUS, 
    ),
  },
})

univer.registerPlugin(UniverUniscriptPlugin)