@haluo/biz 2.0.7 → 2.0.9

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.61527b92.js").then(function() {
1832
1836
  me.initSquire();
1833
1837
  });
1834
1838
  } else {
@@ -2375,6 +2379,7 @@ const _sfc_main = {
2375
2379
  this.parseHtml(data, essayPicRelVOList).then((res) => {
2376
2380
  this.editorDom.innerHTML = "";
2377
2381
  this.editor.insertElement(res);
2382
+ this.editor.saveUndoState();
2378
2383
  this.updateData();
2379
2384
  });
2380
2385
  },
@@ -3034,14 +3039,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3034
3039
  }, null, 36),
3035
3040
  createVNode(_component_el_dialog, {
3036
3041
  modelValue: $data.viewLinkDialog,
3037
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = $event),
3042
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.viewLinkDialog = $event),
3038
3043
  "before-close": $options.handleClose,
3039
3044
  class: "squire-dialog-content",
3040
3045
  "append-to-body": ""
3041
3046
  }, {
3042
3047
  default: withCtx(() => [
3043
3048
  createElementVNode("div", _hoisted_2, [
3044
- createVNode(_component_el_form, { model: $data.linkForm }, {
3049
+ createVNode(_component_el_form, {
3050
+ model: $data.linkForm,
3051
+ onSubmit: _cache[3] || (_cache[3] = withModifiers(() => {
3052
+ }, ["prevent"]))
3053
+ }, {
3045
3054
  default: withCtx(() => [
3046
3055
  createVNode(_component_el_form_item, {
3047
3056
  label: "\u6DFB\u52A0\u94FE\u63A5",
@@ -3074,7 +3083,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3074
3083
  ]),
3075
3084
  createElementVNode("div", _hoisted_3, [
3076
3085
  createVNode(_component_el_button, {
3077
- onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
3086
+ onClick: _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = false)
3078
3087
  }, {
3079
3088
  default: withCtx(() => [
3080
3089
  _hoisted_4
@@ -3097,28 +3106,28 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3097
3106
  createVNode(_component_InsertArticle, {
3098
3107
  article: $data.article,
3099
3108
  visible: $data.visibleArticle,
3100
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => $data.visibleArticle = $event),
3109
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => $data.visibleArticle = $event),
3101
3110
  getList: $props.getArticleList,
3102
3111
  onDelete: $options.handleImgDelete,
3103
3112
  onChange: $options.selectArticle
3104
3113
  }, null, 8, ["article", "visible", "getList", "onDelete", "onChange"]),
3105
3114
  createVNode(_component_ImgUpload, {
3106
3115
  "img-list": $data.imgList,
3107
- "onUpdate:img-list": _cache[6] || (_cache[6] = ($event) => $data.imgList = $event),
3116
+ "onUpdate:img-list": _cache[7] || (_cache[7] = ($event) => $data.imgList = $event),
3108
3117
  visible: $data.visibleImg,
3109
- "onUpdate:visible": _cache[7] || (_cache[7] = ($event) => $data.visibleImg = $event),
3118
+ "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleImg = $event),
3110
3119
  onSubmit: $options.submitImg
3111
3120
  }, null, 8, ["img-list", "visible", "onSubmit"]),
3112
3121
  createVNode(_component_VideoUpload, {
3113
3122
  visible: $data.visibleVideo,
3114
- "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleVideo = $event),
3123
+ "onUpdate:visible": _cache[9] || (_cache[9] = ($event) => $data.visibleVideo = $event),
3115
3124
  "file-selected": $options.uploadVideo
3116
3125
  }, null, 8, ["visible", "file-selected"]),
3117
3126
  createVNode(_component_CollectArticle, {
3118
3127
  "link-content": $data.linkContent,
3119
- "onUpdate:link-content": _cache[9] || (_cache[9] = ($event) => $data.linkContent = $event),
3128
+ "onUpdate:link-content": _cache[10] || (_cache[10] = ($event) => $data.linkContent = $event),
3120
3129
  visible: $data.visibleCollectArticle,
3121
- "onUpdate:visible": _cache[10] || (_cache[10] = ($event) => $data.visibleCollectArticle = $event),
3130
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => $data.visibleCollectArticle = $event),
3122
3131
  onSubmit: $options.confirmLink
3123
3132
  }, null, 8, ["link-content", "visible", "onSubmit"]),
3124
3133
  createElementVNode("input", {
@@ -3127,14 +3136,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3127
3136
  multiple: "",
3128
3137
  class: "upload-again-input hide",
3129
3138
  accept: "image/*",
3130
- onChange: _cache[11] || (_cache[11] = (...args) => $options.againImg && $options.againImg(...args))
3139
+ onChange: _cache[12] || (_cache[12] = (...args) => $options.againImg && $options.againImg(...args))
3131
3140
  }, null, 32),
3132
3141
  createElementVNode("input", {
3133
3142
  type: "file",
3134
3143
  name: "file",
3135
3144
  class: "replace-input hide",
3136
3145
  accept: "image/*",
3137
- onChange: _cache[12] || (_cache[12] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3146
+ onChange: _cache[13] || (_cache[13] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3138
3147
  }, null, 32)
3139
3148
  ]);
3140
3149
  }
@@ -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" };
@@ -2377,6 +2381,7 @@
2377
2381
  this.parseHtml(data, essayPicRelVOList).then((res) => {
2378
2382
  this.editorDom.innerHTML = "";
2379
2383
  this.editor.insertElement(res);
2384
+ this.editor.saveUndoState();
2380
2385
  this.updateData();
2381
2386
  });
2382
2387
  },
@@ -3036,14 +3041,18 @@
3036
3041
  }, null, 36),
3037
3042
  vue.createVNode(_component_el_dialog, {
3038
3043
  modelValue: $data.viewLinkDialog,
3039
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = $event),
3044
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.viewLinkDialog = $event),
3040
3045
  "before-close": $options.handleClose,
3041
3046
  class: "squire-dialog-content",
3042
3047
  "append-to-body": ""
3043
3048
  }, {
3044
3049
  default: vue.withCtx(() => [
3045
3050
  vue.createElementVNode("div", _hoisted_2, [
3046
- vue.createVNode(_component_el_form, { model: $data.linkForm }, {
3051
+ vue.createVNode(_component_el_form, {
3052
+ model: $data.linkForm,
3053
+ onSubmit: _cache[3] || (_cache[3] = vue.withModifiers(() => {
3054
+ }, ["prevent"]))
3055
+ }, {
3047
3056
  default: vue.withCtx(() => [
3048
3057
  vue.createVNode(_component_el_form_item, {
3049
3058
  label: "\u6DFB\u52A0\u94FE\u63A5",
@@ -3076,7 +3085,7 @@
3076
3085
  ]),
3077
3086
  vue.createElementVNode("div", _hoisted_3, [
3078
3087
  vue.createVNode(_component_el_button, {
3079
- onClick: _cache[3] || (_cache[3] = ($event) => $data.viewLinkDialog = false)
3088
+ onClick: _cache[4] || (_cache[4] = ($event) => $data.viewLinkDialog = false)
3080
3089
  }, {
3081
3090
  default: vue.withCtx(() => [
3082
3091
  _hoisted_4
@@ -3099,28 +3108,28 @@
3099
3108
  vue.createVNode(_component_InsertArticle, {
3100
3109
  article: $data.article,
3101
3110
  visible: $data.visibleArticle,
3102
- "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => $data.visibleArticle = $event),
3111
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => $data.visibleArticle = $event),
3103
3112
  getList: $props.getArticleList,
3104
3113
  onDelete: $options.handleImgDelete,
3105
3114
  onChange: $options.selectArticle
3106
3115
  }, null, 8, ["article", "visible", "getList", "onDelete", "onChange"]),
3107
3116
  vue.createVNode(_component_ImgUpload, {
3108
3117
  "img-list": $data.imgList,
3109
- "onUpdate:img-list": _cache[6] || (_cache[6] = ($event) => $data.imgList = $event),
3118
+ "onUpdate:img-list": _cache[7] || (_cache[7] = ($event) => $data.imgList = $event),
3110
3119
  visible: $data.visibleImg,
3111
- "onUpdate:visible": _cache[7] || (_cache[7] = ($event) => $data.visibleImg = $event),
3120
+ "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleImg = $event),
3112
3121
  onSubmit: $options.submitImg
3113
3122
  }, null, 8, ["img-list", "visible", "onSubmit"]),
3114
3123
  vue.createVNode(_component_VideoUpload, {
3115
3124
  visible: $data.visibleVideo,
3116
- "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => $data.visibleVideo = $event),
3125
+ "onUpdate:visible": _cache[9] || (_cache[9] = ($event) => $data.visibleVideo = $event),
3117
3126
  "file-selected": $options.uploadVideo
3118
3127
  }, null, 8, ["visible", "file-selected"]),
3119
3128
  vue.createVNode(_component_CollectArticle, {
3120
3129
  "link-content": $data.linkContent,
3121
- "onUpdate:link-content": _cache[9] || (_cache[9] = ($event) => $data.linkContent = $event),
3130
+ "onUpdate:link-content": _cache[10] || (_cache[10] = ($event) => $data.linkContent = $event),
3122
3131
  visible: $data.visibleCollectArticle,
3123
- "onUpdate:visible": _cache[10] || (_cache[10] = ($event) => $data.visibleCollectArticle = $event),
3132
+ "onUpdate:visible": _cache[11] || (_cache[11] = ($event) => $data.visibleCollectArticle = $event),
3124
3133
  onSubmit: $options.confirmLink
3125
3134
  }, null, 8, ["link-content", "visible", "onSubmit"]),
3126
3135
  vue.createElementVNode("input", {
@@ -3129,14 +3138,14 @@
3129
3138
  multiple: "",
3130
3139
  class: "upload-again-input hide",
3131
3140
  accept: "image/*",
3132
- onChange: _cache[11] || (_cache[11] = (...args) => $options.againImg && $options.againImg(...args))
3141
+ onChange: _cache[12] || (_cache[12] = (...args) => $options.againImg && $options.againImg(...args))
3133
3142
  }, null, 32),
3134
3143
  vue.createElementVNode("input", {
3135
3144
  type: "file",
3136
3145
  name: "file",
3137
3146
  class: "replace-input hide",
3138
3147
  accept: "image/*",
3139
- onChange: _cache[12] || (_cache[12] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3148
+ onChange: _cache[13] || (_cache[13] = (...args) => $options.replaceImg && $options.replaceImg(...args))
3140
3149
  }, null, 32)
3141
3150
  ]);
3142
3151
  }
@@ -6373,6 +6382,10 @@
6373
6382
  nodeAfterSplit = this.createDefaultBlock();
6374
6383
  root.appendChild(nodeAfterSplit);
6375
6384
  }
6385
+ const pBlock = el.previousSibling;
6386
+ if (pBlock && isEmptyBlock(pBlock)) {
6387
+ pBlock.remove();
6388
+ }
6376
6389
  range.setStart(nodeAfterSplit, 0);
6377
6390
  range.setEnd(nodeAfterSplit, 0);
6378
6391
  moveRangeBoundariesDownTree(range);
@@ -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);
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.7",
4
+ "version": "2.0.9",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",