PermMark
JSSDK: 1.2.0、FilezOffice2022.3 支持
内容保护文档的可编辑区域对象
属性
name
可编辑区域对象的名称
语法
permMark.name
permMark: 内容保护文档的可编辑区域对象
返回值
name: Promise<string>
示例
async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const name = await permMark.name;
}
range
获取可编辑区域所在范围
语法
permMark.range
permMark: 内容保护文档的可编辑区域对象
返回值
Promise<Writer.Range>
示例
async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const range = await permMark.range;
}
permissionType
JSSDK: 1.9.1、FilezOffice V8.0 FP1 支持
可编辑区域,对于当前人的权限
语法
permMark.permissionType
permMark: 内容保护文档的可编辑区域对象
返回值
Promise<Writer.PermissionType>
示例
async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const permissionType = await permMark.permissionType;
}
方法
addEditors
JSSDK: 1.12.1、FilezOffice v9.1 FP1 支持
options参数
添加可编辑区域用户信息
语法
permMark.addEditors(editors, options)
permMark: 内容保护文档的可编辑区域对象
| 属性 | 数据类型 | 必填 | 说明 |
|---|---|---|---|
| editors | any | 是 | editors为{"group":["everyone"]}或者{"users": string[]} // 用户ID |
| options | object | 否 | 鉴权参数 { nounce?: string | number }。文档配置了 nounce 时必须携带且匹配,否则返回失败;仅环境变量LS_WEBRESOURCE_DOCUMENTS_TEXT_PROTECTPASSWORD为true时生效 |
返回值
Promise<boolean> 是否添加成功
示例
async function example(app, option) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) editors = await permMark.addEditors(option);
}
delete
JSSDK: 1.2.2、FilezOffice2022.3 FP2 支持
JSSDK: 1.12.1、FilezOffice v9.1 FP1 支持
options参数
删除可编辑区域
语法
permMark.delete(options)
permMark: 内容保护文档的可编辑区域对象
参数
| 属性 | 数据类型 | 必填 | 说明 |
|---|---|---|---|
| options | object | 否 | 鉴权参数 { nounce?: string | number }。文档配置了 nounce 时必须携带且匹配,否则返回失败;仅环境变量LS_WEBRESOURCE_DOCUMENTS_TEXT_PROTECTPASSWORD为true时生效 |
返回值
Promise<boolean> 是否删除成功
示例
async function example(app) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.delete();
}
deleteEditors
JSSDK: 1.2.0、FilezOffice2022.3 支持
JSSDK: 1.12.1、FilezOffice v9.1 FP1 支持
options参数
删除可编辑区域用户信息
语法
permMark.deleteEditors(editors, options)
permMark: 内容保护文档的可编辑区域对象
| 属性 | 数据类型 | 必填 | 说明 |
|---|---|---|---|
| editors | any | 是 | editors为{"group":["everyone"]}或者{"users": string[]} // 用户ID |
| options | object | 否 | 鉴权参数 { nounce?: string | number }。文档配置了 nounce 时必须携带且匹配,否则返回失败;仅环境变量LS_WEBRESOURCE_DOCUMENTS_TEXT_PROTECTPASSWORD为true时生效 |
返回值
Promise<boolean> 是否删除成功
示例
async function example(app, option) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.deleteEditors(option);
}
focus
JSSDK: 1.2.21、FilezOffice2022.3 FP2 hotfix1 支持
定位可编辑区域
语法
permMark.focus()
permMark: 内容保护文档的可编辑区域对象
返回值
Promise<boolean> 是否定位成功
示例
async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const success = await permMark.focus();
}
getEditors
获取可编辑区域用户信息
语法
permMark.getEditors()
permMark: 内容保护文档的可编辑区域对象
返回值
Promise<string> 可编辑区域用户信息的Json字符串,有两种格式:
{"group":["everyone"]} 或者 {"users": string[]} // 用户ID
示例
async function example(app) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.getEditors();
}
getText
JSSDK: 1.2.21、FilezOffice2022.3 FP2 hotfix1 支持
获取可编辑区域的文本
语法
permMark.getText()
permMark: 内容保护文档的可编辑区域对象
返回值
Promise<string>
示例
async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const success = await permMark.getText();
}
setEditors
JSSDK: 1.12.1、FilezOffice v9.1 FP1 支持
options参数
设置可编辑区域的可编辑成员信息
语法
permMark.setEditors(editors, options)
permMark: 内容保护文档的可编辑区域对象
| 属性 | 数据类型 | 必填 | 说明 |
|---|---|---|---|
| editors | any | 是 | editors为{"group":["everyone"]}或者{"users": string[]} // 用户ID |
| options | object | 否 | 鉴权参数 { nounce?: string | number }。文档配置了 nounce 时必须携带且匹配,否则返回失败;仅环境变量LS_WEBRESOURCE_DOCUMENTS_TEXT_PROTECTPASSWORD为true时生效 |
返回值
Promise<boolean> 是否设置成功
示例
async function example(app, option) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.setEditors(option);
}
setText
JSSDK: 1.2.21、FilezOffice2022.3 FP2 hotfix1 支持
设置可编辑区域的文本
语法
permMark.setText()
permMark: 内容保护文档的可编辑区域对象
返回值
Promise<boolean> 文本是否设置成功
参数
| 属性 | 数据类型 | 必填 | 说明 |
|---|---|---|---|
| content | string | 是 | 可编辑区域的文本 |
示例
async function example(content) {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const success = await permMark.setText(content);
}