vue-editify 0.1.49 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/lib/core/tool.d.ts +10 -1
  2. package/lib/editify/props.d.ts +1 -1
  3. package/lib/editify.es.js +12794 -12786
  4. package/lib/editify.umd.js +2 -1
  5. package/lib/index.d.ts +731 -5
  6. package/lib/plugins/infoBlock/index.d.ts +1 -1
  7. package/lib/plugins/mathformula/index.d.ts +1 -1
  8. package/lib/plugins/panel/index.d.ts +1 -1
  9. package/package.json +3 -3
  10. package/src/components/button/button.vue +5 -5
  11. package/src/components/button/props.ts +1 -1
  12. package/src/components/checkbox/checkbox.vue +3 -3
  13. package/src/components/checkbox/props.ts +1 -1
  14. package/src/components/colors/colors.vue +3 -3
  15. package/src/components/colors/props.ts +1 -1
  16. package/src/components/insertImage/insertImage.vue +3 -3
  17. package/src/components/insertLink/insertLink.vue +1 -1
  18. package/src/components/insertVideo/insertVideo.vue +3 -3
  19. package/src/components/layer/layer.vue +3 -3
  20. package/src/components/menu/menu.vue +13 -13
  21. package/src/components/menu/props.ts +1 -1
  22. package/src/components/toolbar/props.ts +1 -1
  23. package/src/components/toolbar/toolbar.vue +10 -10
  24. package/src/components/tooltip/tooltip.vue +1 -1
  25. package/src/components/triangle/triangle.vue +1 -1
  26. package/src/core/function.ts +2 -2
  27. package/src/core/rule.ts +4 -4
  28. package/src/core/tool.ts +20 -6
  29. package/src/editify/editify.vue +8 -8
  30. package/src/editify/props.ts +2 -2
  31. package/src/index.ts +24 -21
  32. package/src/plugins/attachment/index.ts +7 -7
  33. package/src/plugins/attachment/insertAttachment/insertAttachment.vue +3 -3
  34. package/src/plugins/infoBlock/index.ts +4 -4
  35. package/src/plugins/mathformula/index.ts +4 -4
  36. package/src/plugins/panel/index.ts +4 -4
  37. package/tsconfig.json +4 -0
  38. package/vite.config.ts +7 -1
  39. package/lib/style.css +0 -1
@@ -1,5 +1,5 @@
1
- import { PluginType } from '../../core/tool';
2
1
  import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
+ import { PluginType } from '../../core/tool';
3
3
 
4
4
  export type InfoBlockOptionsType = {
5
5
  sequence?: number;
@@ -1,5 +1,5 @@
1
- import { PluginType } from '../../core/tool';
2
1
  import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
+ import { PluginType } from '../../core/tool';
3
3
 
4
4
  export type MathformulaOptionsType = {
5
5
  sequence?: number;
@@ -1,5 +1,5 @@
1
- import { PluginType } from '../../core/tool';
2
1
  import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor';
2
+ import { PluginType } from '../../core/tool';
3
3
 
4
4
  export type PanelOptionsType = {
5
5
  sequence?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-editify",
3
- "version": "0.1.49",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -28,12 +28,12 @@
28
28
  "@types/node": "^20.11.24",
29
29
  "@vitejs/plugin-vue": "^5.0.4",
30
30
  "less": "^3.0.4",
31
- "less-loader": "^5.0.0",
32
31
  "terser": "^5.16.9",
33
32
  "typescript": "^5.2.2",
34
33
  "vite": "^5.2.8",
35
34
  "vite-plugin-dts": "^3.7.3",
36
- "vue-tsc": "^1.8.27"
35
+ "vue-tsc": "^1.8.27",
36
+ "vite-plugin-css-injected-by-js": "^3.5.1"
37
37
  },
38
38
  "browserslist": [
39
39
  "> 1%",
@@ -28,13 +28,13 @@
28
28
  </div>
29
29
  </template>
30
30
  <script setup lang="ts">
31
- import Tooltip from '../tooltip/tooltip.vue'
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'
@@ -1,5 +1,5 @@
1
1
  import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { ObjectType } from '../../core/tool'
2
+ import { ObjectType } from '@/core/tool'
3
3
 
4
4
  export type ButtonTypeType = 'default' | 'select' | 'display'
5
5
 
@@ -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 '../icon/icon.vue'
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'
@@ -1,6 +1,6 @@
1
1
  import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { ObjectType } from '../../core/tool'
3
2
  import { common as DapCommon } from 'dap-util'
3
+ import { ObjectType } from '@/core/tool'
4
4
 
5
5
  export const CheckboxProps = {
6
6
  //是否禁用
@@ -15,10 +15,10 @@
15
15
  </template>
16
16
  <script setup lang="ts">
17
17
  import { inject } from 'vue'
18
- import Icon from '../icon/icon.vue'
19
- import Tooltip from '../tooltip/tooltip.vue'
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'
@@ -1,5 +1,5 @@
1
1
  import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { ButtonOptionsItemType } from '../button/props'
2
+ import { ButtonOptionsItemType } from '@/components/button/props'
3
3
 
4
4
  export const ColorsProps = {
5
5
  //颜色数组
@@ -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 { ObjectType } from '../../core/tool'
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'
@@ -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 '../checkbox/checkbox.vue'
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 '../../core/tool'
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'
@@ -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 '../triangle/triangle.vue'
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 { 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'
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 { ButtonOptionsItemType } from '../button/props'
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'
@@ -1,5 +1,5 @@
1
1
  import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { MenuConfigType } from '../../core/tool'
2
+ import { MenuConfigType } from '@/core/tool'
3
3
 
4
4
  export const MenuProps = {
5
5
  //菜单栏配置
@@ -1,5 +1,5 @@
1
1
  import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { ToolbarConfigType } from '../../core/tool'
2
+ import { ToolbarConfigType } from '@/core/tool'
3
3
 
4
4
  export const ToolbarProps = {
5
5
  //是否显示
@@ -210,18 +210,18 @@
210
210
  </Layer>
211
211
  </template>
212
212
  <script setup lang="ts">
213
- import Layer from '../layer/layer.vue'
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 { getCellSpanNumber, getTableSize, getMatchElementByRange, removeTextStyle, removeTextMark, setTextStyle, setLineHeight, setTextMark, setList, setTask, setHeading, setAlign, isRangeInList, isRangeInTask, queryTextStyle, queryTextMark, getMatchElementByElement, getCellMergeElement, setTableCellMerged } from '../../core/function'
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'
@@ -10,7 +10,7 @@
10
10
  </template>
11
11
  <script setup lang="ts">
12
12
  import { ref } from 'vue'
13
- import Layer from '../layer/layer.vue'
13
+ import Layer from '@/components/layer/layer.vue'
14
14
  import { TooltipProps } from './props'
15
15
 
16
16
  defineOptions({
@@ -7,7 +7,7 @@
7
7
  <script setup lang="ts">
8
8
  import { computed } from 'vue'
9
9
  import { TriangleProps } from './props'
10
- import { ObjectType } from '../../core/tool'
10
+ import { ObjectType } from '@/core/tool'
11
11
 
12
12
  defineOptions({
13
13
  name: 'Triangle'
@@ -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 '../components/button/props'
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 { isPanel } from '../plugins/panel'
6
- import { isInfoBlock } from '../plugins/infoBlock'
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 { languages } from '../hljs'
2
+ import { App, Component, ComponentInternalInstance, VNode } from 'vue'
3
3
  import { AlexElement } from 'alex-editor'
4
- import { ButtonOptionsItemType, ButtonTypeType } from '../components/button/props'
5
- import { LocaleType } from '../locale'
6
- import { InsertImageUploadErrorType } from '../components/insertImage/props'
7
- import { ComponentInternalInstance, VNode } from 'vue'
8
- import Button from '../components/button/button.vue'
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
@@ -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
+ }
@@ -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 '../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'
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({
@@ -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 { LocaleType } from '../locale'
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, FunctionPlugin } from 'vue'
1
+ import { App } from 'vue'
2
+ import { withInstall } from '@/core/tool'
2
3
  //引入字体图标样式
3
- import './icon/iconfont.css'
4
+ import '@/icon/iconfont.css'
4
5
  //引入组件
5
- import Editify from './editify/editify.vue'
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 './components/button/props'
9
- export type { InsertImageUploadErrorType } from './components/insertImage/props'
10
- export type { InsertVideoUploadErrorType } from './components/insertVideo/props'
11
- export type { MenuButtonType, MenuSelectButtonType, MenuDisplayButtonType, MenuImageButtonType, MenuVideoButtonType, MenuTableButtonType, MenuCustomButtonType, CodeBlockToolbarType, TextToolbarType, ToolbarConfigType, MenuSequenceType, MenuModeType, MenuExtendType, MenuConfigType, PluginType, PluginResultType } from './core/tool'
12
- export type { ElementMatchConfigType } from './core/function'
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 './core/function'
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: FunctionPlugin = (app: App) => {
21
+ const install = (app: App) => {
19
22
  app.component(Editify.name!, Editify)
20
23
  }
21
24
  //版本号
22
- const version = '0.1.49'
25
+ const version = '0.2.1'
23
26
 
24
27
  //导出AlexElement元素
25
28
  export { AlexElement } from 'alex-editor'
26
29
 
27
30
  //导出attachment插件相关的方法和类型
28
- export type { AttachmentOptionsType } from './plugins/attachment'
29
- export type { InsertAttachmentUploadErrorType } from './plugins/attachment/insertAttachment/props'
30
- export { attachment, isAttachment, hasAttachmentInRange } from './plugins/attachment'
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 './plugins/mathformula'
33
- export { mathformula, isMathformula, isUnderMathformula, getMathformulaElement, hasMathformulaInRange, getMathformulaElementByRange } from './plugins/mathformula'
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 './plugins/panel'
36
- export { panel, isPanel, isUnderPanel, getPanelElement, hasPanelInRange, getPanelElementByRange } from './plugins/panel'
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 './plugins/infoBlock'
39
- export { infoBlock, isInfoBlock, isUnderInfoBlock, getInfoBlockElement, hasInfoBlockInRange, getInfoBlockElementByRange } from './plugins/infoBlock'
41
+ export type { InfoBlockOptionsType } from '@/plugins/infoBlock'
42
+ export { infoBlock, isInfoBlock, isUnderInfoBlock, getInfoBlockElement, hasInfoBlockInRange, getInfoBlockElementByRange } from '@/plugins/infoBlock'
40
43
 
41
44
  //导出组件和安装函数
42
- export { install as default, install, Editify, version }
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 { ObjectType, PluginType } from '../../core/tool'
4
- import Layer from '../../components/layer/layer.vue'
5
- import Button from '../../components/button/button.vue'
6
- import Icon from '../../components/icon/icon.vue'
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 { event as DapEvent, common as DapCommon } from 'dap-util'
10
- import { hasPreInRange } from '../../core/function'
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
  //排序
@@ -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 '../../../core/tool'
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'
@@ -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 Icon from '../../components/icon/icon.vue'
6
- import { elementToParagraph, hasPreInRange, hasTableInRange } from '../../core/function'
7
- import { hasPanelInRange } from '../panel'
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
  //排序
@@ -1,13 +1,13 @@
1
1
  import { common as DapCommon } from 'dap-util'
2
- import { ObjectType, PluginType, cloneData } from '../../core/tool'
3
2
  import { ComponentInternalInstance, h } from 'vue'
4
3
  import { AlexEditor, AlexElement, AlexElementsRangeType } from 'alex-editor'
4
+ import { ObjectType, PluginType, cloneData } from '@/core/tool'
5
5
  import 'katex/dist/katex.css'
6
6
  import KaTex from 'katex'
7
- import Icon from '../../components/icon/icon.vue'
8
- import Button from '../../components/button/button.vue'
7
+ import Icon from '@/components/icon/icon.vue'
8
+ import Button from '@/components/button/button.vue'
9
+ import { hasLinkInRange, hasPreInRange } from '@/core/function'
9
10
  import InsertMathformula from './insertMathformula/insertMathformula.vue'
10
- import { hasLinkInRange, hasPreInRange } from '../../core/function'
11
11
 
12
12
  export type MathformulaOptionsType = {
13
13
  //排序
@@ -1,10 +1,10 @@
1
1
  import { common as DapCommon } 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 Icon from '../../components/icon/icon.vue'
6
- import { hasTableInRange } from '../../core/function'
7
- import { hasMathformulaInRange } from '../mathformula'
4
+ import { PluginType } from '@/core/tool'
5
+ import Icon from '@/components/icon/icon.vue'
6
+ import { hasTableInRange } from '@/core/function'
7
+ import { hasMathformulaInRange } from '@/plugins/mathformula'
8
8
 
9
9
  export type PanelOptionsType = {
10
10
  //排序
package/tsconfig.json CHANGED
@@ -7,6 +7,10 @@
7
7
  "skipLibCheck": true,
8
8
  "allowSyntheticDefaultImports": true,
9
9
  "types": ["node"],
10
+ "baseUrl": "./",
11
+ "paths": {
12
+ "@/*": ["src/*"]
13
+ },
10
14
 
11
15
  /* Bundler mode */
12
16
  "moduleResolution": "bundler",
package/vite.config.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  import { defineConfig } from 'vite'
2
2
  import vue from '@vitejs/plugin-vue'
3
3
  import dts from 'vite-plugin-dts'
4
+ import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
4
5
  import path from 'path'
5
6
 
6
7
  export default defineConfig({
7
- plugins: [vue(), dts()],
8
+ plugins: [vue(), dts(), cssInjectedByJsPlugin({ topExecutionPriority: false })],
9
+ resolve: {
10
+ alias: {
11
+ '@': path.resolve(__dirname, './src')
12
+ }
13
+ },
8
14
  build: {
9
15
  //打包后的目录名称
10
16
  outDir: 'lib',