@baohu/canvas-editor-ui 1.1.0 → 1.2.0
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 +28 -3
- package/dist/canvas-editor-ui.esm.js +1147 -594
- package/dist/canvas-editor-ui.esm.js.map +1 -1
- package/dist/canvas-editor-ui.umd.js +2 -5
- package/dist/canvas-editor-ui.umd.js.map +1 -1
- package/dist/types/EditorUI.d.ts +1 -0
- package/dist/types/components/ControlPanel.d.ts +61 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/locale.d.ts +80 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,11 +53,11 @@ ui.destroy() // 销毁
|
|
|
53
53
|
|
|
54
54
|
默认显示的按钮(`DEFAULT_TOOLBAR`):`undo` `redo` `painter` `format` `font` `size` `sizeAdd` `sizeMinus` `bold` `italic` `underline` `strikeout` `superscript` `subscript` `color` `highlight` `title` `left` `center` `right` `alignment` `justify` `rowMargin` `list` `table` `image` `hyperlink` `separator` `pageBreak` `checkbox` `date` `search`
|
|
55
55
|
|
|
56
|
-
内置但默认不显示、需要时自行加入的按钮:`
|
|
56
|
+
内置但默认不显示、需要时自行加入的按钮:`print`(打印)`pdf`(导出 PDF)
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
59
|
createEditorUI('#app', {
|
|
60
|
-
toolbar: [...DEFAULT_TOOLBAR, '|', '
|
|
60
|
+
toolbar: [...DEFAULT_TOOLBAR, '|', 'print', 'pdf']
|
|
61
61
|
})
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -84,7 +84,7 @@ createEditorUI('#app', {
|
|
|
84
84
|
|
|
85
85
|
默认显示(`DEFAULT_STATUSBAR`):`pageNo`(页码)`wordCount`(字数)`rowCol`(行列)`pageMode`(分页/连页)`scale`(缩放)`paperDirection`(纸张方向)`paperMargin`(页边距)`fullscreen`(全屏)
|
|
86
86
|
|
|
87
|
-
内置但默认不显示:`mode
|
|
87
|
+
内置但默认不显示:`mode`(编辑模式切换,含编辑、清洁、只读、表单、打印、设计、涂鸦、留痕)。实际接入时一般不开放给用户,通过代码 `ui.setMode(mode)` 切换模式。
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
90
|
createEditorUI('#app', {
|
|
@@ -100,4 +100,29 @@ createEditorUI('#app', {
|
|
|
100
100
|
| `ui.setMode(mode)` | 切换编辑模式(直接调用 `editor.command.executeMode` 也会同步界面) |
|
|
101
101
|
| `ui.destroy()` | 销毁编辑器和界面 |
|
|
102
102
|
|
|
103
|
+
## 控件
|
|
104
|
+
|
|
105
|
+
右键菜单:
|
|
106
|
+
|
|
107
|
+
- 删除控件:`deletable: false` 的控件不显示该菜单,设计模式除外
|
|
108
|
+
- 控件属性:仅设计模式下,右键控件时显示,打开控件面板修改属性(不可修改控件类型)
|
|
109
|
+
|
|
110
|
+
控件面板按控件类型排版,分为基础、选项、规则校验、样式、高级几页,覆盖控件支持的全部属性(值集、多选、日期格式、可删除/禁用/必填、校验规则、背景色、计算表达式、级联规则、扩展数据等)。
|
|
111
|
+
|
|
112
|
+
工具栏不提供插入控件的按钮。面板已导出,可以接入自己的新增入口,例如设计模式下右键插入控件:
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
import { ControlPanel } from '@baohu/canvas-editor-ui'
|
|
116
|
+
|
|
117
|
+
ui.editor.register.contextMenuList([
|
|
118
|
+
{
|
|
119
|
+
name: '新增控件',
|
|
120
|
+
when: payload => payload.options.mode === 'design' && payload.editorTextFocus,
|
|
121
|
+
callback: () => new ControlPanel({ editor: ui.editor, locale: ui.locale })
|
|
122
|
+
}
|
|
123
|
+
])
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`ControlPanel` 参数:`editor`、`locale`,新增时可传 `type` 指定默认类型;修改时传 `controlId` 和 `control`。
|
|
127
|
+
|
|
103
128
|
另外导出了 `Dialog`,可以用来做和内置弹窗风格一致的自定义弹窗。
|