vue-editify 0.2.17 → 0.2.19
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/examples/App.vue +4 -12
 - package/lib/components/colors/colors.vue.d.ts +9 -0
 - package/lib/components/colors/props.d.ts +4 -0
 - package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
 - package/lib/core/function.d.ts +112 -64
 - package/lib/core/rule.d.ts +23 -17
 - package/lib/core/shortcut.d.ts +36 -0
 - package/lib/core/tool.d.ts +12 -16
 - package/lib/editify/editify.vue.d.ts +162 -15
 - package/lib/editify/props.d.ts +1 -5
 - package/lib/editify/toolbar/props.d.ts +1 -1
 - package/lib/editify/toolbar/toolbar.vue.d.ts +3 -3
 - package/lib/editify.es.js +13660 -12954
 - package/lib/editify.umd.js +2 -2
 - package/lib/feature/align.d.ts +0 -14
 - package/lib/feature/heading.d.ts +0 -14
 - package/lib/feature/lineHeight.d.ts +0 -14
 - package/lib/feature/orderList.d.ts +1 -3
 - package/lib/feature/task.d.ts +0 -14
 - package/lib/feature/unorderList.d.ts +1 -3
 - package/lib/index.d.ts +164 -17
 - package/package.json +2 -2
 - package/src/components/button/button.vue +3 -3
 - package/src/components/checkbox/checkbox.vue +1 -1
 - package/src/components/colors/colors.vue +4 -4
 - package/src/components/colors/props.ts +6 -1
 - package/src/components/insertAttachment/insertAttachment.vue +1 -1
 - package/src/components/insertImage/insertImage.vue +1 -1
 - package/src/components/insertLink/insertLink.vue +1 -1
 - package/src/components/insertVideo/insertVideo.vue +1 -1
 - package/src/components/layer/layer.vue +9 -3
 - package/src/components/tooltip/tooltip.vue +1 -1
 - package/src/components/updateLink/updateLink.vue +1 -1
 - package/src/core/function.ts +873 -491
 - package/src/core/rule.ts +86 -368
 - package/src/core/shortcut.ts +386 -0
 - package/src/core/tool.ts +111 -159
 - package/src/css/var.less +0 -10
 - package/src/editify/editify.less +85 -39
 - package/src/editify/editify.vue +204 -88
 - package/src/editify/menu/menu.vue +2 -3
 - package/src/editify/props.ts +1 -6
 - package/src/editify/toolbar/props.ts +2 -2
 - package/src/editify/toolbar/toolbar.vue +12 -12
 - package/src/feature/align.ts +2 -62
 - package/src/feature/attachment.ts +14 -27
 - package/src/feature/backColor.ts +2 -1
 - package/src/feature/bold.ts +1 -1
 - package/src/feature/code.ts +1 -1
 - package/src/feature/codeBlock.ts +3 -3
 - package/src/feature/fontFamily.ts +1 -1
 - package/src/feature/fontSize.ts +1 -1
 - package/src/feature/foreColor.ts +2 -1
 - package/src/feature/formatClear.ts +1 -1
 - package/src/feature/fullScreen.ts +1 -1
 - package/src/feature/heading.ts +5 -76
 - package/src/feature/image.ts +1 -1
 - package/src/feature/indent.ts +1 -1
 - package/src/feature/infoBlock.ts +6 -37
 - package/src/feature/italic.ts +1 -1
 - package/src/feature/lineHeight.ts +2 -78
 - package/src/feature/link.ts +1 -1
 - package/src/feature/mathformula.ts +4 -51
 - package/src/feature/orderList.ts +168 -37
 - package/src/feature/quote.ts +3 -3
 - package/src/feature/redo.ts +1 -1
 - package/src/feature/separator.ts +1 -1
 - package/src/feature/sourceView.ts +1 -1
 - package/src/feature/strikethrough.ts +1 -1
 - package/src/feature/sub.ts +1 -1
 - package/src/feature/super.ts +1 -1
 - package/src/feature/table.ts +3 -3
 - package/src/feature/task.ts +4 -58
 - package/src/feature/underline.ts +1 -1
 - package/src/feature/undo.ts +1 -1
 - package/src/feature/unorderList.ts +108 -37
 - package/src/feature/video.ts +1 -1
 - package/src/icon/iconfont.css +39 -3
 - package/src/icon/iconfont.ttf +0 -0
 - package/src/icon/iconfont.woff +0 -0
 - package/src/index.ts +13 -11
 - package/src/locale/en_US.ts +109 -110
 - package/src/locale/zh_CN.ts +11 -12
 - package/lib/feature/panel.d.ts +0 -18
 - package/src/feature/panel.ts +0 -107
 
| 
         @@ -1,16 +1,20 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            <template>
         
     | 
| 
       2 
2 
     | 
    
         
             
            	<Layer v-model="show" ref="layerRef" :node="node" :scroll-node="scrollNode" border placement="bottom-start" :useRange="type == 'text'" :z-index="zIndex" :inside-elements="insideElements">
         
     | 
| 
       3 
3 
     | 
    
         
             
            		<div class="editify-toolbar" :style="config.style">
         
     | 
| 
       4 
     | 
    
         
            -
            			<!-- 链接工具条 -->
         
     | 
| 
       5 
     | 
    
         
            -
            			<linkToolbar v-if="type == 'link'" :color="color" />
         
     | 
| 
       6 
4 
     | 
    
         
             
            			<!-- 图片工具条 -->
         
     | 
| 
       7 
     | 
    
         
            -
            			<ImageToolbar v- 
     | 
| 
      
 5 
     | 
    
         
            +
            			<ImageToolbar v-if="type == 'image'" @reset-toolbar="layerRef!.setPosition()" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
       8 
6 
     | 
    
         
             
            			<!-- 视频工具条 -->
         
     | 
| 
       9 
7 
     | 
    
         
             
            			<VideoToolbar v-else-if="type == 'video'" @reset-toolbar="layerRef!.setPosition()" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
       10 
     | 
    
         
            -
            			<!-- 表格工具条 -->
         
     | 
| 
       11 
     | 
    
         
            -
            			<TableToolbar v-else-if="type == 'table'" @reset-toolbar="layerRef!.setPosition()" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
       12 
8 
     | 
    
         
             
            			<!-- 代码块工具条 -->
         
     | 
| 
       13 
9 
     | 
    
         
             
            			<CodeBlockToolbar v-else-if="type == 'codeBlock'" ref="codeBlockToolbarRef" :language="config.codeBlock!.languages!" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
      
 10 
     | 
    
         
            +
            			<!-- 链接工具条 -->
         
     | 
| 
      
 11 
     | 
    
         
            +
            			<linkToolbar v-else-if="type == 'link'" :color="color" />
         
     | 
| 
      
 12 
     | 
    
         
            +
            			<!-- 表格工具条 -->
         
     | 
| 
      
 13 
     | 
    
         
            +
            			<TableToolbar v-else-if="type == 'table'" @reset-toolbar="layerRef!.setPosition()" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
      
 14 
     | 
    
         
            +
            			<!-- 有序列表工具条 -->
         
     | 
| 
      
 15 
     | 
    
         
            +
            			<OrderListToolbar v-else-if="type == 'orderList'" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
      
 16 
     | 
    
         
            +
            			<!-- 无序列表工具条 -->
         
     | 
| 
      
 17 
     | 
    
         
            +
            			<UnorderListToolbar v-else-if="type == 'unorderList'" :tooltip="config.tooltip!" :color="color" :z-index="zIndex + 1" />
         
     | 
| 
       14 
18 
     | 
    
         
             
            			<!-- 文本工具条 -->
         
     | 
| 
       15 
19 
     | 
    
         
             
            			<template v-else-if="type == 'text'">
         
     | 
| 
       16 
20 
     | 
    
         
             
            				<component v-for="(btn, index) in textToolbarBtns" :ref="el => (textToolbarBtnRefs[index] = (el as BtnComponentPublicInstance))" :is="btn" :color="color" :z-index="zIndex + 1" :config="textButtonConfig(btn.name)" :tooltip="config.tooltip!" />
         
     | 
| 
         @@ -28,11 +32,8 @@ import { ImageToolbar } from '@/feature/image' 
     | 
|
| 
       28 
32 
     | 
    
         
             
            import { VideoToolbar } from '@/feature/video'
         
     | 
| 
       29 
33 
     | 
    
         
             
            import { TableToolbar } from '@/feature/table'
         
     | 
| 
       30 
34 
     | 
    
         
             
            import { CodeBlockToolbar } from '@/feature/codeBlock'
         
     | 
| 
       31 
     | 
    
         
            -
            import {  
     | 
| 
       32 
     | 
    
         
            -
            import {  
     | 
| 
       33 
     | 
    
         
            -
            import { OrderListToolbarButton } from '@/feature/orderList'
         
     | 
| 
       34 
     | 
    
         
            -
            import { UnorderListToolbarButton } from '@/feature/unorderList'
         
     | 
| 
       35 
     | 
    
         
            -
            import { TaskToolbarButton } from '@/feature/task'
         
     | 
| 
      
 35 
     | 
    
         
            +
            import { OrderListToolbar } from '@/feature/orderList'
         
     | 
| 
      
 36 
     | 
    
         
            +
            import { UnorderListToolbar } from '@/feature/unorderList'
         
     | 
| 
       36 
37 
     | 
    
         
             
            import { BoldToolbarButton } from '@/feature/bold'
         
     | 
| 
       37 
38 
     | 
    
         
             
            import { ItalicToolbarButton } from '@/feature/italic'
         
     | 
| 
       38 
39 
     | 
    
         
             
            import { StrikethroughToolbarButton } from '@/feature/strikethrough'
         
     | 
| 
         @@ -42,7 +43,6 @@ import { SuperToolbarButton } from '@/feature/super' 
     | 
|
| 
       42 
43 
     | 
    
         
             
            import { SubToolbarButton } from '@/feature/sub'
         
     | 
| 
       43 
44 
     | 
    
         
             
            import { FontSizeToolbarButton } from '@/feature/fontSize'
         
     | 
| 
       44 
45 
     | 
    
         
             
            import { FontFamilyToolbarButton } from '@/feature/fontFamily'
         
     | 
| 
       45 
     | 
    
         
            -
            import { LineHeightToolbarButton } from '@/feature/lineHeight'
         
     | 
| 
       46 
46 
     | 
    
         
             
            import { ForeColorToolbarButton } from '@/feature/foreColor'
         
     | 
| 
       47 
47 
     | 
    
         
             
            import { BackColorToolbarButton } from '@/feature/backColor'
         
     | 
| 
       48 
48 
     | 
    
         
             
            import { FormatClearToolbarButton } from '@/feature/formatClear'
         
     | 
| 
         @@ -62,7 +62,7 @@ type BtnComponentPublicInstance = ComponentPublicInstance & { btnRef: InstanceTy 
     | 
|
| 
       62 
62 
     | 
    
         
             
            //代码块语言选择按钮实例
         
     | 
| 
       63 
63 
     | 
    
         
             
            const codeBlockToolbarRef = ref<BtnComponentPublicInstance | null>(null)
         
     | 
| 
       64 
64 
     | 
    
         
             
            //文本工具条按钮数组
         
     | 
| 
       65 
     | 
    
         
            -
            const textToolbarBtns = shallowRef([ 
     | 
| 
      
 65 
     | 
    
         
            +
            const textToolbarBtns = shallowRef([BoldToolbarButton, ItalicToolbarButton, StrikethroughToolbarButton, UnderlineToolbarButton, CodeToolbarButton, SuperToolbarButton, SubToolbarButton, FontSizeToolbarButton, FontFamilyToolbarButton, ForeColorToolbarButton, BackColorToolbarButton, FormatClearToolbarButton])
         
     | 
| 
       66 
66 
     | 
    
         
             
            //文本工具条按钮实例
         
     | 
| 
       67 
67 
     | 
    
         
             
            const textToolbarBtnRefs = ref<BtnComponentPublicInstance[]>([])
         
     | 
| 
       68 
68 
     | 
    
         | 
    
        package/src/feature/align.ts
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { defineComponent, h, inject, PropType, Ref 
     | 
| 
      
 1 
     | 
    
         
            +
            import { defineComponent, h, inject, PropType, Ref } from 'vue'
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { AlexElementsRangeType, AlexEditor } from 'alex-editor'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { MenuSelectButtonType } from '@/core/tool'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { hasPreInRange, setAlign } from '@/core/function'
         
     | 
| 
         @@ -10,66 +10,6 @@ import { Icon } from '@/components/icon' 
     | 
|
| 
       10 
10 
     | 
    
         
             
             */
         
     | 
| 
       11 
11 
     | 
    
         
             
            const FEATURE_NAME = 'align'
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            /**
         
     | 
| 
       14 
     | 
    
         
            -
             * 工具栏 - 对齐方式
         
     | 
| 
       15 
     | 
    
         
            -
             */
         
     | 
| 
       16 
     | 
    
         
            -
            export const AlignToolbarButton = defineComponent(
         
     | 
| 
       17 
     | 
    
         
            -
            	(props, { expose }) => {
         
     | 
| 
       18 
     | 
    
         
            -
            		const editor = inject<Ref<AlexEditor>>('editor')!
         
     | 
| 
       19 
     | 
    
         
            -
            		const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
         
     | 
| 
       20 
     | 
    
         
            -
            		const $editTrans = inject<(key: string) => any>('$editTrans')!
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            		const btnRef = ref<InstanceType<typeof Button> | null>(null)
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            		expose({
         
     | 
| 
       25 
     | 
    
         
            -
            			btnRef
         
     | 
| 
       26 
     | 
    
         
            -
            		})
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            		return () => {
         
     | 
| 
       29 
     | 
    
         
            -
            			return props.config.show
         
     | 
| 
       30 
     | 
    
         
            -
            				? h(
         
     | 
| 
       31 
     | 
    
         
            -
            						Button,
         
     | 
| 
       32 
     | 
    
         
            -
            						{
         
     | 
| 
       33 
     | 
    
         
            -
            							ref: btnRef,
         
     | 
| 
       34 
     | 
    
         
            -
            							name: FEATURE_NAME,
         
     | 
| 
       35 
     | 
    
         
            -
            							type: 'select',
         
     | 
| 
       36 
     | 
    
         
            -
            							title: $editTrans('align'),
         
     | 
| 
       37 
     | 
    
         
            -
            							tooltip: props.tooltip,
         
     | 
| 
       38 
     | 
    
         
            -
            							color: props.color,
         
     | 
| 
       39 
     | 
    
         
            -
            							zIndex: props.zIndex,
         
     | 
| 
       40 
     | 
    
         
            -
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       41 
     | 
    
         
            -
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       42 
     | 
    
         
            -
            							active: false,
         
     | 
| 
       43 
     | 
    
         
            -
            							disabled: props.config.disabled,
         
     | 
| 
       44 
     | 
    
         
            -
            							selectConfig: {
         
     | 
| 
       45 
     | 
    
         
            -
            								options: props.config.options,
         
     | 
| 
       46 
     | 
    
         
            -
            								width: props.config.width,
         
     | 
| 
       47 
     | 
    
         
            -
            								maxHeight: props.config.maxHeight
         
     | 
| 
       48 
     | 
    
         
            -
            							},
         
     | 
| 
       49 
     | 
    
         
            -
            							onOperate: (_name: string, val: 'left' | 'right' | 'center' | 'justify') => {
         
     | 
| 
       50 
     | 
    
         
            -
            								setAlign(editor.value, dataRangeCaches.value, val)
         
     | 
| 
       51 
     | 
    
         
            -
            								editor.value.domRender()
         
     | 
| 
       52 
     | 
    
         
            -
            								editor.value.rangeRender()
         
     | 
| 
       53 
     | 
    
         
            -
            							}
         
     | 
| 
       54 
     | 
    
         
            -
            						},
         
     | 
| 
       55 
     | 
    
         
            -
            						{
         
     | 
| 
       56 
     | 
    
         
            -
            							default: () => h(Icon, { value: 'align-left' })
         
     | 
| 
       57 
     | 
    
         
            -
            						}
         
     | 
| 
       58 
     | 
    
         
            -
            				  )
         
     | 
| 
       59 
     | 
    
         
            -
            				: null
         
     | 
| 
       60 
     | 
    
         
            -
            		}
         
     | 
| 
       61 
     | 
    
         
            -
            	},
         
     | 
| 
       62 
     | 
    
         
            -
            	{
         
     | 
| 
       63 
     | 
    
         
            -
            		name: `_${FEATURE_NAME}`,
         
     | 
| 
       64 
     | 
    
         
            -
            		props: {
         
     | 
| 
       65 
     | 
    
         
            -
            			color: String,
         
     | 
| 
       66 
     | 
    
         
            -
            			zIndex: Number,
         
     | 
| 
       67 
     | 
    
         
            -
            			config: Object as PropType<MenuSelectButtonType>,
         
     | 
| 
       68 
     | 
    
         
            -
            			tooltip: Boolean
         
     | 
| 
       69 
     | 
    
         
            -
            		}
         
     | 
| 
       70 
     | 
    
         
            -
            	}
         
     | 
| 
       71 
     | 
    
         
            -
            )
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
13 
     | 
    
         
             
            /**
         
     | 
| 
       74 
14 
     | 
    
         
             
             * 菜单栏 - 对齐方式
         
     | 
| 
       75 
15 
     | 
    
         
             
             */
         
     | 
| 
         @@ -90,7 +30,7 @@ export const AlignMenuButton = defineComponent( 
     | 
|
| 
       90 
30 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       91 
31 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       92 
32 
     | 
    
         
             
            							type: 'select',
         
     | 
| 
       93 
     | 
    
         
            -
            							title: $editTrans('align') 
     | 
| 
      
 33 
     | 
    
         
            +
            							title: `${$editTrans('align')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       94 
34 
     | 
    
         
             
            							selectConfig: {
         
     | 
| 
       95 
35 
     | 
    
         
             
            								options: props.config.options,
         
     | 
| 
       96 
36 
     | 
    
         
             
            								width: props.config.width,
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { defineComponent, h, inject, PropType, ref, Ref } from 'vue'
         
     | 
| 
       2 
     | 
    
         
            -
            import { AlexEditor,  
     | 
| 
       3 
     | 
    
         
            -
            import { MenuAttachmentButtonType 
     | 
| 
      
 2 
     | 
    
         
            +
            import { AlexEditor, AlexElementsRangeType } from 'alex-editor'
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { MenuAttachmentButtonType } from '@/core/tool'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { Button } from '@/components/button'
         
     | 
| 
       5 
     | 
    
         
            -
            import { hasMathformulaInRange, hasPreInRange } from '@/core/function'
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { hasMathformulaInRange, hasPreInRange, insertAttachment } from '@/core/function'
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { Icon } from '@/components/icon'
         
     | 
| 
       7 
7 
     | 
    
         
             
            import { InsertAttachment } from '@/components/insertAttachment'
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
         @@ -35,7 +35,7 @@ export const AttachmentMenuButton = defineComponent( 
     | 
|
| 
       35 
35 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       36 
36 
     | 
    
         
             
            							type: 'select',
         
     | 
| 
       37 
37 
     | 
    
         
             
            							hideScroll: true,
         
     | 
| 
       38 
     | 
    
         
            -
            							title: $editTrans('insertAttachment') 
     | 
| 
      
 38 
     | 
    
         
            +
            							title: `${$editTrans('insertAttachment')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       39 
39 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       40 
40 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       41 
41 
     | 
    
         
             
            							active: false,
         
     | 
| 
         @@ -62,30 +62,17 @@ export const AttachmentMenuButton = defineComponent( 
     | 
|
| 
       62 
62 
     | 
    
         
             
            										urls = urls.filter(url => {
         
     | 
| 
       63 
63 
     | 
    
         
             
            											return !!url
         
     | 
| 
       64 
64 
     | 
    
         
             
            										})
         
     | 
| 
       65 
     | 
    
         
            -
            										 
     | 
| 
       66 
     | 
    
         
            -
            										if (urls.length) {
         
     | 
| 
       67 
     | 
    
         
            -
            											 
     | 
| 
       68 
     | 
    
         
            -
            											urls.forEach(url => {
         
     | 
| 
       69 
     | 
    
         
            -
            												const marks: ObjectType = {
         
     | 
| 
       70 
     | 
    
         
            -
            													'data-editify-attachment': url,
         
     | 
| 
       71 
     | 
    
         
            -
            													'data-editify-attachment-name': name || $editTrans('attachmentDefaultName')
         
     | 
| 
       72 
     | 
    
         
            -
            												}
         
     | 
| 
       73 
     | 
    
         
            -
            												//创建元素
         
     | 
| 
       74 
     | 
    
         
            -
            												const attachmentElement = AlexElement.create({
         
     | 
| 
       75 
     | 
    
         
            -
            													type: 'closed',
         
     | 
| 
       76 
     | 
    
         
            -
            													parsedom: 'span',
         
     | 
| 
       77 
     | 
    
         
            -
            													marks
         
     | 
| 
       78 
     | 
    
         
            -
            												})
         
     | 
| 
       79 
     | 
    
         
            -
            												//插入编辑器
         
     | 
| 
       80 
     | 
    
         
            -
            												editor.value.insertElement(attachmentElement)
         
     | 
| 
       81 
     | 
    
         
            -
            												//移动光标到新插入的元素
         
     | 
| 
       82 
     | 
    
         
            -
            												editor.value.range!.anchor.moveToEnd(attachmentElement)
         
     | 
| 
       83 
     | 
    
         
            -
            												editor.value.range!.focus.moveToEnd(attachmentElement)
         
     | 
| 
       84 
     | 
    
         
            -
            											})
         
     | 
| 
       85 
     | 
    
         
            -
            											//渲染
         
     | 
| 
       86 
     | 
    
         
            -
            											editor.value.domRender()
         
     | 
| 
       87 
     | 
    
         
            -
            											editor.value.rangeRender()
         
     | 
| 
      
 65 
     | 
    
         
            +
            										//如果数组为0
         
     | 
| 
      
 66 
     | 
    
         
            +
            										if (urls.length == 0) {
         
     | 
| 
      
 67 
     | 
    
         
            +
            											return
         
     | 
| 
       88 
68 
     | 
    
         
             
            										}
         
     | 
| 
      
 69 
     | 
    
         
            +
            										//遍历地址数组
         
     | 
| 
      
 70 
     | 
    
         
            +
            										urls.forEach(url => {
         
     | 
| 
      
 71 
     | 
    
         
            +
            											insertAttachment(editor.value, url, name || $editTrans('attachmentDefaultName'))
         
     | 
| 
      
 72 
     | 
    
         
            +
            										})
         
     | 
| 
      
 73 
     | 
    
         
            +
            										//渲染
         
     | 
| 
      
 74 
     | 
    
         
            +
            										editor.value.domRender()
         
     | 
| 
      
 75 
     | 
    
         
            +
            										editor.value.rangeRender()
         
     | 
| 
       89 
76 
     | 
    
         
             
            										//关闭浮层
         
     | 
| 
       90 
77 
     | 
    
         
             
            										btnRef.value!.show = false
         
     | 
| 
       91 
78 
     | 
    
         
             
            									}
         
     | 
    
        package/src/feature/backColor.ts
    CHANGED
    
    | 
         @@ -127,7 +127,7 @@ export const BackColorMenuButton = defineComponent( 
     | 
|
| 
       127 
127 
     | 
    
         
             
            								options: props.config.options
         
     | 
| 
       128 
128 
     | 
    
         
             
            							},
         
     | 
| 
       129 
129 
     | 
    
         
             
            							hideScroll: true,
         
     | 
| 
       130 
     | 
    
         
            -
            							title: $editTrans('backColor') 
     | 
| 
      
 130 
     | 
    
         
            +
            							title: `${$editTrans('backColor')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       131 
131 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       132 
132 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       133 
133 
     | 
    
         
             
            							active: false,
         
     | 
| 
         @@ -139,6 +139,7 @@ export const BackColorMenuButton = defineComponent( 
     | 
|
| 
       139 
139 
     | 
    
         
             
            								return h(Colors, {
         
     | 
| 
       140 
140 
     | 
    
         
             
            									tooltip: props.tooltip,
         
     | 
| 
       141 
141 
     | 
    
         
             
            									color: props.color,
         
     | 
| 
      
 142 
     | 
    
         
            +
            									zIndex: props.zIndex + 2,
         
     | 
| 
       142 
143 
     | 
    
         
             
            									value: selectVal.value,
         
     | 
| 
       143 
144 
     | 
    
         
             
            									data: options,
         
     | 
| 
       144 
145 
     | 
    
         
             
            									onChange: (val: string) => {
         
     | 
    
        package/src/feature/bold.ts
    CHANGED
    
    | 
         @@ -97,7 +97,7 @@ export const BoldMenuButton = defineComponent( 
     | 
|
| 
       97 
97 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       98 
98 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       99 
99 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       100 
     | 
    
         
            -
            							title: $editTrans('bold') 
     | 
| 
      
 100 
     | 
    
         
            +
            							title: `${$editTrans('bold')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       101 
101 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       102 
102 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       103 
103 
     | 
    
         
             
            							active: active.value,
         
     | 
    
        package/src/feature/code.ts
    CHANGED
    
    | 
         @@ -97,7 +97,7 @@ export const CodeMenuButton = defineComponent( 
     | 
|
| 
       97 
97 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       98 
98 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       99 
99 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       100 
     | 
    
         
            -
            							title: $editTrans('code') 
     | 
| 
      
 100 
     | 
    
         
            +
            							title: `${$editTrans('code')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       101 
101 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       102 
102 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       103 
103 
     | 
    
         
             
            							active: active.value,
         
     | 
    
        package/src/feature/codeBlock.ts
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ import { computed, defineComponent, h, inject, PropType, ref, Ref } from 'vue' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { Button } from '@/components/button'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { Icon } from '@/components/icon'
         
     | 
| 
       5 
     | 
    
         
            -
            import { getMatchElementByRange, hasAttachmentInRange, hasImageInRange, hasMathformulaInRange,  
     | 
| 
      
 5 
     | 
    
         
            +
            import { getMatchElementByRange, hasAttachmentInRange, hasImageInRange, hasMathformulaInRange, hasTableInRange, hasVideoInRange, insertCodeBlock } from '@/core/function'
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { MenuButtonType, MenuDisplayButtonType } from '@/core/tool'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -170,11 +170,11 @@ export const CodeBlockMenuButton = defineComponent( 
     | 
|
| 
       170 
170 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       171 
171 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       172 
172 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       173 
     | 
    
         
            -
            							title: $editTrans('inserCodeBlock') 
     | 
| 
      
 173 
     | 
    
         
            +
            							title: `${$editTrans('inserCodeBlock')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       174 
174 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       175 
175 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       176 
176 
     | 
    
         
             
            							active: !!getMatchElementByRange(editor.value, dataRangeCaches.value, { parsedom: 'pre' }),
         
     | 
| 
       177 
     | 
    
         
            -
            							disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasImageInRange(editor.value, dataRangeCaches.value) || hasVideoInRange(editor.value, dataRangeCaches.value) || hasAttachmentInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) ||  
     | 
| 
      
 177 
     | 
    
         
            +
            							disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasImageInRange(editor.value, dataRangeCaches.value) || hasVideoInRange(editor.value, dataRangeCaches.value) || hasAttachmentInRange(editor.value, dataRangeCaches.value) || hasMathformulaInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
| 
       178 
178 
     | 
    
         
             
            							onOperate: () => {
         
     | 
| 
       179 
179 
     | 
    
         
             
            								insertCodeBlock(editor.value, dataRangeCaches.value)
         
     | 
| 
       180 
180 
     | 
    
         
             
            								editor.value.domRender()
         
     | 
| 
         @@ -109,7 +109,7 @@ export const FontFamilyMenuButton = defineComponent( 
     | 
|
| 
       109 
109 
     | 
    
         
             
            							width: props.config.width,
         
     | 
| 
       110 
110 
     | 
    
         
             
            							maxHeight: props.config.maxHeight
         
     | 
| 
       111 
111 
     | 
    
         
             
            						},
         
     | 
| 
       112 
     | 
    
         
            -
            						title: $editTrans('fontFamily') 
     | 
| 
      
 112 
     | 
    
         
            +
            						title: `${$editTrans('fontFamily')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       113 
113 
     | 
    
         
             
            						leftBorder: props.config.leftBorder,
         
     | 
| 
       114 
114 
     | 
    
         
             
            						rightBorder: props.config.rightBorder,
         
     | 
| 
       115 
115 
     | 
    
         
             
            						active: false,
         
     | 
    
        package/src/feature/fontSize.ts
    CHANGED
    
    | 
         @@ -111,7 +111,7 @@ export const FontSizeMenuButton = defineComponent( 
     | 
|
| 
       111 
111 
     | 
    
         
             
            							width: props.config.width,
         
     | 
| 
       112 
112 
     | 
    
         
             
            							maxHeight: props.config.maxHeight
         
     | 
| 
       113 
113 
     | 
    
         
             
            						},
         
     | 
| 
       114 
     | 
    
         
            -
            						title: $editTrans('fontSize') 
     | 
| 
      
 114 
     | 
    
         
            +
            						title: `${$editTrans('fontSize')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       115 
115 
     | 
    
         
             
            						leftBorder: props.config.leftBorder,
         
     | 
| 
       116 
116 
     | 
    
         
             
            						rightBorder: props.config.rightBorder,
         
     | 
| 
       117 
117 
     | 
    
         
             
            						disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
    
        package/src/feature/foreColor.ts
    CHANGED
    
    | 
         @@ -129,7 +129,7 @@ export const ForeColorMenuButton = defineComponent( 
     | 
|
| 
       129 
129 
     | 
    
         
             
            								options: props.config.options
         
     | 
| 
       130 
130 
     | 
    
         
             
            							},
         
     | 
| 
       131 
131 
     | 
    
         
             
            							hideScroll: true,
         
     | 
| 
       132 
     | 
    
         
            -
            							title: $editTrans('foreColor') 
     | 
| 
      
 132 
     | 
    
         
            +
            							title: `${$editTrans('foreColor')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       133 
133 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       134 
134 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       135 
135 
     | 
    
         
             
            							disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
| 
         @@ -141,6 +141,7 @@ export const ForeColorMenuButton = defineComponent( 
     | 
|
| 
       141 
141 
     | 
    
         
             
            								return h(Colors, {
         
     | 
| 
       142 
142 
     | 
    
         
             
            									tooltip: props.tooltip,
         
     | 
| 
       143 
143 
     | 
    
         
             
            									color: props.color,
         
     | 
| 
      
 144 
     | 
    
         
            +
            									zIndex: props.zIndex + 2,
         
     | 
| 
       144 
145 
     | 
    
         
             
            									value: selectVal.value,
         
     | 
| 
       145 
146 
     | 
    
         
             
            									data: options,
         
     | 
| 
       146 
147 
     | 
    
         
             
            									onChange: (val: string) => {
         
     | 
| 
         @@ -84,7 +84,7 @@ export const FormatClearMenuButton = defineComponent( 
     | 
|
| 
       84 
84 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       85 
85 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       86 
86 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       87 
     | 
    
         
            -
            							title: $editTrans('formatClear') 
     | 
| 
      
 87 
     | 
    
         
            +
            							title: `${$editTrans('formatClear')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       88 
88 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       89 
89 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       90 
90 
     | 
    
         
             
            							active: false,
         
     | 
| 
         @@ -27,7 +27,7 @@ export const FullScreenMenuButton = defineComponent( 
     | 
|
| 
       27 
27 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       28 
28 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       29 
29 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       30 
     | 
    
         
            -
            							title: $editTrans('fullScreen') 
     | 
| 
      
 30 
     | 
    
         
            +
            							title: `${$editTrans('fullScreen')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       31 
31 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       32 
32 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       33 
33 
     | 
    
         
             
            							active: isFullScreen.value,
         
     | 
    
        package/src/feature/heading.ts
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { computed, defineComponent, h, inject, PropType, Ref 
     | 
| 
      
 1 
     | 
    
         
            +
            import { computed, defineComponent, h, inject, PropType, Ref } from 'vue'
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { AlexElementsRangeType, AlexEditor } from 'alex-editor'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { common as DapCommon } from 'dap-util'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { MenuDisplayButtonType } from '@/core/tool'
         
     | 
| 
       5 
     | 
    
         
            -
            import {  
     | 
| 
      
 5 
     | 
    
         
            +
            import { hasPreInRange, hasTableInRange, setHeading } from '@/core/function'
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { Button, ButtonOptionsItemType } from '@/components/button'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -10,77 +10,6 @@ import { Button, ButtonOptionsItemType } from '@/components/button' 
     | 
|
| 
       10 
10 
     | 
    
         
             
             */
         
     | 
| 
       11 
11 
     | 
    
         
             
            const FEATURE_NAME = 'heading'
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            /**
         
     | 
| 
       14 
     | 
    
         
            -
             * 工具栏 - 标题
         
     | 
| 
       15 
     | 
    
         
            -
             */
         
     | 
| 
       16 
     | 
    
         
            -
            export const HeadingToolbarButton = defineComponent(
         
     | 
| 
       17 
     | 
    
         
            -
            	(props, { expose }) => {
         
     | 
| 
       18 
     | 
    
         
            -
            		const editor = inject<Ref<AlexEditor>>('editor')!
         
     | 
| 
       19 
     | 
    
         
            -
            		const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
         
     | 
| 
       20 
     | 
    
         
            -
            		const $editTrans = inject<(key: string) => any>('$editTrans')!
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            		const btnRef = ref<InstanceType<typeof Button> | null>(null)
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            		const selectVal = computed<string>(() => {
         
     | 
| 
       25 
     | 
    
         
            -
            			//显示已设置标题
         
     | 
| 
       26 
     | 
    
         
            -
            			const findHeadingItem = props.config.options!.find((item: string | number | ButtonOptionsItemType) => {
         
     | 
| 
       27 
     | 
    
         
            -
            				let val: string | number | ButtonOptionsItemType = item
         
     | 
| 
       28 
     | 
    
         
            -
            				if (DapCommon.isObject(item)) {
         
     | 
| 
       29 
     | 
    
         
            -
            					val = (item as ButtonOptionsItemType).value!
         
     | 
| 
       30 
     | 
    
         
            -
            				}
         
     | 
| 
       31 
     | 
    
         
            -
            				return dataRangeCaches.value.list.every(el => {
         
     | 
| 
       32 
     | 
    
         
            -
            					if (el.element.isBlock()) {
         
     | 
| 
       33 
     | 
    
         
            -
            						return el.element.parsedom == val
         
     | 
| 
       34 
     | 
    
         
            -
            					}
         
     | 
| 
       35 
     | 
    
         
            -
            					return el.element.getBlock().parsedom == val
         
     | 
| 
       36 
     | 
    
         
            -
            				})
         
     | 
| 
       37 
     | 
    
         
            -
            			})
         
     | 
| 
       38 
     | 
    
         
            -
            			return findHeadingItem ? (DapCommon.isObject(findHeadingItem) ? ((findHeadingItem as ButtonOptionsItemType).value as string) : (findHeadingItem as string)) : (props.config.defaultValue as string)
         
     | 
| 
       39 
     | 
    
         
            -
            		})
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
            		expose({
         
     | 
| 
       42 
     | 
    
         
            -
            			btnRef
         
     | 
| 
       43 
     | 
    
         
            -
            		})
         
     | 
| 
       44 
     | 
    
         
            -
            		return () => {
         
     | 
| 
       45 
     | 
    
         
            -
            			return props.config.show
         
     | 
| 
       46 
     | 
    
         
            -
            				? h(Button, {
         
     | 
| 
       47 
     | 
    
         
            -
            						ref: btnRef,
         
     | 
| 
       48 
     | 
    
         
            -
            						name: FEATURE_NAME,
         
     | 
| 
       49 
     | 
    
         
            -
            						type: 'display',
         
     | 
| 
       50 
     | 
    
         
            -
            						title: $editTrans('heading'),
         
     | 
| 
       51 
     | 
    
         
            -
            						tooltip: props.tooltip,
         
     | 
| 
       52 
     | 
    
         
            -
            						color: props.color,
         
     | 
| 
       53 
     | 
    
         
            -
            						zIndex: props.zIndex,
         
     | 
| 
       54 
     | 
    
         
            -
            						leftBorder: props.config.leftBorder,
         
     | 
| 
       55 
     | 
    
         
            -
            						rightBorder: props.config.rightBorder,
         
     | 
| 
       56 
     | 
    
         
            -
            						active: false,
         
     | 
| 
       57 
     | 
    
         
            -
            						disabled: props.config.disabled,
         
     | 
| 
       58 
     | 
    
         
            -
            						displayConfig: {
         
     | 
| 
       59 
     | 
    
         
            -
            							options: props.config.options,
         
     | 
| 
       60 
     | 
    
         
            -
            							value: selectVal.value,
         
     | 
| 
       61 
     | 
    
         
            -
            							width: props.config.width,
         
     | 
| 
       62 
     | 
    
         
            -
            							maxHeight: props.config.maxHeight
         
     | 
| 
       63 
     | 
    
         
            -
            						},
         
     | 
| 
       64 
     | 
    
         
            -
            						onOperate: (_name: string, val: string) => {
         
     | 
| 
       65 
     | 
    
         
            -
            							setHeading(editor.value, dataRangeCaches.value, $editTrans, val)
         
     | 
| 
       66 
     | 
    
         
            -
            							editor.value.domRender()
         
     | 
| 
       67 
     | 
    
         
            -
            							editor.value.rangeRender()
         
     | 
| 
       68 
     | 
    
         
            -
            						}
         
     | 
| 
       69 
     | 
    
         
            -
            				  })
         
     | 
| 
       70 
     | 
    
         
            -
            				: null
         
     | 
| 
       71 
     | 
    
         
            -
            		}
         
     | 
| 
       72 
     | 
    
         
            -
            	},
         
     | 
| 
       73 
     | 
    
         
            -
            	{
         
     | 
| 
       74 
     | 
    
         
            -
            		name: `_${FEATURE_NAME}`,
         
     | 
| 
       75 
     | 
    
         
            -
            		props: {
         
     | 
| 
       76 
     | 
    
         
            -
            			color: String,
         
     | 
| 
       77 
     | 
    
         
            -
            			zIndex: Number,
         
     | 
| 
       78 
     | 
    
         
            -
            			config: Object as PropType<MenuDisplayButtonType>,
         
     | 
| 
       79 
     | 
    
         
            -
            			tooltip: Boolean
         
     | 
| 
       80 
     | 
    
         
            -
            		}
         
     | 
| 
       81 
     | 
    
         
            -
            	}
         
     | 
| 
       82 
     | 
    
         
            -
            )
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
13 
     | 
    
         
             
            /**
         
     | 
| 
       85 
14 
     | 
    
         
             
             * 菜单栏 - 标题
         
     | 
| 
       86 
15 
     | 
    
         
             
             */
         
     | 
| 
         @@ -125,13 +54,13 @@ export const HeadingMenuButton = defineComponent( 
     | 
|
| 
       125 
54 
     | 
    
         
             
            							width: props.config.width,
         
     | 
| 
       126 
55 
     | 
    
         
             
            							maxHeight: props.config.maxHeight
         
     | 
| 
       127 
56 
     | 
    
         
             
            						},
         
     | 
| 
       128 
     | 
    
         
            -
            						title: $editTrans('heading') 
     | 
| 
      
 57 
     | 
    
         
            +
            						title: `${$editTrans('heading')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       129 
58 
     | 
    
         
             
            						leftBorder: props.config.leftBorder,
         
     | 
| 
       130 
59 
     | 
    
         
             
            						rightBorder: props.config.rightBorder,
         
     | 
| 
       131 
60 
     | 
    
         
             
            						active: false,
         
     | 
| 
       132 
     | 
    
         
            -
            						disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) ||  
     | 
| 
      
 61 
     | 
    
         
            +
            						disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || hasTableInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
| 
       133 
62 
     | 
    
         
             
            						onOperate: (_name: string, val: string) => {
         
     | 
| 
       134 
     | 
    
         
            -
            							setHeading(editor.value, dataRangeCaches.value,  
     | 
| 
      
 63 
     | 
    
         
            +
            							setHeading(editor.value, dataRangeCaches.value, val)
         
     | 
| 
       135 
64 
     | 
    
         
             
            							editor.value.domRender()
         
     | 
| 
       136 
65 
     | 
    
         
             
            							editor.value.rangeRender()
         
     | 
| 
       137 
66 
     | 
    
         
             
            						}
         
     | 
    
        package/src/feature/image.ts
    CHANGED
    
    | 
         @@ -163,7 +163,7 @@ export const ImageMenuButton = defineComponent( 
     | 
|
| 
       163 
163 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       164 
164 
     | 
    
         
             
            							type: 'select',
         
     | 
| 
       165 
165 
     | 
    
         
             
            							hideScroll: true,
         
     | 
| 
       166 
     | 
    
         
            -
            							title: $editTrans('insertImage') 
     | 
| 
      
 166 
     | 
    
         
            +
            							title: `${$editTrans('insertImage')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       167 
167 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       168 
168 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       169 
169 
     | 
    
         
             
            							active: false,
         
     | 
    
        package/src/feature/indent.ts
    CHANGED
    
    | 
         @@ -30,7 +30,7 @@ export const IndentMenuButton = defineComponent( 
     | 
|
| 
       30 
30 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       31 
31 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       32 
32 
     | 
    
         
             
            							type: 'select',
         
     | 
| 
       33 
     | 
    
         
            -
            							title: $editTrans('indent') 
     | 
| 
      
 33 
     | 
    
         
            +
            							title: `${$editTrans('indent')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       34 
34 
     | 
    
         
             
            							selectConfig: {
         
     | 
| 
       35 
35 
     | 
    
         
             
            								options: props.config.options,
         
     | 
| 
       36 
36 
     | 
    
         
             
            								width: props.config.width,
         
     | 
    
        package/src/feature/infoBlock.ts
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { defineComponent, h, inject, PropType, Ref } from 'vue'
         
     | 
| 
       2 
     | 
    
         
            -
            import { AlexEditor,  
     | 
| 
      
 2 
     | 
    
         
            +
            import { AlexEditor, AlexElementsRangeType } from 'alex-editor'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { Button } from '@/components/button'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { MenuButtonType } from '@/core/tool'
         
     | 
| 
       5 
5 
     | 
    
         
             
            import { Icon } from '@/components/icon'
         
     | 
| 
       6 
     | 
    
         
            -
            import {  
     | 
| 
      
 6 
     | 
    
         
            +
            import { hasPreInRange, hasTableInRange, insertInfoBlock, rangeIsInInfoBlock } from '@/core/function'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            /**
         
     | 
| 
       9 
9 
     | 
    
         
             
             * feature名称
         
     | 
| 
         @@ -29,45 +29,14 @@ export const InfoBlockMenuButton = defineComponent( 
     | 
|
| 
       29 
29 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       30 
30 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       31 
31 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       32 
     | 
    
         
            -
            							title: $editTrans('insertInfoBlock') 
     | 
| 
      
 32 
     | 
    
         
            +
            							title: `${$editTrans('insertInfoBlock')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       33 
33 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       34 
34 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       35 
35 
     | 
    
         
             
            							active: rangeIsInInfoBlock(editor.value, dataRangeCaches.value),
         
     | 
| 
       36 
     | 
    
         
            -
            							disabled: props.disabled || isSourceView.value ||  
     | 
| 
      
 36 
     | 
    
         
            +
            							disabled: props.disabled || isSourceView.value || hasTableInRange(editor.value, dataRangeCaches.value) || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
| 
       37 
37 
     | 
    
         
             
            							onOperate: () => {
         
     | 
| 
       38 
     | 
    
         
            -
            								 
     | 
| 
       39 
     | 
    
         
            -
            								 
     | 
| 
       40 
     | 
    
         
            -
            								//起点和终点在一起
         
     | 
| 
       41 
     | 
    
         
            -
            								if (editor.value.range!.anchor.isEqual(editor.value.range!.focus)) {
         
     | 
| 
       42 
     | 
    
         
            -
            									const block = editor.value.range!.anchor.element.getBlock()
         
     | 
| 
       43 
     | 
    
         
            -
            									elementToParagraph(block)
         
     | 
| 
       44 
     | 
    
         
            -
            									if (!flag) {
         
     | 
| 
       45 
     | 
    
         
            -
            										block.parsedom = 'div'
         
     | 
| 
       46 
     | 
    
         
            -
            										block.marks = {
         
     | 
| 
       47 
     | 
    
         
            -
            											'data-editify-info': 'true'
         
     | 
| 
       48 
     | 
    
         
            -
            										}
         
     | 
| 
       49 
     | 
    
         
            -
            									}
         
     | 
| 
       50 
     | 
    
         
            -
            								}
         
     | 
| 
       51 
     | 
    
         
            -
            								//起点和终点不在一起
         
     | 
| 
       52 
     | 
    
         
            -
            								else {
         
     | 
| 
       53 
     | 
    
         
            -
            									let blocks: AlexElement[] = []
         
     | 
| 
       54 
     | 
    
         
            -
            									dataRangeCaches.value.list.forEach(item => {
         
     | 
| 
       55 
     | 
    
         
            -
            										const block = item.element.getBlock()
         
     | 
| 
       56 
     | 
    
         
            -
            										const exist = blocks.some(el => block.isEqual(el))
         
     | 
| 
       57 
     | 
    
         
            -
            										if (!exist) {
         
     | 
| 
       58 
     | 
    
         
            -
            											blocks.push(block)
         
     | 
| 
       59 
     | 
    
         
            -
            										}
         
     | 
| 
       60 
     | 
    
         
            -
            									})
         
     | 
| 
       61 
     | 
    
         
            -
            									blocks.forEach(block => {
         
     | 
| 
       62 
     | 
    
         
            -
            										elementToParagraph(block)
         
     | 
| 
       63 
     | 
    
         
            -
            										if (!flag) {
         
     | 
| 
       64 
     | 
    
         
            -
            											block.parsedom = 'div'
         
     | 
| 
       65 
     | 
    
         
            -
            											block.marks = {
         
     | 
| 
       66 
     | 
    
         
            -
            												'data-editify-info': 'true'
         
     | 
| 
       67 
     | 
    
         
            -
            											}
         
     | 
| 
       68 
     | 
    
         
            -
            										}
         
     | 
| 
       69 
     | 
    
         
            -
            									})
         
     | 
| 
       70 
     | 
    
         
            -
            								}
         
     | 
| 
      
 38 
     | 
    
         
            +
            								//插入信息块
         
     | 
| 
      
 39 
     | 
    
         
            +
            								insertInfoBlock(editor.value, dataRangeCaches.value)
         
     | 
| 
       71 
40 
     | 
    
         
             
            								//渲染
         
     | 
| 
       72 
41 
     | 
    
         
             
            								editor.value.domRender()
         
     | 
| 
       73 
42 
     | 
    
         
             
            								editor.value.rangeRender()
         
     | 
    
        package/src/feature/italic.ts
    CHANGED
    
    | 
         @@ -97,7 +97,7 @@ export const ItalicMenuButton = defineComponent( 
     | 
|
| 
       97 
97 
     | 
    
         
             
            							tooltip: props.tooltip,
         
     | 
| 
       98 
98 
     | 
    
         
             
            							color: props.color,
         
     | 
| 
       99 
99 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       100 
     | 
    
         
            -
            							title: $editTrans('italic') 
     | 
| 
      
 100 
     | 
    
         
            +
            							title: `${$editTrans('italic')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       101 
101 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       102 
102 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       103 
103 
     | 
    
         
             
            							disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
| 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { computed, defineComponent, h, inject, PropType, Ref 
     | 
| 
      
 1 
     | 
    
         
            +
            import { computed, defineComponent, h, inject, PropType, Ref } from 'vue'
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { AlexElementsRangeType, AlexEditor } from 'alex-editor'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { common as DapCommon } from 'dap-util'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { MenuDisplayButtonType } from '@/core/tool'
         
     | 
| 
         @@ -10,82 +10,6 @@ import { Button, ButtonOptionsItemType } from '@/components/button' 
     | 
|
| 
       10 
10 
     | 
    
         
             
             */
         
     | 
| 
       11 
11 
     | 
    
         
             
            const FEATURE_NAME = 'lineHeight'
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            /**
         
     | 
| 
       14 
     | 
    
         
            -
             * 工具栏 - 行高
         
     | 
| 
       15 
     | 
    
         
            -
             */
         
     | 
| 
       16 
     | 
    
         
            -
            export const LineHeightToolbarButton = defineComponent(
         
     | 
| 
       17 
     | 
    
         
            -
            	(props, { expose }) => {
         
     | 
| 
       18 
     | 
    
         
            -
            		const editor = inject<Ref<AlexEditor>>('editor')!
         
     | 
| 
       19 
     | 
    
         
            -
            		const dataRangeCaches = inject<Ref<AlexElementsRangeType>>('dataRangeCaches')!
         
     | 
| 
       20 
     | 
    
         
            -
            		const $editTrans = inject<(key: string) => any>('$editTrans')!
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            		const btnRef = ref<InstanceType<typeof Button> | null>(null)
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            		const selectVal = computed<string | number>(() => {
         
     | 
| 
       25 
     | 
    
         
            -
            			const findHeightItem = props.config.options!.find((item: string | number | ButtonOptionsItemType) => {
         
     | 
| 
       26 
     | 
    
         
            -
            				let val: string | number | ButtonOptionsItemType = item
         
     | 
| 
       27 
     | 
    
         
            -
            				if (DapCommon.isObject(item)) {
         
     | 
| 
       28 
     | 
    
         
            -
            					val = (item as ButtonOptionsItemType).value!
         
     | 
| 
       29 
     | 
    
         
            -
            				}
         
     | 
| 
       30 
     | 
    
         
            -
            				return dataRangeCaches.value.list.every(el => {
         
     | 
| 
       31 
     | 
    
         
            -
            					if (el.element.isBlock() || el.element.isInblock()) {
         
     | 
| 
       32 
     | 
    
         
            -
            						return el.element.hasStyles() && el.element.styles!['line-height'] == val
         
     | 
| 
       33 
     | 
    
         
            -
            					}
         
     | 
| 
       34 
     | 
    
         
            -
            					const block = el.element.getBlock()
         
     | 
| 
       35 
     | 
    
         
            -
            					const inblock = el.element.getInblock()
         
     | 
| 
       36 
     | 
    
         
            -
            					if (inblock) {
         
     | 
| 
       37 
     | 
    
         
            -
            						return inblock.hasStyles() && inblock.styles!['line-height'] == val
         
     | 
| 
       38 
     | 
    
         
            -
            					}
         
     | 
| 
       39 
     | 
    
         
            -
            					return block.hasStyles() && block.styles!['line-height'] == val
         
     | 
| 
       40 
     | 
    
         
            -
            				})
         
     | 
| 
       41 
     | 
    
         
            -
            			})
         
     | 
| 
       42 
     | 
    
         
            -
            			return findHeightItem ? (DapCommon.isObject(findHeightItem) ? ((findHeightItem as ButtonOptionsItemType).value as string | number) : (findHeightItem as string | number)) : (props.config.defaultValue as string | number)
         
     | 
| 
       43 
     | 
    
         
            -
            		})
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            		expose({
         
     | 
| 
       46 
     | 
    
         
            -
            			btnRef
         
     | 
| 
       47 
     | 
    
         
            -
            		})
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            		return () => {
         
     | 
| 
       50 
     | 
    
         
            -
            			return props.config.show
         
     | 
| 
       51 
     | 
    
         
            -
            				? h(Button, {
         
     | 
| 
       52 
     | 
    
         
            -
            						ref: btnRef,
         
     | 
| 
       53 
     | 
    
         
            -
            						name: FEATURE_NAME,
         
     | 
| 
       54 
     | 
    
         
            -
            						type: 'display',
         
     | 
| 
       55 
     | 
    
         
            -
            						title: $editTrans('lineHeight'),
         
     | 
| 
       56 
     | 
    
         
            -
            						tooltip: props.tooltip,
         
     | 
| 
       57 
     | 
    
         
            -
            						color: props.color,
         
     | 
| 
       58 
     | 
    
         
            -
            						zIndex: props.zIndex,
         
     | 
| 
       59 
     | 
    
         
            -
            						leftBorder: props.config.leftBorder,
         
     | 
| 
       60 
     | 
    
         
            -
            						rightBorder: props.config.rightBorder,
         
     | 
| 
       61 
     | 
    
         
            -
            						active: false,
         
     | 
| 
       62 
     | 
    
         
            -
            						disabled: props.config.disabled,
         
     | 
| 
       63 
     | 
    
         
            -
            						displayConfig: {
         
     | 
| 
       64 
     | 
    
         
            -
            							options: props.config.options,
         
     | 
| 
       65 
     | 
    
         
            -
            							value: selectVal.value,
         
     | 
| 
       66 
     | 
    
         
            -
            							width: props.config.width,
         
     | 
| 
       67 
     | 
    
         
            -
            							maxHeight: props.config.maxHeight
         
     | 
| 
       68 
     | 
    
         
            -
            						},
         
     | 
| 
       69 
     | 
    
         
            -
            						onOperate: (_name: string, val: string) => {
         
     | 
| 
       70 
     | 
    
         
            -
            							setLineHeight(editor.value, dataRangeCaches.value, val)
         
     | 
| 
       71 
     | 
    
         
            -
            							editor.value.domRender()
         
     | 
| 
       72 
     | 
    
         
            -
            							editor.value.rangeRender()
         
     | 
| 
       73 
     | 
    
         
            -
            						}
         
     | 
| 
       74 
     | 
    
         
            -
            				  })
         
     | 
| 
       75 
     | 
    
         
            -
            				: null
         
     | 
| 
       76 
     | 
    
         
            -
            		}
         
     | 
| 
       77 
     | 
    
         
            -
            	},
         
     | 
| 
       78 
     | 
    
         
            -
            	{
         
     | 
| 
       79 
     | 
    
         
            -
            		name: `_${FEATURE_NAME}`,
         
     | 
| 
       80 
     | 
    
         
            -
            		props: {
         
     | 
| 
       81 
     | 
    
         
            -
            			color: String,
         
     | 
| 
       82 
     | 
    
         
            -
            			zIndex: Number,
         
     | 
| 
       83 
     | 
    
         
            -
            			config: Object as PropType<MenuDisplayButtonType>,
         
     | 
| 
       84 
     | 
    
         
            -
            			tooltip: Boolean
         
     | 
| 
       85 
     | 
    
         
            -
            		}
         
     | 
| 
       86 
     | 
    
         
            -
            	}
         
     | 
| 
       87 
     | 
    
         
            -
            )
         
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
13 
     | 
    
         
             
            /**
         
     | 
| 
       90 
14 
     | 
    
         
             
             * 菜单栏 - 行高
         
     | 
| 
       91 
15 
     | 
    
         
             
             */
         
     | 
| 
         @@ -136,7 +60,7 @@ export const LineHeightMenuButton = defineComponent( 
     | 
|
| 
       136 
60 
     | 
    
         
             
            							width: props.config.width,
         
     | 
| 
       137 
61 
     | 
    
         
             
            							maxHeight: props.config.maxHeight
         
     | 
| 
       138 
62 
     | 
    
         
             
            						},
         
     | 
| 
       139 
     | 
    
         
            -
            						title: $editTrans('lineHeight') 
     | 
| 
      
 63 
     | 
    
         
            +
            						title: `${$editTrans('lineHeight')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       140 
64 
     | 
    
         
             
            						leftBorder: props.config.leftBorder,
         
     | 
| 
       141 
65 
     | 
    
         
             
            						rightBorder: props.config.rightBorder,
         
     | 
| 
       142 
66 
     | 
    
         
             
            						disabled: props.disabled || isSourceView.value || hasPreInRange(editor.value, dataRangeCaches.value) || props.config.disabled,
         
     | 
    
        package/src/feature/link.ts
    CHANGED
    
    | 
         @@ -103,7 +103,7 @@ export const LinkMenuButton = defineComponent( 
     | 
|
| 
       103 
103 
     | 
    
         
             
            							zIndex: props.zIndex,
         
     | 
| 
       104 
104 
     | 
    
         
             
            							type: 'select',
         
     | 
| 
       105 
105 
     | 
    
         
             
            							hideScroll: true,
         
     | 
| 
       106 
     | 
    
         
            -
            							title: $editTrans('insertLink') 
     | 
| 
      
 106 
     | 
    
         
            +
            							title: `${$editTrans('insertLink')}${props.config.shortcut?.title ? `【${props.config.shortcut?.title}】` : ''}`,
         
     | 
| 
       107 
107 
     | 
    
         
             
            							leftBorder: props.config.leftBorder,
         
     | 
| 
       108 
108 
     | 
    
         
             
            							rightBorder: props.config.rightBorder,
         
     | 
| 
       109 
109 
     | 
    
         
             
            							active: false,
         
     |