@baohu/canvas-editor-ui 0.0.0-stage → 1.1.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/LICENSE +22 -0
- package/README.md +102 -2
- package/dist/canvas-editor-ui.esm.js +1085 -0
- package/dist/canvas-editor-ui.esm.js.map +1 -0
- package/dist/canvas-editor-ui.umd.js +6 -0
- package/dist/canvas-editor-ui.umd.js.map +1 -0
- package/dist/types/EditorUI.d.ts +20 -0
- package/dist/types/components/Dialog.d.ts +35 -0
- package/dist/types/components/Dropdown.d.ts +16 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/locale.d.ts +85 -0
- package/dist/types/statusbar/Statusbar.d.ts +15 -0
- package/dist/types/toolbar/Toolbar.d.ts +15 -0
- package/dist/types/toolbar/items.d.ts +7 -0
- package/dist/types/types.d.ts +31 -0
- package/dist/types/utils.d.ts +12 -0
- package/package.json +37 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas-editor-ui.esm.js","sources":["../src/locale.ts","../src/utils.ts","../src/components/Dialog.ts","../src/components/Dropdown.ts","../src/icons/exit-fullscreen.svg","../src/icons/page-mode.svg","../src/icons/page-scale-add.svg","../src/icons/page-scale-minus.svg","../src/icons/paper-direction.svg","../src/icons/paper-margin.svg","../src/icons/request-fullscreen.svg","../src/statusbar/Statusbar.ts","../src/icons/alignment.svg","../src/icons/bold.svg","../src/icons/center.svg","../src/icons/checkbox.svg","../src/icons/color.svg","../src/icons/control.svg","../src/icons/date.svg","../src/icons/format.svg","../src/icons/highlight.svg","../src/icons/hyperlink.svg","../src/icons/image.svg","../src/icons/italic.svg","../src/icons/justify.svg","../src/icons/left.svg","../src/icons/list.svg","../src/icons/page-break.svg","../src/icons/painter.svg","../src/icons/pdf.svg","../src/icons/print.svg","../src/icons/redo.svg","../src/icons/right.svg","../src/icons/row-margin.svg","../src/icons/search.svg","../src/icons/separator.svg","../src/icons/size-add.svg","../src/icons/size-minus.svg","../src/icons/strikeout.svg","../src/icons/subscript.svg","../src/icons/superscript.svg","../src/icons/table.svg","../src/icons/title.svg","../src/icons/underline.svg","../src/icons/undo.svg","../src/toolbar/items.ts","../src/toolbar/Toolbar.ts","../src/EditorUI.ts"],"sourcesContent":["export const defaultLocale = {\n undo: '撤销',\n redo: '重做',\n painter: '格式刷(双击可连续使用)',\n format: '清除格式',\n font: '字体',\n size: '字号',\n sizeAdd: '增大字号',\n sizeMinus: '减小字号',\n bold: '加粗',\n italic: '斜体',\n underline: '下划线',\n strikeout: '删除线',\n superscript: '上标',\n subscript: '下标',\n color: '字体颜色',\n highlight: '高亮',\n title: '标题',\n text: '正文',\n left: '左对齐',\n center: '居中对齐',\n right: '右对齐',\n alignment: '两端对齐',\n justify: '分散对齐',\n rowMargin: '行间距',\n list: '列表',\n listDecimal: '有序列表',\n listCheckbox: '复选框列表',\n listDisc: '实心圆点列表',\n listCircle: '空心圆点列表',\n listSquare: '实心方块列表',\n table: '表格',\n image: '图片',\n hyperlink: '超链接',\n hyperlinkText: '文本',\n hyperlinkUrl: '链接',\n separator: '分割线',\n pageBreak: '分页符',\n control: '控件',\n controlType: '类型',\n controlText: '文本',\n controlSelect: '下拉框',\n controlCheckbox: '复选框',\n controlRadio: '单选框',\n controlDate: '日期',\n controlNumber: '数值',\n controlPlaceholder: '占位符',\n controlValueSets: '选项',\n controlValueSetsPlaceholder: '每行一个选项,如:\\n有\\n无',\n controlDateFormat: '日期格式',\n checkbox: '复选框',\n checkboxCross: '叉选',\n checkboxCheck: '勾选',\n date: '日期',\n search: '查找替换',\n searchKeyword: '查找',\n searchReplace: '替换为',\n searchReplacePlaceholder: '留空则只查找',\n print: '打印',\n pdf: '导出 PDF',\n confirm: '确定',\n cancel: '取消',\n pageNo: '页面',\n wordCount: '字数',\n rowCol: '行列',\n pageModePaging: '分页',\n pageModeContinuity: '连页',\n scaleMinus: '缩小',\n scaleAdd: '放大',\n scaleRecovery: '恢复 100%',\n paperDirection: '纸张方向',\n paperMargin: '页边距',\n marginTop: '上边距',\n marginRight: '右边距',\n marginBottom: '下边距',\n marginLeft: '左边距',\n modeEdit: '编辑模式',\n modeClean: '清洁模式',\n modeReadonly: '只读模式',\n modeForm: '表单模式',\n modePrint: '打印模式',\n modeDesign: '设计模式',\n fullscreen: '全屏'\n}\n\nexport type ILocale = typeof defaultLocale\n","export const PREFIX = 'ceu'\n\ntype Attrs = Record<string, string | number | boolean | undefined>\n\n// 创建元素:h('div', { class: 'a', title: 'b' }, child1, 'text')\nexport function h<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n attrs: Attrs = {},\n ...children: (Node | string | null | undefined | false)[]\n): HTMLElementTagNameMap[K] {\n const el = document.createElement(tag)\n Object.keys(attrs).forEach(key => {\n const value = attrs[key]\n if (value === undefined || value === false) return\n if (key === 'class') {\n el.className = String(value)\n } else {\n el.setAttribute(key, value === true ? '' : String(value))\n }\n })\n children.forEach(child => {\n if (child === null || child === undefined || child === false) return\n el.append(child)\n })\n return el\n}\n\nexport function cls(name: string): string {\n return `${PREFIX}-${name}`\n}\n\nexport function debounce<T extends unknown[]>(\n fn: (...args: T) => void,\n delay: number\n): ((...args: T) => void) & { cancel: () => void } {\n let timer: ReturnType<typeof setTimeout> | null = null\n const debounced = (...args: T) => {\n if (timer) clearTimeout(timer)\n timer = setTimeout(() => {\n timer = null\n fn(...args)\n }, delay)\n }\n debounced.cancel = () => {\n if (timer) clearTimeout(timer)\n timer = null\n }\n return debounced\n}\n\nexport function readFileAsDataURL(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => resolve(reader.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nexport function loadImage(src: string): Promise<HTMLImageElement> {\n return new Promise((resolve, reject) => {\n const image = new Image()\n image.onload = () => resolve(image)\n image.onerror = reject\n image.src = src\n })\n}\n\nexport function downloadBlob(blob: Blob, fileName: string) {\n const url = URL.createObjectURL(blob)\n const a = h('a', { href: url, download: fileName })\n a.click()\n URL.revokeObjectURL(url)\n}\n\nexport function formatDate(date: Date, withTime: boolean): string {\n const pad = (num: number) => String(num).padStart(2, '0')\n const day = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(\n date.getDate()\n )}`\n if (!withTime) return day\n return `${day} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(\n date.getSeconds()\n )}`\n}\n","import { EDITOR_COMPONENT, EditorComponent } from '@baohu/canvas-editor'\nimport { cls, h } from '../utils'\n\nexport interface IDialogField {\n type: 'text' | 'number' | 'textarea' | 'select' | 'color'\n name: string\n label?: string\n value?: string\n placeholder?: string\n required?: boolean\n options?: { label: string; value: string }[]\n height?: number\n}\n\nexport type IDialogResult = Record<string, string>\n\nexport interface IDialogOptions {\n title: string\n fields: IDialogField[]\n confirmText?: string\n cancelText?: string\n // 返回 false 阻止关闭\n onConfirm?: (result: IDialogResult) => void | boolean\n onClose?: () => void\n}\n\ntype FieldInput = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement\n\nexport class Dialog {\n private options: IDialogOptions\n private mask: HTMLDivElement\n private container: HTMLDivElement\n private inputList: FieldInput[] = []\n private keydownHandler: (evt: KeyboardEvent) => void\n\n constructor(options: IDialogOptions) {\n this.options = options\n this.mask = h('div', { class: cls('dialog-mask') })\n this.container = this.render()\n // 标记为编辑器组件,避免点击弹窗时编辑器失焦清空选区\n this.mask.setAttribute(EDITOR_COMPONENT, EditorComponent.COMPONENT)\n this.container.setAttribute(EDITOR_COMPONENT, EditorComponent.COMPONENT)\n document.body.append(this.mask, this.container)\n this.keydownHandler = evt => {\n if (evt.key === 'Escape') this.close()\n }\n document.addEventListener('keydown', this.keydownHandler)\n this.inputList[0]?.focus()\n }\n\n private render(): HTMLDivElement {\n const { title, fields, confirmText = '确定', cancelText = '取消' } =\n this.options\n const closeBtn = h('i', { class: cls('dialog__close') })\n closeBtn.onclick = () => this.close()\n const body = h('div', { class: cls('dialog__body') })\n fields.forEach(field => {\n const input = this.createInput(field)\n this.inputList.push(input)\n const label = field.label\n ? h(\n 'span',\n {\n class: `${cls('dialog__label')}${\n field.required ? ` ${cls('dialog__label--required')}` : ''\n }`\n },\n field.label\n )\n : null\n body.append(h('label', { class: cls('dialog__field') }, label, input))\n })\n const cancelBtn = h('button', { type: 'button' }, cancelText)\n cancelBtn.onclick = () => this.close()\n const confirmBtn = h(\n 'button',\n { type: 'button', class: cls('dialog__confirm') },\n confirmText\n )\n confirmBtn.onclick = () => this.confirm()\n const dialog = h(\n 'div',\n { class: cls('dialog') },\n h('div', { class: cls('dialog__title') }, h('span', {}, title), closeBtn),\n body,\n h('div', { class: cls('dialog__footer') }, cancelBtn, confirmBtn)\n )\n // 单行输入框回车确认\n dialog.addEventListener('keydown', evt => {\n const target = evt.target as HTMLElement\n if (evt.key === 'Enter' && target.tagName === 'INPUT') {\n evt.preventDefault()\n this.confirm()\n }\n })\n return h('div', { class: cls('dialog-container') }, dialog)\n }\n\n private createInput(field: IDialogField): FieldInput {\n let input: FieldInput\n if (field.type === 'select') {\n input = h('select', { name: field.name })\n field.options?.forEach(option => {\n input.append(h('option', { value: option.value }, option.label))\n })\n } else if (field.type === 'textarea') {\n input = h('textarea', { name: field.name })\n if (field.height) input.style.height = `${field.height}px`\n } else {\n input = h('input', { name: field.name, type: field.type })\n }\n if (field.value !== undefined) input.value = field.value\n if (field.placeholder && !(input instanceof HTMLSelectElement)) {\n input.placeholder = field.placeholder\n }\n return input\n }\n\n private confirm() {\n const { fields, onConfirm } = this.options\n const result: IDialogResult = {}\n let isValid = true\n this.inputList.forEach((input, index) => {\n result[input.name] = input.value\n const isEmpty = fields[index].required && !input.value.trim()\n input.classList.toggle(cls('dialog__input--error'), !!isEmpty)\n if (isEmpty) isValid = false\n })\n if (!isValid) return\n if (onConfirm && onConfirm(result) === false) return\n this.dispose()\n }\n\n public close() {\n this.options.onClose?.()\n this.dispose()\n }\n\n private dispose() {\n document.removeEventListener('keydown', this.keydownHandler)\n this.mask.remove()\n this.container.remove()\n }\n}\n","import { cls, h } from '../utils'\n\nexport interface IDropdownOption {\n label: string\n value: string\n // 选项自身样式(如字体预览)\n style?: string\n icon?: string\n}\n\nconst openedDropdownSet = new Set<Dropdown>()\n\n// 点击下拉框以外区域时关闭\nfunction onDocumentMousedown(evt: MouseEvent) {\n openedDropdownSet.forEach(dropdown => {\n if (!dropdown.el.contains(evt.target as Node)) dropdown.close()\n })\n}\n\nexport class Dropdown {\n public el: HTMLDivElement\n public panel: HTMLDivElement\n\n constructor(trigger: HTMLElement, panel: HTMLElement, placement = 'bottom') {\n this.panel = h(\n 'div',\n { class: `${cls('dropdown__panel')} ${cls(`dropdown__panel--${placement}`)}` },\n panel\n )\n this.el = h('div', { class: cls('dropdown') }, trigger, this.panel)\n trigger.addEventListener('click', () => this.toggle())\n }\n\n public toggle() {\n if (openedDropdownSet.has(this)) {\n this.close()\n } else {\n this.open()\n }\n }\n\n public open() {\n openedDropdownSet.forEach(dropdown => dropdown.close())\n this.panel.classList.add(cls('dropdown__panel--visible'))\n // 超出视口右侧时改为右对齐\n this.panel.style.left = ''\n this.panel.style.right = ''\n const rect = this.panel.getBoundingClientRect()\n if (rect.right > window.innerWidth) {\n this.panel.style.left = 'auto'\n this.panel.style.right = '0'\n }\n if (!openedDropdownSet.size) {\n document.addEventListener('mousedown', onDocumentMousedown)\n }\n openedDropdownSet.add(this)\n }\n\n public close() {\n this.panel.classList.remove(cls('dropdown__panel--visible'))\n openedDropdownSet.delete(this)\n if (!openedDropdownSet.size) {\n document.removeEventListener('mousedown', onDocumentMousedown)\n }\n }\n}\n\n// 选项列表面板\nexport function createOptionList(\n options: IDropdownOption[],\n onSelect: (value: string) => void\n): HTMLUListElement {\n const list = h('ul', { class: cls('option-list') })\n options.forEach(option => {\n const item = h(\n 'li',\n { 'data-value': option.value, style: option.style },\n option.icon\n ? h('i', {\n class: cls('icon'),\n style: `background-image:url(\"${option.icon}\")`\n })\n : null,\n option.label\n )\n // mousedown 阻止默认行为,保持编辑器选区\n item.addEventListener('mousedown', evt => evt.preventDefault())\n item.addEventListener('click', () => onSelect(option.value))\n list.append(item)\n })\n return list\n}\n\nexport function setActiveOption(list: HTMLElement, value: string | null) {\n list.querySelectorAll('li').forEach(item => {\n item.classList.toggle(cls('active'), item.dataset.value === value)\n })\n}\n","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M9%209h1v4H9z'/%3e%3cpath%20d='M9%209h4v1H9zM7%207H6V3h1z'/%3e%3cpath%20d='M7%207H3V6h4z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20transform='translate(2%201)'%3e%3crect%20stroke='%233D4757'%20x='.5'%20y='.5'%20width='11'%20height='8'%20rx='1'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M2%203h4v1H2zm0%202h8v1H2z'/%3e%3c/g%3e%3cg%20fill='%233D4757'%20fill-rule='nonzero'%3e%3cpath%20d='M14%2015h-1v-5H3v5H2V9h12v6z'/%3e%3cpath%20d='M4%2012h4v1H4zm0%202h8v1H4z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7%207V3h2v4h4v2H9v4H7V9H3V7h4z'%20fill='%23636363'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%207h10v2H3z'%20fill='%23636363'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_1-文字_x2F_04页面_x2F_纸张方向-16px'%3e%3cg%20id='编组'%20transform='translate(1%201)'%3e%3cpath%20id='合并形状'%20class='st0'%20d='M14%206v7c0%20.6-.4%201-1%201H4c-.6%200-1-.4-1-1V6c0-.6.4-1%201-1h9c.6%200%201%20.4%201%201zm-1%200H4v7h9V6z'/%3e%3cpath%20id='路径'%20class='st0'%20d='M9%204H8V1H1v9h1v1H1c-.6%200-1-.4-1-1V1c0-.6.4-1%201-1h7c.6%200%201%20.4%201%201v3z'/%3e%3cpath%20id='矩形'%20class='st0'%20d='M11%207h1v5h-1z'/%3e%3cpath%20id='矩形-copy-2'%20class='st0'%20d='M2%202h5v1H2z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3crect%20stroke='%233D4757'%20x='2.5'%20y='1.5'%20width='11'%20height='13'%20rx='1'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M3%204h10v1H3zm0%207h10v1H3z'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M5%2014V2h1v12zm5%200V2h1v12z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M3%203h1v4H3z'/%3e%3cpath%20d='M3%203h4v1H3zm10%2010h-1V9h1z'/%3e%3cpath%20d='M13%2013H9v-1h4z'/%3e%3c/g%3e%3c/svg%3e\"","import {\n EDITOR_COMPONENT,\n EditorComponent,\n EditorMode,\n PageMode,\n PaperDirection\n} from '@baohu/canvas-editor'\nimport { Dialog } from '../components/Dialog'\nimport { Dropdown, createOptionList, setActiveOption } from '../components/Dropdown'\nimport type { EditorUI } from '../EditorUI'\nimport type { IStatusbarItem } from '../types'\nimport { cls, debounce, h } from '../utils'\nimport exitFullscreenIcon from '../icons/exit-fullscreen.svg'\nimport pageModeIcon from '../icons/page-mode.svg'\nimport pageScaleAddIcon from '../icons/page-scale-add.svg'\nimport pageScaleMinusIcon from '../icons/page-scale-minus.svg'\nimport paperDirectionIcon from '../icons/paper-direction.svg'\nimport paperMarginIcon from '../icons/paper-margin.svg'\nimport requestFullscreenIcon from '../icons/request-fullscreen.svg'\n\nexport const DEFAULT_STATUSBAR: IStatusbarItem[] = [\n 'pageNo',\n 'wordCount',\n 'rowCol',\n 'pageMode',\n 'scale',\n 'paperDirection',\n 'paperMargin',\n 'fullscreen'\n]\n\n// 左侧为信息,右侧为操作\nconst LEFT_ITEMS: IStatusbarItem[] = ['pageNo', 'wordCount', 'rowCol']\n\nfunction iconButton(icon: string, title: string, onClick: () => void) {\n const el = h(\n 'div',\n { class: cls('statusbar__button'), title },\n h('i', { class: cls('icon'), style: `background-image:url(\"${icon}\")` })\n )\n el.addEventListener('click', onClick)\n return el\n}\n\nexport class Statusbar {\n public el: HTMLDivElement\n private ui: EditorUI\n private disposeList: (() => void)[] = []\n private updaterList: (() => void)[] = []\n\n constructor(ui: EditorUI, items: IStatusbarItem[] = DEFAULT_STATUSBAR) {\n this.ui = ui\n const left = h('div', { class: cls('statusbar__left') })\n const right = h('div', { class: cls('statusbar__right') })\n this.el = h('div', { class: cls('statusbar') }, left, right)\n this.el.setAttribute(EDITOR_COMPONENT, EditorComponent.FOOTER)\n this.el.addEventListener('mousedown', evt => evt.preventDefault())\n items.forEach(key => {\n const el = this.createItem(key)\n if (!el) return\n el.classList.add(cls('statusbar__item'))\n ;(LEFT_ITEMS.includes(key) ? left : right).append(el)\n })\n }\n\n // 订阅编辑器事件,销毁时统一取消\n private on: EditorUI['editor']['eventBus']['on'] = (event, callback) => {\n const { eventBus } = this.ui.editor\n eventBus.on(event, callback)\n this.disposeList.push(() => eventBus.off(event, callback))\n }\n\n private createItem(key: IStatusbarItem): HTMLElement | null {\n const { editor, locale } = this.ui\n switch (key) {\n case 'pageNo': {\n const pageNo = h('span', {}, '1')\n const pageSize = h('span', {}, String(this.ui.getPageSize()))\n this.on('intersectionPageNoChange', (payload: number) => {\n pageNo.innerText = String(payload + 1)\n })\n this.on('pageSizeChange', (payload: number) => {\n pageSize.innerText = String(payload)\n })\n return h('span', {}, `${locale.pageNo}:`, pageNo, '/', pageSize)\n }\n case 'wordCount': {\n const count = h('span', {}, '0')\n const refresh = debounce(async () => {\n count.innerText = String(await editor.command.getWordCount())\n }, 300)\n this.on('contentChange', refresh)\n this.disposeList.push(refresh.cancel)\n refresh()\n return h('span', {}, `${locale.wordCount}:`, count)\n }\n case 'rowCol': {\n const text = h('span', {}, '1:1')\n this.on('rangeStyleChange', () => {\n const context = editor.command.getRangeContext()\n if (context) {\n text.innerText = `${context.startRowNo + 1}:${context.startColNo + 1}`\n }\n })\n return h('span', {}, `${locale.rowCol}:`, text)\n }\n case 'pageMode': {\n const trigger = iconButton(pageModeIcon, '', () => undefined)\n const list = createOptionList(\n [\n { label: locale.pageModePaging, value: PageMode.PAGING },\n { label: locale.pageModeContinuity, value: PageMode.CONTINUITY }\n ],\n value => {\n dropdown.close()\n editor.command.executePageMode(<PageMode>value)\n }\n )\n const dropdown = new Dropdown(trigger, list, 'top')\n const sync = (mode: PageMode) => {\n setActiveOption(list, mode)\n trigger.title =\n mode === PageMode.CONTINUITY\n ? locale.pageModeContinuity\n : locale.pageModePaging\n }\n sync(editor.command.getOptions().pageMode)\n this.on('pageModeChange', sync)\n return dropdown.el\n }\n case 'scale': {\n const percentage = h('span', {\n class: cls('statusbar__scale'),\n title: locale.scaleRecovery\n })\n const sync = (scale: number) => {\n percentage.innerText = `${Math.round(scale * 100)}%`\n }\n sync(editor.command.getOptions().scale)\n this.on('pageScaleChange', sync)\n percentage.addEventListener('click', () =>\n editor.command.executePageScaleRecovery()\n )\n return h(\n 'div',\n { class: cls('statusbar__group') },\n iconButton(pageScaleMinusIcon, locale.scaleMinus, () =>\n editor.command.executePageScaleMinus()\n ),\n percentage,\n iconButton(pageScaleAddIcon, locale.scaleAdd, () =>\n editor.command.executePageScaleAdd()\n )\n )\n }\n case 'paperDirection':\n return iconButton(paperDirectionIcon, locale.paperDirection, () => {\n const { paperDirection } = editor.command.getOptions()\n editor.command.executePaperDirection(\n paperDirection === PaperDirection.HORIZONTAL\n ? PaperDirection.VERTICAL\n : PaperDirection.HORIZONTAL\n )\n })\n case 'paperMargin':\n return iconButton(paperMarginIcon, locale.paperMargin, () =>\n this.openPaperMarginDialog()\n )\n case 'mode': {\n const modeList = [\n { label: locale.modeEdit, value: EditorMode.EDIT },\n { label: locale.modeClean, value: EditorMode.CLEAN },\n { label: locale.modeReadonly, value: EditorMode.READONLY },\n { label: locale.modeForm, value: EditorMode.FORM },\n { label: locale.modePrint, value: EditorMode.PRINT },\n { label: locale.modeDesign, value: EditorMode.DESIGN }\n ]\n const label = h('span', { class: cls('statusbar__mode') })\n const list = createOptionList(modeList, value => {\n dropdown.close()\n this.ui.setMode(<EditorMode>value)\n })\n const dropdown = new Dropdown(label, list, 'top')\n const sync = () => {\n const mode = editor.command.getOptions().mode\n label.innerText =\n modeList.find(item => item.value === mode)?.label || mode\n setActiveOption(list, mode)\n }\n sync()\n this.updaterList.push(sync)\n return dropdown.el\n }\n case 'fullscreen': {\n const button = iconButton(requestFullscreenIcon, locale.fullscreen, () => {\n if (document.fullscreenElement) {\n document.exitFullscreen()\n } else {\n this.ui.root.requestFullscreen()\n }\n })\n const onChange = () => {\n const icon = document.fullscreenElement\n ? exitFullscreenIcon\n : requestFullscreenIcon\n button.querySelector<HTMLElement>('i')!.style.backgroundImage =\n `url(\"${icon}\")`\n }\n document.addEventListener('fullscreenchange', onChange)\n this.disposeList.push(() =>\n document.removeEventListener('fullscreenchange', onChange)\n )\n return button\n }\n default:\n console.warn(`[canvas-editor-ui] unknown statusbar item: ${key}`)\n return null\n }\n }\n\n private openPaperMarginDialog() {\n const { editor, locale } = this.ui\n // 顺序:上、右、下、左\n const nameList = ['top', 'right', 'bottom', 'left']\n const labelList = [\n locale.marginTop,\n locale.marginRight,\n locale.marginBottom,\n locale.marginLeft\n ]\n const marginList = editor.command.getPaperMargin()\n new Dialog({\n title: locale.paperMargin,\n confirmText: locale.confirm,\n cancelText: locale.cancel,\n fields: nameList.map((name, index) => ({\n type: 'number',\n name,\n label: labelList[index],\n required: true,\n value: String(marginList[index])\n })),\n onConfirm: result => {\n const [top, right, bottom, left] = nameList.map(name =>\n Number(result[name])\n )\n const margins: [number, number, number, number] = [top, right, bottom, left]\n if (margins.some(margin => isNaN(margin) || margin < 0)) return false\n editor.command.executeSetPaperMargin(margins)\n }\n })\n }\n\n // 外部状态(如编辑模式)变化后刷新\n public update() {\n this.updaterList.forEach(update => update())\n }\n\n public destroy() {\n this.disposeList.forEach(dispose => dispose())\n this.el.remove()\n }\n}\n","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2v-1zm0-3h12v1H2v-1zm0-3h12v1H2V7zm0-6h12v1H2V1zm0%203h12v1H2V4z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.131%206.9c2.035%200%202.569-.9%202.569-1.869%200-.968-.64-1.831-2.623-1.831H5.2v3.7h2.931zm.524%205.9c2.045%200%202.545-1.305%202.545-2.3%200-.985-.506-2.4-2.81-2.4H5.2v4.7h3.455zM4%202h4.71c2.367%200%203.19%201.583%203.19%203s-.325%201.852-1.1%202.5c1.2.5%201.569%201.379%201.6%203%20.03%201.606-.586%203.5-3.769%203.5H4V2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2v-1zm2-3h8v1H4v-1zM2%207h12v1H2V7zm0-6h12v1H2V1zm2%203h8v1H4V4z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_1-文字_x2F_01开始_x2F_任务列表-16px'%3e%3cpath%20id='合并形状'%20class='st0'%20d='M10.1%202H2v11h11V8.7l1-1V13c0%20.6-.4%201-1%201H2c-.6%200-1-.4-1-1V2c0-.6.4-1%201-1h9.1l-1%201z'/%3e%3cpath%20id='路径'%20class='st0'%20d='M7.7%208.5l5.7-5.8.9.8-6.1%205.9-.5.5-3.9-3.4.8-.7z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.997%203.429L6.398%208h3.2L7.997%203.429zM8.497%202L12%2012h-1L9.949%209h-3.9L5%2012H4L7.496%202h1z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M9.793%201.5H3a.5.5%200%2000-.5.5v12a.5.5%200%2000.5.5h9a.5.5%200%2000.5-.5V4.207L9.793%201.5z'%20stroke='%233D4757'/%3e%3cg%20fill='%233D4757'%3e%3cpath%20d='M7%207h1v5H7z'/%3e%3cpath%20d='M5%207h5v1H5z'/%3e%3c/g%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M9%202h1v3H9z'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M9%204h3v1H9z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M7.5%2014.154a5.654%205.654%200%20100-11.308%205.654%205.654%200%20000%2011.308zm0%20.846a6.5%206.5%200%20110-13%206.5%206.5%200%20010%2013z'%20fill-rule='nonzero'/%3e%3cpath%20d='M8%208h4v1H7V4h1v4z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M8.213%2013H6.8l6.636-6.636-4.243-4.243-7.07%207.071L5.928%2013H4.515L1.06%209.546a.5.5%200%20010-.707L8.839%201.06a.5.5%200%2001.707%200l4.95%204.95a.5.5%200%20010%20.707L8.213%2013z'%20fill-rule='nonzero'/%3e%3cpath%20d='M4.536%206.364l4.95%204.95-.707.707-4.95-4.95zM4.521%2013h10.03v1H5.496z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M13.31%205h-1.92a2.203%202.203%200%2000-.39-.034c-.135%200-.27.012-.402.034H10v.18c-.578.256-1%20.714-1%201.214v1.928c0%20.196.117.43.3.658v1.23a3.543%203.543%200%2001-.3-.4V11H8V1h1v4.265C9%204.763%2010%204%2010.942%204c1.19%200%201.92.422%202.367%201zM2%206c-.03-.498-.175-2%202.5-2C7.11%204%207%205%207%206.902V11H5.984v-.993c.38.662-.115.993-1.484.993C2.708%2011%202%209.931%202%209c0-1.428.447-2%202.5-2h1.484c0-1%20.031-2-1.484-2-1.533%200-1.577.485-1.577%201H2zm2.5%202C3.601%208%203%207.768%203%209c0%201.31.438%201%201.5%201%20.617%200%201.484-.665%201.484-1.847V8H4.5z'/%3e%3cpath%20d='M13.085%206.316l-2.814%203a1%201%200%20101.458%201.368l2.815-3a1%201%200%2000-1.459-1.368z'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='rotate(45%205.5%2013.328)'%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M7%206H6V3.515a2.5%202.5%200%2010-5%200V6H0V3.515a3.5%203.5%200%20117%200V6zm0%204v2.5a3.5%203.5%200%2001-7%200V10h1v2.5a2.5%202.5%200%20105%200V10h1z'%20fill-rule='nonzero'/%3e%3crect%20x='3.062'%20y='5.209'%20width='1'%20height='5.5'%20rx='.5'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_插入图片-16px-'%3e%3cg%20id='Group-19'%20transform='translate(1%201)'%3e%3cpath%20id='Combined-Shape'%20class='st0'%20d='M1%200h12c.6%200%201%20.4%201%201v11c0%20.6-.4%201-1%201H1c-.6%200-1-.4-1-1V1c0-.6.4-1%201-1zm0%201v11h12V1H1z'/%3e%3ccircle%20id='椭圆形'%20class='st0'%20cx='10'%20cy='4'%20r='1'/%3e%3cpath%20id='Path'%20class='st0'%20d='M8.5%2011.2l-4-4.1L1%2010.7V9.2c1.7-1.6%202.7-2.5%203-2.8.4-.5.7-.4%201%200L8.5%2010%2011%207.3c.4-.5.6-.5%201-.1l2%202.8v1.5l-2.5-3.4-3%203.1z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.017%203L8.08%2013H9v1H6v-1h1.182L9%203H8V2h3v1h-.983z'%20fill='%233D4757'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20stroke='%233D4757'%20fill='%233D4757'%20d='M2%2010.5H14M2%2013.5H14'%20stroke-linecap='round'%20stroke-linejoin='miter'%3e%3c/path%3e%3cpath%20stroke='%233D4757'%20fill='%233D4757'%20d='M14%203.5L12%201.5M14%203.5L12%205.5M14%203.5L2%203.5M4%201.5L2%203.5M2%203.5L4%205.5'%20stroke-linecap='round'%20stroke-linejoin='miter'%3e%3c/path%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20height='16'%20viewBox='0%200%2016%2016'%20width='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2zm0-3h8v1H2zm0-3h12v1H2zm0-6h12v1H2zm0%203h8v1H2z'%20fill='%233d4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M7%2012h7v1H7zm0-5h7v1H7zm0-5h7v1H7zM3%204V2H2V1h2v3h1v1H2V4h1z'/%3e%3cpath%20d='M2%206h3v1H2V6zm0%203h3v1H2V9z'%20fill='%234F4F4F'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M4.5%206L5%207l-2.5%203L2%209z'/%3e%3cpath%20d='M4%2014l-1-2H2v-1h3v1H4l1%202v1H2v-1h2z'%20fill='%233D4757'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:none;stroke:%233d4757}.st1{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_1-文字_x2F_02插入_x2F_分页-16px'%3e%3cpath%20id='矩形'%20class='st0'%20d='M5.5%202.5h7c.6%200%201%20.4%201%201v3c0%20.6-.4%201-1%201h-7c-.6%200-1-.4-1-1v-3c0-.6.4-1%201-1z'/%3e%3cpath%20id='三角形'%20class='st1'%20d='M4%208.5L1%206v5z'/%3e%3cpath%20id='合并形状'%20class='st0'%20d='M10.8%209.5H5c-.3%200-.5.2-.5.5v4c0%20.3.2.5.5.5h8c.3%200%20.5-.2.5-.5v-1.8l-2.7-2.7z'/%3e%3cpath%20id='矩形_1_'%20class='st1'%20d='M10%2010h1v3h-1z'/%3e%3cpath%20id='矩形-copy-2'%20class='st1'%20d='M10%2012h3v1h-3z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M7.5%202v2.5H4a.5.5%200%2000-.5.5v2a.5.5%200%2000.5.5h9a.5.5%200%2000.5-.5V5a.5.5%200%2000-.5-.5H9.5V2a.5.5%200%2000-.5-.5H8a.5.5%200%2000-.5.5z'%20stroke='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M13%207h1v4h-1z'/%3e%3cpath%20d='M11%2013a2%202%200%20002-2V8.764A3%203%200%20118.764%2013H11z'%20fill='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M1%2013h10v1H1z'/%3e%3cpath%20d='M1%2013a2%202%200%20002-2V8.764A3%203%200%20011%2014v-1z'%20fill='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M3%207h1v4H3z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M10%201l4%204v9a1%201%200%2001-1%201H3a1%201%200%2001-1-1V2a1%201%200%20011-1h7zm-.414%201H3v12h10V5.414L9.586%202z'/%3e%3cpath%20d='M9%201h1v4h4v1H9z'/%3e%3cpath%20d='M8%207h1v4.293l1.646-1.647.708.708L8.5%2013.207l-2.854-2.853.708-.708L8%2011.293z'%20transform='translate(-.5)'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M12%204h-1V2H5v2H4V2a1%201%200%20011-1h6a1%201%200%20011%201v2zm0%205v4a1%201%200%2001-1%201H5a1%201%200%2001-1-1V9h1v4h6V9h1z'/%3e%3cpath%20d='M12%2012v-1h2V5H2v6h2v1H2a1%201%200%2001-1-1V5a1%201%200%20011-1h12a1%201%200%20011%201v6a1%201%200%2001-1%201h-2z'/%3e%3cpath%20d='M3%208h10v1H3zm8-2h2v1h-2z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%2014v-3a4%204%200%20014-4h3V6H7a5%205%200%2000-5%205v3h1zm7.016-11.282v7.543l4.29-3.73z'%20fill='%233D4757'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2v-1zm4-3h8v1H6v-1zM2%207h12v1H2V7zm0-6h12v1H2V1zm4%203h8v1H6V4z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2014h12v1H2v-1zm7-5h5v1H9V9zm0-3h5v1H9V6zM2%201h12v1H2V1zm2.5%203L7%207H2zm0%208L7%209H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3ccircle%20stroke='%233D4757'%20cx='6'%20cy='6'%20r='4.5'/%3e%3cpath%20d='M10.061%2010.968L8.707%209.414l.707-.707%201.514%201.457.435-.404%202.632%202.462a1.154%201.154%200%2001.05%201.635%201.184%201.184%200%2001-1.655.064l-2.788-2.527.46-.426z'%20fill='%233D4757'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.9%202.8l2.01%202.506c.2.25.58.25.78%200L8.7%202.799l2.01%202.507c.2.25.58.25.78%200l2.4-2.993-.78-.626-2.01%202.507-2.01-2.507a.5.5%200%2000-.78%200L6.3%204.194%204.29%201.687a.5.5%200%2000-.78%200l-2.4%203%20.78.625L3.9%202.8zM1%208h13v1H1zm0%204h3v1H1zm5%200h3v1H6zm5%200h3v1h-3z'%20fill='%233D4757'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M6.215%203.29H7.64L11.855%2014H10.52l-1.14-3H4.46l-1.14%203H2L6.215%203.29zM4.85%209.965h4.14L6.965%204.61h-.06L4.85%209.965z'/%3e%3cpath%20d='M12%204V2h1v2h2v1h-2v2h-1V5h-2V4h2z'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20fill-rule='nonzero'%20d='M11%204h4v1h-4z'/%3e%3cpath%20d='M6.215%203.29H7.64L11.855%2014H10.52l-1.14-3H4.46l-1.14%203H2L6.215%203.29zM4.85%209.965h4.14L6.965%204.61h-.06L4.85%209.965z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M10.42%207.903H6.692a9.182%209.182%200%2001-.41-.172%205.54%205.54%200%2001-.814-.447%202.955%202.955%200%2001-.655-.595%202.728%202.728%200%2001-.44-.777%202.877%202.877%200%2001-.162-1.006c0-.472.094-.888.282-1.25.188-.36.453-.663.793-.907s.747-.43%201.22-.558A5.97%205.97%200%20018.063%202c.504%200%20.95.049%201.337.147.387.097.725.23%201.013.398.287.169.53.365.73.59a3.337%203.337%200%2001.772%201.486c.03.13.054.255.073.379h-1.276a2.393%202.393%200%2000-.22-.615%202.315%202.315%200%2000-.59-.724%202.467%202.467%200%2000-.834-.44%203.376%203.376%200%2000-1.005-.146%204.69%204.69%200%2000-.958.097%202.77%202.77%200%2000-.839.314%201.765%201.765%200%2000-.597.566c-.152.233-.229.518-.229.854%200%20.348.086.642.258.884.171.241.401.449.689.622.287.174.615.323.983.448s.749.247%201.142.367c.31.097.62.196.934.297a8.439%208.439%200%2001.973.38zm1.376%201c.175.217.315.466.418.746.105.285.158.612.158.98%200%20.554-.104%201.041-.312%201.462-.207.42-.496.772-.867%201.054-.37.282-.81.495-1.32.64A6.12%206.12%200%20018.205%2014c-.543%200-1.071-.09-1.586-.273a4.44%204.44%200%2001-1.374-.773%203.873%203.873%200%2001-.97-1.217%203.695%203.695%200%2001-.395-1.612h1.27c.028.407.122.78.282%201.12a2.835%202.835%200%20001.581%201.465c.363.138.76.207%201.192.207.387%200%20.758-.042%201.112-.126a2.85%202.85%200%2000.938-.399%202.01%202.01%200%2000.647-.708c.16-.29.241-.642.241-1.054%200-.337-.087-.623-.261-.86a2.333%202.333%200%2000-.69-.61%204.651%204.651%200%2000-.495-.257h2.099z'/%3e%3cpath%20d='M3%207h10v1H3z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_subscript'%3e%3cpath%20id='_x32_'%20class='st0'%20d='M15%2013.3v.7h-3c0-.3.1-.5.3-.8.2-.2.5-.6%201-1%20.4-.3.6-.5.7-.7.1-.2.2-.3.2-.5s-.1-.3-.2-.4c-.1-.1-.2-.1-.4-.1s-.3%200-.4.1-.2.4-.2.7l-.9-.1c.1-.4.2-.7.5-.9.3-.2.6-.3%201-.3s.8.1%201%20.3c.3.2.4.5.4.8%200%20.2%200%20.4-.1.5-.1.2-.2.3-.3.5-.1.1-.3.3-.6.5s-.4.4-.5.4c-.1.1-.1.2-.2.3H15z'/%3e%3cpath%20id='合并形状'%20class='st0'%20d='M7.2%208.5l4%205.5H9.8L6.5%209.4%203.2%2014H1.8l4-5.5-4-5.5h1.4l3.3%204.6L9.8%203h1.3L7.2%208.5z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_superscript'%3e%3cpath%20id='_x32_'%20class='st0'%20d='M15%206.3V7h-3c0-.3.1-.5.3-.8.2-.2.5-.6%201-1%20.3-.2.6-.5.7-.6.1-.2.2-.3.2-.5s-.1-.3-.2-.4c-.1-.1-.2-.1-.4-.1s-.3%200-.4.1-.2.3-.2.6l-.9-.1c.1-.4.2-.7.5-.9s.6-.3%201-.3.8.1%201%20.3c.3.2.4.5.4.8%200%20.2%200%20.4-.1.5s-.2.4-.4.5c-.1.1-.3.3-.6.5s-.4.4-.4.5c-.1.1-.1.2-.2.3l1.7-.1z'/%3e%3cpath%20id='合并形状'%20class='st0'%20d='M7.4%208.5l4%205.5H10L6.7%209.4%203.4%2014H2l4-5.5L2%203h1.4l3.3%204.6L10%203h1.3L7.4%208.5z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3crect%20x='.5'%20y='.5'%20width='12'%20height='12'%20rx='1'%20transform='translate(1%201)'%20stroke='%233D4757'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M2%209h12v1H2zm0-4h12v1H2z'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M5%201h1v13H5zm4%200h1v13H9z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M14%201a1%201%200%20011%201v12a1%201%200%2001-1%201H2a1%201%200%2001-1-1V2a1%201%200%20011-1h12zm0%201H2v12h12V2z'%20fill-rule='nonzero'/%3e%3cpath%20fill-rule='nonzero'%20d='M4%2011h8v1H4zm0-3h4v1H4zm0-3h2v1H4z'/%3e%3cpath%20d='M9%205h1v4H9z'/%3e%3cpath%20d='M7%205h5v1H7z'/%3e%3c/g%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5%202v6a3%203%200%20106%200V2h1v6a4%204%200%2011-8%200V2h1zM4%2013h8v1H4z'%20fill='%233D4757'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6%202.763v7.544l-4.29-3.73zM13%2014v-3a4%204%200%2000-4-4H6V6h3a5%205%200%20015%205v3h-1z'%20fill='%233D4757'/%3e%3c/svg%3e\"","import {\n CheckboxMarkType,\n ControlType,\n ElementType,\n ListStyle,\n ListType,\n RowFlex,\n TitleLevel,\n splitText\n} from '@baohu/canvas-editor'\nimport type { IElement } from '@baohu/canvas-editor'\nimport { Dialog } from '../components/Dialog'\nimport {\n Dropdown,\n IDropdownOption,\n createOptionList,\n setActiveOption\n} from '../components/Dropdown'\nimport type { ILocale } from '../locale'\nimport type { IToolbarButton, IToolbarContext } from '../types'\nimport {\n cls,\n downloadBlob,\n formatDate,\n h,\n loadImage,\n readFileAsDataURL\n} from '../utils'\nimport alignmentIcon from '../icons/alignment.svg'\nimport boldIcon from '../icons/bold.svg'\nimport centerIcon from '../icons/center.svg'\nimport checkboxIcon from '../icons/checkbox.svg'\nimport colorIcon from '../icons/color.svg'\nimport controlIcon from '../icons/control.svg'\nimport dateIcon from '../icons/date.svg'\nimport formatIcon from '../icons/format.svg'\nimport highlightIcon from '../icons/highlight.svg'\nimport hyperlinkIcon from '../icons/hyperlink.svg'\nimport imageIcon from '../icons/image.svg'\nimport italicIcon from '../icons/italic.svg'\nimport justifyIcon from '../icons/justify.svg'\nimport leftIcon from '../icons/left.svg'\nimport listIcon from '../icons/list.svg'\nimport pageBreakIcon from '../icons/page-break.svg'\nimport painterIcon from '../icons/painter.svg'\nimport pdfIcon from '../icons/pdf.svg'\nimport printIcon from '../icons/print.svg'\nimport redoIcon from '../icons/redo.svg'\nimport rightIcon from '../icons/right.svg'\nimport rowMarginIcon from '../icons/row-margin.svg'\nimport searchIcon from '../icons/search.svg'\nimport separatorIcon from '../icons/separator.svg'\nimport sizeAddIcon from '../icons/size-add.svg'\nimport sizeMinusIcon from '../icons/size-minus.svg'\nimport strikeoutIcon from '../icons/strikeout.svg'\nimport subscriptIcon from '../icons/subscript.svg'\nimport superscriptIcon from '../icons/superscript.svg'\nimport tableIcon from '../icons/table.svg'\nimport titleIcon from '../icons/title.svg'\nimport underlineIcon from '../icons/underline.svg'\nimport undoIcon from '../icons/undo.svg'\n\nexport const FONT_LIST: IDropdownOption[] = [\n 'Microsoft YaHei',\n '宋体',\n '黑体',\n '仿宋',\n '楷体',\n '华文宋体',\n '华文黑体',\n '华文仿宋',\n '华文楷体',\n '华文隶书',\n '华文行楷',\n 'Arial',\n 'Segoe UI',\n 'Times New Roman'\n].map(font => ({\n label: font === 'Microsoft YaHei' ? '微软雅黑' : font,\n value: font,\n style: `font-family:'${font}'`\n}))\n\nexport const SIZE_LIST: IDropdownOption[] = [\n ['初号', 56],\n ['小初', 48],\n ['一号', 34],\n ['小一', 32],\n ['二号', 29],\n ['小二', 24],\n ['三号', 21],\n ['小三', 20],\n ['四号', 18],\n ['小四', 16],\n ['五号', 14],\n ['小五', 12],\n ['六号', 10],\n ['小六', 8],\n ['七号', 7],\n ['八号', 6]\n].map(([label, value]) => ({ label: String(label), value: String(value) }))\n\nconst ROW_MARGIN_LIST = ['1', '1.25', '1.5', '1.75', '2', '2.5', '3']\n\n// 分割线虚线样式\nconst SEPARATOR_LIST: { label: string; dashArray: number[] }[] = [\n { label: '———— 实线', dashArray: [] },\n { label: '··········· 点线', dashArray: [1, 1] },\n { label: '- - - - - 短虚线', dashArray: [3, 1] },\n { label: '— — — 长虚线', dashArray: [4, 4] },\n { label: '—·—·— 点划线', dashArray: [7, 3, 3, 3] },\n { label: '—··—·· 双点划线', dashArray: [6, 2, 2, 2, 2, 2] }\n]\n\n// 简单按钮\nfunction button(\n key: string,\n title: string,\n icon: string,\n onClick: (ctx: IToolbarContext, el: HTMLElement) => void,\n extra: Partial<IToolbarButton> = {}\n): IToolbarButton {\n return { key, title, icon, onClick, ...extra }\n}\n\n// 下拉选择:触发器显示当前值\nfunction selectItem(\n key: string,\n title: string,\n options: IDropdownOption[],\n width: number,\n onSelect: (ctx: IToolbarContext, value: string) => void,\n getValue: (ctx: IToolbarContext) => string | null\n): IToolbarButton {\n return {\n key,\n title,\n render: ctx => {\n const label = h('span', { class: cls('select__label') })\n const trigger = h(\n 'div',\n { class: cls('select'), title, style: `width:${width}px` },\n label\n )\n const list = createOptionList(options, value => {\n dropdown.close()\n onSelect(ctx, value)\n })\n const dropdown = new Dropdown(trigger, list)\n return dropdown.el\n },\n update: (ctx, el) => {\n const value = getValue(ctx)\n const option = options.find(o => o.value === value)\n el.querySelector<HTMLElement>(`.${cls('select__label')}`)!.innerText =\n option ? option.label : value || ''\n setActiveOption(el, value)\n }\n }\n}\n\n// 图标按钮 + 下拉面板\nfunction dropdownItem(\n key: string,\n title: string,\n icon: string,\n createPanel: (ctx: IToolbarContext, close: () => void) => HTMLElement,\n extra: Partial<IToolbarButton> = {}\n): IToolbarButton {\n return {\n key,\n title,\n render: ctx => {\n const trigger = h(\n 'div',\n { class: `${cls('toolbar__button')} ${cls('toolbar__button--arrow')}`, title },\n h('i', { class: cls('icon'), style: `background-image:url(\"${icon}\")` })\n )\n const panel = h('div')\n const dropdown = new Dropdown(trigger, panel)\n // 每次打开时重新生成面板内容(如当前时间)\n trigger.addEventListener(\n 'click',\n () => {\n panel.innerHTML = ''\n panel.append(createPanel(ctx, () => dropdown.close()))\n },\n true\n )\n return dropdown.el\n },\n ...extra\n }\n}\n\n// 颜色按钮:图标下方显示当前颜色\nfunction colorItem(\n key: string,\n title: string,\n icon: string,\n execute: (ctx: IToolbarContext, color: string) => void,\n getColor: (ctx: IToolbarContext) => string | null\n): IToolbarButton {\n return {\n key,\n title,\n render: ctx => {\n const input = h('input', { type: 'color', class: cls('color__input') })\n input.addEventListener('input', () => execute(ctx, input.value))\n const bar = h('span', { class: cls('color__bar') })\n const trigger = h(\n 'div',\n { class: `${cls('toolbar__button')} ${cls('color')}`, title },\n h('i', { class: cls('icon'), style: `background-image:url(\"${icon}\")` }),\n bar,\n input\n )\n trigger.addEventListener('click', () => input.click())\n return trigger\n },\n update: (ctx, el) => {\n const color = getColor(ctx)\n el.querySelector<HTMLElement>(`.${cls('color__bar')}`)!.style.background =\n color || 'transparent'\n }\n }\n}\n\nfunction insertImage(ctx: IToolbarContext) {\n const input = h('input', { type: 'file', accept: 'image/*' })\n input.addEventListener('change', async () => {\n const file = input.files?.[0]\n if (!file) return\n const value = await readFileAsDataURL(file)\n const image = await loadImage(value)\n ctx.editor.command.executeImage({\n value,\n width: image.width,\n height: image.height\n })\n })\n input.click()\n}\n\nfunction openHyperlinkDialog({ editor, locale }: IToolbarContext) {\n new Dialog({\n title: locale.hyperlink,\n confirmText: locale.confirm,\n cancelText: locale.cancel,\n fields: [\n {\n type: 'text',\n name: 'text',\n label: locale.hyperlinkText,\n required: true,\n value: editor.command.getRangeText()\n },\n {\n type: 'text',\n name: 'url',\n label: locale.hyperlinkUrl,\n required: true,\n placeholder: 'https://'\n }\n ],\n onConfirm: ({ text, url }) => {\n editor.command.executeHyperlink({\n url,\n valueList: splitText(text).map(value => ({ value }))\n })\n }\n })\n}\n\nconst OPTION_CONTROL_TYPES: string[] = [\n ControlType.SELECT,\n ControlType.CHECKBOX,\n ControlType.RADIO\n]\n\nfunction openControlDialog({ editor, locale }: IToolbarContext) {\n new Dialog({\n title: locale.control,\n confirmText: locale.confirm,\n cancelText: locale.cancel,\n fields: [\n {\n type: 'select',\n name: 'type',\n label: locale.controlType,\n options: [\n { label: locale.controlText, value: ControlType.TEXT },\n { label: locale.controlSelect, value: ControlType.SELECT },\n { label: locale.controlCheckbox, value: ControlType.CHECKBOX },\n { label: locale.controlRadio, value: ControlType.RADIO },\n { label: locale.controlDate, value: ControlType.DATE },\n { label: locale.controlNumber, value: ControlType.NUMBER }\n ]\n },\n {\n type: 'text',\n name: 'placeholder',\n label: locale.controlPlaceholder\n },\n {\n type: 'textarea',\n name: 'valueSets',\n label: locale.controlValueSets,\n placeholder: locale.controlValueSetsPlaceholder,\n height: 80\n },\n {\n type: 'select',\n name: 'dateFormat',\n label: locale.controlDateFormat,\n options: [\n { label: 'yyyy-MM-dd', value: 'yyyy-MM-dd' },\n { label: 'yyyy-MM-dd HH:mm:ss', value: 'yyyy-MM-dd HH:mm:ss' }\n ]\n }\n ],\n onConfirm: result => {\n const type = <ControlType>result.type\n const valueSets = result.valueSets\n .split('\\n')\n .map(value => value.trim())\n .filter(Boolean)\n .map(value => ({ value, code: value }))\n // 下拉、复选、单选必须提供选项\n if (OPTION_CONTROL_TYPES.includes(type) && !valueSets.length) {\n return false\n }\n const control: IElement['control'] = {\n type,\n value: null,\n placeholder: result.placeholder || undefined\n }\n if (OPTION_CONTROL_TYPES.includes(type)) {\n control.code = null\n control.valueSets = valueSets\n }\n if (type === ControlType.CHECKBOX) {\n control.markType = CheckboxMarkType.CROSS\n }\n if (type === ControlType.DATE) {\n control.dateFormat = result.dateFormat\n }\n editor.command.executeInsertControl({\n type: ElementType.CONTROL,\n value: '',\n control\n })\n }\n })\n}\n\nfunction openSearchDialog({ editor, locale }: IToolbarContext) {\n new Dialog({\n title: locale.search,\n confirmText: locale.confirm,\n cancelText: locale.cancel,\n fields: [\n {\n type: 'text',\n name: 'keyword',\n label: locale.searchKeyword,\n required: true,\n value: editor.command.getRangeText()\n },\n {\n type: 'text',\n name: 'replace',\n label: locale.searchReplace,\n placeholder: locale.searchReplacePlaceholder\n }\n ],\n onConfirm: ({ keyword, replace }) => {\n editor.command.executeSearch(keyword)\n if (replace) {\n editor.command.executeReplace(replace)\n }\n },\n onClose: () => editor.command.executeSearch(null)\n })\n}\n\nfunction createTablePicker(\n ctx: IToolbarContext,\n close: () => void\n): HTMLElement {\n const MAX = 10\n const title = h('div', { class: cls('table-picker__title') }, ctx.locale.table)\n const grid = h('div', { class: cls('table-picker__grid') })\n const cellList: HTMLElement[] = []\n for (let r = 1; r <= MAX; r++) {\n for (let c = 1; c <= MAX; c++) {\n const cell = h('span', { 'data-row': r, 'data-col': c })\n cellList.push(cell)\n grid.append(cell)\n }\n }\n grid.addEventListener('mouseover', evt => {\n const target = evt.target as HTMLElement\n const row = Number(target.dataset.row)\n const col = Number(target.dataset.col)\n if (!row || !col) return\n title.innerText = `${row} × ${col}`\n cellList.forEach(cell => {\n cell.classList.toggle(\n cls('active'),\n Number(cell.dataset.row) <= row && Number(cell.dataset.col) <= col\n )\n })\n })\n grid.addEventListener('mousedown', evt => evt.preventDefault())\n grid.addEventListener('click', evt => {\n const target = evt.target as HTMLElement\n const row = Number(target.dataset.row)\n const col = Number(target.dataset.col)\n if (!row || !col) return\n close()\n ctx.editor.command.executeInsertTable(row, col)\n })\n return h('div', { class: cls('table-picker') }, title, grid)\n}\n\nconst ROW_FLEX_ITEMS: [string, RowFlex, string][] = [\n ['left', RowFlex.LEFT, leftIcon],\n ['center', RowFlex.CENTER, centerIcon],\n ['right', RowFlex.RIGHT, rightIcon],\n ['alignment', RowFlex.ALIGNMENT, alignmentIcon],\n ['justify', RowFlex.JUSTIFY, justifyIcon]\n]\n\nexport function createBuiltinItems(\n locale: ILocale\n): Record<string, IToolbarButton> {\n const list: IToolbarButton[] = [\n button('undo', locale.undo, undoIcon, ({ editor }) =>\n editor.command.executeUndo(), {\n isDisabled: ({ style }) => !!style && !style.undo\n }),\n button('redo', locale.redo, redoIcon, ({ editor }) =>\n editor.command.executeRedo(), {\n isDisabled: ({ style }) => !!style && !style.redo\n }),\n {\n key: 'painter',\n title: locale.painter,\n icon: painterIcon,\n isActive: ({ style }) => !!style?.painter,\n render: ({ editor }) => {\n const el = h(\n 'div',\n { class: cls('toolbar__button'), title: locale.painter },\n h('i', {\n class: cls('icon'),\n style: `background-image:url(\"${painterIcon}\")`\n })\n )\n // 单击、双击区分处理\n let timer: ReturnType<typeof setTimeout> | null = null\n el.addEventListener('click', () => {\n if (timer) clearTimeout(timer)\n timer = setTimeout(() => {\n timer = null\n editor.command.executePainter({ isDblclick: false })\n }, 200)\n })\n el.addEventListener('dblclick', () => {\n if (timer) clearTimeout(timer)\n timer = null\n editor.command.executePainter({ isDblclick: true })\n })\n return el\n }\n },\n button('format', locale.format, formatIcon, ({ editor }) =>\n editor.command.executeFormat()\n ),\n selectItem(\n 'font',\n locale.font,\n FONT_LIST,\n 90,\n ({ editor }, value) => editor.command.executeFont(value),\n ({ editor, style }) => style?.font || editor.command.getOptions().defaultFont\n ),\n selectItem(\n 'size',\n locale.size,\n SIZE_LIST,\n 54,\n ({ editor }, value) => editor.command.executeSize(Number(value)),\n ({ editor, style }) =>\n String(style ? style.size : editor.command.getOptions().defaultSize)\n ),\n button('sizeAdd', locale.sizeAdd, sizeAddIcon, ({ editor }) =>\n editor.command.executeSizeAdd()\n ),\n button('sizeMinus', locale.sizeMinus, sizeMinusIcon, ({ editor }) =>\n editor.command.executeSizeMinus()\n ),\n button('bold', locale.bold, boldIcon, ({ editor }) =>\n editor.command.executeBold(), {\n isActive: ({ style }) => !!style?.bold\n }),\n button('italic', locale.italic, italicIcon, ({ editor }) =>\n editor.command.executeItalic(), {\n isActive: ({ style }) => !!style?.italic\n }),\n button('underline', locale.underline, underlineIcon, ({ editor }) =>\n editor.command.executeUnderline(), {\n isActive: ({ style }) => !!style?.underline\n }),\n button('strikeout', locale.strikeout, strikeoutIcon, ({ editor }) =>\n editor.command.executeStrikeout(), {\n isActive: ({ style }) => !!style?.strikeout\n }),\n button('superscript', locale.superscript, superscriptIcon, ({ editor }) =>\n editor.command.executeSuperscript(), {\n isActive: ({ style }) => style?.type === ElementType.SUPERSCRIPT\n }),\n button('subscript', locale.subscript, subscriptIcon, ({ editor }) =>\n editor.command.executeSubscript(), {\n isActive: ({ style }) => style?.type === ElementType.SUBSCRIPT\n }),\n colorItem(\n 'color',\n locale.color,\n colorIcon,\n ({ editor }, color) => editor.command.executeColor(color),\n ({ style }) => style?.color || '#000000'\n ),\n colorItem(\n 'highlight',\n locale.highlight,\n highlightIcon,\n ({ editor }, color) => editor.command.executeHighlight(color),\n ({ style }) => style?.highlight || null\n ),\n dropdownItem('title', locale.title, titleIcon, ({ editor, style }, close) => {\n const levelList = [\n TitleLevel.FIRST,\n TitleLevel.SECOND,\n TitleLevel.THIRD,\n TitleLevel.FOURTH,\n TitleLevel.FIFTH,\n TitleLevel.SIXTH\n ]\n const options: IDropdownOption[] = [\n { label: locale.text, value: '' },\n ...levelList.map((level, index) => ({\n label: `${locale.title}${index + 1}`,\n value: level,\n style: `font-size:${26 - index * 2}px;font-weight:bold`\n }))\n ]\n const list = createOptionList(options, value => {\n close()\n editor.command.executeTitle(<TitleLevel>value || null)\n })\n setActiveOption(list, style?.level || '')\n return list\n }),\n ...ROW_FLEX_ITEMS.map(([key, rowFlex, icon]) =>\n button(key, locale[<keyof ILocale>key], icon, ({ editor }) =>\n editor.command.executeRowFlex(rowFlex), {\n isActive: ({ style }) =>\n (style?.rowFlex || RowFlex.LEFT) === rowFlex\n })\n ),\n dropdownItem(\n 'rowMargin',\n locale.rowMargin,\n rowMarginIcon,\n ({ editor, style }, close) => {\n const list = createOptionList(\n ROW_MARGIN_LIST.map(value => ({ label: value, value })),\n value => {\n close()\n editor.command.executeRowMargin(Number(value))\n }\n )\n setActiveOption(list, style ? String(style.rowMargin) : null)\n return list\n }\n ),\n dropdownItem(\n 'list',\n locale.list,\n listIcon,\n ({ editor, style }, close) => {\n const options: IDropdownOption[] = [\n { label: locale.listDecimal, value: `${ListType.OL}|${ListStyle.DECIMAL}` },\n { label: locale.listCheckbox, value: `${ListType.UL}|${ListStyle.CHECKBOX}` },\n { label: locale.listDisc, value: `${ListType.UL}|${ListStyle.DISC}` },\n { label: locale.listCircle, value: `${ListType.UL}|${ListStyle.CIRCLE}` },\n { label: locale.listSquare, value: `${ListType.UL}|${ListStyle.SQUARE}` }\n ]\n const list = createOptionList(options, value => {\n close()\n const [listType, listStyle] = value.split('|')\n editor.command.executeList(<ListType>listType, <ListStyle>listStyle)\n })\n setActiveOption(\n list,\n style?.listType ? `${style.listType}|${style.listStyle}` : null\n )\n return list\n },\n { isActive: ({ style }) => !!style?.listType }\n ),\n dropdownItem('table', locale.table, tableIcon, createTablePicker),\n button('image', locale.image, imageIcon, insertImage),\n button('hyperlink', locale.hyperlink, hyperlinkIcon, openHyperlinkDialog),\n dropdownItem(\n 'separator',\n locale.separator,\n separatorIcon,\n ({ editor }, close) =>\n createOptionList(\n SEPARATOR_LIST.map((item, index) => ({\n label: item.label,\n value: String(index)\n })),\n value => {\n close()\n editor.command.executeSeparator(\n SEPARATOR_LIST[Number(value)].dashArray\n )\n }\n )\n ),\n button('pageBreak', locale.pageBreak, pageBreakIcon, ({ editor }) =>\n editor.command.executePageBreak()\n ),\n button('control', locale.control, controlIcon, openControlDialog),\n dropdownItem('checkbox', locale.checkbox, checkboxIcon, ({ editor }, close) => {\n const list = createOptionList(\n [\n { label: `☒ ${locale.checkboxCross}`, value: CheckboxMarkType.CROSS },\n { label: `☑ ${locale.checkboxCheck}`, value: CheckboxMarkType.CHECK }\n ],\n value => {\n close()\n editor.command.executeInsertElementList([\n {\n type: ElementType.CHECKBOX,\n value: '',\n checkbox: { value: false, markType: <CheckboxMarkType>value }\n }\n ])\n }\n )\n // 默认叉选\n setActiveOption(list, CheckboxMarkType.CROSS)\n return list\n }),\n dropdownItem('date', locale.date, dateIcon, ({ editor }, close) => {\n const now = new Date()\n const formatList = [\n { format: 'yyyy-MM-dd', text: formatDate(now, false) },\n { format: 'yyyy-MM-dd HH:mm:ss', text: formatDate(now, true) }\n ]\n return createOptionList(\n formatList.map((item, index) => ({\n label: item.text,\n value: String(index)\n })),\n value => {\n close()\n const { format, text } = formatList[Number(value)]\n editor.command.executeInsertElementList([\n {\n type: ElementType.DATE,\n value: '',\n dateFormat: format,\n valueList: [{ value: text }]\n }\n ])\n }\n )\n }),\n button('search', locale.search, searchIcon, openSearchDialog, {\n keepEnabledInReadonly: true\n }),\n button('print', locale.print, printIcon, ({ editor }) =>\n editor.command.executePrint(), {\n keepEnabledInReadonly: true\n }),\n button(\n 'pdf',\n locale.pdf,\n pdfIcon,\n async ({ editor }) => {\n const blob = await editor.command.getPdf()\n downloadBlob(blob, `document-${Date.now()}.pdf`)\n },\n { keepEnabledInReadonly: true }\n )\n ]\n const map: Record<string, IToolbarButton> = {}\n list.forEach(item => {\n map[item.key] = item\n })\n return map\n}\n\nexport const DEFAULT_TOOLBAR: string[] = [\n 'undo',\n 'redo',\n 'painter',\n 'format',\n '|',\n 'font',\n 'size',\n 'sizeAdd',\n 'sizeMinus',\n 'bold',\n 'italic',\n 'underline',\n 'strikeout',\n 'superscript',\n 'subscript',\n 'color',\n 'highlight',\n '|',\n 'title',\n 'left',\n 'center',\n 'right',\n 'alignment',\n 'justify',\n 'rowMargin',\n 'list',\n '|',\n 'table',\n 'image',\n 'hyperlink',\n 'separator',\n 'pageBreak',\n 'checkbox',\n 'date',\n '|',\n 'search'\n]\n","import { EDITOR_COMPONENT, EditorComponent, EditorMode } from '@baohu/canvas-editor'\nimport type { IRangeStyle } from '@baohu/canvas-editor'\nimport type { EditorUI } from '../EditorUI'\nimport type { IToolbarButton, IToolbarContext, IToolbarItem } from '../types'\nimport { cls, h } from '../utils'\nimport { DEFAULT_TOOLBAR, createBuiltinItems } from './items'\n\ninterface IRenderedItem {\n item: IToolbarButton\n el: HTMLElement\n}\n\n// 只读类模式下禁用编辑按钮\nconst READONLY_MODES: string[] = [EditorMode.READONLY, EditorMode.PRINT]\n\nexport class Toolbar {\n public el: HTMLDivElement\n private ui: EditorUI\n private style: IRangeStyle | null = null\n private renderedList: IRenderedItem[] = []\n private rangeStyleChange: (style: IRangeStyle) => void\n\n constructor(ui: EditorUI, items: IToolbarItem[] = DEFAULT_TOOLBAR) {\n this.ui = ui\n this.el = h('div', { class: cls('toolbar') })\n this.el.setAttribute(EDITOR_COMPONENT, EditorComponent.MENU)\n // 阻止点击工具栏时编辑器失去焦点(输入框除外)\n this.el.addEventListener('mousedown', evt => {\n const tag = (evt.target as HTMLElement).tagName\n if (tag !== 'INPUT' && tag !== 'SELECT' && tag !== 'TEXTAREA') {\n evt.preventDefault()\n }\n })\n this.render(items)\n this.rangeStyleChange = style => {\n this.style = style\n this.update()\n }\n ui.editor.eventBus.on('rangeStyleChange', this.rangeStyleChange)\n this.update()\n }\n\n private getContext(): IToolbarContext {\n return {\n editor: this.ui.editor,\n ui: this.ui,\n locale: this.ui.locale,\n style: this.style\n }\n }\n\n private render(items: IToolbarItem[]) {\n const builtinMap = createBuiltinItems(this.ui.locale)\n const ctx = this.getContext()\n items.forEach(entry => {\n if (entry === '|') {\n this.el.append(h('span', { class: cls('toolbar__divider') }))\n return\n }\n const item = typeof entry === 'string' ? builtinMap[entry] : entry\n if (!item) {\n console.warn(`[canvas-editor-ui] unknown toolbar item: ${entry}`)\n return\n }\n const el = item.render ? item.render(ctx) : this.renderButton(item)\n el.classList.add(cls('toolbar__item'))\n el.dataset.key = item.key\n this.el.append(el)\n this.renderedList.push({ item, el })\n })\n }\n\n private renderButton(item: IToolbarButton): HTMLElement {\n const el = h(\n 'div',\n { class: cls('toolbar__button'), title: item.title },\n item.icon\n ? h('i', {\n class: cls('icon'),\n style: `background-image:url(\"${item.icon}\")`\n })\n : null,\n item.text ? h('span', { class: cls('toolbar__text') }, item.text) : null\n )\n el.addEventListener('click', () => {\n if (el.classList.contains(cls('disabled'))) return\n item.onClick?.(this.getContext(), el)\n })\n return el\n }\n\n // 根据光标样式与编辑模式刷新按钮状态\n public update() {\n const ctx = this.getContext()\n const mode = this.ui.editor.command.getOptions().mode\n const isReadonly = READONLY_MODES.includes(mode)\n this.renderedList.forEach(({ item, el }) => {\n const disabled =\n (isReadonly && !item.keepEnabledInReadonly) ||\n !!item.isDisabled?.(ctx)\n el.classList.toggle(cls('disabled'), disabled)\n el.classList.toggle(cls('active'), !!item.isActive?.(ctx))\n item.update?.(ctx, el)\n })\n }\n\n public destroy() {\n this.ui.editor.eventBus.off('rangeStyleChange', this.rangeStyleChange)\n this.el.remove()\n }\n}\n","import Editor, { EditorMode } from '@baohu/canvas-editor'\nimport { defaultLocale, ILocale } from './locale'\nimport { DEFAULT_STATUSBAR, Statusbar } from './statusbar/Statusbar'\nimport { Toolbar } from './toolbar/Toolbar'\nimport { DEFAULT_TOOLBAR } from './toolbar/items'\nimport type { IEditorUIOptions } from './types'\nimport { cls, h } from './utils'\nimport './style.css'\n\nlet uid = 0\n\nexport class EditorUI {\n public editor: Editor\n public root: HTMLDivElement\n public locale: ILocale\n private toolbar: Toolbar | null = null\n private statusbar: Statusbar | null = null\n private main: HTMLDivElement\n private mode: EditorMode\n private renderChange: () => void\n\n constructor(container: HTMLElement, options: IEditorUIOptions = {}) {\n this.locale = { ...defaultLocale, ...options.locale }\n const id = `${cls('root')}-${++uid}`\n const editorContainer = h('div', { class: cls('editor') })\n this.main = h('div', { class: cls('main') }, editorContainer)\n this.root = h('div', { class: cls('root'), id }, this.main)\n container.append(this.root)\n // 滚动容器需在编辑器创建前挂载到文档中\n this.editor = new Editor(editorContainer, options.data || { main: [] }, {\n scrollContainerSelector: `#${id} .${cls('main')}`,\n ...options.options\n })\n if (options.toolbar !== false) {\n this.toolbar = new Toolbar(this, options.toolbar || DEFAULT_TOOLBAR)\n this.root.prepend(this.toolbar.el)\n }\n if (options.statusbar !== false) {\n this.statusbar = new Statusbar(this, options.statusbar || DEFAULT_STATUSBAR)\n this.root.append(this.statusbar.el)\n }\n // 编辑器没有模式变化事件:渲染后比对,兼容直接调用 executeMode 的情况\n this.mode = this.editor.command.getOptions().mode\n this.renderChange = () => {\n if (this.editor.command.getOptions().mode !== this.mode) {\n this.syncMode()\n }\n }\n this.editor.eventBus.on('renderChange', this.renderChange)\n }\n\n private syncMode() {\n this.mode = this.editor.command.getOptions().mode\n this.toolbar?.update()\n this.statusbar?.update()\n }\n\n // 当前总页数(编辑器仅在页数变化时通知,初始值从页面画布读取)\n public getPageSize(): number {\n return this.main.querySelectorAll('canvas[data-index]').length || 1\n }\n\n // 切换编辑模式并刷新工具栏可用状态\n public setMode(mode: EditorMode) {\n this.editor.command.executeMode(mode)\n this.syncMode()\n }\n\n public destroy() {\n this.editor.eventBus.off('renderChange', this.renderChange)\n this.toolbar?.destroy()\n this.statusbar?.destroy()\n this.editor.destroy()\n this.root.remove()\n }\n}\n\nexport function createEditorUI(\n container: HTMLElement | string,\n options?: IEditorUIOptions\n): EditorUI {\n const el =\n typeof container === 'string'\n ? document.querySelector<HTMLElement>(container)\n : container\n if (!el) {\n throw new Error(`[canvas-editor-ui] container not found: ${container}`)\n }\n return new EditorUI(el, options)\n}\n"],"names":["defaultLocale","PREFIX","h","tag","attrs","children","el","key","value","child","cls","name","debounce","fn","delay","timer","debounced","args","readFileAsDataURL","file","resolve","reject","reader","loadImage","src","image","downloadBlob","blob","fileName","url","formatDate","date","withTime","pad","num","day","Dialog","options","EDITOR_COMPONENT","EditorComponent","evt","_a","title","fields","confirmText","cancelText","closeBtn","body","field","input","label","cancelBtn","confirmBtn","dialog","target","option","onConfirm","result","isValid","index","isEmpty","_b","openedDropdownSet","onDocumentMousedown","dropdown","Dropdown","trigger","panel","placement","createOptionList","onSelect","list","item","setActiveOption","exitFullscreenIcon","pageModeIcon","pageScaleAddIcon","pageScaleMinusIcon","paperDirectionIcon","paperMarginIcon","requestFullscreenIcon","DEFAULT_STATUSBAR","LEFT_ITEMS","iconButton","icon","onClick","Statusbar","ui","items","event","callback","eventBus","left","right","editor","locale","pageNo","pageSize","payload","count","refresh","text","context","PageMode","sync","mode","percentage","scale","paperDirection","PaperDirection","modeList","EditorMode","button","onChange","nameList","labelList","marginList","top","bottom","margins","margin","update","dispose","alignmentIcon","boldIcon","centerIcon","checkboxIcon","colorIcon","controlIcon","dateIcon","formatIcon","highlightIcon","hyperlinkIcon","imageIcon","italicIcon","justifyIcon","leftIcon","listIcon","pageBreakIcon","painterIcon","pdfIcon","printIcon","redoIcon","rightIcon","rowMarginIcon","searchIcon","separatorIcon","sizeAddIcon","sizeMinusIcon","strikeoutIcon","subscriptIcon","superscriptIcon","tableIcon","titleIcon","underlineIcon","undoIcon","FONT_LIST","font","SIZE_LIST","ROW_MARGIN_LIST","SEPARATOR_LIST","extra","selectItem","width","getValue","ctx","o","dropdownItem","createPanel","colorItem","execute","getColor","bar","color","insertImage","openHyperlinkDialog","splitText","OPTION_CONTROL_TYPES","ControlType","openControlDialog","type","valueSets","control","CheckboxMarkType","ElementType","openSearchDialog","keyword","replace","createTablePicker","close","grid","cellList","r","c","cell","row","col","ROW_FLEX_ITEMS","RowFlex","createBuiltinItems","style","levelList","TitleLevel","level","rowFlex","ListType","ListStyle","listType","listStyle","now","formatList","format","map","DEFAULT_TOOLBAR","READONLY_MODES","Toolbar","builtinMap","entry","isReadonly","disabled","_c","uid","EditorUI","container","id","editorContainer","Editor","createEditorUI"],"mappings":";AAAO,MAAMA,IAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,WAAW;AAAA,EACX,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA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,OAAOyN,KAAc,WACjB,SAAS,cAA2BA,CAAS,IAC7CA;AACN,MAAI,CAACzN;AACH,UAAM,IAAI,MAAM,2CAA2CyN,CAAS,EAAE;AAExE,SAAO,IAAID,GAASxN,GAAI+B,CAAO;AACjC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.id="canvas-editor-ui-style",e.appendChild(document.createTextNode(`.ceu-root{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-height:0;background:#f2f4f7;color:#3d4757;font-size:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;box-sizing:border-box}.ceu-root *,.ceu-dialog-container *{box-sizing:border-box}.ceu-main{position:relative;flex:1;min-height:0;overflow:auto}.ceu-editor>div{margin:20px auto}.ceu-icon{display:inline-block;width:16px;height:16px;background-repeat:no-repeat;background-size:100% 100%}.ceu-active{background:#19375814}.ceu-disabled{opacity:.4;pointer-events:none}.ceu-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 2px;padding:8px 12px;background:#f2f4f7;border-bottom:1px solid #e2e6ed;user-select:none}.ceu-toolbar__divider{width:1px;height:16px;margin:0 6px;background:#cfd2d8}.ceu-toolbar__button,.ceu-statusbar__button{position:relative;display:flex;align-items:center;justify-content:center;min-width:24px;height:24px;padding:0 4px;cursor:pointer}.ceu-toolbar__button:hover,.ceu-statusbar__button:hover,.ceu-select:hover{background:#1937580a}.ceu-toolbar__item.ceu-active>.ceu-toolbar__button,.ceu-toolbar__button.ceu-active{background:#19375814}.ceu-toolbar__text{margin-left:2px;white-space:nowrap}.ceu-toolbar__button--arrow:after,.ceu-select:after{content:"";width:0;height:0;margin-left:3px;border:3px solid transparent;border-top:4px solid #767c85;transform:translateY(2px)}.ceu-select{display:flex;align-items:center;justify-content:space-between;height:24px;padding:0 4px;cursor:pointer}.ceu-select__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ceu-color{flex-direction:column}.ceu-color .ceu-icon{width:14px;height:12px}.ceu-color__bar{width:14px;height:3px;margin-top:1px;border:1px solid #e2e6ed}.ceu-color__input{position:absolute;left:0;bottom:0;width:0;height:0;padding:0;border:0;opacity:0;pointer-events:none}.ceu-dropdown{position:relative}.ceu-dropdown__panel{position:absolute;left:0;z-index:10;display:none;min-width:100%;padding:6px;background:#fff;border:1px solid #e2e6ed;border-radius:2px;box-shadow:0 2px 12px #38383833}.ceu-dropdown__panel--bottom{top:calc(100% + 4px)}.ceu-dropdown__panel--top{bottom:calc(100% + 4px)}.ceu-dropdown__panel--visible{display:block}.ceu-option-list{margin:0;padding:0;list-style:none;max-height:300px;overflow-y:auto}.ceu-option-list li{display:flex;align-items:center;gap:6px;padding:5px 10px;white-space:nowrap;cursor:pointer}.ceu-option-list li:hover{background:#ebecef}.ceu-option-list li.ceu-active{background:#e2e6ed}.ceu-table-picker__title{padding:2px 2px 6px;color:#3d4757}.ceu-table-picker__grid{display:grid;grid-template-columns:repeat(10,16px);gap:3px}.ceu-table-picker__grid span{width:16px;height:16px;border:1px solid #e2e6ed;cursor:pointer}.ceu-table-picker__grid span.ceu-active{background:#4991f226;border-color:#4991f280}.ceu-statusbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px 12px;min-height:30px;padding:2px 8px 2px 16px;background:#f2f4f7;border-top:1px solid #e2e6ed;user-select:none}.ceu-statusbar__left,.ceu-statusbar__right,.ceu-statusbar__group{display:flex;align-items:center;gap:4px}.ceu-statusbar__left{gap:12px}.ceu-statusbar__left>span{white-space:nowrap;letter-spacing:1px}.ceu-statusbar__scale,.ceu-statusbar__mode{display:inline-block;padding:0 6px;line-height:24px;white-space:nowrap;cursor:pointer}.ceu-statusbar__scale:hover,.ceu-statusbar__mode:hover{background:#1937580a}.ceu-statusbar .ceu-dropdown__panel{left:auto;right:0}.ceu-dialog-mask{position:fixed;inset:0;z-index:2000;background:#00000080}.ceu-dialog-container{position:fixed;inset:0;z-index:2001;display:flex;align-items:center;justify-content:center;overflow:auto;font-size:14px;color:#3d4757}.ceu-dialog{width:420px;max-width:calc(100vw - 32px);padding:0 24px 24px;background:#fff;border:1px solid #e2e6ed;border-radius:2px;box-shadow:0 2px 12px #38383833}.ceu-dialog__title{display:flex;align-items:center;justify-content:space-between;height:56px;margin-bottom:20px;border-bottom:1px solid #e2e6ed}.ceu-dialog__close{width:16px;height:16px;cursor:pointer;background:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.9%208.192l4.242%204.243-.707.707L8.192%208.9%203.95%2013.142l-.707-.707%204.242-4.243L3.243%203.95l.707-.707%204.242%204.242%204.243-4.242.707.707L8.9%208.192z'%20fill='%236A6A6A'%20fill-rule='evenodd'/%3e%3c/svg%3e") no-repeat}.ceu-dialog__field{display:flex;align-items:center;gap:12px;margin-bottom:16px}.ceu-dialog__label{position:relative;flex-shrink:0;width:64px;text-align:right}.ceu-dialog__label--required:before{content:"*";position:absolute;left:-8px;color:#f56c6c}.ceu-dialog__field input,.ceu-dialog__field textarea,.ceu-dialog__field select{flex:1;min-width:0;height:30px;padding:5px;font:inherit;border:1px solid #d3d3d3;border-radius:2px;outline:none}.ceu-dialog__field textarea{resize:vertical}.ceu-dialog__field input:focus,.ceu-dialog__field textarea:focus,.ceu-dialog__field select:focus{border-color:#4991f2}.ceu-dialog__field .ceu-dialog__input--error{border-color:#f56c6c}.ceu-dialog__footer{display:flex;justify-content:flex-end;gap:12px;margin-top:8px}.ceu-dialog__footer button{padding:0 16px;line-height:26px;font:inherit;background:#fff;border:1px solid #e2e6ed;border-radius:2px;cursor:pointer}.ceu-dialog__footer button:hover{background:#1937580a}.ceu-dialog__footer .ceu-dialog__confirm{color:#fff;background:#4991f2;border-color:#4991f2}.ceu-dialog__footer .ceu-dialog__confirm:hover{background:#5b9cf3}`)),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
(function(p,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("@baohu/canvas-editor")):typeof define=="function"&&define.amd?define(["exports","@baohu/canvas-editor"],c):(p=typeof globalThis!="undefined"?globalThis:p||self,c(p.CanvasEditorUI={},p["canvas-editor"]))})(this,function(p,c){"use strict";const B=(a=>a&&a.__esModule?a:{default:a})(c),_={undo:"撤销",redo:"重做",painter:"格式刷(双击可连续使用)",format:"清除格式",font:"字体",size:"字号",sizeAdd:"增大字号",sizeMinus:"减小字号",bold:"加粗",italic:"斜体",underline:"下划线",strikeout:"删除线",superscript:"上标",subscript:"下标",color:"字体颜色",highlight:"高亮",title:"标题",text:"正文",left:"左对齐",center:"居中对齐",right:"右对齐",alignment:"两端对齐",justify:"分散对齐",rowMargin:"行间距",list:"列表",listDecimal:"有序列表",listCheckbox:"复选框列表",listDisc:"实心圆点列表",listCircle:"空心圆点列表",listSquare:"实心方块列表",table:"表格",image:"图片",hyperlink:"超链接",hyperlinkText:"文本",hyperlinkUrl:"链接",separator:"分割线",pageBreak:"分页符",control:"控件",controlType:"类型",controlText:"文本",controlSelect:"下拉框",controlCheckbox:"复选框",controlRadio:"单选框",controlDate:"日期",controlNumber:"数值",controlPlaceholder:"占位符",controlValueSets:"选项",controlValueSetsPlaceholder:`每行一个选项,如:
|
|
3
|
+
有
|
|
4
|
+
无`,controlDateFormat:"日期格式",checkbox:"复选框",checkboxCross:"叉选",checkboxCheck:"勾选",date:"日期",search:"查找替换",searchKeyword:"查找",searchReplace:"替换为",searchReplacePlaceholder:"留空则只查找",print:"打印",pdf:"导出 PDF",confirm:"确定",cancel:"取消",pageNo:"页面",wordCount:"字数",rowCol:"行列",pageModePaging:"分页",pageModeContinuity:"连页",scaleMinus:"缩小",scaleAdd:"放大",scaleRecovery:"恢复 100%",paperDirection:"纸张方向",paperMargin:"页边距",marginTop:"上边距",marginRight:"右边距",marginBottom:"下边距",marginLeft:"左边距",modeEdit:"编辑模式",modeClean:"清洁模式",modeReadonly:"只读模式",modeForm:"表单模式",modePrint:"打印模式",modeDesign:"设计模式",fullscreen:"全屏"},$="ceu";function l(a,n={},...s){const e=document.createElement(a);return Object.keys(n).forEach(t=>{const o=n[t];o===void 0||o===!1||(t==="class"?e.className=String(o):e.setAttribute(t,o===!0?"":String(o)))}),s.forEach(t=>{t==null||t===!1||e.append(t)}),e}function r(a){return`${$}-${a}`}function F(a,n){let s=null;const e=(...t)=>{s&&clearTimeout(s),s=setTimeout(()=>{s=null,a(...t)},n)};return e.cancel=()=>{s&&clearTimeout(s),s=null},e}function P(a){return new Promise((n,s)=>{const e=new FileReader;e.onload=()=>n(e.result),e.onerror=s,e.readAsDataURL(a)})}function U(a){return new Promise((n,s)=>{const e=new Image;e.onload=()=>n(e),e.onerror=s,e.src=a})}function q(a,n){const s=URL.createObjectURL(a);l("a",{href:s,download:n}).click(),URL.revokeObjectURL(s)}function C(a,n){const s=t=>String(t).padStart(2,"0"),e=`${a.getFullYear()}-${s(a.getMonth()+1)}-${s(a.getDate())}`;return n?`${e} ${s(a.getHours())}:${s(a.getMinutes())}:${s(a.getSeconds())}`:e}class L{constructor(n){var s;this.inputList=[],this.options=n,this.mask=l("div",{class:r("dialog-mask")}),this.container=this.render(),this.mask.setAttribute(c.EDITOR_COMPONENT,c.EditorComponent.COMPONENT),this.container.setAttribute(c.EDITOR_COMPONENT,c.EditorComponent.COMPONENT),document.body.append(this.mask,this.container),this.keydownHandler=e=>{e.key==="Escape"&&this.close()},document.addEventListener("keydown",this.keydownHandler),(s=this.inputList[0])==null||s.focus()}render(){const{title:n,fields:s,confirmText:e="确定",cancelText:t="取消"}=this.options,o=l("i",{class:r("dialog__close")});o.onclick=()=>this.close();const i=l("div",{class:r("dialog__body")});s.forEach(u=>{const m=this.createInput(u);this.inputList.push(m);const z=u.label?l("span",{class:`${r("dialog__label")}${u.required?` ${r("dialog__label--required")}`:""}`},u.label):null;i.append(l("label",{class:r("dialog__field")},z,m))});const d=l("button",{type:"button"},t);d.onclick=()=>this.close();const h=l("button",{type:"button",class:r("dialog__confirm")},e);h.onclick=()=>this.confirm();const g=l("div",{class:r("dialog")},l("div",{class:r("dialog__title")},l("span",{},n),o),i,l("div",{class:r("dialog__footer")},d,h));return g.addEventListener("keydown",u=>{const m=u.target;u.key==="Enter"&&m.tagName==="INPUT"&&(u.preventDefault(),this.confirm())}),l("div",{class:r("dialog-container")},g)}createInput(n){var e;let s;return n.type==="select"?(s=l("select",{name:n.name}),(e=n.options)==null||e.forEach(t=>{s.append(l("option",{value:t.value},t.label))})):n.type==="textarea"?(s=l("textarea",{name:n.name}),n.height&&(s.style.height=`${n.height}px`)):s=l("input",{name:n.name,type:n.type}),n.value!==void 0&&(s.value=n.value),n.placeholder&&!(s instanceof HTMLSelectElement)&&(s.placeholder=n.placeholder),s}confirm(){const{fields:n,onConfirm:s}=this.options,e={};let t=!0;this.inputList.forEach((o,i)=>{e[o.name]=o.value;const d=n[i].required&&!o.value.trim();o.classList.toggle(r("dialog__input--error"),!!d),d&&(t=!1)}),t&&(s&&s(e)===!1||this.dispose())}close(){var n,s;(s=(n=this.options).onClose)==null||s.call(n),this.dispose()}dispose(){document.removeEventListener("keydown",this.keydownHandler),this.mask.remove(),this.container.remove()}}const f=new Set;function D(a){f.forEach(n=>{n.el.contains(a.target)||n.close()})}class H{constructor(n,s,e="bottom"){this.panel=l("div",{class:`${r("dropdown__panel")} ${r(`dropdown__panel--${e}`)}`},s),this.el=l("div",{class:r("dropdown")},n,this.panel),n.addEventListener("click",()=>this.toggle())}toggle(){f.has(this)?this.close():this.open()}open(){f.forEach(s=>s.close()),this.panel.classList.add(r("dropdown__panel--visible")),this.panel.style.left="",this.panel.style.right="",this.panel.getBoundingClientRect().right>window.innerWidth&&(this.panel.style.left="auto",this.panel.style.right="0"),f.size||document.addEventListener("mousedown",D),f.add(this)}close(){this.panel.classList.remove(r("dropdown__panel--visible")),f.delete(this),f.size||document.removeEventListener("mousedown",D)}}function w(a,n){const s=l("ul",{class:r("option-list")});return a.forEach(e=>{const t=l("li",{"data-value":e.value,style:e.style},e.icon?l("i",{class:r("icon"),style:`background-image:url("${e.icon}")`}):null,e.label);t.addEventListener("mousedown",o=>o.preventDefault()),t.addEventListener("click",()=>n(e.value)),s.append(t)}),s}function x(a,n){a.querySelectorAll("li").forEach(s=>{s.classList.toggle(r("active"),s.dataset.value===n)})}const X="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M9%209h1v4H9z'/%3e%3cpath%20d='M9%209h4v1H9zM7%207H6V3h1z'/%3e%3cpath%20d='M7%207H3V6h4z'/%3e%3c/g%3e%3c/svg%3e",j="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cg%20transform='translate(2%201)'%3e%3crect%20stroke='%233D4757'%20x='.5'%20y='.5'%20width='11'%20height='8'%20rx='1'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M2%203h4v1H2zm0%202h8v1H2z'/%3e%3c/g%3e%3cg%20fill='%233D4757'%20fill-rule='nonzero'%3e%3cpath%20d='M14%2015h-1v-5H3v5H2V9h12v6z'/%3e%3cpath%20d='M4%2012h4v1H4zm0%202h8v1H4z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Y="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7%207V3h2v4h4v2H9v4H7V9H3V7h4z'%20fill='%23636363'%20fill-rule='evenodd'/%3e%3c/svg%3e",K="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%207h10v2H3z'%20fill='%23636363'%20fill-rule='evenodd'/%3e%3c/svg%3e",G="data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_1-文字_x2F_04页面_x2F_纸张方向-16px'%3e%3cg%20id='编组'%20transform='translate(1%201)'%3e%3cpath%20id='合并形状'%20class='st0'%20d='M14%206v7c0%20.6-.4%201-1%201H4c-.6%200-1-.4-1-1V6c0-.6.4-1%201-1h9c.6%200%201%20.4%201%201zm-1%200H4v7h9V6z'/%3e%3cpath%20id='路径'%20class='st0'%20d='M9%204H8V1H1v9h1v1H1c-.6%200-1-.4-1-1V1c0-.6.4-1%201-1h7c.6%200%201%20.4%201%201v3z'/%3e%3cpath%20id='矩形'%20class='st0'%20d='M11%207h1v5h-1z'/%3e%3cpath%20id='矩形-copy-2'%20class='st0'%20d='M2%202h5v1H2z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",W="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3crect%20stroke='%233D4757'%20x='2.5'%20y='1.5'%20width='11'%20height='13'%20rx='1'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M3%204h10v1H3zm0%207h10v1H3z'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M5%2014V2h1v12zm5%200V2h1v12z'/%3e%3c/g%3e%3c/svg%3e",k="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M3%203h1v4H3z'/%3e%3cpath%20d='M3%203h4v1H3zm10%2010h-1V9h1z'/%3e%3cpath%20d='M13%2013H9v-1h4z'/%3e%3c/g%3e%3c/svg%3e",y=["pageNo","wordCount","rowCol","pageMode","scale","paperDirection","paperMargin","fullscreen"],Z=["pageNo","wordCount","rowCol"];function M(a,n,s){const e=l("div",{class:r("statusbar__button"),title:n},l("i",{class:r("icon"),style:`background-image:url("${a}")`}));return e.addEventListener("click",s),e}class J{constructor(n,s=y){this.disposeList=[],this.updaterList=[],this.on=(o,i)=>{const{eventBus:d}=this.ui.editor;d.on(o,i),this.disposeList.push(()=>d.off(o,i))},this.ui=n;const e=l("div",{class:r("statusbar__left")}),t=l("div",{class:r("statusbar__right")});this.el=l("div",{class:r("statusbar")},e,t),this.el.setAttribute(c.EDITOR_COMPONENT,c.EditorComponent.FOOTER),this.el.addEventListener("mousedown",o=>o.preventDefault()),s.forEach(o=>{const i=this.createItem(o);i&&(i.classList.add(r("statusbar__item")),(Z.includes(o)?e:t).append(i))})}createItem(n){const{editor:s,locale:e}=this.ui;switch(n){case"pageNo":{const t=l("span",{},"1"),o=l("span",{},String(this.ui.getPageSize()));return this.on("intersectionPageNoChange",i=>{t.innerText=String(i+1)}),this.on("pageSizeChange",i=>{o.innerText=String(i)}),l("span",{},`${e.pageNo}:`,t,"/",o)}case"wordCount":{const t=l("span",{},"0"),o=F(async()=>{t.innerText=String(await s.command.getWordCount())},300);return this.on("contentChange",o),this.disposeList.push(o.cancel),o(),l("span",{},`${e.wordCount}:`,t)}case"rowCol":{const t=l("span",{},"1:1");return this.on("rangeStyleChange",()=>{const o=s.command.getRangeContext();o&&(t.innerText=`${o.startRowNo+1}:${o.startColNo+1}`)}),l("span",{},`${e.rowCol}:`,t)}case"pageMode":{const t=M(j,"",()=>{}),o=w([{label:e.pageModePaging,value:c.PageMode.PAGING},{label:e.pageModeContinuity,value:c.PageMode.CONTINUITY}],h=>{i.close(),s.command.executePageMode(h)}),i=new H(t,o,"top"),d=h=>{x(o,h),t.title=h===c.PageMode.CONTINUITY?e.pageModeContinuity:e.pageModePaging};return d(s.command.getOptions().pageMode),this.on("pageModeChange",d),i.el}case"scale":{const t=l("span",{class:r("statusbar__scale"),title:e.scaleRecovery}),o=i=>{t.innerText=`${Math.round(i*100)}%`};return o(s.command.getOptions().scale),this.on("pageScaleChange",o),t.addEventListener("click",()=>s.command.executePageScaleRecovery()),l("div",{class:r("statusbar__group")},M(K,e.scaleMinus,()=>s.command.executePageScaleMinus()),t,M(Y,e.scaleAdd,()=>s.command.executePageScaleAdd()))}case"paperDirection":return M(G,e.paperDirection,()=>{const{paperDirection:t}=s.command.getOptions();s.command.executePaperDirection(t===c.PaperDirection.HORIZONTAL?c.PaperDirection.VERTICAL:c.PaperDirection.HORIZONTAL)});case"paperMargin":return M(W,e.paperMargin,()=>this.openPaperMarginDialog());case"mode":{const t=[{label:e.modeEdit,value:c.EditorMode.EDIT},{label:e.modeClean,value:c.EditorMode.CLEAN},{label:e.modeReadonly,value:c.EditorMode.READONLY},{label:e.modeForm,value:c.EditorMode.FORM},{label:e.modePrint,value:c.EditorMode.PRINT},{label:e.modeDesign,value:c.EditorMode.DESIGN}],o=l("span",{class:r("statusbar__mode")}),i=w(t,g=>{d.close(),this.ui.setMode(g)}),d=new H(o,i,"top"),h=()=>{var u;const g=s.command.getOptions().mode;o.innerText=((u=t.find(m=>m.value===g))==null?void 0:u.label)||g,x(i,g)};return h(),this.updaterList.push(h),d.el}case"fullscreen":{const t=M(k,e.fullscreen,()=>{document.fullscreenElement?document.exitFullscreen():this.ui.root.requestFullscreen()}),o=()=>{const i=document.fullscreenElement?X:k;t.querySelector("i").style.backgroundImage=`url("${i}")`};return document.addEventListener("fullscreenchange",o),this.disposeList.push(()=>document.removeEventListener("fullscreenchange",o)),t}default:return console.warn(`[canvas-editor-ui] unknown statusbar item: ${n}`),null}}openPaperMarginDialog(){const{editor:n,locale:s}=this.ui,e=["top","right","bottom","left"],t=[s.marginTop,s.marginRight,s.marginBottom,s.marginLeft],o=n.command.getPaperMargin();new L({title:s.paperMargin,confirmText:s.confirm,cancelText:s.cancel,fields:e.map((i,d)=>({type:"number",name:i,label:t[d],required:!0,value:String(o[d])})),onConfirm:i=>{const[d,h,g,u]=e.map(z=>Number(i[z])),m=[d,h,g,u];if(m.some(z=>isNaN(z)||z<0))return!1;n.command.executeSetPaperMargin(m)}})}update(){this.updaterList.forEach(n=>n())}destroy(){this.disposeList.forEach(n=>n()),this.el.remove()}}const Q="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2v-1zm0-3h12v1H2v-1zm0-3h12v1H2V7zm0-6h12v1H2V1zm0%203h12v1H2V4z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",ee="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.131%206.9c2.035%200%202.569-.9%202.569-1.869%200-.968-.64-1.831-2.623-1.831H5.2v3.7h2.931zm.524%205.9c2.045%200%202.545-1.305%202.545-2.3%200-.985-.506-2.4-2.81-2.4H5.2v4.7h3.455zM4%202h4.71c2.367%200%203.19%201.583%203.19%203s-.325%201.852-1.1%202.5c1.2.5%201.569%201.379%201.6%203%20.03%201.606-.586%203.5-3.769%203.5H4V2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",te="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2v-1zm2-3h8v1H4v-1zM2%207h12v1H2V7zm0-6h12v1H2V1zm2%203h8v1H4V4z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",ne="data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_1-文字_x2F_01开始_x2F_任务列表-16px'%3e%3cpath%20id='合并形状'%20class='st0'%20d='M10.1%202H2v11h11V8.7l1-1V13c0%20.6-.4%201-1%201H2c-.6%200-1-.4-1-1V2c0-.6.4-1%201-1h9.1l-1%201z'/%3e%3cpath%20id='路径'%20class='st0'%20d='M7.7%208.5l5.7-5.8.9.8-6.1%205.9-.5.5-3.9-3.4.8-.7z'/%3e%3c/g%3e%3c/svg%3e",se="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.997%203.429L6.398%208h3.2L7.997%203.429zM8.497%202L12%2012h-1L9.949%209h-3.9L5%2012H4L7.496%202h1z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",ae="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M9.793%201.5H3a.5.5%200%2000-.5.5v12a.5.5%200%2000.5.5h9a.5.5%200%2000.5-.5V4.207L9.793%201.5z'%20stroke='%233D4757'/%3e%3cg%20fill='%233D4757'%3e%3cpath%20d='M7%207h1v5H7z'/%3e%3cpath%20d='M5%207h5v1H5z'/%3e%3c/g%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M9%202h1v3H9z'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M9%204h3v1H9z'/%3e%3c/g%3e%3c/svg%3e",oe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M7.5%2014.154a5.654%205.654%200%20100-11.308%205.654%205.654%200%20000%2011.308zm0%20.846a6.5%206.5%200%20110-13%206.5%206.5%200%20010%2013z'%20fill-rule='nonzero'/%3e%3cpath%20d='M8%208h4v1H7V4h1v4z'/%3e%3c/g%3e%3c/svg%3e",ie="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M8.213%2013H6.8l6.636-6.636-4.243-4.243-7.07%207.071L5.928%2013H4.515L1.06%209.546a.5.5%200%20010-.707L8.839%201.06a.5.5%200%2001.707%200l4.95%204.95a.5.5%200%20010%20.707L8.213%2013z'%20fill-rule='nonzero'/%3e%3cpath%20d='M4.536%206.364l4.95%204.95-.707.707-4.95-4.95zM4.521%2013h10.03v1H5.496z'/%3e%3c/g%3e%3c/svg%3e",ce="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M13.31%205h-1.92a2.203%202.203%200%2000-.39-.034c-.135%200-.27.012-.402.034H10v.18c-.578.256-1%20.714-1%201.214v1.928c0%20.196.117.43.3.658v1.23a3.543%203.543%200%2001-.3-.4V11H8V1h1v4.265C9%204.763%2010%204%2010.942%204c1.19%200%201.92.422%202.367%201zM2%206c-.03-.498-.175-2%202.5-2C7.11%204%207%205%207%206.902V11H5.984v-.993c.38.662-.115.993-1.484.993C2.708%2011%202%209.931%202%209c0-1.428.447-2%202.5-2h1.484c0-1%20.031-2-1.484-2-1.533%200-1.577.485-1.577%201H2zm2.5%202C3.601%208%203%207.768%203%209c0%201.31.438%201%201.5%201%20.617%200%201.484-.665%201.484-1.847V8H4.5z'/%3e%3cpath%20d='M13.085%206.316l-2.814%203a1%201%200%20101.458%201.368l2.815-3a1%201%200%2000-1.459-1.368z'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e",le="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='rotate(45%205.5%2013.328)'%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M7%206H6V3.515a2.5%202.5%200%2010-5%200V6H0V3.515a3.5%203.5%200%20117%200V6zm0%204v2.5a3.5%203.5%200%2001-7%200V10h1v2.5a2.5%202.5%200%20105%200V10h1z'%20fill-rule='nonzero'/%3e%3crect%20x='3.062'%20y='5.209'%20width='1'%20height='5.5'%20rx='.5'/%3e%3c/g%3e%3c/svg%3e",re="data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_插入图片-16px-'%3e%3cg%20id='Group-19'%20transform='translate(1%201)'%3e%3cpath%20id='Combined-Shape'%20class='st0'%20d='M1%200h12c.6%200%201%20.4%201%201v11c0%20.6-.4%201-1%201H1c-.6%200-1-.4-1-1V1c0-.6.4-1%201-1zm0%201v11h12V1H1z'/%3e%3ccircle%20id='椭圆形'%20class='st0'%20cx='10'%20cy='4'%20r='1'/%3e%3cpath%20id='Path'%20class='st0'%20d='M8.5%2011.2l-4-4.1L1%2010.7V9.2c1.7-1.6%202.7-2.5%203-2.8.4-.5.7-.4%201%200L8.5%2010%2011%207.3c.4-.5.6-.5%201-.1l2%202.8v1.5l-2.5-3.4-3%203.1z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",de="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.017%203L8.08%2013H9v1H6v-1h1.182L9%203H8V2h3v1h-.983z'%20fill='%233D4757'/%3e%3c/svg%3e",he="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20stroke='%233D4757'%20fill='%233D4757'%20d='M2%2010.5H14M2%2013.5H14'%20stroke-linecap='round'%20stroke-linejoin='miter'%3e%3c/path%3e%3cpath%20stroke='%233D4757'%20fill='%233D4757'%20d='M14%203.5L12%201.5M14%203.5L12%205.5M14%203.5L2%203.5M4%201.5L2%203.5M2%203.5L4%205.5'%20stroke-linecap='round'%20stroke-linejoin='miter'%3e%3c/path%3e%3c/svg%3e",ge="data:image/svg+xml,%3csvg%20height='16'%20viewBox='0%200%2016%2016'%20width='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2zm0-3h8v1H2zm0-3h12v1H2zm0-6h12v1H2zm0%203h8v1H2z'%20fill='%233d4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",ue="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20fill='%233D4757'%20d='M7%2012h7v1H7zm0-5h7v1H7zm0-5h7v1H7zM3%204V2H2V1h2v3h1v1H2V4h1z'/%3e%3cpath%20d='M2%206h3v1H2V6zm0%203h3v1H2V9z'%20fill='%234F4F4F'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M4.5%206L5%207l-2.5%203L2%209z'/%3e%3cpath%20d='M4%2014l-1-2H2v-1h3v1H4l1%202v1H2v-1h2z'%20fill='%233D4757'/%3e%3c/g%3e%3c/svg%3e",ve="data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:none;stroke:%233d4757}.st1{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_1-文字_x2F_02插入_x2F_分页-16px'%3e%3cpath%20id='矩形'%20class='st0'%20d='M5.5%202.5h7c.6%200%201%20.4%201%201v3c0%20.6-.4%201-1%201h-7c-.6%200-1-.4-1-1v-3c0-.6.4-1%201-1z'/%3e%3cpath%20id='三角形'%20class='st1'%20d='M4%208.5L1%206v5z'/%3e%3cpath%20id='合并形状'%20class='st0'%20d='M10.8%209.5H5c-.3%200-.5.2-.5.5v4c0%20.3.2.5.5.5h8c.3%200%20.5-.2.5-.5v-1.8l-2.7-2.7z'/%3e%3cpath%20id='矩形_1_'%20class='st1'%20d='M10%2010h1v3h-1z'/%3e%3cpath%20id='矩形-copy-2'%20class='st1'%20d='M10%2012h3v1h-3z'/%3e%3c/g%3e%3c/svg%3e",S="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M7.5%202v2.5H4a.5.5%200%2000-.5.5v2a.5.5%200%2000.5.5h9a.5.5%200%2000.5-.5V5a.5.5%200%2000-.5-.5H9.5V2a.5.5%200%2000-.5-.5H8a.5.5%200%2000-.5.5z'%20stroke='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M13%207h1v4h-1z'/%3e%3cpath%20d='M11%2013a2%202%200%20002-2V8.764A3%203%200%20118.764%2013H11z'%20fill='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M1%2013h10v1H1z'/%3e%3cpath%20d='M1%2013a2%202%200%20002-2V8.764A3%203%200%20011%2014v-1z'%20fill='%233D4757'/%3e%3cpath%20fill='%233D4757'%20d='M3%207h1v4H3z'/%3e%3c/g%3e%3c/svg%3e",pe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M10%201l4%204v9a1%201%200%2001-1%201H3a1%201%200%2001-1-1V2a1%201%200%20011-1h7zm-.414%201H3v12h10V5.414L9.586%202z'/%3e%3cpath%20d='M9%201h1v4h4v1H9z'/%3e%3cpath%20d='M8%207h1v4.293l1.646-1.647.708.708L8.5%2013.207l-2.854-2.853.708-.708L8%2011.293z'%20transform='translate(-.5)'/%3e%3c/g%3e%3c/svg%3e",me="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M12%204h-1V2H5v2H4V2a1%201%200%20011-1h6a1%201%200%20011%201v2zm0%205v4a1%201%200%2001-1%201H5a1%201%200%2001-1-1V9h1v4h6V9h1z'/%3e%3cpath%20d='M12%2012v-1h2V5H2v6h2v1H2a1%201%200%2001-1-1V5a1%201%200%20011-1h12a1%201%200%20011%201v6a1%201%200%2001-1%201h-2z'/%3e%3cpath%20d='M3%208h10v1H3zm8-2h2v1h-2z'/%3e%3c/g%3e%3c/svg%3e",we="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3%2014v-3a4%204%200%20014-4h3V6H7a5%205%200%2000-5%205v3h1zm7.016-11.282v7.543l4.29-3.73z'%20fill='%233D4757'/%3e%3c/svg%3e",fe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2013h12v1H2v-1zm4-3h8v1H6v-1zM2%207h12v1H2V7zm0-6h12v1H2V1zm4%203h8v1H6V4z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",xe="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2%2014h12v1H2v-1zm7-5h5v1H9V9zm0-3h5v1H9V6zM2%201h12v1H2V1zm2.5%203L7%207H2zm0%208L7%209H2z'%20fill='%233D4757'%20fill-rule='evenodd'/%3e%3c/svg%3e",be="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3ccircle%20stroke='%233D4757'%20cx='6'%20cy='6'%20r='4.5'/%3e%3cpath%20d='M10.061%2010.968L8.707%209.414l.707-.707%201.514%201.457.435-.404%202.632%202.462a1.154%201.154%200%2001.05%201.635%201.184%201.184%200%2001-1.655.064l-2.788-2.527.46-.426z'%20fill='%233D4757'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e",Me="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.9%202.8l2.01%202.506c.2.25.58.25.78%200L8.7%202.799l2.01%202.507c.2.25.58.25.78%200l2.4-2.993-.78-.626-2.01%202.507-2.01-2.507a.5.5%200%2000-.78%200L6.3%204.194%204.29%201.687a.5.5%200%2000-.78%200l-2.4%203%20.78.625L3.9%202.8zM1%208h13v1H1zm0%204h3v1H1zm5%200h3v1H6zm5%200h3v1h-3z'%20fill='%233D4757'/%3e%3c/svg%3e",ze="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M6.215%203.29H7.64L11.855%2014H10.52l-1.14-3H4.46l-1.14%203H2L6.215%203.29zM4.85%209.965h4.14L6.965%204.61h-.06L4.85%209.965z'/%3e%3cpath%20d='M12%204V2h1v2h2v1h-2v2h-1V5h-2V4h2z'%20fill-rule='nonzero'/%3e%3c/g%3e%3c/svg%3e",Le="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20fill-rule='nonzero'%20d='M11%204h4v1h-4z'/%3e%3cpath%20d='M6.215%203.29H7.64L11.855%2014H10.52l-1.14-3H4.46l-1.14%203H2L6.215%203.29zM4.85%209.965h4.14L6.965%204.61h-.06L4.85%209.965z'/%3e%3c/g%3e%3c/svg%3e",He="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M10.42%207.903H6.692a9.182%209.182%200%2001-.41-.172%205.54%205.54%200%2001-.814-.447%202.955%202.955%200%2001-.655-.595%202.728%202.728%200%2001-.44-.777%202.877%202.877%200%2001-.162-1.006c0-.472.094-.888.282-1.25.188-.36.453-.663.793-.907s.747-.43%201.22-.558A5.97%205.97%200%20018.063%202c.504%200%20.95.049%201.337.147.387.097.725.23%201.013.398.287.169.53.365.73.59a3.337%203.337%200%2001.772%201.486c.03.13.054.255.073.379h-1.276a2.393%202.393%200%2000-.22-.615%202.315%202.315%200%2000-.59-.724%202.467%202.467%200%2000-.834-.44%203.376%203.376%200%2000-1.005-.146%204.69%204.69%200%2000-.958.097%202.77%202.77%200%2000-.839.314%201.765%201.765%200%2000-.597.566c-.152.233-.229.518-.229.854%200%20.348.086.642.258.884.171.241.401.449.689.622.287.174.615.323.983.448s.749.247%201.142.367c.31.097.62.196.934.297a8.439%208.439%200%2001.973.38zm1.376%201c.175.217.315.466.418.746.105.285.158.612.158.98%200%20.554-.104%201.041-.312%201.462-.207.42-.496.772-.867%201.054-.37.282-.81.495-1.32.64A6.12%206.12%200%20018.205%2014c-.543%200-1.071-.09-1.586-.273a4.44%204.44%200%2001-1.374-.773%203.873%203.873%200%2001-.97-1.217%203.695%203.695%200%2001-.395-1.612h1.27c.028.407.122.78.282%201.12a2.835%202.835%200%20001.581%201.465c.363.138.76.207%201.192.207.387%200%20.758-.042%201.112-.126a2.85%202.85%200%2000.938-.399%202.01%202.01%200%2000.647-.708c.16-.29.241-.642.241-1.054%200-.337-.087-.623-.261-.86a2.333%202.333%200%2000-.69-.61%204.651%204.651%200%2000-.495-.257h2.099z'/%3e%3cpath%20d='M3%207h10v1H3z'/%3e%3c/g%3e%3c/svg%3e",ye="data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_subscript'%3e%3cpath%20id='_x32_'%20class='st0'%20d='M15%2013.3v.7h-3c0-.3.1-.5.3-.8.2-.2.5-.6%201-1%20.4-.3.6-.5.7-.7.1-.2.2-.3.2-.5s-.1-.3-.2-.4c-.1-.1-.2-.1-.4-.1s-.3%200-.4.1-.2.4-.2.7l-.9-.1c.1-.4.2-.7.5-.9.3-.2.6-.3%201-.3s.8.1%201%20.3c.3.2.4.5.4.8%200%20.2%200%20.4-.1.5-.1.2-.2.3-.3.5-.1.1-.3.3-.6.5s-.4.4-.5.4c-.1.1-.1.2-.2.3H15z'/%3e%3cpath%20id='合并形状'%20class='st0'%20d='M7.2%208.5l4%205.5H9.8L6.5%209.4%203.2%2014H1.8l4-5.5-4-5.5h1.4l3.3%204.6L9.8%203h1.3L7.2%208.5z'/%3e%3c/g%3e%3c/svg%3e",Te="data:image/svg+xml,%3csvg%20version='1.1'%20id='图层_1'%20xmlns='http://www.w3.org/2000/svg'%20x='0'%20y='0'%20viewBox='0%200%2016%2016'%20xml:space='preserve'%3e%3cstyle%3e.st0{fill:%233d4757}%3c/style%3e%3cg%20id='_x30_0-公共_x2F_02工具栏_x2F_superscript'%3e%3cpath%20id='_x32_'%20class='st0'%20d='M15%206.3V7h-3c0-.3.1-.5.3-.8.2-.2.5-.6%201-1%20.3-.2.6-.5.7-.6.1-.2.2-.3.2-.5s-.1-.3-.2-.4c-.1-.1-.2-.1-.4-.1s-.3%200-.4.1-.2.3-.2.6l-.9-.1c.1-.4.2-.7.5-.9s.6-.3%201-.3.8.1%201%20.3c.3.2.4.5.4.8%200%20.2%200%20.4-.1.5s-.2.4-.4.5c-.1.1-.3.3-.6.5s-.4.4-.4.5c-.1.1-.1.2-.2.3l1.7-.1z'/%3e%3cpath%20id='合并形状'%20class='st0'%20d='M7.4%208.5l4%205.5H10L6.7%209.4%203.4%2014H2l4-5.5L2%203h1.4l3.3%204.6L10%203h1.3L7.4%208.5z'/%3e%3c/g%3e%3c/svg%3e",_e="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='none'%20fill-rule='evenodd'%3e%3crect%20x='.5'%20y='.5'%20width='12'%20height='12'%20rx='1'%20transform='translate(1%201)'%20stroke='%233D4757'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M2%209h12v1H2zm0-4h12v1H2z'/%3e%3cpath%20fill='%233D4757'%20fill-rule='nonzero'%20d='M5%201h1v13H5zm4%200h1v13H9z'/%3e%3c/g%3e%3c/svg%3e",Ce="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%233D4757'%20fill-rule='evenodd'%3e%3cpath%20d='M14%201a1%201%200%20011%201v12a1%201%200%2001-1%201H2a1%201%200%2001-1-1V2a1%201%200%20011-1h12zm0%201H2v12h12V2z'%20fill-rule='nonzero'/%3e%3cpath%20fill-rule='nonzero'%20d='M4%2011h8v1H4zm0-3h4v1H4zm0-3h2v1H4z'/%3e%3cpath%20d='M9%205h1v4H9z'/%3e%3cpath%20d='M7%205h5v1H7z'/%3e%3c/g%3e%3c/svg%3e",De="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5%202v6a3%203%200%20106%200V2h1v6a4%204%200%2011-8%200V2h1zM4%2013h8v1H4z'%20fill='%233D4757'/%3e%3c/svg%3e",ke="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6%202.763v7.544l-4.29-3.73zM13%2014v-3a4%204%200%2000-4-4H6V6h3a5%205%200%20015%205v3h-1z'%20fill='%233D4757'/%3e%3c/svg%3e",I=["Microsoft YaHei","宋体","黑体","仿宋","楷体","华文宋体","华文黑体","华文仿宋","华文楷体","华文隶书","华文行楷","Arial","Segoe UI","Times New Roman"].map(a=>({label:a==="Microsoft YaHei"?"微软雅黑":a,value:a,style:`font-family:'${a}'`})),R=[["初号",56],["小初",48],["一号",34],["小一",32],["二号",29],["小二",24],["三号",21],["小三",20],["四号",18],["小四",16],["五号",14],["小五",12],["六号",10],["小六",8],["七号",7],["八号",6]].map(([a,n])=>({label:String(a),value:String(n)})),Se=["1","1.25","1.5","1.75","2","2.5","3"],V=[{label:"———— 实线",dashArray:[]},{label:"··········· 点线",dashArray:[1,1]},{label:"- - - - - 短虚线",dashArray:[3,1]},{label:"— — — 长虚线",dashArray:[4,4]},{label:"—·—·— 点划线",dashArray:[7,3,3,3]},{label:"—··—·· 双点划线",dashArray:[6,2,2,2,2,2]}];function v(a,n,s,e,t={}){return{key:a,title:n,icon:s,onClick:e,...t}}function A(a,n,s,e,t,o){return{key:a,title:n,render:i=>{const d=l("span",{class:r("select__label")}),h=l("div",{class:r("select"),title:n,style:`width:${e}px`},d),g=w(s,m=>{u.close(),t(i,m)}),u=new H(h,g);return u.el},update:(i,d)=>{const h=o(i),g=s.find(u=>u.value===h);d.querySelector(`.${r("select__label")}`).innerText=g?g.label:h||"",x(d,h)}}}function b(a,n,s,e,t={}){return{key:a,title:n,render:o=>{const i=l("div",{class:`${r("toolbar__button")} ${r("toolbar__button--arrow")}`,title:n},l("i",{class:r("icon"),style:`background-image:url("${s}")`})),d=l("div"),h=new H(i,d);return i.addEventListener("click",()=>{d.innerHTML="",d.append(e(o,()=>h.close()))},!0),h.el},...t}}function E(a,n,s,e,t){return{key:a,title:n,render:o=>{const i=l("input",{type:"color",class:r("color__input")});i.addEventListener("input",()=>e(o,i.value));const d=l("span",{class:r("color__bar")}),h=l("div",{class:`${r("toolbar__button")} ${r("color")}`,title:n},l("i",{class:r("icon"),style:`background-image:url("${s}")`}),d,i);return h.addEventListener("click",()=>i.click()),h},update:(o,i)=>{const d=t(o);i.querySelector(`.${r("color__bar")}`).style.background=d||"transparent"}}}function Ie(a){const n=l("input",{type:"file",accept:"image/*"});n.addEventListener("change",async()=>{var o;const s=(o=n.files)==null?void 0:o[0];if(!s)return;const e=await P(s),t=await U(e);a.editor.command.executeImage({value:e,width:t.width,height:t.height})}),n.click()}function Re({editor:a,locale:n}){new L({title:n.hyperlink,confirmText:n.confirm,cancelText:n.cancel,fields:[{type:"text",name:"text",label:n.hyperlinkText,required:!0,value:a.command.getRangeText()},{type:"text",name:"url",label:n.hyperlinkUrl,required:!0,placeholder:"https://"}],onConfirm:({text:s,url:e})=>{a.command.executeHyperlink({url:e,valueList:c.splitText(s).map(t=>({value:t}))})}})}const O=[c.ControlType.SELECT,c.ControlType.CHECKBOX,c.ControlType.RADIO];function Ve({editor:a,locale:n}){new L({title:n.control,confirmText:n.confirm,cancelText:n.cancel,fields:[{type:"select",name:"type",label:n.controlType,options:[{label:n.controlText,value:c.ControlType.TEXT},{label:n.controlSelect,value:c.ControlType.SELECT},{label:n.controlCheckbox,value:c.ControlType.CHECKBOX},{label:n.controlRadio,value:c.ControlType.RADIO},{label:n.controlDate,value:c.ControlType.DATE},{label:n.controlNumber,value:c.ControlType.NUMBER}]},{type:"text",name:"placeholder",label:n.controlPlaceholder},{type:"textarea",name:"valueSets",label:n.controlValueSets,placeholder:n.controlValueSetsPlaceholder,height:80},{type:"select",name:"dateFormat",label:n.controlDateFormat,options:[{label:"yyyy-MM-dd",value:"yyyy-MM-dd"},{label:"yyyy-MM-dd HH:mm:ss",value:"yyyy-MM-dd HH:mm:ss"}]}],onConfirm:s=>{const e=s.type,t=s.valueSets.split(`
|
|
5
|
+
`).map(i=>i.trim()).filter(Boolean).map(i=>({value:i,code:i}));if(O.includes(e)&&!t.length)return!1;const o={type:e,value:null,placeholder:s.placeholder||void 0};O.includes(e)&&(o.code=null,o.valueSets=t),e===c.ControlType.CHECKBOX&&(o.markType=c.CheckboxMarkType.CROSS),e===c.ControlType.DATE&&(o.dateFormat=s.dateFormat),a.command.executeInsertControl({type:c.ElementType.CONTROL,value:"",control:o})}})}function Ae({editor:a,locale:n}){new L({title:n.search,confirmText:n.confirm,cancelText:n.cancel,fields:[{type:"text",name:"keyword",label:n.searchKeyword,required:!0,value:a.command.getRangeText()},{type:"text",name:"replace",label:n.searchReplace,placeholder:n.searchReplacePlaceholder}],onConfirm:({keyword:s,replace:e})=>{a.command.executeSearch(s),e&&a.command.executeReplace(e)},onClose:()=>a.command.executeSearch(null)})}function Ee(a,n){const e=l("div",{class:r("table-picker__title")},a.locale.table),t=l("div",{class:r("table-picker__grid")}),o=[];for(let i=1;i<=10;i++)for(let d=1;d<=10;d++){const h=l("span",{"data-row":i,"data-col":d});o.push(h),t.append(h)}return t.addEventListener("mouseover",i=>{const d=i.target,h=Number(d.dataset.row),g=Number(d.dataset.col);!h||!g||(e.innerText=`${h} × ${g}`,o.forEach(u=>{u.classList.toggle(r("active"),Number(u.dataset.row)<=h&&Number(u.dataset.col)<=g)}))}),t.addEventListener("mousedown",i=>i.preventDefault()),t.addEventListener("click",i=>{const d=i.target,h=Number(d.dataset.row),g=Number(d.dataset.col);!h||!g||(n(),a.editor.command.executeInsertTable(h,g))}),l("div",{class:r("table-picker")},e,t)}const Oe=[["left",c.RowFlex.LEFT,ge],["center",c.RowFlex.CENTER,te],["right",c.RowFlex.RIGHT,fe],["alignment",c.RowFlex.ALIGNMENT,Q],["justify",c.RowFlex.JUSTIFY,he]];function Ne(a){const n=[v("undo",a.undo,ke,({editor:e})=>e.command.executeUndo(),{isDisabled:({style:e})=>!!e&&!e.undo}),v("redo",a.redo,we,({editor:e})=>e.command.executeRedo(),{isDisabled:({style:e})=>!!e&&!e.redo}),{key:"painter",title:a.painter,icon:S,isActive:({style:e})=>!!(e!=null&&e.painter),render:({editor:e})=>{const t=l("div",{class:r("toolbar__button"),title:a.painter},l("i",{class:r("icon"),style:`background-image:url("${S}")`}));let o=null;return t.addEventListener("click",()=>{o&&clearTimeout(o),o=setTimeout(()=>{o=null,e.command.executePainter({isDblclick:!1})},200)}),t.addEventListener("dblclick",()=>{o&&clearTimeout(o),o=null,e.command.executePainter({isDblclick:!0})}),t}},v("format",a.format,ie,({editor:e})=>e.command.executeFormat()),A("font",a.font,I,90,({editor:e},t)=>e.command.executeFont(t),({editor:e,style:t})=>(t==null?void 0:t.font)||e.command.getOptions().defaultFont),A("size",a.size,R,54,({editor:e},t)=>e.command.executeSize(Number(t)),({editor:e,style:t})=>String(t?t.size:e.command.getOptions().defaultSize)),v("sizeAdd",a.sizeAdd,ze,({editor:e})=>e.command.executeSizeAdd()),v("sizeMinus",a.sizeMinus,Le,({editor:e})=>e.command.executeSizeMinus()),v("bold",a.bold,ee,({editor:e})=>e.command.executeBold(),{isActive:({style:e})=>!!(e!=null&&e.bold)}),v("italic",a.italic,de,({editor:e})=>e.command.executeItalic(),{isActive:({style:e})=>!!(e!=null&&e.italic)}),v("underline",a.underline,De,({editor:e})=>e.command.executeUnderline(),{isActive:({style:e})=>!!(e!=null&&e.underline)}),v("strikeout",a.strikeout,He,({editor:e})=>e.command.executeStrikeout(),{isActive:({style:e})=>!!(e!=null&&e.strikeout)}),v("superscript",a.superscript,Te,({editor:e})=>e.command.executeSuperscript(),{isActive:({style:e})=>(e==null?void 0:e.type)===c.ElementType.SUPERSCRIPT}),v("subscript",a.subscript,ye,({editor:e})=>e.command.executeSubscript(),{isActive:({style:e})=>(e==null?void 0:e.type)===c.ElementType.SUBSCRIPT}),E("color",a.color,se,({editor:e},t)=>e.command.executeColor(t),({style:e})=>(e==null?void 0:e.color)||"#000000"),E("highlight",a.highlight,ce,({editor:e},t)=>e.command.executeHighlight(t),({style:e})=>(e==null?void 0:e.highlight)||null),b("title",a.title,Ce,({editor:e,style:t},o)=>{const i=[c.TitleLevel.FIRST,c.TitleLevel.SECOND,c.TitleLevel.THIRD,c.TitleLevel.FOURTH,c.TitleLevel.FIFTH,c.TitleLevel.SIXTH],d=[{label:a.text,value:""},...i.map((g,u)=>({label:`${a.title}${u+1}`,value:g,style:`font-size:${26-u*2}px;font-weight:bold`}))],h=w(d,g=>{o(),e.command.executeTitle(g||null)});return x(h,(t==null?void 0:t.level)||""),h}),...Oe.map(([e,t,o])=>v(e,a[e],o,({editor:i})=>i.command.executeRowFlex(t),{isActive:({style:i})=>((i==null?void 0:i.rowFlex)||c.RowFlex.LEFT)===t})),b("rowMargin",a.rowMargin,xe,({editor:e,style:t},o)=>{const i=w(Se.map(d=>({label:d,value:d})),d=>{o(),e.command.executeRowMargin(Number(d))});return x(i,t?String(t.rowMargin):null),i}),b("list",a.list,ue,({editor:e,style:t},o)=>{const i=[{label:a.listDecimal,value:`${c.ListType.OL}|${c.ListStyle.DECIMAL}`},{label:a.listCheckbox,value:`${c.ListType.UL}|${c.ListStyle.CHECKBOX}`},{label:a.listDisc,value:`${c.ListType.UL}|${c.ListStyle.DISC}`},{label:a.listCircle,value:`${c.ListType.UL}|${c.ListStyle.CIRCLE}`},{label:a.listSquare,value:`${c.ListType.UL}|${c.ListStyle.SQUARE}`}],d=w(i,h=>{o();const[g,u]=h.split("|");e.command.executeList(g,u)});return x(d,t!=null&&t.listType?`${t.listType}|${t.listStyle}`:null),d},{isActive:({style:e})=>!!(e!=null&&e.listType)}),b("table",a.table,_e,Ee),v("image",a.image,re,Ie),v("hyperlink",a.hyperlink,le,Re),b("separator",a.separator,Me,({editor:e},t)=>w(V.map((o,i)=>({label:o.label,value:String(i)})),o=>{t(),e.command.executeSeparator(V[Number(o)].dashArray)})),v("pageBreak",a.pageBreak,ve,({editor:e})=>e.command.executePageBreak()),v("control",a.control,ae,Ve),b("checkbox",a.checkbox,ne,({editor:e},t)=>{const o=w([{label:`☒ ${a.checkboxCross}`,value:c.CheckboxMarkType.CROSS},{label:`☑ ${a.checkboxCheck}`,value:c.CheckboxMarkType.CHECK}],i=>{t(),e.command.executeInsertElementList([{type:c.ElementType.CHECKBOX,value:"",checkbox:{value:!1,markType:i}}])});return x(o,c.CheckboxMarkType.CROSS),o}),b("date",a.date,oe,({editor:e},t)=>{const o=new Date,i=[{format:"yyyy-MM-dd",text:C(o,!1)},{format:"yyyy-MM-dd HH:mm:ss",text:C(o,!0)}];return w(i.map((d,h)=>({label:d.text,value:String(h)})),d=>{t();const{format:h,text:g}=i[Number(d)];e.command.executeInsertElementList([{type:c.ElementType.DATE,value:"",dateFormat:h,valueList:[{value:g}]}])})}),v("search",a.search,be,Ae,{keepEnabledInReadonly:!0}),v("print",a.print,me,({editor:e})=>e.command.executePrint(),{keepEnabledInReadonly:!0}),v("pdf",a.pdf,pe,async({editor:e})=>{const t=await e.command.getPdf();q(t,`document-${Date.now()}.pdf`)},{keepEnabledInReadonly:!0})],s={};return n.forEach(e=>{s[e.key]=e}),s}const T=["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"],Be=[c.EditorMode.READONLY,c.EditorMode.PRINT];class $e{constructor(n,s=T){this.style=null,this.renderedList=[],this.ui=n,this.el=l("div",{class:r("toolbar")}),this.el.setAttribute(c.EDITOR_COMPONENT,c.EditorComponent.MENU),this.el.addEventListener("mousedown",e=>{const t=e.target.tagName;t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&e.preventDefault()}),this.render(s),this.rangeStyleChange=e=>{this.style=e,this.update()},n.editor.eventBus.on("rangeStyleChange",this.rangeStyleChange),this.update()}getContext(){return{editor:this.ui.editor,ui:this.ui,locale:this.ui.locale,style:this.style}}render(n){const s=Ne(this.ui.locale),e=this.getContext();n.forEach(t=>{if(t==="|"){this.el.append(l("span",{class:r("toolbar__divider")}));return}const o=typeof t=="string"?s[t]:t;if(!o){console.warn(`[canvas-editor-ui] unknown toolbar item: ${t}`);return}const i=o.render?o.render(e):this.renderButton(o);i.classList.add(r("toolbar__item")),i.dataset.key=o.key,this.el.append(i),this.renderedList.push({item:o,el:i})})}renderButton(n){const s=l("div",{class:r("toolbar__button"),title:n.title},n.icon?l("i",{class:r("icon"),style:`background-image:url("${n.icon}")`}):null,n.text?l("span",{class:r("toolbar__text")},n.text):null);return s.addEventListener("click",()=>{var e;s.classList.contains(r("disabled"))||(e=n.onClick)==null||e.call(n,this.getContext(),s)}),s}update(){const n=this.getContext(),s=this.ui.editor.command.getOptions().mode,e=Be.includes(s);this.renderedList.forEach(({item:t,el:o})=>{var d,h,g;const i=e&&!t.keepEnabledInReadonly||!!((d=t.isDisabled)!=null&&d.call(t,n));o.classList.toggle(r("disabled"),i),o.classList.toggle(r("active"),!!((h=t.isActive)!=null&&h.call(t,n))),(g=t.update)==null||g.call(t,n,o)})}destroy(){this.ui.editor.eventBus.off("rangeStyleChange",this.rangeStyleChange),this.el.remove()}}let Fe=0;class N{constructor(n,s={}){this.toolbar=null,this.statusbar=null,this.locale={..._,...s.locale};const e=`${r("root")}-${++Fe}`,t=l("div",{class:r("editor")});this.main=l("div",{class:r("main")},t),this.root=l("div",{class:r("root"),id:e},this.main),n.append(this.root),this.editor=new B.default(t,s.data||{main:[]},{scrollContainerSelector:`#${e} .${r("main")}`,...s.options}),s.toolbar!==!1&&(this.toolbar=new $e(this,s.toolbar||T),this.root.prepend(this.toolbar.el)),s.statusbar!==!1&&(this.statusbar=new J(this,s.statusbar||y),this.root.append(this.statusbar.el)),this.mode=this.editor.command.getOptions().mode,this.renderChange=()=>{this.editor.command.getOptions().mode!==this.mode&&this.syncMode()},this.editor.eventBus.on("renderChange",this.renderChange)}syncMode(){var n,s;this.mode=this.editor.command.getOptions().mode,(n=this.toolbar)==null||n.update(),(s=this.statusbar)==null||s.update()}getPageSize(){return this.main.querySelectorAll("canvas[data-index]").length||1}setMode(n){this.editor.command.executeMode(n),this.syncMode()}destroy(){var n,s;this.editor.eventBus.off("renderChange",this.renderChange),(n=this.toolbar)==null||n.destroy(),(s=this.statusbar)==null||s.destroy(),this.editor.destroy(),this.root.remove()}}function Pe(a,n){const s=typeof a=="string"?document.querySelector(a):a;if(!s)throw new Error(`[canvas-editor-ui] container not found: ${a}`);return new N(s,n)}p.DEFAULT_STATUSBAR=y,p.DEFAULT_TOOLBAR=T,p.Dialog=L,p.EditorUI=N,p.FONT_LIST=I,p.SIZE_LIST=R,p.createEditorUI=Pe,p.defaultLocale=_,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
6
|
+
//# sourceMappingURL=canvas-editor-ui.umd.js.map
|