vue-editify 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/insertImage/insertImage.vue.d.ts +3 -3
- package/lib/components/insertImage/props.d.ts +1 -1
- package/lib/components/insertVideo/insertVideo.vue.d.ts +3 -3
- package/lib/components/insertVideo/props.d.ts +1 -1
- package/lib/core/tool.d.ts +12 -3
- package/lib/editify/props.d.ts +1 -1
- package/lib/editify.es.js +12794 -12787
- package/lib/editify.umd.js +2 -2
- package/lib/index.d.ts +731 -5
- package/lib/plugins/attachment/index.d.ts +1 -1
- package/lib/plugins/attachment/insertAttachment/insertAttachment.vue.d.ts +3 -3
- package/lib/plugins/attachment/insertAttachment/props.d.ts +1 -1
- package/lib/plugins/infoBlock/index.d.ts +1 -1
- package/lib/plugins/mathformula/index.d.ts +1 -1
- package/lib/plugins/panel/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/button/button.vue +5 -5
- package/src/components/button/props.ts +1 -1
- package/src/components/checkbox/checkbox.vue +3 -3
- package/src/components/checkbox/props.ts +1 -1
- package/src/components/colors/colors.vue +3 -3
- package/src/components/colors/props.ts +1 -1
- package/src/components/insertImage/insertImage.vue +3 -3
- package/src/components/insertImage/props.ts +1 -1
- package/src/components/insertLink/insertLink.vue +1 -1
- package/src/components/insertVideo/insertVideo.vue +3 -3
- package/src/components/insertVideo/props.ts +1 -1
- package/src/components/layer/layer.vue +3 -3
- package/src/components/menu/menu.vue +13 -13
- package/src/components/menu/props.ts +1 -1
- package/src/components/toolbar/props.ts +1 -1
- package/src/components/toolbar/toolbar.vue +10 -10
- package/src/components/tooltip/tooltip.vue +1 -1
- package/src/components/triangle/triangle.vue +1 -1
- package/src/core/function.ts +2 -2
- package/src/core/rule.ts +4 -4
- package/src/core/tool.ts +22 -8
- package/src/editify/editify.vue +8 -8
- package/src/editify/props.ts +2 -2
- package/src/index.ts +24 -21
- package/src/plugins/attachment/index.ts +8 -8
- package/src/plugins/attachment/insertAttachment/insertAttachment.vue +3 -3
- package/src/plugins/attachment/insertAttachment/props.ts +1 -1
- package/src/plugins/infoBlock/index.ts +4 -4
- package/src/plugins/mathformula/index.ts +4 -4
- package/src/plugins/panel/index.ts +4 -4
- package/tsconfig.json +4 -0
- package/vite.config.ts +5 -0
@@ -13,7 +13,7 @@ export type AttachmentOptionsType = {
|
|
13
13
|
multiple?: boolean;
|
14
14
|
maxSize?: number;
|
15
15
|
minSize?: number;
|
16
|
-
customUpload?: (files: File[]) => string[] | Promise<string[]
|
16
|
+
customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>);
|
17
17
|
handleError?: (error: InsertAttachmentUploadErrorType, file: File) => void;
|
18
18
|
};
|
19
19
|
/**
|
@@ -24,7 +24,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
24
24
|
default: null;
|
25
25
|
};
|
26
26
|
customUpload: {
|
27
|
-
type: import('vue').PropType<(files: File[]) => string[] | Promise<string[]
|
27
|
+
type: import('vue').PropType<((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)>;
|
28
28
|
default: null;
|
29
29
|
};
|
30
30
|
handleError: {
|
@@ -60,7 +60,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
60
60
|
default: null;
|
61
61
|
};
|
62
62
|
customUpload: {
|
63
|
-
type: import('vue').PropType<(files: File[]) => string[] | Promise<string[]
|
63
|
+
type: import('vue').PropType<((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)>;
|
64
64
|
default: null;
|
65
65
|
};
|
66
66
|
handleError: {
|
@@ -76,7 +76,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
76
76
|
multiple: boolean;
|
77
77
|
maxSize: number;
|
78
78
|
minSize: number;
|
79
|
-
customUpload: (files: File[]) => string[] | Promise<string[]
|
79
|
+
customUpload: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>);
|
80
80
|
handleError: (error: import('./props').InsertAttachmentUploadErrorType, file: File) => void;
|
81
81
|
accept: string;
|
82
82
|
}, {}>;
|
@@ -27,7 +27,7 @@ export declare const InsertAttachmentProps: {
|
|
27
27
|
default: null;
|
28
28
|
};
|
29
29
|
customUpload: {
|
30
|
-
type: PropType<(files: File[]) => string[] | Promise<string[]
|
30
|
+
type: PropType<((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)>;
|
31
31
|
default: null;
|
32
32
|
};
|
33
33
|
handleError: {
|
package/package.json
CHANGED
@@ -28,13 +28,13 @@
|
|
28
28
|
</div>
|
29
29
|
</template>
|
30
30
|
<script setup lang="ts">
|
31
|
-
import
|
32
|
-
import Layer from '../layer/layer.vue'
|
33
|
-
import Icon from '../icon/icon.vue'
|
31
|
+
import { computed, ref } from 'vue'
|
34
32
|
import { common as DapCommon, color as DapColor } from 'dap-util'
|
33
|
+
import Tooltip from '@/components/tooltip/tooltip.vue'
|
34
|
+
import Layer from '@/components/layer/layer.vue'
|
35
|
+
import Icon from '@/components/icon/icon.vue'
|
36
|
+
import { ObjectType } from '@/core/tool'
|
35
37
|
import { ButtonDisplayConfigType, ButtonOptionsItemType, ButtonProps, ButtonSelectConfigType } from './props'
|
36
|
-
import { computed, ref } from 'vue'
|
37
|
-
import { ObjectType } from '../../core/tool'
|
38
38
|
|
39
39
|
defineOptions({
|
40
40
|
name: 'Button'
|
@@ -10,11 +10,11 @@
|
|
10
10
|
</template>
|
11
11
|
|
12
12
|
<script setup lang="ts">
|
13
|
+
import { computed } from 'vue'
|
13
14
|
import { common as DapCommon } from 'dap-util'
|
14
|
-
import Icon from '
|
15
|
+
import Icon from '@/components/icon/icon.vue'
|
16
|
+
import { ObjectType } from '@/core/tool'
|
15
17
|
import { CheckboxProps } from './props'
|
16
|
-
import { computed } from 'vue'
|
17
|
-
import { ObjectType } from '../../core/tool'
|
18
18
|
|
19
19
|
defineOptions({
|
20
20
|
name: 'Checkbox'
|
@@ -15,10 +15,10 @@
|
|
15
15
|
</template>
|
16
16
|
<script setup lang="ts">
|
17
17
|
import { inject } from 'vue'
|
18
|
-
import Icon from '
|
19
|
-
import Tooltip from '
|
18
|
+
import Icon from '@/components/icon/icon.vue'
|
19
|
+
import Tooltip from '@/components/tooltip/tooltip.vue'
|
20
|
+
import { ButtonOptionsItemType } from '@/components/button/props'
|
20
21
|
import { ColorsProps } from './props'
|
21
|
-
import { ButtonOptionsItemType } from '../button/props'
|
22
22
|
|
23
23
|
defineOptions({
|
24
24
|
name: 'Colors'
|
@@ -21,10 +21,10 @@
|
|
21
21
|
</template>
|
22
22
|
<script setup lang="ts">
|
23
23
|
import { file as DapFile } from 'dap-util'
|
24
|
-
import Icon from '../icon/icon.vue'
|
25
|
-
import { InsertImageProps } from './props'
|
26
24
|
import { computed, inject, ref, watch } from 'vue'
|
27
|
-
import
|
25
|
+
import Icon from '@/components/icon/icon.vue'
|
26
|
+
import { ObjectType } from '@/core/tool'
|
27
|
+
import { InsertImageProps } from './props'
|
28
28
|
|
29
29
|
defineOptions({
|
30
30
|
name: 'InsertImage'
|
@@ -30,7 +30,7 @@ export const InsertImageProps = {
|
|
30
30
|
},
|
31
31
|
//是否自定义上传图片
|
32
32
|
customUpload: {
|
33
|
-
type: Function as PropType<(files: File[]) => string[] | Promise<string[]
|
33
|
+
type: Function as PropType<((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)>,
|
34
34
|
default: null
|
35
35
|
},
|
36
36
|
//处理上传图片异常
|
@@ -13,7 +13,7 @@
|
|
13
13
|
</template>
|
14
14
|
<script setup lang="ts">
|
15
15
|
import { inject, ref, watch } from 'vue'
|
16
|
-
import Checkbox from '
|
16
|
+
import Checkbox from '@/components/checkbox/checkbox.vue'
|
17
17
|
import { InsertLinkProps } from './props'
|
18
18
|
|
19
19
|
defineOptions({
|
@@ -21,10 +21,10 @@
|
|
21
21
|
</template>
|
22
22
|
<script setup lang="ts">
|
23
23
|
import { file as DapFile } from 'dap-util'
|
24
|
-
import Icon from '../icon/icon.vue'
|
25
|
-
import { InsertVideoProps } from './props'
|
26
24
|
import { computed, inject, ref, watch } from 'vue'
|
27
|
-
import { ObjectType } from '
|
25
|
+
import { ObjectType } from '@/core/tool'
|
26
|
+
import Icon from '@/components/icon/icon.vue'
|
27
|
+
import { InsertVideoProps } from './props'
|
28
28
|
|
29
29
|
defineOptions({
|
30
30
|
name: 'InsertVideo'
|
@@ -30,7 +30,7 @@ export const InsertVideoProps = {
|
|
30
30
|
},
|
31
31
|
//是否自定义上传视频
|
32
32
|
customUpload: {
|
33
|
-
type: Function as PropType<(files: File[]) => string[] | Promise<string[]
|
33
|
+
type: Function as PropType<((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)>,
|
34
34
|
default: null
|
35
35
|
},
|
36
36
|
//处理上传视频异常
|
@@ -11,10 +11,10 @@
|
|
11
11
|
<script setup lang="ts">
|
12
12
|
import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
13
13
|
import { element as DapElement, event as DapEvent } from 'dap-util'
|
14
|
-
import Triangle from '
|
14
|
+
import Triangle from '@/components/triangle/triangle.vue'
|
15
|
+
import { TrianglePlacementType } from '@/components/triangle/props'
|
16
|
+
import { ObjectType } from '@/core/tool'
|
15
17
|
import { LayerPlacementType, LayerProps } from './props'
|
16
|
-
import { TrianglePlacementType } from '../triangle/props'
|
17
|
-
import { ObjectType } from '../../core/tool'
|
18
18
|
|
19
19
|
defineOptions({
|
20
20
|
name: 'Layer'
|
@@ -4,21 +4,21 @@
|
|
4
4
|
</div>
|
5
5
|
</template>
|
6
6
|
<script setup lang="ts">
|
7
|
-
import Icon from '../icon/icon.vue'
|
8
|
-
import Layer from '../layer/layer.vue'
|
9
|
-
import Button from '../button/button.vue'
|
10
|
-
import Colors from '../colors/colors.vue'
|
11
|
-
import InsertLink from '../insertLink/insertLink.vue'
|
12
|
-
import InsertImage from '../insertImage/insertImage.vue'
|
13
|
-
import InsertVideo from '../insertVideo/insertVideo.vue'
|
14
|
-
import InsertTable from '../insertTable/insertTable.vue'
|
15
|
-
import { h, getCurrentInstance, ref, computed, inject, ComponentInternalInstance, Ref, ComputedRef, defineComponent } from 'vue'
|
16
7
|
import { common as DapCommon } from 'dap-util'
|
17
|
-
import {
|
18
|
-
import { MenuProps } from './props'
|
19
|
-
import { MenuModeType, ObjectType, PluginResultType, MenuExtendType, MenuSequenceType, mergeObject } from '../../core/tool'
|
8
|
+
import { h, getCurrentInstance, ref, computed, inject, ComponentInternalInstance, Ref, ComputedRef, defineComponent } from 'vue'
|
20
9
|
import { AlexEditor, AlexElementsRangeType } from 'alex-editor'
|
21
|
-
import
|
10
|
+
import Icon from '@/components/icon/icon.vue'
|
11
|
+
import Layer from '@/components/layer/layer.vue'
|
12
|
+
import Button from '@/components/button/button.vue'
|
13
|
+
import Colors from '@/components/colors/colors.vue'
|
14
|
+
import InsertLink from '@/components/insertLink/insertLink.vue'
|
15
|
+
import InsertImage from '@/components/insertImage/insertImage.vue'
|
16
|
+
import InsertVideo from '@/components/insertVideo/insertVideo.vue'
|
17
|
+
import InsertTable from '@/components/insertTable/insertTable.vue'
|
18
|
+
import { ButtonOptionsItemType } from '@/components/button/props'
|
19
|
+
import { getRangeText, setHeading, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setTextStyle, setTextMark, removeTextStyle, removeTextMark, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, hasPreInRange, hasTableInRange, hasLinkInRange, isRangeInQuote, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getMatchElementByRange, hasImageInRange, hasVideoInRange, insertSeparator } from '@/core/function'
|
20
|
+
import { MenuModeType, ObjectType, PluginResultType, MenuExtendType, MenuSequenceType, mergeObject } from '@/core/tool'
|
21
|
+
import { MenuProps } from './props'
|
22
22
|
|
23
23
|
defineOptions({
|
24
24
|
name: 'Menu'
|
@@ -210,18 +210,18 @@
|
|
210
210
|
</Layer>
|
211
211
|
</template>
|
212
212
|
<script setup lang="ts">
|
213
|
-
import
|
214
|
-
import Button from '../button/button.vue'
|
215
|
-
import Icon from '../icon/icon.vue'
|
216
|
-
import Checkbox from '../checkbox/checkbox.vue'
|
217
|
-
import Colors from '../colors/colors.vue'
|
218
|
-
import { AlexEditor, AlexElement, AlexElementCreateConfigType, AlexElementsRangeType } from 'alex-editor'
|
213
|
+
import { Ref, computed, inject, ref } from 'vue'
|
219
214
|
import { common as DapCommon } from 'dap-util'
|
220
|
-
import {
|
215
|
+
import { AlexEditor, AlexElement, AlexElementCreateConfigType, AlexElementsRangeType } from 'alex-editor'
|
216
|
+
import Layer from '@/components/layer/layer.vue'
|
217
|
+
import Button from '@/components/button/button.vue'
|
218
|
+
import Icon from '@/components/icon/icon.vue'
|
219
|
+
import Checkbox from '@/components/checkbox/checkbox.vue'
|
220
|
+
import Colors from '@/components/colors/colors.vue'
|
221
|
+
import { getCellSpanNumber, getTableSize, getMatchElementByRange, removeTextStyle, removeTextMark, setTextStyle, setLineHeight, setTextMark, setList, setTask, setHeading, setAlign, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getMatchElementByElement, getCellMergeElement, setTableCellMerged } from '@/core/function'
|
222
|
+
import { ObjectType } from '@/core/tool'
|
223
|
+
import { ButtonOptionsItemType } from '@/components/button/props'
|
221
224
|
import { ToolbarProps } from './props'
|
222
|
-
import { Ref, computed, inject, ref } from 'vue'
|
223
|
-
import { ObjectType } from '../../core/tool'
|
224
|
-
import { ButtonOptionsItemType } from '../button/props'
|
225
225
|
|
226
226
|
defineOptions({
|
227
227
|
name: 'Toolbar'
|
package/src/core/function.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
2
|
* 这里的方法都是对编辑器内容元素进行判断或者操作的方法,不涉及到格式化、dom渲染和光标渲染
|
3
3
|
*/
|
4
|
-
import { AlexElement, AlexElementsRangeType, AlexEditor, AlexElementCreateConfigType } from 'alex-editor'
|
5
4
|
import { common as DapCommon } from 'dap-util'
|
5
|
+
import { AlexElement, AlexElementsRangeType, AlexEditor, AlexElementCreateConfigType } from 'alex-editor'
|
6
6
|
import { cloneData, queryHasValue, getButtonOptionsConfig, ObjectType } from './tool'
|
7
|
-
import { ButtonOptionsItemType } from '
|
7
|
+
import { ButtonOptionsItemType } from '@/components/button/props'
|
8
8
|
|
9
9
|
export type ElementMatchConfigType = {
|
10
10
|
parsedom?: string
|
package/src/core/rule.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { AlexEditor, AlexElement, AlexElementCreateConfigType } from 'alex-editor'
|
2
|
-
import { LanguagesItemType, getHljsHtml } from '../hljs'
|
3
|
-
import { isList, isTask, getTableSize, getCellSpanNumber } from './function'
|
4
2
|
import { common as DapCommon } from 'dap-util'
|
5
|
-
import {
|
6
|
-
import {
|
3
|
+
import { LanguagesItemType, getHljsHtml } from '@/hljs'
|
4
|
+
import { isList, isTask, getTableSize, getCellSpanNumber } from './function'
|
5
|
+
import { isPanel } from '@/plugins/panel'
|
6
|
+
import { isInfoBlock } from '@/plugins/infoBlock'
|
7
7
|
|
8
8
|
/**
|
9
9
|
* 自动补全表格行和列
|
package/src/core/tool.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { common as DapCommon, string as DapString, color as DapColor } from 'dap-util'
|
2
|
-
import {
|
2
|
+
import { App, Component, ComponentInternalInstance, VNode } from 'vue'
|
3
3
|
import { AlexElement } from 'alex-editor'
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import Button from '
|
4
|
+
import { languages } from '@/hljs'
|
5
|
+
import { ButtonOptionsItemType, ButtonTypeType } from '@/components/button/props'
|
6
|
+
import { LocaleType } from '@/locale'
|
7
|
+
import { InsertImageUploadErrorType } from '@/components/insertImage/props'
|
8
|
+
import Button from '@/components/button/button.vue'
|
9
9
|
|
10
10
|
export type ObjectType = {
|
11
11
|
[key: string]: any
|
@@ -43,7 +43,7 @@ export interface MenuImageButtonType extends MenuButtonType {
|
|
43
43
|
multiple?: boolean
|
44
44
|
maxSize?: number | null
|
45
45
|
minSize?: number | null
|
46
|
-
customUpload?: ((
|
46
|
+
customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>) | null
|
47
47
|
handleError?: ((error: InsertImageUploadErrorType, file: File) => void) | null
|
48
48
|
}
|
49
49
|
|
@@ -52,7 +52,7 @@ export interface MenuVideoButtonType extends MenuButtonType {
|
|
52
52
|
multiple?: boolean
|
53
53
|
maxSize?: number | null
|
54
54
|
minSize?: number | null
|
55
|
-
customUpload?: ((
|
55
|
+
customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>) | null
|
56
56
|
handleError?: ((error: InsertImageUploadErrorType, file: File) => void) | null
|
57
57
|
}
|
58
58
|
|
@@ -218,6 +218,8 @@ export type PluginResultType = {
|
|
218
218
|
|
219
219
|
export type PluginType = (editifyInstance: ComponentInternalInstance, editTrans: (key: string) => any) => PluginResultType
|
220
220
|
|
221
|
+
export type SFCWithInstall<T> = T & { install(app: App): void }
|
222
|
+
|
221
223
|
/**
|
222
224
|
* 对象平替值方法
|
223
225
|
* @param o1
|
@@ -1151,3 +1153,15 @@ export const getMenuConfig = (editTrans: (key: string) => any, editLocale: Local
|
|
1151
1153
|
extends: {}
|
1152
1154
|
}
|
1153
1155
|
}
|
1156
|
+
|
1157
|
+
/**
|
1158
|
+
* 给组件增加install属性
|
1159
|
+
* @param component
|
1160
|
+
* @returns
|
1161
|
+
*/
|
1162
|
+
export const withInstall = <T extends Component>(component: T) => {
|
1163
|
+
;(component as SFCWithInstall<T>).install = (app: App) => {
|
1164
|
+
app.component(component.name!, component)
|
1165
|
+
}
|
1166
|
+
return component as SFCWithInstall<typeof component>
|
1167
|
+
}
|
package/src/editify/editify.vue
CHANGED
@@ -22,15 +22,15 @@
|
|
22
22
|
import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue'
|
23
23
|
import { AlexEditor, AlexElement, AlexElementRangeType, AlexElementsRangeType } from 'alex-editor'
|
24
24
|
import { element as DapElement, event as DapEvent, data as DapData, number as DapNumber, color as DapColor } from 'dap-util'
|
25
|
-
import { mergeObject, getToolbarConfig, getMenuConfig, MenuConfigType, ObjectType, ToolbarConfigType, PluginResultType } from '
|
26
|
-
import { parseList, orderdListHandle, commonElementHandle, tableThTdHandle, tableFormatHandle, tableRangeMergedHandle, preHandle, specialInblockHandle } from '
|
27
|
-
import { isTask, elementToParagraph, getMatchElementByRange, hasTableInRange, hasLinkInRange, hasPreInRange, hasImageInRange, hasVideoInRange } from '
|
28
|
-
import Toolbar from '
|
29
|
-
import Menu from '
|
30
|
-
import Layer from '
|
25
|
+
import { mergeObject, getToolbarConfig, getMenuConfig, MenuConfigType, ObjectType, ToolbarConfigType, PluginResultType } from '@/core/tool'
|
26
|
+
import { parseList, orderdListHandle, commonElementHandle, tableThTdHandle, tableFormatHandle, tableRangeMergedHandle, preHandle, specialInblockHandle } from '@/core/rule'
|
27
|
+
import { isTask, elementToParagraph, getMatchElementByRange, hasTableInRange, hasLinkInRange, hasPreInRange, hasImageInRange, hasVideoInRange } from '@/core/function'
|
28
|
+
import Toolbar from '@/components/toolbar/toolbar.vue'
|
29
|
+
import Menu from '@/components/menu/menu.vue'
|
30
|
+
import Layer from '@/components/layer/layer.vue'
|
31
|
+
import { trans } from '@/locale'
|
32
|
+
import { LanguagesItemType } from '@/hljs'
|
31
33
|
import { EditifyProps, EditifyResizeParamsType, EditifyToolbarOptionsType } from './props'
|
32
|
-
import { trans } from '../locale'
|
33
|
-
import { LanguagesItemType } from '../hljs'
|
34
34
|
|
35
35
|
//定义组件名称
|
36
36
|
defineOptions({
|
package/src/editify/props.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { common as DapCommon } from 'dap-util'
|
2
2
|
import { ExtractPublicPropTypes, PropType } from 'vue'
|
3
|
-
import { PluginType, MenuConfigType, ObjectType, ToolbarConfigType } from '../core/tool'
|
4
3
|
import { AlexElement } from 'alex-editor'
|
5
|
-
import {
|
4
|
+
import { PluginType, MenuConfigType, ObjectType, ToolbarConfigType } from '@/core/tool'
|
5
|
+
import { LocaleType } from '@/locale'
|
6
6
|
|
7
7
|
export type EditifyResizeParamsType = {
|
8
8
|
element: AlexElement | null
|
package/src/index.ts
CHANGED
@@ -1,44 +1,47 @@
|
|
1
|
-
import { App
|
1
|
+
import { App } from 'vue'
|
2
|
+
import { withInstall } from '@/core/tool'
|
2
3
|
//引入字体图标样式
|
3
|
-
import '
|
4
|
+
import '@/icon/iconfont.css'
|
4
5
|
//引入组件
|
5
|
-
import
|
6
|
+
import editify from '@/editify/editify.vue'
|
7
|
+
//注入install方法
|
8
|
+
const Editify = withInstall(editify)
|
6
9
|
|
7
10
|
//导出类型
|
8
|
-
export type { ButtonTypeType, ButtonOptionsItemType, ButtonSelectConfigType, ButtonDisplayConfigType } from '
|
9
|
-
export type { InsertImageUploadErrorType } from '
|
10
|
-
export type { InsertVideoUploadErrorType } from '
|
11
|
-
export type { MenuButtonType, MenuSelectButtonType, MenuDisplayButtonType, MenuImageButtonType, MenuVideoButtonType, MenuTableButtonType, MenuCustomButtonType, CodeBlockToolbarType, TextToolbarType, ToolbarConfigType, MenuSequenceType, MenuModeType, MenuExtendType, MenuConfigType, PluginType, PluginResultType } from '
|
12
|
-
export type { ElementMatchConfigType } from '
|
11
|
+
export type { ButtonTypeType, ButtonOptionsItemType, ButtonSelectConfigType, ButtonDisplayConfigType } from '@/components/button/props'
|
12
|
+
export type { InsertImageUploadErrorType } from '@/components/insertImage/props'
|
13
|
+
export type { InsertVideoUploadErrorType } from '@/components/insertVideo/props'
|
14
|
+
export type { MenuButtonType, MenuSelectButtonType, MenuDisplayButtonType, MenuImageButtonType, MenuVideoButtonType, MenuTableButtonType, MenuCustomButtonType, CodeBlockToolbarType, TextToolbarType, ToolbarConfigType, MenuSequenceType, MenuModeType, MenuExtendType, MenuConfigType, PluginType, PluginResultType } from '@/core/tool'
|
15
|
+
export type { ElementMatchConfigType } from '@/core/function'
|
13
16
|
|
14
17
|
//导出编辑器操作方法
|
15
|
-
export { elementIsMatch, getMatchElementByElement, getMatchElementByRange, isList, isTask, elementIsInList, elementIsInTask, hasPreInRange, hasQuoteInRange, hasListInRange, hasTaskInRange, hasLinkInRange, hasTableInRange, hasImageInRange, hasVideoInRange, isRangeInQuote, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getRangeText, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setTextStyle, setTextMark, removeTextStyle, removeTextMark, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, insertSeparator } from '
|
18
|
+
export { elementIsMatch, getMatchElementByElement, getMatchElementByRange, isList, isTask, elementIsInList, elementIsInTask, hasPreInRange, hasQuoteInRange, hasListInRange, hasTaskInRange, hasLinkInRange, hasTableInRange, hasImageInRange, hasVideoInRange, isRangeInQuote, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getRangeText, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setTextStyle, setTextMark, removeTextStyle, removeTextMark, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, insertSeparator } from '@/core/function'
|
16
19
|
|
17
20
|
//安装函数
|
18
|
-
const install
|
21
|
+
const install = (app: App) => {
|
19
22
|
app.component(Editify.name!, Editify)
|
20
23
|
}
|
21
24
|
//版本号
|
22
|
-
const version = '0.2.
|
25
|
+
const version = '0.2.2'
|
23
26
|
|
24
27
|
//导出AlexElement元素
|
25
28
|
export { AlexElement } from 'alex-editor'
|
26
29
|
|
27
30
|
//导出attachment插件相关的方法和类型
|
28
|
-
export type { AttachmentOptionsType } from '
|
29
|
-
export type { InsertAttachmentUploadErrorType } from '
|
30
|
-
export { attachment, isAttachment, hasAttachmentInRange } from '
|
31
|
+
export type { AttachmentOptionsType } from '@/plugins/attachment'
|
32
|
+
export type { InsertAttachmentUploadErrorType } from '@/plugins/attachment/insertAttachment/props'
|
33
|
+
export { attachment, isAttachment, hasAttachmentInRange } from '@/plugins/attachment'
|
31
34
|
//导出mathformula插件相关的方法和类型
|
32
|
-
export type { MathformulaOptionsType } from '
|
33
|
-
export { mathformula, isMathformula, isUnderMathformula, getMathformulaElement, hasMathformulaInRange, getMathformulaElementByRange } from '
|
35
|
+
export type { MathformulaOptionsType } from '@/plugins/mathformula'
|
36
|
+
export { mathformula, isMathformula, isUnderMathformula, getMathformulaElement, hasMathformulaInRange, getMathformulaElementByRange } from '@/plugins/mathformula'
|
34
37
|
//导出panel插件相关的方法和类型
|
35
|
-
export type { PanelOptionsType } from '
|
36
|
-
export { panel, isPanel, isUnderPanel, getPanelElement, hasPanelInRange, getPanelElementByRange } from '
|
38
|
+
export type { PanelOptionsType } from '@/plugins/panel'
|
39
|
+
export { panel, isPanel, isUnderPanel, getPanelElement, hasPanelInRange, getPanelElementByRange } from '@/plugins/panel'
|
37
40
|
//导出infoBlock插件相关的方法和类型
|
38
|
-
export type { InfoBlockOptionsType } from '
|
39
|
-
export { infoBlock, isInfoBlock, isUnderInfoBlock, getInfoBlockElement, hasInfoBlockInRange, getInfoBlockElementByRange } from '
|
41
|
+
export type { InfoBlockOptionsType } from '@/plugins/infoBlock'
|
42
|
+
export { infoBlock, isInfoBlock, isUnderInfoBlock, getInfoBlockElement, hasInfoBlockInRange, getInfoBlockElementByRange } from '@/plugins/infoBlock'
|
40
43
|
|
41
44
|
//导出组件和安装函数
|
42
|
-
export {
|
45
|
+
export { Editify as default, Editify, install, version }
|
43
46
|
|
44
47
|
console.log(`%c vue-editify %c v${version} `, 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;')
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { ComponentInternalInstance, h } from 'vue'
|
2
2
|
import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
3
|
+
import { event as DapEvent, common as DapCommon } from 'dap-util'
|
4
|
+
import { ObjectType, PluginType } from '@/core/tool'
|
5
|
+
import Layer from '@/components/layer/layer.vue'
|
6
|
+
import Button from '@/components/button/button.vue'
|
7
|
+
import Icon from '@/components/icon/icon.vue'
|
7
8
|
import InsertAttachment from './insertAttachment/insertAttachment.vue'
|
8
9
|
import { InsertAttachmentUploadErrorType } from './insertAttachment/props'
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import { hasMathformulaInRange } from '../mathformula'
|
10
|
+
import { hasPreInRange } from '@/core/function'
|
11
|
+
import { hasMathformulaInRange } from '@/plugins/mathformula'
|
12
12
|
|
13
13
|
export type AttachmentOptionsType = {
|
14
14
|
//排序
|
@@ -32,7 +32,7 @@ export type AttachmentOptionsType = {
|
|
32
32
|
//选择的单个文件最小值,单位kb,不设置将不限制
|
33
33
|
minSize?: number
|
34
34
|
//是否自定义上传附件
|
35
|
-
customUpload?: (files: File[]) => string[] | Promise<string[]>
|
35
|
+
customUpload?: ((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)
|
36
36
|
//处理上传附件异常
|
37
37
|
handleError?: (error: InsertAttachmentUploadErrorType, file: File) => void
|
38
38
|
}
|
@@ -25,10 +25,10 @@
|
|
25
25
|
</template>
|
26
26
|
<script setup lang="ts">
|
27
27
|
import { file as DapFile } from 'dap-util'
|
28
|
-
import Icon from '../../../components/icon/icon.vue'
|
29
|
-
import { InsertAttachmentProps } from './props'
|
30
28
|
import { computed, inject, ref, watch } from 'vue'
|
31
|
-
import { ObjectType } from '
|
29
|
+
import { ObjectType } from '@/core/tool'
|
30
|
+
import Icon from '@/components/icon/icon.vue'
|
31
|
+
import { InsertAttachmentProps } from './props'
|
32
32
|
|
33
33
|
defineOptions({
|
34
34
|
name: 'InsertAttachment'
|
@@ -35,7 +35,7 @@ export const InsertAttachmentProps = {
|
|
35
35
|
},
|
36
36
|
//是否自定义上传附件
|
37
37
|
customUpload: {
|
38
|
-
type: Function as PropType<(files: File[]) => string[] | Promise<string[]
|
38
|
+
type: Function as PropType<((files: File[]) => string[]) | ((files: File[]) => Promise<string[]>)>,
|
39
39
|
default: null
|
40
40
|
},
|
41
41
|
//处理上传附件异常
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { common as DapCommon, color as DapColor } from 'dap-util'
|
2
|
-
import { PluginType } from '../../core/tool'
|
3
2
|
import { ComponentInternalInstance, h } from 'vue'
|
4
3
|
import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import {
|
4
|
+
import { PluginType } from '@/core/tool'
|
5
|
+
import Icon from '@/components/icon/icon.vue'
|
6
|
+
import { elementToParagraph, hasPreInRange, hasTableInRange } from '@/core/function'
|
7
|
+
import { hasPanelInRange } from '@/plugins/panel'
|
8
8
|
|
9
9
|
export type InfoBlockOptionsType = {
|
10
10
|
//排序
|