vue-editify 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. package/examples/App.vue +289 -13
  2. package/lib/components/colors/colors.vue.d.ts +9 -0
  3. package/lib/components/colors/props.d.ts +4 -0
  4. package/lib/core/function.d.ts +120 -45
  5. package/lib/core/rule.d.ts +23 -17
  6. package/lib/core/tool.d.ts +1 -13
  7. package/lib/editify/editify.vue.d.ts +10 -1
  8. package/lib/editify/props.d.ts +1 -1
  9. package/lib/editify/toolbar/props.d.ts +1 -1
  10. package/lib/editify/toolbar/toolbar.vue.d.ts +3 -3
  11. package/lib/editify.es.js +13640 -13799
  12. package/lib/editify.umd.js +2 -2
  13. package/lib/feature/align.d.ts +0 -14
  14. package/lib/feature/heading.d.ts +0 -14
  15. package/lib/feature/lineHeight.d.ts +0 -14
  16. package/lib/feature/orderList.d.ts +1 -3
  17. package/lib/feature/task.d.ts +0 -14
  18. package/lib/feature/unorderList.d.ts +1 -3
  19. package/lib/index.d.ts +12 -3
  20. package/package.json +2 -2
  21. package/src/components/button/button.vue +3 -3
  22. package/src/components/checkbox/checkbox.vue +1 -1
  23. package/src/components/colors/colors.vue +4 -4
  24. package/src/components/colors/props.ts +6 -1
  25. package/src/components/insertAttachment/insertAttachment.vue +1 -1
  26. package/src/components/insertImage/insertImage.vue +1 -1
  27. package/src/components/insertLink/insertLink.vue +1 -1
  28. package/src/components/insertVideo/insertVideo.vue +1 -1
  29. package/src/components/layer/layer.vue +9 -3
  30. package/src/components/tooltip/tooltip.vue +1 -1
  31. package/src/components/updateLink/updateLink.vue +1 -1
  32. package/src/core/function.ts +961 -475
  33. package/src/core/rule.ts +85 -367
  34. package/src/core/tool.ts +8 -114
  35. package/src/editify/editify.less +88 -14
  36. package/src/editify/editify.vue +117 -65
  37. package/src/editify/props.ts +1 -1
  38. package/src/editify/toolbar/props.ts +2 -2
  39. package/src/editify/toolbar/toolbar.vue +12 -12
  40. package/src/feature/align.ts +1 -61
  41. package/src/feature/attachment.ts +13 -26
  42. package/src/feature/backColor.ts +1 -0
  43. package/src/feature/foreColor.ts +1 -0
  44. package/src/feature/heading.ts +2 -73
  45. package/src/feature/infoBlock.ts +4 -35
  46. package/src/feature/lineHeight.ts +1 -77
  47. package/src/feature/mathformula.ts +3 -50
  48. package/src/feature/orderList.ts +166 -35
  49. package/src/feature/panel.ts +4 -49
  50. package/src/feature/sub.ts +1 -1
  51. package/src/feature/super.ts +1 -1
  52. package/src/feature/task.ts +1 -55
  53. package/src/feature/unorderList.ts +106 -35
  54. package/src/feature/video.ts +1 -1
  55. package/src/icon/iconfont.css +40 -0
  56. package/src/icon/iconfont.ttf +0 -0
  57. package/src/icon/iconfont.woff +0 -0
  58. package/src/index.ts +14 -8
  59. package/src/locale/en_US.ts +112 -110
  60. package/src/locale/zh_CN.ts +11 -9
@@ -1,19 +1,5 @@
1
1
  import { MenuSelectButtonType } from '../core/tool';
2
2
 
3
- /**
4
- * 工具栏 - 对齐方式
5
- */
6
- export declare const AlignToolbarButton: import('vue').DefineSetupFnComponent<{
7
- color: string;
8
- zIndex: number;
9
- config: MenuSelectButtonType;
10
- tooltip: boolean;
11
- }, {}, {}, {
12
- color: string;
13
- zIndex: number;
14
- config: MenuSelectButtonType;
15
- tooltip: boolean;
16
- } & {}, import('vue').PublicProps>;
17
3
  /**
18
4
  * 菜单栏 - 对齐方式
19
5
  */
@@ -1,19 +1,5 @@
1
1
  import { MenuDisplayButtonType } from '../core/tool';
2
2
 
3
- /**
4
- * 工具栏 - 标题
5
- */
6
- export declare const HeadingToolbarButton: import('vue').DefineSetupFnComponent<{
7
- color: string;
8
- zIndex: number;
9
- config: MenuDisplayButtonType;
10
- tooltip: boolean;
11
- }, {}, {}, {
12
- color: string;
13
- zIndex: number;
14
- config: MenuDisplayButtonType;
15
- tooltip: boolean;
16
- } & {}, import('vue').PublicProps>;
17
3
  /**
18
4
  * 菜单栏 - 标题
19
5
  */
@@ -1,19 +1,5 @@
1
1
  import { MenuDisplayButtonType } from '../core/tool';
2
2
 
3
- /**
4
- * 工具栏 - 行高
5
- */
6
- export declare const LineHeightToolbarButton: import('vue').DefineSetupFnComponent<{
7
- color: string;
8
- zIndex: number;
9
- config: MenuDisplayButtonType;
10
- tooltip: boolean;
11
- }, {}, {}, {
12
- color: string;
13
- zIndex: number;
14
- config: MenuDisplayButtonType;
15
- tooltip: boolean;
16
- } & {}, import('vue').PublicProps>;
17
3
  /**
18
4
  * 菜单栏 - 行高
19
5
  */
@@ -3,15 +3,13 @@ import { MenuButtonType } from '../core/tool';
3
3
  /**
4
4
  * 工具栏 - 有序列表
5
5
  */
6
- export declare const OrderListToolbarButton: import('vue').DefineSetupFnComponent<{
6
+ export declare const OrderListToolbar: import('vue').DefineSetupFnComponent<{
7
7
  color: string;
8
8
  zIndex: number;
9
- config: MenuButtonType;
10
9
  tooltip: boolean;
11
10
  }, {}, {}, {
12
11
  color: string;
13
12
  zIndex: number;
14
- config: MenuButtonType;
15
13
  tooltip: boolean;
16
14
  } & {}, import('vue').PublicProps>;
17
15
  /**
@@ -1,19 +1,5 @@
1
1
  import { MenuButtonType } from '../core/tool';
2
2
 
3
- /**
4
- * 工具栏 - 任务列表
5
- */
6
- export declare const TaskToolbarButton: import('vue').DefineSetupFnComponent<{
7
- color: string;
8
- zIndex: number;
9
- config: MenuButtonType;
10
- tooltip: boolean;
11
- }, {}, {}, {
12
- color: string;
13
- zIndex: number;
14
- config: MenuButtonType;
15
- tooltip: boolean;
16
- } & {}, import('vue').PublicProps>;
17
3
  /**
18
4
  * 菜单栏 - 任务列表
19
5
  */
@@ -3,15 +3,13 @@ import { MenuButtonType } from '../core/tool';
3
3
  /**
4
4
  * 工具栏 - 无序列表
5
5
  */
6
- export declare const UnorderListToolbarButton: import('vue').DefineSetupFnComponent<{
6
+ export declare const UnorderListToolbar: import('vue').DefineSetupFnComponent<{
7
7
  color: string;
8
8
  zIndex: number;
9
- config: MenuButtonType;
10
9
  tooltip: boolean;
11
10
  }, {}, {}, {
12
11
  color: string;
13
12
  zIndex: number;
14
- config: MenuButtonType;
15
13
  tooltip: boolean;
16
14
  } & {}, import('vue').PublicProps>;
17
15
  /**
package/lib/index.d.ts CHANGED
@@ -437,7 +437,9 @@ declare const Editify: import('./core/tool').SFCWithInstall<import('vue').Define
437
437
  };
438
438
  } | null;
439
439
  __guid: number;
440
- __events: import('alex-editor').ObjectType;
440
+ __events: {
441
+ [key: string]: ((...args: any) => void)[];
442
+ };
441
443
  __oldStack: {
442
444
  key: number;
443
445
  type: import('alex-editor').AlexElementType;
@@ -484,6 +486,12 @@ declare const Editify: import('./core/tool').SFCWithInstall<import('vue').Define
484
486
  __isInputChinese: boolean;
485
487
  __innerSelectionChange: boolean;
486
488
  __chineseInputTimer: any;
489
+ __domObserver: {
490
+ disconnect: () => void;
491
+ observe: (target: Node, options?: MutationObserverInit) => void;
492
+ takeRecords: () => MutationRecord[];
493
+ } | null;
494
+ __illegalDoms: Node[];
487
495
  initRange: () => void;
488
496
  delete: () => void;
489
497
  insertText: (data: string) => void;
@@ -509,6 +517,7 @@ declare const Editify: import('./core/tool').SFCWithInstall<import('vue').Define
509
517
  setEnabled: () => void;
510
518
  emit: (eventName: string, ...value: any) => boolean;
511
519
  on: (eventName: string, eventHandle: (...args: any) => void) => void;
520
+ off: (eventName: string, eventHandle?: (...args: any) => void) => void;
512
521
  destroy: () => void;
513
522
  } | null>;
514
523
  isSourceView: import('vue').Ref<boolean>;
@@ -804,7 +813,7 @@ export type * from './core/tool';
804
813
  export type * from './core/function';
805
814
  export type * from './editify/menu';
806
815
  export type * from './editify/toolbar';
807
- export { elementIsMatch, getMatchElementByElement, getMatchElementByRange, elementIsList, getListByElement, hasListInRange, rangeIsInList, elementIsTask, getTaskByElement, hasTaskInRange, rangeIsInTask, elementIsAttachment, hasAttachmentInRange, elementIsMathformula, getMathformulaByElement, hasMathformulaInRange, elementIsPanel, getPanelByElement, hasPanelInRange, elementIsInfoBlock, getInfoBlockByElement, hasInfoBlockInRange, rangeIsInInfoBlock, hasPreInRange, hasQuoteInRange, hasLinkInRange, hasTableInRange, hasImageInRange, hasVideoInRange, rangeIsInQuote, queryTextStyle, queryTextMark, getRangeText, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setTextStyle, setTextMark, removeTextStyle, removeTextMark, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, insertSeparator } from './core/function';
816
+ export { elementIsMatch, getMatchElementByElement, getMatchElementByRange, elementIsList, getListByElement, hasListInRange, rangeIsInList, elementIsTask, getTaskByElement, hasTaskInRange, rangeIsInTask, elementIsAttachment, hasAttachmentInRange, elementIsMathformula, getMathformulaByElement, hasMathformulaInRange, elementIsPanel, getPanelByElement, hasPanelInRange, elementIsInfoBlock, getInfoBlockByElement, hasInfoBlockInRange, rangeIsInInfoBlock, hasPreInRange, hasTableInRange, hasQuoteInRange, rangeIsInQuote, hasLinkInRange, hasImageInRange, hasVideoInRange, queryTextStyle, setTextStyle, removeTextStyle, queryTextMark, setTextMark, removeTextMark, getRangeText, addSpaceTextToBothSides, setHeading, setIndentIncrease, setIndentDecrease, setQuote, setAlign, setList, setTask, setLineHeight, insertLink, insertImage, insertVideo, insertTable, insertCodeBlock, insertSeparator, insertAttachment, insertMathformula, insertInfoBlock, insertPanel } from './core/function';
808
817
  declare const install: (app: App) => void;
809
- declare const version = "0.2.17";
818
+ declare const version = "0.2.18";
810
819
  export { Editify as default, Editify, install, AlexElement, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-editify",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -17,7 +17,7 @@
17
17
  "lib": "vue-tsc && vite build"
18
18
  },
19
19
  "dependencies": {
20
- "alex-editor": "^1.4.25",
20
+ "alex-editor": "^1.4.30",
21
21
  "dap-util": "^1.5.8",
22
22
  "highlight.js": "^11.8.0",
23
23
  "katex": "^0.16.10",
@@ -31,9 +31,9 @@
31
31
  import { computed, ref } from 'vue'
32
32
  import { common as DapCommon, color as DapColor } from 'dap-util'
33
33
  import { ObjectType } from '@/core/tool'
34
- import { Tooltip } from '@/components/tooltip'
35
- import { Layer } from '@/components/layer'
36
- import { Icon } from '@/components/icon'
34
+ import { Tooltip } from '../tooltip'
35
+ import { Layer } from '../layer'
36
+ import { Icon } from '../icon'
37
37
  import { ButtonOptionsItemType, ButtonParseDisplayConfigType, ButtonParseSelectConfigType, ButtonProps } from './props'
38
38
 
39
39
  defineOptions({
@@ -12,8 +12,8 @@
12
12
  <script setup lang="ts">
13
13
  import { computed } from 'vue'
14
14
  import { common as DapCommon } from 'dap-util'
15
- import { Icon } from '@/components/icon'
16
15
  import { ObjectType } from '@/core/tool'
16
+ import { Icon } from '../icon'
17
17
  import { CheckboxProps } from './props'
18
18
 
19
19
  defineOptions({
@@ -6,7 +6,7 @@
6
6
  </div>
7
7
  <div class="editify-colors-list">
8
8
  <div class="editify-color" :class="{ 'editify-active': value == item.value }" v-for="item in data" :style="{ borderColor: value == item.value ? color || '' : '' }">
9
- <Tooltip block :content="<string>item.label" :disabled="!tooltip">
9
+ <Tooltip block :content="`${item.label}`" :disabled="!tooltip" :z-index="zIndex">
10
10
  <div @click="selectColor(item)" class="editify-color-el" :style="{ background: item.value }"></div>
11
11
  </Tooltip>
12
12
  </div>
@@ -15,9 +15,9 @@
15
15
  </template>
16
16
  <script setup lang="ts">
17
17
  import { inject } from 'vue'
18
- import { Icon } from '@/components/icon'
19
- import { Tooltip } from '@/components/tooltip'
20
- import { ButtonOptionsItemType } from '@/components/button'
18
+ import { Icon } from '../icon'
19
+ import { Tooltip } from '../tooltip'
20
+ import { ButtonOptionsItemType } from '../button'
21
21
  import { ColorsProps } from './props'
22
22
 
23
23
  defineOptions({
@@ -1,5 +1,5 @@
1
1
  import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { ButtonOptionsItemType } from '@/components/button'
2
+ import { ButtonOptionsItemType } from '../button'
3
3
 
4
4
  export const ColorsProps = {
5
5
  //颜色数组
@@ -23,6 +23,11 @@ export const ColorsProps = {
23
23
  tooltip: {
24
24
  type: Boolean,
25
25
  default: false
26
+ },
27
+ //层级
28
+ zIndex: {
29
+ type: Number,
30
+ default: 1
26
31
  }
27
32
  }
28
33
 
@@ -27,7 +27,7 @@
27
27
  import { computed, inject, ref, watch } from 'vue'
28
28
  import { file as DapFile } from 'dap-util'
29
29
  import { ObjectType } from '@/core/tool'
30
- import { Icon } from '@/components/icon'
30
+ import { Icon } from '../icon'
31
31
  import { InsertAttachmentProps } from './props'
32
32
 
33
33
  defineOptions({
@@ -23,7 +23,7 @@
23
23
  import { computed, inject, ref, watch } from 'vue'
24
24
  import { file as DapFile } from 'dap-util'
25
25
  import { ObjectType } from '@/core/tool'
26
- import { Icon } from '@/components/icon'
26
+ import { Icon } from '../icon'
27
27
  import { InsertImageProps } from './props'
28
28
 
29
29
  defineOptions({
@@ -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 '@/components/checkbox'
16
+ import { Checkbox } from '../checkbox'
17
17
  import { InsertLinkProps } from './props'
18
18
 
19
19
  defineOptions({
@@ -23,7 +23,7 @@
23
23
  import { computed, inject, ref, watch } from 'vue'
24
24
  import { file as DapFile } from 'dap-util'
25
25
  import { ObjectType } from '@/core/tool'
26
- import { Icon } from '@/components/icon'
26
+ import { Icon } from '../icon'
27
27
  import { InsertVideoProps } from './props'
28
28
 
29
29
  defineOptions({
@@ -14,7 +14,7 @@
14
14
  import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
15
15
  import { element as DapElement, event as DapEvent } from 'dap-util'
16
16
  import { ObjectType } from '@/core/tool'
17
- import { Triangle, TrianglePlacementType } from '@/components/triangle'
17
+ import { Triangle, TrianglePlacementType } from '../triangle'
18
18
  import { LayerPlacementType, LayerProps } from './props'
19
19
 
20
20
  defineOptions({
@@ -583,7 +583,10 @@ const handleScroll = () => {
583
583
  setScroll(el.parentNode as HTMLElement)
584
584
  }
585
585
  }
586
- setScroll(getNode()! || getScrollNode()!)
586
+ const node = getNode() || getScrollNode()
587
+ if (node) {
588
+ setScroll(node)
589
+ }
587
590
  }
588
591
  //移除上述滚动事件的监听
589
592
  const removeScrollHandle = () => {
@@ -593,7 +596,10 @@ const removeScrollHandle = () => {
593
596
  removeScroll(el.parentNode as HTMLElement)
594
597
  }
595
598
  }
596
- removeScroll(getNode()! || getScrollNode()!)
599
+ const node = getNode() || getScrollNode()
600
+ if (node) {
601
+ removeScroll(node)
602
+ }
597
603
  }
598
604
  //点击定位元素和自身以外的元素关闭浮层
599
605
  const handleClick = (e: Event) => {
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
  <script setup lang="ts">
10
10
  import { ComputedRef, inject, ref } from 'vue'
11
- import { Layer } from '@/components/layer'
11
+ import { Layer } from '../layer'
12
12
  import { TooltipProps } from './props'
13
13
 
14
14
  defineOptions({
@@ -13,7 +13,7 @@
13
13
  </template>
14
14
  <script setup lang="ts">
15
15
  import { inject, onBeforeUnmount, ref, watch } from 'vue'
16
- import { Checkbox } from '@/components/checkbox'
16
+ import { Checkbox } from '../checkbox'
17
17
  import { UpdateLinkProps } from './props'
18
18
 
19
19
  defineOptions({