Skip to content

图片操作

工具栏

点击图片可显示图片相关工具

工具栏按钮配置

可通过配置项 modules.image.toolbar.buttons 对工具栏按钮进行配置。默认存在 align-leftalign-centeralign-rightcopydownload 五个按钮,可以自行增加按钮或者通过设置 false 关闭某个按钮。

配置

modules.image.toolbar

属性类型说明
mainClassNamestringtoolbar 元素 class 名
mainStyleRecord<string, string>toolbar 元素 style
buttonClassNamestringbutton 元素 class 名
addButtonSelectStyleboolean是否应用选中样式
buttonStyleRecord<string, string>button 元素 style
svgStyleRecord<string, string>button 中 icon style
buttonsRecord<string, ToolButtonOption | boolean>toolbar 按钮配置
ToolButtonOption
ts
export interface ToolButtonOption {
  name: string
  icon: string
  isActive?: (el: HTMLElement) => boolean
  apply: (this: ImageToolbar, el: HTMLImageElement, toolbarButtons: ImageToolbarButtons) => void
}

modules.image.overlay

属性类型说明
classNamestringoverlay 元素 class 名
styleRecord<string, string>overlay 元素 style

modules.image.resize

属性类型说明
handleClassNamestringresize 元素(拖拽块) class 名
handleStyleRecord<string, string>resize 元素(拖拽块) style

Made with ❤ by