Images
Preset Info
@univerjs/preset-docs-drawing
Server Required
No
Images can be used to enrich document content, enhance visual expression, and help illustrate or highlight key information.
Preset Mode
Installation
npm install @univerjs/preset-docs-drawing
Usage
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'
import UniverPresetDocsCoreEnUS from '@univerjs/preset-docs-core/locales/en-US'
import { UniverDocsDrawingPreset } from '@univerjs/preset-docs-drawing'
import UniverPresetDocsDrawingEnUS from '@univerjs/preset-docs-drawing/locales/en-US'
import { createUniver, LocaleType, merge } from '@univerjs/presets'
import '@univerjs/preset-docs-core/lib/index.css'
import '@univerjs/preset-docs-drawing/lib/index.css'
const { univerAPI } = createUniver({
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: merge(
{},
UniverPresetDocsCoreEnUS,
UniverPresetDocsDrawingEnUS,
),
},
presets: [
UniverDocsCorePreset(),
UniverDocsDrawingPreset(),
],
})
If you are using the collaboration feature, make sure to pass the collaboration: true
option in UniverDocsDrawingPreset
:
UniverDocsDrawingPreset({
collaboration: true,
})
Plugin Mode
Installation
npm install @univerjs/drawing @univerjs/drawing-ui @univerjs/docs-drawing @univerjs/docs-drawing-ui
Usage
import { LocaleType, merge, Univer } from '@univerjs/core'
import { UniverDocsDrawingPlugin } from '@univerjs/docs-drawing'
import { UniverDocsDrawingUIPlugin } from '@univerjs/docs-drawing-ui'
import DocsDrawingUIEnUS from '@univerjs/docs-drawing-ui/locale/en-US'
import { UniverDrawingPlugin } from '@univerjs/drawing'
import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui'
import DrawingUIEnUS from '@univerjs/drawing-ui/locale/en-US'
import '@univerjs/drawing-ui/lib/index.css'
import '@univerjs/docs-drawing-ui/lib/index.css'
const univer = new Univer({
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: merge(
{},
DrawingUIEnUS,
DocsDrawingUIEnUS,
),
},
})
univer.registerPlugin(UniverDrawingPlugin)
univer.registerPlugin(UniverDrawingUIPlugin)
univer.registerPlugin(UniverDocsDrawingPlugin)
univer.registerPlugin(UniverDocsDrawingUIPlugin)
If you are using the collaboration feature, you need to add the override
configuration:
univer.registerPlugin(UniverDrawingPlugin, {
override: [[IImageIoService, null]],
})