Skip to content

Commit

Permalink
docs(watermark): update contents
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 committed Oct 23, 2024
1 parent b79e27e commit 7430d6f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 34 deletions.
41 changes: 24 additions & 17 deletions src/docs/guides/general/features/watermark.en-US.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Callout, Steps, Tabs } from 'nextra/components'
import BadgeGroup, { UniverTypes } from '@/components/BadgeGroup'
import VersionBadge from '@/components/VersionBadge'

# Use Watermark
# Use Watermark <VersionBadge version="0.4.2+" />

<BadgeGroup values={[UniverTypes.GENERAL]} value={UniverTypes.GENERAL} />

The watermark feature is designed to provide a flexible and secure watermark solution for web pages or applications. With this feature, developers can dynamically generate text or image watermarks on the page to prevent unauthorized use or dissemination of content. It supports multiple configurations.

Watermark supports three settings: UI interface, FacadeAPI, and plug-in configuration.
Three types of watermarks are supported: user information type, custom image type, and custom text type. The display of watermarks only supports one type of display, and the priority is user information type > custom image type > custom text type.

## Install

Install using your package manager:
Expand All @@ -28,34 +32,37 @@ Install using your package manager:

```typescript
import { UniverWatermarkPlugin } from '@univerjs/watermark';

univer.registerPlugin(UniverWatermarkPlugin);
```


## Use

Watermark supports three settings: UI interface, FacadeAPI, and plug-in configuration.
Three types of watermarks are supported: user information type, custom image type, and custom text type. The display of watermarks only supports one type of display, and the priority is user information type > custom image type > custom text type.

### How to use FacadeAPI
## Register

```typescript
import { FUniver } from "@univerjs/facade";

const univerAPI = FUniver.newAPI(univer);
// Please refer to the API documentation for specific parameters https://github.com/dream-num/univer/blob/d0054f3e690d9d3cf9715b59a97a8cb95f65a6c8/packages/facade/src/apis/facade.ts#L555
univerAPI.addWatermark()
univer.registerPlugin(UniverWatermarkPlugin);
```

### Configurable plugins
## Config

```typescript

univer.registerPlugin(UniverWatermarkPlugin, {
textWatermarkSettings: {
// For specific configuration parameters, see https://github.com/dream-num/univer/blob/d0054f3e690d9d3cf9715b59a97a8cb95f65a6c8/packages/watermark/src/controllers/config.schema.ts#L24
content: "Univer",
}
})
```

### Facade API

### `FUniver.setWatermark(type, config)`

Set watermark.

```typescript
const univerAPI = FUniver.newAPI(univer);
// Please refer to the API documentation for specific parameters https://github.com/dream-num/univer/blob/d0054f3e690d9d3cf9715b59a97a8cb95f65a6c8/packages/facade/src/apis/facade.ts#L555
univerAPI.setWatermark("text", { content: "hello", repeat: true })
```

### `FUniver.setWatermark(null)`

Remove watermark.
41 changes: 24 additions & 17 deletions src/docs/guides/general/features/watermark.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Callout, Steps, Tabs } from 'nextra/components'
import BadgeGroup, { UniverTypes } from '@/components/BadgeGroup'
import VersionBadge from '@/components/VersionBadge'

# 使用水印
# 使用水印 <VersionBadge version="0.4.2+" />

<BadgeGroup values={[UniverTypes.GENERAL]} value={UniverTypes.GENERAL} />

水印功能旨在为网页或应用提供灵活且安全的水印方案。通过该功能,开发者可以在页面上动态生成文本或图片水印,以防止内容未经授权的使用或传播。并支持多种配置。

水印支持三种设置方式,分别为 UI 界面、Facade API、和插件配置。
水印类型支持三种类型,分别是用户信息类型、自定义图片类型、自定义文本类型,水印的展示只支持某一种类型的展示,优先级为用户信息类型 > 自定义图片类型 > 自定义文本类型。

## 安装

使用你的包管理器安装:
Expand All @@ -28,34 +32,37 @@ import BadgeGroup, { UniverTypes } from '@/components/BadgeGroup'

```typescript
import { UniverWatermarkPlugin } from '@univerjs/watermark';

univer.registerPlugin(UniverWatermarkPlugin);
```


## 使用

水印支持三种设置方式,分别为 UI 界面、Facade API、和插件配置。
水印类型支持三种类型,分别是用户信息类型、自定义图片类型、自定义文本类型,水印的展示只支持某一种类型的展示,优先级为用户信息类型 > 自定义图片类型 > 自定义文本类型。

### Facade API使用方式
## 注册

```typescript
import { FUniver } from "@univerjs/facade";

const univerAPI = FUniver.newAPI(univer);
// 具体参数请看 API 文档 https://github.com/dream-num/univer/blob/d0054f3e690d9d3cf9715b59a97a8cb95f65a6c8/packages/facade/src/apis/facade.ts#L555
univerAPI.addWatermark()
univer.registerPlugin(UniverWatermarkPlugin);
```

### 通过插件配置化
## 配置

```typescript

univer.registerPlugin(UniverWatermarkPlugin, {
textWatermarkSettings: {
// 具体配置参数请看 https://github.com/dream-num/univer/blob/d0054f3e690d9d3cf9715b59a97a8cb95f65a6c8/packages/watermark/src/controllers/config.schema.ts#L24
content: "Univer",
}
})
```

## Facade API

### `FUniver.setWatermark(type, config)`

设置水印。

```typescript
const univerAPI = FUniver.newAPI(univer);
// 具体参数请看 API 文档 https://github.com/dream-num/univer/blob/d0054f3e690d9d3cf9715b59a97a8cb95f65a6c8/packages/facade/src/apis/facade.ts#L555
univerAPI.setWatermark("text", { content: "hello", repeat: true })
```

### `FUniver.setWatermark(null)`

移除水印。

0 comments on commit 7430d6f

Please sign in to comment.