@haluo/biz 2.0.6 → 2.0.8

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/dist/haluo-biz.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ElTooltip, ElDivider, ElPopover, ElDialog, ElButton, ElRadio, ElInput, ElInfiniteScroll, ElMessage, ElIcon, ElFormItem, ElForm, ElMessageBox } from "element-plus";
2
- import { resolveComponent, resolveDirective, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, normalizeStyle, createCommentVNode, normalizeClass, toDisplayString, withDirectives, Fragment, renderList, createBlock, defineComponent, inject, computed, unref, isRef, renderSlot, createTextVNode, provide, toRefs, reactive, watch, onMounted, withKeys, ref, h, render, vShow } from "vue";
2
+ import { resolveComponent, resolveDirective, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, normalizeStyle, createCommentVNode, normalizeClass, toDisplayString, withDirectives, Fragment, renderList, createBlock, defineComponent, inject, computed, unref, isRef, renderSlot, createTextVNode, provide, toRefs, reactive, watch, onMounted, withKeys, ref, h, render, vShow, withModifiers } from "vue";
3
3
  import { Picture, CircleCloseFilled, Plus } from "@element-plus/icons-vue";
4
4
  import util from "@haluo/util";
5
5
  import draggable from "vuedraggable";
@@ -164,12 +164,16 @@ const _sfc_main$7 = {
164
164
  this.editor.collectArticle();
165
165
  },
166
166
  back(e) {
167
- this.editor.setContent(e);
168
- this.backState = this.editor.editor.getUndoOrRedoState();
167
+ if (this.backState.undo) {
168
+ this.editor.setContent(e);
169
+ this.backState = this.editor.editor.getUndoOrRedoState();
170
+ }
169
171
  },
170
172
  forward(e) {
171
- this.editor.setContent(e);
172
- this.backState = this.editor.editor.getUndoOrRedoState();
173
+ if (this.backState.redo) {
174
+ this.editor.setContent(e);
175
+ this.backState = this.editor.editor.getUndoOrRedoState();
176
+ }
173
177
  },
174
178
  setTitle(e, type) {
175
179
  this.headType = type;
@@ -808,7 +812,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
808
812
  ])
809
813
  ])) : createCommentVNode("", true);
810
814
  }
811
- const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3], ["__scopeId", "data-v-bea66306"]]);
815
+ const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3], ["__scopeId", "data-v-679581a3"]]);
812
816
  const __vite_glob_0_0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAmCAYAAAClI5npAAAA0UlEQVR42uWYwQnDMAxFfckAXkFDmGzgS1foDpnFS3gTb+IFtIDyA4UeBKUtNR8qwTvlkAdyfmSletySmRUwgIIJOijXs9VcLxegwNVDRFYLdHtdCg6wrRKY9l4NUFYIqH1WDeTfCXxXE9w5Ar4tQhBwh7SBjSDg2lJJAj47SAI+OwgC7pDuJAGfHQQBnx0kAZ8dBAF3SOtTgCchybjV2QLKFpihW6BAQn6GA0i4KG4g037H4QaSDiTWUMocyweQcFezBjLrer5TFxR/uaKhL6lOdeUQ8G6X1pQAAAAASUVORK5CYII=";
813
817
  const index_vue_vue_type_style_index_0_lang$4 = "";
814
818
  const _hoisted_1$6 = { class: "basic-dialog_title" };
@@ -1828,7 +1832,7 @@ const _sfc_main = {
1828
1832
  me.editorDom = document.getElementById("editor-content");
1829
1833
  me.editorDom.addEventListener("blur", this.canSetAlign);
1830
1834
  if (!window.Squire) {
1831
- import("./squire-raw.7e84068d.js").then(function() {
1835
+ import("./squire-raw.68995d75.js").then(function() {
1832
1836
  me.initSquire();
1833
1837
  });
1834
1838
  } else {
@@ -3034,14 +3038,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3034
3038
  }, null, 36),
3035
3039
  createVNode(_component_el_dialog, {
3036
3040
  modelValue: $data.viewLinkDialog,
3037
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = $event),
3041
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.viewLinkDialog = $event),
3038
3042
  "before-close": $options.handleClose,
3039
3043
  class: "squire-dialog-content",
3040
3044
  "append-to-body": ""
3041
3045
  }, {
3042
3046
  default: withCtx(() => [
3043
3047
  createElementVNode("div", _hoisted_2, [
3044
- createVNode(_component_el_form, { model: $data.linkForm }, {
3048
+ createVNode(_component_el_form, {
3049
+ model: $data.linkForm,
3050
+ onSubmit: _cache[3] || (_cache[3] = withModifiers(() => {
3051
+ }, ["prevent"]))
3052
+ }, {
3045
3053
  default: withCtx(() => [
3046
3054
  createVNode(_component_el_form_item, {
3047
3055
  label: "\u6DFB\u52A0\u94FE\u63A5",
@@ -3074,7 +3082,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3074
3082
  ]),
3075
3083
  createElementVNode("div", _hoisted_3, [
3076
3084
  createVNode(_component_el_button, {
3077
- onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
3085
+ onClick: _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = false)
3078
3086
  }, {
3079
3087
  default: withCtx(() => [
3080
3088
  _hoisted_4
@@ -3097,28 +3105,28 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3097
3105
  createVNode(_component_InsertArticle, {
3098
3106
  article: $data.article,
3099
3107
  visible: $data.visibleArticle,
3100
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => $data.visibleArticle = $event),
3108
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => $data.visibleArticle = $event),
3101
3109
  getList: $props.getArticleList,
3102
3110
  onDelete: $options.handleImgDelete,
3103
3111
  onChange: $options.selectArticle
3104
3112
  }, null, 8, ["article", "visible", "getList", "onDelete", "onChange"]),
3105
3113
  createVNode(_component_ImgUpload, {
3106
3114
  "img-list": $data.imgList,
3107
- "onUpdate:img-list": _cache[6] || (_cache[6] = ($event) => $data.imgList = $event),
3115
+ "onUpdate:img-list": _cache[7] || (_cache[7] = ($event) => $data.imgList = $event),
3108
3116
  visible: $data.visibleImg,
3109
- "onUpdate:visible": _cache[7] || (_cache[7] = ($event) => $data.visibleImg = $event),
3117
+ "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleImg = $event),
3110
3118
  onSubmit: $options.submitImg
3111
3119
  }, null, 8, ["img-list", "visible", "onSubmit"]),
3112
3120
  createVNode(_component_VideoUpload, {
3113
3121
  visible: $data.visibleVideo,
3114
- "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleVideo = $event),
3122
+ "onUpdate:visible": _cache[9] || (_cache[9] = ($event) => $data.visibleVideo = $event),
3115
3123
  "file-selected": $options.uploadVideo
3116
3124
  }, null, 8, ["visible", "file-selected"]),
3117
3125
  createVNode(_component_CollectArticle, {
3118
3126
  "link-content": $data.linkContent,
3119
- "onUpdate:link-content": _cache[9] || (_cache[9] = ($event) => $data.linkContent = $event),
3127
+ "onUpdate:link-content": _cache[10] || (_cache[10] = ($event) => $data.linkContent = $event),
3120
3128
  visible: $data.visibleCollectArticle,
3121
- "onUpdate:visible": _cache[10] || (_cache[10] = ($event) => $data.visibleCollectArticle = $event),
3129
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => $data.visibleCollectArticle = $event),
3122
3130
  onSubmit: $options.confirmLink
3123
3131
  }, null, 8, ["link-content", "visible", "onSubmit"]),
3124
3132
  createElementVNode("input", {
@@ -3127,14 +3135,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3127
3135
  multiple: "",
3128
3136
  class: "upload-again-input hide",
3129
3137
  accept: "image/*",
3130
- onChange: _cache[11] || (_cache[11] = (...args) => $options.againImg && $options.againImg(...args))
3138
+ onChange: _cache[12] || (_cache[12] = (...args) => $options.againImg && $options.againImg(...args))
3131
3139
  }, null, 32),
3132
3140
  createElementVNode("input", {
3133
3141
  type: "file",
3134
3142
  name: "file",
3135
3143
  class: "replace-input hide",
3136
3144
  accept: "image/*",
3137
- onChange: _cache[12] || (_cache[12] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3145
+ onChange: _cache[13] || (_cache[13] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3138
3146
  }, null, 32)
3139
3147
  ]);
3140
3148
  }
@@ -166,12 +166,16 @@
166
166
  this.editor.collectArticle();
167
167
  },
168
168
  back(e) {
169
- this.editor.setContent(e);
170
- this.backState = this.editor.editor.getUndoOrRedoState();
169
+ if (this.backState.undo) {
170
+ this.editor.setContent(e);
171
+ this.backState = this.editor.editor.getUndoOrRedoState();
172
+ }
171
173
  },
172
174
  forward(e) {
173
- this.editor.setContent(e);
174
- this.backState = this.editor.editor.getUndoOrRedoState();
175
+ if (this.backState.redo) {
176
+ this.editor.setContent(e);
177
+ this.backState = this.editor.editor.getUndoOrRedoState();
178
+ }
175
179
  },
176
180
  setTitle(e, type) {
177
181
  this.headType = type;
@@ -810,7 +814,7 @@
810
814
  ])
811
815
  ])) : vue.createCommentVNode("", true);
812
816
  }
813
- const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3], ["__scopeId", "data-v-bea66306"]]);
817
+ const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3], ["__scopeId", "data-v-679581a3"]]);
814
818
  const __vite_glob_0_0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAmCAYAAAClI5npAAAA0UlEQVR42uWYwQnDMAxFfckAXkFDmGzgS1foDpnFS3gTb+IFtIDyA4UeBKUtNR8qwTvlkAdyfmSletySmRUwgIIJOijXs9VcLxegwNVDRFYLdHtdCg6wrRKY9l4NUFYIqH1WDeTfCXxXE9w5Ar4tQhBwh7SBjSDg2lJJAj47SAI+OwgC7pDuJAGfHQQBnx0kAZ8dBAF3SOtTgCchybjV2QLKFpihW6BAQn6GA0i4KG4g037H4QaSDiTWUMocyweQcFezBjLrer5TFxR/uaKhL6lOdeUQ8G6X1pQAAAAASUVORK5CYII=";
815
819
  const index_vue_vue_type_style_index_0_lang$4 = "";
816
820
  const _hoisted_1$6 = { class: "basic-dialog_title" };
@@ -3036,14 +3040,18 @@
3036
3040
  }, null, 36),
3037
3041
  vue.createVNode(_component_el_dialog, {
3038
3042
  modelValue: $data.viewLinkDialog,
3039
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = $event),
3043
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.viewLinkDialog = $event),
3040
3044
  "before-close": $options.handleClose,
3041
3045
  class: "squire-dialog-content",
3042
3046
  "append-to-body": ""
3043
3047
  }, {
3044
3048
  default: vue.withCtx(() => [
3045
3049
  vue.createElementVNode("div", _hoisted_2, [
3046
- vue.createVNode(_component_el_form, { model: $data.linkForm }, {
3050
+ vue.createVNode(_component_el_form, {
3051
+ model: $data.linkForm,
3052
+ onSubmit: _cache[3] || (_cache[3] = vue.withModifiers(() => {
3053
+ }, ["prevent"]))
3054
+ }, {
3047
3055
  default: vue.withCtx(() => [
3048
3056
  vue.createVNode(_component_el_form_item, {
3049
3057
  label: "\u6DFB\u52A0\u94FE\u63A5",
@@ -3076,7 +3084,7 @@
3076
3084
  ]),
3077
3085
  vue.createElementVNode("div", _hoisted_3, [
3078
3086
  vue.createVNode(_component_el_button, {
3079
- onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
3087
+ onClick: _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = false)
3080
3088
  }, {
3081
3089
  default: vue.withCtx(() => [
3082
3090
  _hoisted_4
@@ -3099,28 +3107,28 @@
3099
3107
  vue.createVNode(_component_InsertArticle, {
3100
3108
  article: $data.article,
3101
3109
  visible: $data.visibleArticle,
3102
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => $data.visibleArticle = $event),
3110
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => $data.visibleArticle = $event),
3103
3111
  getList: $props.getArticleList,
3104
3112
  onDelete: $options.handleImgDelete,
3105
3113
  onChange: $options.selectArticle
3106
3114
  }, null, 8, ["article", "visible", "getList", "onDelete", "onChange"]),
3107
3115
  vue.createVNode(_component_ImgUpload, {
3108
3116
  "img-list": $data.imgList,
3109
- "onUpdate:img-list": _cache[6] || (_cache[6] = ($event) => $data.imgList = $event),
3117
+ "onUpdate:img-list": _cache[7] || (_cache[7] = ($event) => $data.imgList = $event),
3110
3118
  visible: $data.visibleImg,
3111
- "onUpdate:visible": _cache[7] || (_cache[7] = ($event) => $data.visibleImg = $event),
3119
+ "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleImg = $event),
3112
3120
  onSubmit: $options.submitImg
3113
3121
  }, null, 8, ["img-list", "visible", "onSubmit"]),
3114
3122
  vue.createVNode(_component_VideoUpload, {
3115
3123
  visible: $data.visibleVideo,
3116
- "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleVideo = $event),
3124
+ "onUpdate:visible": _cache[9] || (_cache[9] = ($event) => $data.visibleVideo = $event),
3117
3125
  "file-selected": $options.uploadVideo
3118
3126
  }, null, 8, ["visible", "file-selected"]),
3119
3127
  vue.createVNode(_component_CollectArticle, {
3120
3128
  "link-content": $data.linkContent,
3121
- "onUpdate:link-content": _cache[9] || (_cache[9] = ($event) => $data.linkContent = $event),
3129
+ "onUpdate:link-content": _cache[10] || (_cache[10] = ($event) => $data.linkContent = $event),
3122
3130
  visible: $data.visibleCollectArticle,
3123
- "onUpdate:visible": _cache[10] || (_cache[10] = ($event) => $data.visibleCollectArticle = $event),
3131
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => $data.visibleCollectArticle = $event),
3124
3132
  onSubmit: $options.confirmLink
3125
3133
  }, null, 8, ["link-content", "visible", "onSubmit"]),
3126
3134
  vue.createElementVNode("input", {
@@ -3129,14 +3137,14 @@
3129
3137
  multiple: "",
3130
3138
  class: "upload-again-input hide",
3131
3139
  accept: "image/*",
3132
- onChange: _cache[11] || (_cache[11] = (...args) => $options.againImg && $options.againImg(...args))
3140
+ onChange: _cache[12] || (_cache[12] = (...args) => $options.againImg && $options.againImg(...args))
3133
3141
  }, null, 32),
3134
3142
  vue.createElementVNode("input", {
3135
3143
  type: "file",
3136
3144
  name: "file",
3137
3145
  class: "replace-input hide",
3138
3146
  accept: "image/*",
3139
- onChange: _cache[12] || (_cache[12] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3147
+ onChange: _cache[13] || (_cache[13] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3140
3148
  }, null, 32)
3141
3149
  ]);
3142
3150
  }
@@ -6373,6 +6381,10 @@
6373
6381
  nodeAfterSplit = this.createDefaultBlock();
6374
6382
  root.appendChild(nodeAfterSplit);
6375
6383
  }
6384
+ const pBlock = el.previousSibling;
6385
+ if (pBlock && isEmptyBlock(pBlock)) {
6386
+ pBlock.remove();
6387
+ }
6376
6388
  range.setStart(nodeAfterSplit, 0);
6377
6389
  range.setEnd(nodeAfterSplit, 0);
6378
6390
  moveRangeBoundariesDownTree(range);
@@ -6380,6 +6392,7 @@
6380
6392
  this.focus();
6381
6393
  this.setSelection(range);
6382
6394
  this._updatePath(range);
6395
+ this.saveUndoState(range);
6383
6396
  if (!canObserveMutations) {
6384
6397
  this._docWasChanged();
6385
6398
  }
@@ -3230,6 +3230,10 @@
3230
3230
  nodeAfterSplit = this.createDefaultBlock();
3231
3231
  root.appendChild(nodeAfterSplit);
3232
3232
  }
3233
+ const pBlock = el.previousSibling;
3234
+ if (pBlock && isEmptyBlock(pBlock)) {
3235
+ pBlock.remove();
3236
+ }
3233
3237
  range.setStart(nodeAfterSplit, 0);
3234
3238
  range.setEnd(nodeAfterSplit, 0);
3235
3239
  moveRangeBoundariesDownTree(range);
@@ -3237,6 +3241,7 @@
3237
3241
  this.focus();
3238
3242
  this.setSelection(range);
3239
3243
  this._updatePath(range);
3244
+ this.saveUndoState(range);
3240
3245
  if (!canObserveMutations) {
3241
3246
  this._docWasChanged();
3242
3247
  }
package/dist/style.css CHANGED
@@ -1,24 +1,24 @@
1
- .m12[data-v-bea66306] {
1
+ .m12[data-v-679581a3] {
2
2
  margin: 0 12px;
3
3
  }
4
- .ml16[data-v-bea66306] {
4
+ .ml16[data-v-679581a3] {
5
5
  margin-left: 16px;
6
6
  }
7
- .mr12[data-v-bea66306] {
7
+ .mr12[data-v-679581a3] {
8
8
  margin-right: 12px;
9
9
  }
10
- .ml12[data-v-bea66306] {
10
+ .ml12[data-v-679581a3] {
11
11
  margin-left: 12px;
12
12
  }
13
- .mr18[data-v-bea66306] {
13
+ .mr18[data-v-679581a3] {
14
14
  margin-right: 18px;
15
15
  }
16
- .tools[data-v-bea66306] {
16
+ .tools[data-v-679581a3] {
17
17
  z-index: 2;
18
18
  position: relative;
19
19
  background: #FAFAFA;
20
20
  }
21
- .tools .tools-content[data-v-bea66306] {
21
+ .tools .tools-content[data-v-679581a3] {
22
22
  display: -webkit-box;
23
23
  display: -ms-flexbox;
24
24
  display: flex;
@@ -26,13 +26,13 @@
26
26
  -ms-flex-align: center;
27
27
  align-items: center;
28
28
  }
29
- .tools img[data-v-bea66306] {
29
+ .tools img[data-v-679581a3] {
30
30
  cursor: pointer;
31
31
  }
32
- .tools .box[data-v-bea66306] {
32
+ .tools .box[data-v-679581a3] {
33
33
  position: relative;
34
34
  }
35
- .tools .box .box-mask[data-v-bea66306] {
35
+ .tools .box .box-mask[data-v-679581a3] {
36
36
  width: 40px;
37
37
  height: 40px;
38
38
  background: black;
@@ -41,7 +41,7 @@
41
41
  position: absolute;
42
42
  pointer-events: none;
43
43
  }
44
- .tools .tools-title[data-v-bea66306] {
44
+ .tools .tools-title[data-v-679581a3] {
45
45
  color: #333333;
46
46
  font-size: 18px;
47
47
  display: -webkit-box;
@@ -52,25 +52,25 @@
52
52
  align-items: center;
53
53
  cursor: pointer;
54
54
  }
55
- .tools .disable[data-v-bea66306] {
55
+ .tools .disable[data-v-679581a3] {
56
56
  cursor: not-allowed;
57
57
  -webkit-filter: blur(0.6px);
58
58
  filter: blur(0.6px);
59
59
  }
60
- .tools .disable img[data-v-bea66306] {
60
+ .tools .disable img[data-v-679581a3] {
61
61
  cursor: not-allowed;
62
62
  }
63
- .tools .wrap[data-v-bea66306] {
63
+ .tools .wrap[data-v-679581a3] {
64
64
  position: relative;
65
65
  }
66
- .tools[data-v-bea66306] .m-colorPicker {
66
+ .tools[data-v-679581a3] .m-colorPicker {
67
67
  position: absolute;
68
68
  width: 100%;
69
69
  left: 0;
70
70
  z-index: -1;
71
71
  height: 100%;
72
72
  }
73
- .tools[data-v-bea66306] .m-colorPicker .colorBtn {
73
+ .tools[data-v-679581a3] .m-colorPicker .colorBtn {
74
74
  width: 100%;
75
75
  height: 100%;
76
76
  opacity: 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haluo/biz",
3
3
  "description": "rich text",
4
- "version": "2.0.6",
4
+ "version": "2.0.8",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",