十字高亮
Facade API | 付费版本 | 需要 Univer 服务端 | Univer on Node.js | Preset |
---|---|---|---|---|
✅ | - | - | ✅ | ❌ 通过 plugin 引入 |
十字高亮将用户选中的单元格所在行列突出显示,以便用户更容易地识别当前选中的单元格。
该功能包含以下插件包:
Presets 安装
npm install @univerjs/sheets-crosshair-highlight
import { createUniver, defaultTheme, LocaleType, Tools } from '@univerjs/presets';
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
import UniverPresetSheetsCoreZhCN from '@univerjs/presets/preset-sheets-core/locales/zh-CN';
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import sheetsCrosshairHighlightZhCN from '@univerjs/sheets-crosshair-highlight/locale/zh-CN';
import '@univerjs/sheets-crosshair-highlight/lib/index.css';
import '@univerjs/sheets-crosshair-highlight/facade';
const { univerAPI } = createUniver({
locale: LocaleType.ZH_CN,
locales: {
zhCN: Tools.deepMerge(
{},
UniverPresetSheetsCoreZhCN,
sheetsCrosshairHighlightZhCN
),
},
theme: defaultTheme,
presets: [
UniverSheetsCorePreset(),
],
plugins: [
UniverSheetsCrosshairHighlightPlugin
],
});
高级安装
npm install @univerjs/sheets-crosshair-highlight
import { LocaleType, Tools } from '@univerjs/core';
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import SheetsCrosshairHighlightZhCN from '@univerjs/sheets-crosshair-highlight/locale/zh-CN';
import '@univerjs/sheets-crosshair-highlight/lib/index.css';
import '@univerjs/sheets-crosshair-highlight/facade';
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
locales: {
[LocaleType.ZH_CN]: Tools.deepMerge(
SheetsCrosshairHighlightZhCN
),
},
});
univer.registerPlugin(UniverSheetsCrosshairHighlightPlugin);
Facade API
切换十字高亮开关
univerAPI.setCrosshairHighlightEnabled(true);
univerAPI.setCrosshairHighlightEnabled(false);
设置十字高亮颜色
univerAPI.setCrosshairHighlightColor('red');