GuidesUniver SheetsFeaturesCrosshair Highlight

Crosshair Highlight

Facade APIPaid VersionUniver ServerUniver on Node.jsPreset
---❌ import via plugins

Crosshair highlight highlights the row and column of the selected cell to make it easier for users to identify the currently selected cell.

This feature includes the following plugin packages:

Installation

Presets Installation

npm install @univerjs/sheets-crosshair-highlight
import { createUniver, defaultTheme, LocaleType, Tools } from '@univerjs/presets';
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
import UniverPresetSheetsCoreEnUS from '@univerjs/presets/preset-sheets-core/locales/en-US';
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import sheetsCrosshairHighlightEnUS from '@univerjs/sheets-crosshair-highlight/locale/en-US';
 
import '@univerjs/sheets-crosshair-highlight/lib/index.css';
 
import '@univerjs/sheets-crosshair-highlight/facade';
 
const { univerAPI } = createUniver({
  locale: LocaleType.EN_US,
  locales: {
    enUS: Tools.deepMerge(
      {},
      UniverPresetSheetsCoreEnUS,
      sheetsCrosshairHighlightEnUS 
    ),
  },
  theme: defaultTheme,
  presets: [
    UniverSheetsCorePreset(),
  ],
  plugins: [
    UniverSheetsCrosshairHighlightPlugin
  ],
});

Advanced Installation

npm install @univerjs/sheets-crosshair-highlight
import { LocaleType, Tools } from '@univerjs/core';
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import SheetsCrosshairHighlightEnUS from '@univerjs/sheets-crosshair-highlight/locale/en-US';
 
import '@univerjs/sheets-crosshair-highlight/lib/index.css';
 
import '@univerjs/sheets-crosshair-highlight/facade';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: Tools.deepMerge(
      SheetsCrosshairHighlightEnUS
    ),
  },
});
 
univer.registerPlugin(UniverSheetsCrosshairHighlightPlugin);

Facade API

Toggle Crosshair Highlight

univerAPI.setCrosshairHighlightEnabled(true);
 
univerAPI.setCrosshairHighlightEnabled(false);

Set Crosshair Highlight Color

univerAPI.setCrosshairHighlightColor('red');