Univer
Univer Sheet
功能
浮动图片

浮动图片

📊 Univer Sheet📝 Univer Doc

插入浮动图片,支持拖拽调整大小和位置。

安装

pnpm add @univerjs/drawing @univerjs/sheets-drawing @univerjs/drawing-ui @univerjs/sheets-drawing-ui

引入

import '@univerjs/drawing-ui/lib/index.css';
import '@univerjs/sheets-drawing-ui/lib/index.css';
 
import { UniverDrawingPlugin } from '@univerjs/drawing';
import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui';
import { UniverSheetsDrawingPlugin } from '@univerjs/sheets-drawing';
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';

国际化

import { LocaleType, Tools } from '@univerjs/core';
import DrawingUIZhCN from '@univerjs/drawing-ui/locale/zh-CN';
import SheetsDrawingUIZhCN from '@univerjs/sheets-drawing-ui/locale/zh-CN';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.ZH_CN,
  locales: {
    [LocaleType.ZH_CN]: Tools.deepMerge(
      DrawingUIZhCN,
      SheetsDrawingUIZhCN
    ),
  },
});

注册

不使用协同插件时,注册代码如下:

univer.registerPlugin(UniverDrawingPlugin);
univer.registerPlugin(UniverDrawingUIPlugin);
univer.registerPlugin(UniverSheetsDrawingPlugin);
univer.registerPlugin(UniverSheetsDrawingUIPlugin);

使用协同插件时,注册代码如下:

import { IImageIoService } from '@univerjs/drawing'
 
univer.registerPlugin(UniverDrawingPlugin, {
  override: [[IImageIoService, null]], // 协同插件将会提供该实现
});
univer.registerPlugin(UniverDrawingUIPlugin);
univer.registerPlugin(UniverSheetsDrawingPlugin);
univer.registerPlugin(UniverSheetsDrawingUIPlugin);

Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.