@univerjs/watermark 0.4.0-nightly.202410290723
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/lib/cjs/index.js +9 -0
- package/lib/es/index.js +911 -0
- package/lib/index.css +1 -0
- package/lib/locale/en-US.json +32 -0
- package/lib/locale/fa-IR.json +32 -0
- package/lib/locale/ru-RU.json +32 -0
- package/lib/locale/vi-VN.json +32 -0
- package/lib/locale/zh-CN.json +32 -0
- package/lib/locale/zh-TW.json +32 -0
- package/lib/types/commands/operations/open-watermark-panel.operation.d.ts +2 -0
- package/lib/types/common/const.d.ts +10 -0
- package/lib/types/common/type.d.ts +59 -0
- package/lib/types/controllers/config.schema.d.ts +12 -0
- package/lib/types/controllers/menu.d.ts +3 -0
- package/lib/types/controllers/menu.schema.d.ts +2 -0
- package/lib/types/controllers/watermark.menu.controller.d.ts +9 -0
- package/lib/types/controllers/watermark.render.controller.d.ts +14 -0
- package/lib/types/facade/f-univer.d.ts +26 -0
- package/lib/types/facade/index.d.ts +0 -0
- package/lib/types/index.d.ts +20 -0
- package/lib/types/locale/en-US.d.ts +3 -0
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/locale/ru-RU.d.ts +3 -0
- package/lib/types/locale/vi-VN.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts +48 -0
- package/lib/types/locale/zh-TW.d.ts +3 -0
- package/lib/types/plugin.d.ts +18 -0
- package/lib/types/services/watermark.service.d.ts +15 -0
- package/lib/types/util.d.ts +7 -0
- package/lib/types/views/components/WatermarkImageSetting.d.ts +8 -0
- package/lib/types/views/components/WatermarkPanel.d.ts +2 -0
- package/lib/types/views/components/WatermarkPanelFooter.d.ts +2 -0
- package/lib/types/views/components/WatermarkTextSetting.d.ts +8 -0
- package/lib/types/views/extensions/watermark-layer.d.ts +11 -0
- package/lib/umd/index.js +9 -0
- package/package.json +92 -0
package/lib/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.univer-watermark-panel{margin:16px 0}.univer-watermark-panel-type-title{font-size:15px;color:rgb(var(--text-color-secondary))}.univer-watermark-panel-type-select{width:100%;margin-top:16px}.univer-watermark-panel-setting{width:100%;min-height:100px;border-radius:8px}.univer-watermark-panel-footer{display:flex;justify-content:space-between;align-items:center;font-size:12px}.univer-watermark-panel-footer-button-wrapper{display:flex;align-items:center}.univer-watermark-panel-footer-reset{cursor:pointer;white-space:nowrap;color:rgb(var(--primary-color));border-bottom:1px solid rgb(var(--primary-color))}.univer-watermark-text-setting{font-size:14px}.univer-watermark-text-setting-header{font-size:15px;color:rgb(var(--text-color-secondary));margin:16px 0}.univer-watermark-text-setting-font-content{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.univer-watermark-text-setting-font-style-part{display:flex;justify-content:space-between;align-items:center;margin-top:16px}.univer-watermark-text-setting-font-style-part:first-child{margin-top:0}.univer-watermark-text-setting-layout-font-wrapper{width:calc(50% - 8px);align-self:flex-start;white-space:nowrap}.univer-watermark-image-setting{font-size:14px}.univer-watermark-input{height:28px;box-sizing:border-box}.univer-watermark-input-content{width:220px}.univer-watermark-icon{width:18px;height:18px;margin:2px}.univer-watermark-icon-wrapper{cursor:pointer;border-radius:4px;width:24px;height:24px}.univer-watermark-icon-wrapper-select,.univer-watermark-icon-wrapper:hover{background-color:rgb(var(--grey-100))}.univer-watermark-icon-wrapper:first-child{margin-left:28px}.univer-watermark-icon-wrapper:last-child{margin-right:28px}.univer-watermark-color-picker-wrapper{padding:16px;border-radius:8px;background-color:#fff;border:1px solid rgb(var(--grey-100))}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
"title": "Watermark",
|
|
4
|
+
"type": "Type",
|
|
5
|
+
"text": "Text",
|
|
6
|
+
"image": "Image",
|
|
7
|
+
"uploadImage": "Upload Image",
|
|
8
|
+
"replaceImage": "Replace Image",
|
|
9
|
+
"keepRatio": "Keep Ratio",
|
|
10
|
+
"width": "Width",
|
|
11
|
+
"height": "Height",
|
|
12
|
+
"style": "Style Settings",
|
|
13
|
+
"content": "Content",
|
|
14
|
+
"textPlaceholder": "Enter text",
|
|
15
|
+
"fontSize": "Font Size",
|
|
16
|
+
"direction": "Direction",
|
|
17
|
+
"ltr": "Left to Right",
|
|
18
|
+
"rtl": "Right to Left",
|
|
19
|
+
"inherits": "Inherit",
|
|
20
|
+
"opacity": "Opacity",
|
|
21
|
+
"layout": "Layout Settings",
|
|
22
|
+
"rotate": "Rotate",
|
|
23
|
+
"repeat": "Repeat",
|
|
24
|
+
"spacingX": "Horizontal Spacing",
|
|
25
|
+
"spacingY": "Vertical Spacing",
|
|
26
|
+
"startX": "Horizontal Start Position",
|
|
27
|
+
"startY": "Vertical Start Position",
|
|
28
|
+
"cancel": "Cancel Watermark",
|
|
29
|
+
"close": "Close Panel",
|
|
30
|
+
"copy": "Copy Config"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
"title": "علامت آب",
|
|
4
|
+
"type": "نوع",
|
|
5
|
+
"text": "متن",
|
|
6
|
+
"image": "تصویر",
|
|
7
|
+
"uploadImage": "آپلود تصویر",
|
|
8
|
+
"replaceImage": "جایگزینی تصویر",
|
|
9
|
+
"keepRatio": "حفظ نسبت",
|
|
10
|
+
"width": "عرض",
|
|
11
|
+
"height": "ارتفاع",
|
|
12
|
+
"style": "تنظیمات سبک",
|
|
13
|
+
"content": "محتوا",
|
|
14
|
+
"textPlaceholder": "متن را وارد کنید",
|
|
15
|
+
"fontSize": "اندازه فونت",
|
|
16
|
+
"direction": "جهت",
|
|
17
|
+
"ltr": "چپ به راست",
|
|
18
|
+
"rtl": "راست به چپ",
|
|
19
|
+
"inherits": "ارث بردن",
|
|
20
|
+
"opacity": "شفافیت",
|
|
21
|
+
"layout": "تنظیمات چیدمان",
|
|
22
|
+
"rotate": "چرخاندن",
|
|
23
|
+
"repeat": "تکرار",
|
|
24
|
+
"spacingX": "فاصله افقی",
|
|
25
|
+
"spacingY": "فاصله عمودی",
|
|
26
|
+
"startX": "موقعیت شروع افقی",
|
|
27
|
+
"startY": "موقعیت شروع عمودی",
|
|
28
|
+
"cancel": "لغو علامت آب",
|
|
29
|
+
"close": "بستن پنل",
|
|
30
|
+
"copy": "کپی تنظیمات"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
"title": "Водяной знак",
|
|
4
|
+
"type": "Тип",
|
|
5
|
+
"text": "Текст",
|
|
6
|
+
"image": "Изображение",
|
|
7
|
+
"uploadImage": "Загрузить изображение",
|
|
8
|
+
"replaceImage": "Заменить изображение",
|
|
9
|
+
"keepRatio": "Сохранить пропорции",
|
|
10
|
+
"width": "Ширина",
|
|
11
|
+
"height": "Высота",
|
|
12
|
+
"style": "Настройки стиля",
|
|
13
|
+
"content": "Содержание",
|
|
14
|
+
"textPlaceholder": "Введите текст",
|
|
15
|
+
"fontSize": "Размер шрифта",
|
|
16
|
+
"direction": "Направление",
|
|
17
|
+
"ltr": "Слева направо",
|
|
18
|
+
"rtl": "Справа налево",
|
|
19
|
+
"inherits": "Наследовать",
|
|
20
|
+
"opacity": "Прозрачность",
|
|
21
|
+
"layout": "Настройки макета",
|
|
22
|
+
"rotate": "Поворот",
|
|
23
|
+
"repeat": "Повтор",
|
|
24
|
+
"spacingX": "Горизонтальный интервал",
|
|
25
|
+
"spacingY": "Вертикальный интервал",
|
|
26
|
+
"startX": "Горизонтальная начальная позиция",
|
|
27
|
+
"startY": "Вертикальная начальная позиция",
|
|
28
|
+
"cancel": "Отменить водяной знак",
|
|
29
|
+
"close": "Закрыть панель",
|
|
30
|
+
"copy": "Копировать конфигурацию"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
"title": "Hình mờ",
|
|
4
|
+
"type": "Loại",
|
|
5
|
+
"text": "Văn bản",
|
|
6
|
+
"image": "Hình ảnh",
|
|
7
|
+
"uploadImage": "Tải lên hình ảnh",
|
|
8
|
+
"replaceImage": "Thay thế hình ảnh",
|
|
9
|
+
"keepRatio": "Giữ tỷ lệ",
|
|
10
|
+
"width": "Chiều rộng",
|
|
11
|
+
"height": "Chiều cao",
|
|
12
|
+
"style": "Cài đặt kiểu",
|
|
13
|
+
"content": "Nội dung",
|
|
14
|
+
"textPlaceholder": "Nhập văn bản",
|
|
15
|
+
"fontSize": "Kích thước phông chữ",
|
|
16
|
+
"direction": "Hướng",
|
|
17
|
+
"ltr": "Trái sang phải",
|
|
18
|
+
"rtl": "Phải sang trái",
|
|
19
|
+
"inherits": "Thừa kế",
|
|
20
|
+
"opacity": "Độ mờ",
|
|
21
|
+
"layout": "Cài đặt bố cục",
|
|
22
|
+
"rotate": "Xoay",
|
|
23
|
+
"repeat": "Lặp lại",
|
|
24
|
+
"spacingX": "Khoảng cách ngang",
|
|
25
|
+
"spacingY": "Khoảng cách dọc",
|
|
26
|
+
"startX": "Vị trí bắt đầu ngang",
|
|
27
|
+
"startY": "Vị trí bắt đầu dọc",
|
|
28
|
+
"cancel": "Hủy hình mờ",
|
|
29
|
+
"close": "Đóng bảng điều khiển",
|
|
30
|
+
"copy": "Sao chép cấu hình"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
"title": "水印",
|
|
4
|
+
"type": "类型",
|
|
5
|
+
"text": "文本",
|
|
6
|
+
"image": "图片",
|
|
7
|
+
"uploadImage": "上传图片",
|
|
8
|
+
"replaceImage": "替换图片",
|
|
9
|
+
"keepRatio": "保持比例",
|
|
10
|
+
"width": "长度",
|
|
11
|
+
"height": "高度",
|
|
12
|
+
"style": "样式设置",
|
|
13
|
+
"content": "内容",
|
|
14
|
+
"textPlaceholder": "请输入文本",
|
|
15
|
+
"fontSize": "字体大小",
|
|
16
|
+
"direction": "方向",
|
|
17
|
+
"ltr": "从左到右",
|
|
18
|
+
"rtl": "从右到左",
|
|
19
|
+
"inherits": "继承",
|
|
20
|
+
"opacity": "透明度",
|
|
21
|
+
"layout": "布局设置",
|
|
22
|
+
"rotate": "旋转",
|
|
23
|
+
"repeat": "重复",
|
|
24
|
+
"spacingX": "水平间距",
|
|
25
|
+
"spacingY": "垂直间距",
|
|
26
|
+
"startX": "水平起始位置",
|
|
27
|
+
"startY": "垂直起始位置",
|
|
28
|
+
"cancel": "取消水印",
|
|
29
|
+
"close": "关闭面板",
|
|
30
|
+
"copy": "复制配置"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"univer-watermark": {
|
|
3
|
+
"title": "浮水印",
|
|
4
|
+
"type": "類型",
|
|
5
|
+
"text": "文字",
|
|
6
|
+
"image": "圖片",
|
|
7
|
+
"uploadImage": "上傳圖片",
|
|
8
|
+
"replaceImage": "替換圖片",
|
|
9
|
+
"keepRatio": "保持比例",
|
|
10
|
+
"width": "長度",
|
|
11
|
+
"height": "高度",
|
|
12
|
+
"style": "樣式設置",
|
|
13
|
+
"content": "內容",
|
|
14
|
+
"textPlaceholder": "請輸入文字",
|
|
15
|
+
"fontSize": "字體大小",
|
|
16
|
+
"direction": "方向",
|
|
17
|
+
"ltr": "從左到右",
|
|
18
|
+
"rtl": "從右到左",
|
|
19
|
+
"inherits": "繼承",
|
|
20
|
+
"opacity": "透明度",
|
|
21
|
+
"layout": "佈局設置",
|
|
22
|
+
"rotate": "旋轉",
|
|
23
|
+
"repeat": "重複",
|
|
24
|
+
"spacingX": "水平間距",
|
|
25
|
+
"spacingY": "垂直間距",
|
|
26
|
+
"startX": "水平起始位置",
|
|
27
|
+
"startY": "垂直起始位置",
|
|
28
|
+
"cancel": "取消浮水印",
|
|
29
|
+
"close": "關閉面板",
|
|
30
|
+
"copy": "複製配置"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig } from './type';
|
|
2
|
+
export declare const UNIVER_WATERMARK_MENU = "UNIVER_WATERMARK_MENU";
|
|
3
|
+
export declare const WATERMARK_PANEL = "WATERMARK_PANEL";
|
|
4
|
+
export declare const WATERMARK_PANEL_FOOTER = "WATERMARK_PANEL_FOOTER";
|
|
5
|
+
export declare const UNIVER_WATERMARK_STORAGE_KEY = "UNIVER_WATERMARK_STORAGE_KEY";
|
|
6
|
+
export declare const UNIVER_WATERMARK_LAYER_INDEX = 10;
|
|
7
|
+
export declare const WATERMARK_IMAGE_ALLOW_IMAGE_LIST: string[];
|
|
8
|
+
export declare const WatermarkTextBaseConfig: ITextWatermarkConfig;
|
|
9
|
+
export declare const WatermarkImageBaseConfig: IImageWatermarkConfig;
|
|
10
|
+
export declare const WatermarkUserInfoBaseConfig: IUserInfoWatermarkConfig;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare enum IWatermarkTypeEnum {
|
|
17
|
+
UserInfo = "userInfo",
|
|
18
|
+
Text = "text",
|
|
19
|
+
Image = "image"
|
|
20
|
+
}
|
|
21
|
+
export interface IGeneralWatermarkConfig {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
repeat: boolean;
|
|
25
|
+
spacingX: number;
|
|
26
|
+
spacingY: number;
|
|
27
|
+
rotate: number;
|
|
28
|
+
opacity: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ITextWatermarkConfig extends IGeneralWatermarkConfig {
|
|
31
|
+
content?: string;
|
|
32
|
+
fontSize: number;
|
|
33
|
+
color: string;
|
|
34
|
+
bold: boolean;
|
|
35
|
+
italic: boolean;
|
|
36
|
+
direction: 'ltr' | 'rtl' | 'inherit';
|
|
37
|
+
}
|
|
38
|
+
export interface IImageWatermarkConfig extends IGeneralWatermarkConfig {
|
|
39
|
+
url: string;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
maintainAspectRatio: boolean;
|
|
43
|
+
originRatio: number;
|
|
44
|
+
}
|
|
45
|
+
export interface IUserInfoWatermarkConfig extends IGeneralWatermarkConfig, Omit<ITextWatermarkConfig, 'content'> {
|
|
46
|
+
name: boolean;
|
|
47
|
+
email: boolean;
|
|
48
|
+
phone: boolean;
|
|
49
|
+
uid: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface IWatermarkConfig {
|
|
52
|
+
text?: ITextWatermarkConfig;
|
|
53
|
+
image?: IImageWatermarkConfig;
|
|
54
|
+
userInfo?: IUserInfoWatermarkConfig;
|
|
55
|
+
}
|
|
56
|
+
export interface IWatermarkConfigWithType {
|
|
57
|
+
config: IWatermarkConfig;
|
|
58
|
+
type: IWatermarkTypeEnum;
|
|
59
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MenuConfig } from '@univerjs/ui';
|
|
2
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig } from '../common/type';
|
|
3
|
+
export declare const PLUGIN_CONFIG_KEY = "watermark.config";
|
|
4
|
+
export declare const configSymbol: unique symbol;
|
|
5
|
+
export interface IUniverWatermarkConfig {
|
|
6
|
+
menu?: MenuConfig;
|
|
7
|
+
showMenu?: boolean;
|
|
8
|
+
userWatermarkSettings?: Partial<IUserInfoWatermarkConfig>;
|
|
9
|
+
textWatermarkSettings?: Partial<ITextWatermarkConfig>;
|
|
10
|
+
imageWatermarkSettings?: Partial<IImageWatermarkConfig>;
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultPluginConfig: IUniverWatermarkConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { ComponentManager, IMenuManagerService } from '@univerjs/ui';
|
|
3
|
+
export declare class UniverWatermarkMenuController extends Disposable {
|
|
4
|
+
protected readonly _menuManagerService: IMenuManagerService;
|
|
5
|
+
private readonly _componentManager;
|
|
6
|
+
constructor(_menuManagerService: IMenuManagerService, _componentManager: ComponentManager);
|
|
7
|
+
private _initComponents;
|
|
8
|
+
private _initMenu;
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UnitModel, ILocalStorageService, RxDisposable, UserManagerService } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
|
+
import { WatermarkService } from '../services/watermark.service';
|
|
4
|
+
export declare class WatermarkRenderController extends RxDisposable implements IRenderModule {
|
|
5
|
+
private readonly _context;
|
|
6
|
+
private _watermarkService;
|
|
7
|
+
private _localStorageService;
|
|
8
|
+
private _userManagerService;
|
|
9
|
+
private readonly _watermarkLayer;
|
|
10
|
+
constructor(_context: IRenderContext<UnitModel>, _watermarkService: WatermarkService, _localStorageService: ILocalStorageService, _userManagerService: UserManagerService);
|
|
11
|
+
private _initAddRender;
|
|
12
|
+
private _initWatermarkConfig;
|
|
13
|
+
private _initWatermarkUpdate;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IWatermarkTypeEnum } from '../common/type';
|
|
2
|
+
interface IFUniverWatermarkMixin {
|
|
3
|
+
/**
|
|
4
|
+
* Adds a watermark to the unit. Supports both text and image watermarks based on the specified type.
|
|
5
|
+
*
|
|
6
|
+
* @param {IWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image} type - The type of watermark to add. Can be either 'Text' or 'Image'.
|
|
7
|
+
* @param {ITextWatermarkConfig | IImageWatermarkConfig} config - The configuration object for the watermark.
|
|
8
|
+
* - If the type is 'Text', the config should follow the ITextWatermarkConfig interface.
|
|
9
|
+
* - If the type is 'Image', the config should follow the IImageWatermarkConfig interface.
|
|
10
|
+
* @throws {Error} Throws an error if the watermark type is unknown.
|
|
11
|
+
*/
|
|
12
|
+
addWatermark(type: IWatermarkTypeEnum.Text, config: ITextWatermarkConfig): void;
|
|
13
|
+
addWatermark(type: IWatermarkTypeEnum.Image, config: IImageWatermarkConfig): void;
|
|
14
|
+
addWatermark(type: IWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image, config: ITextWatermarkConfig | IImageWatermarkConfig): void;
|
|
15
|
+
/**
|
|
16
|
+
* Deletes the currently applied watermark from the unit.
|
|
17
|
+
*
|
|
18
|
+
* This function retrieves the watermark service and invokes the method to remove any existing watermark configuration.
|
|
19
|
+
*/
|
|
20
|
+
deleteWatermark(): void;
|
|
21
|
+
}
|
|
22
|
+
declare module '@univerjs/core' {
|
|
23
|
+
interface FUniver extends IFUniverWatermarkMixin {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { UniverWatermarkPlugin } from './plugin';
|
|
17
|
+
export { WatermarkImageBaseConfig, WatermarkTextBaseConfig, WatermarkUserInfoBaseConfig } from './common/const';
|
|
18
|
+
export type { IImageWatermarkConfig, ITextWatermarkConfig } from './common/type';
|
|
19
|
+
export { IWatermarkTypeEnum } from './common/type';
|
|
20
|
+
export { WatermarkService } from './services/watermark.service';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
declare const locale: {
|
|
17
|
+
'univer-watermark': {
|
|
18
|
+
title: string;
|
|
19
|
+
type: string;
|
|
20
|
+
text: string;
|
|
21
|
+
image: string;
|
|
22
|
+
uploadImage: string;
|
|
23
|
+
replaceImage: string;
|
|
24
|
+
keepRatio: string;
|
|
25
|
+
width: string;
|
|
26
|
+
height: string;
|
|
27
|
+
style: string;
|
|
28
|
+
content: string;
|
|
29
|
+
textPlaceholder: string;
|
|
30
|
+
fontSize: string;
|
|
31
|
+
direction: string;
|
|
32
|
+
ltr: string;
|
|
33
|
+
rtl: string;
|
|
34
|
+
inherits: string;
|
|
35
|
+
opacity: string;
|
|
36
|
+
layout: string;
|
|
37
|
+
rotate: string;
|
|
38
|
+
repeat: string;
|
|
39
|
+
spacingX: string;
|
|
40
|
+
spacingY: string;
|
|
41
|
+
startX: string;
|
|
42
|
+
startY: string;
|
|
43
|
+
cancel: string;
|
|
44
|
+
close: string;
|
|
45
|
+
copy: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export default locale;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IUniverWatermarkConfig } from './controllers/config.schema';
|
|
2
|
+
import { ICommandService, IConfigService, ILocalStorageService, Injector, Plugin } from '@univerjs/core';
|
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
|
+
export declare class UniverWatermarkPlugin extends Plugin {
|
|
5
|
+
private readonly _config;
|
|
6
|
+
protected _injector: Injector;
|
|
7
|
+
private readonly _configService;
|
|
8
|
+
private readonly _commandService;
|
|
9
|
+
private readonly _renderManagerSrv;
|
|
10
|
+
private readonly _localStorageService;
|
|
11
|
+
static pluginName: string;
|
|
12
|
+
constructor(_config: Partial<IUniverWatermarkConfig> | undefined, _injector: Injector, _configService: IConfigService, _commandService: ICommandService, _renderManagerSrv: IRenderManagerService, _localStorageService: ILocalStorageService);
|
|
13
|
+
private _initWatermarkStorage;
|
|
14
|
+
private _initDependencies;
|
|
15
|
+
private _initRegisterCommand;
|
|
16
|
+
onRendered(): void;
|
|
17
|
+
private _initRenderDependencies;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Nullable, Disposable, ILocalStorageService } from '@univerjs/core';
|
|
2
|
+
import { IWatermarkConfigWithType } from '../common/type';
|
|
3
|
+
export declare class WatermarkService extends Disposable {
|
|
4
|
+
private _localStorageService;
|
|
5
|
+
private readonly _updateConfig$;
|
|
6
|
+
readonly updateConfig$: import('rxjs').Observable<Nullable<IWatermarkConfigWithType>>;
|
|
7
|
+
private readonly _refresh$;
|
|
8
|
+
readonly refresh$: import('rxjs').Observable<number>;
|
|
9
|
+
constructor(_localStorageService: ILocalStorageService);
|
|
10
|
+
getWatermarkConfig(): Promise<IWatermarkConfigWithType | null>;
|
|
11
|
+
updateWatermarkConfig(config: IWatermarkConfigWithType): void;
|
|
12
|
+
deleteWatermarkConfig(): void;
|
|
13
|
+
refresh(): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IUser, Nullable } from '@univerjs/core';
|
|
2
|
+
import { UniverRenderingContext } from '@univerjs/engine-render';
|
|
3
|
+
import { IImageWatermarkConfig, ITextWatermarkConfig, IUserInfoWatermarkConfig, IWatermarkConfigWithType } from './common/type';
|
|
4
|
+
export declare function renderWatermark(ctx: UniverRenderingContext, config: IWatermarkConfigWithType, image: Nullable<HTMLImageElement>, userInfo: Nullable<IUser>): void;
|
|
5
|
+
export declare function renderUserInfoWatermark(ctx: UniverRenderingContext, config: IUserInfoWatermarkConfig, userInfo: Nullable<IUser>): void;
|
|
6
|
+
export declare function renderTextWatermark(ctx: UniverRenderingContext, config: ITextWatermarkConfig): void;
|
|
7
|
+
export declare function renderImageWatermark(ctx: UniverRenderingContext, config: IImageWatermarkConfig, image: Nullable<HTMLImageElement>): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IImageWatermarkConfig } from '../../common/type';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface IWatermarkImageSettingProps {
|
|
4
|
+
config?: IImageWatermarkConfig;
|
|
5
|
+
onChange: (config: IImageWatermarkConfig) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const WatermarkImageSetting: React.FC<IWatermarkImageSettingProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITextWatermarkConfig } from '../../common/type';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface IWatermarkTextSettingProps {
|
|
4
|
+
config?: ITextWatermarkConfig;
|
|
5
|
+
onChange: (config: ITextWatermarkConfig) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const WatermarkTextSetting: React.FC<IWatermarkTextSettingProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IUser } from '@univerjs/core';
|
|
2
|
+
import { UniverRenderingContext, Layer } from '@univerjs/engine-render';
|
|
3
|
+
import { IWatermarkConfigWithType } from '../../common/type';
|
|
4
|
+
export declare class WatermarkLayer extends Layer {
|
|
5
|
+
private _config;
|
|
6
|
+
private _image;
|
|
7
|
+
private _user;
|
|
8
|
+
render(ctx?: UniverRenderingContext, isMaxLayer?: boolean): this;
|
|
9
|
+
updateConfig(config?: IWatermarkConfigWithType, user?: IUser): void;
|
|
10
|
+
private _renderWatermark;
|
|
11
|
+
}
|