vue-editify 0.0.28 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- package/examples/App.vue +1 -0
- package/lib/editify.es.js +68 -35
- package/lib/editify.umd.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +2 -2
- package/src/Editify.vue +1 -0
- package/src/components/bussiness/Menu.vue +1 -0
- package/src/index.js +1 -1
package/examples/App.vue
CHANGED
@@ -11,6 +11,7 @@ export default {
|
|
11
11
|
return {
|
12
12
|
value: '<p><span>这是一个基于 </span><span data-editify-code="true">Vue3 + alex-editor</span><span> 构建的一套</span><span style="font-weight: bold;">精美UI样式</span><span>的</span><span style="font-weight: bold;">开箱即用</span><span>的</span><span style="color: #ec1a0a;">富文本编辑器</span></p>',
|
13
13
|
menuConfig: {
|
14
|
+
mode: 'inner',
|
14
15
|
sequence: {
|
15
16
|
alert: 100
|
16
17
|
},
|
package/lib/editify.es.js
CHANGED
@@ -2969,9 +2969,11 @@ const emptyDefaultBehaviorInblock = function(element2) {
|
|
2969
2969
|
}
|
2970
2970
|
};
|
2971
2971
|
const setRangeInVisible = function() {
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2972
|
+
var _a;
|
2973
|
+
const fn = async (root) => {
|
2974
|
+
const scrollHeight = obj$1.element.getScrollHeight(root);
|
2975
|
+
const scrollWidth = obj$1.element.getScrollWidth(root);
|
2976
|
+
if (root.clientHeight < scrollHeight || root.clientWidth < scrollWidth) {
|
2975
2977
|
const selection = window.getSelection();
|
2976
2978
|
if (selection.rangeCount == 0) {
|
2977
2979
|
return;
|
@@ -2983,36 +2985,65 @@ const setRangeInVisible = function() {
|
|
2983
2985
|
target = this.range.focus.element.elm;
|
2984
2986
|
}
|
2985
2987
|
const childRect = target.getBoundingClientRect();
|
2986
|
-
const parentRect =
|
2987
|
-
if (
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
2988
|
+
const parentRect = root.getBoundingClientRect();
|
2989
|
+
if (root.clientHeight < scrollHeight) {
|
2990
|
+
if (childRect.top < parentRect.top) {
|
2991
|
+
await obj$1.element.setScrollTop({
|
2992
|
+
el: root,
|
2993
|
+
number: 0
|
2994
|
+
});
|
2995
|
+
const tempChildRect = target.getBoundingClientRect();
|
2996
|
+
const tempParentRect = root.getBoundingClientRect();
|
2997
|
+
obj$1.element.setScrollTop({
|
2998
|
+
el: root,
|
2999
|
+
number: tempChildRect.top - tempParentRect.top - tempChildRect.height * 2
|
3000
|
+
});
|
3001
|
+
} else if (childRect.bottom > parentRect.bottom) {
|
3002
|
+
await obj$1.element.setScrollTop({
|
3003
|
+
el: root,
|
3004
|
+
number: 0
|
3005
|
+
});
|
3006
|
+
const tempChildRect = target.getBoundingClientRect();
|
3007
|
+
const tempParentRect = root.getBoundingClientRect();
|
3008
|
+
obj$1.element.setScrollTop({
|
3009
|
+
el: root,
|
3010
|
+
number: tempChildRect.bottom - tempParentRect.bottom + tempChildRect.height * 2
|
3011
|
+
});
|
3012
|
+
}
|
3013
|
+
}
|
3014
|
+
if (root.clientWidth < scrollWidth) {
|
3015
|
+
if (childRect.left < parentRect.left) {
|
3016
|
+
await obj$1.element.setScrollLeft({
|
3017
|
+
el: root,
|
3018
|
+
number: 0
|
3019
|
+
});
|
3020
|
+
const tempChildRect = target.getBoundingClientRect();
|
3021
|
+
const tempParentRect = root.getBoundingClientRect();
|
3022
|
+
obj$1.element.setScrollLeft({
|
3023
|
+
el: root,
|
3024
|
+
number: tempChildRect.left - tempParentRect.left - tempChildRect.width * 2 - (tempChildRect.width * 2 > 20 ? 0 : 20)
|
3025
|
+
});
|
3026
|
+
} else if (childRect.right > parentRect.right) {
|
3027
|
+
await obj$1.element.setScrollLeft({
|
3028
|
+
el: root,
|
3029
|
+
number: 0
|
3030
|
+
});
|
3031
|
+
const tempChildRect = target.getBoundingClientRect();
|
3032
|
+
const tempParentRect = root.getBoundingClientRect();
|
3033
|
+
obj$1.element.setScrollLeft({
|
3034
|
+
el: root,
|
3035
|
+
number: tempChildRect.right - tempParentRect.right + tempChildRect.width * 2 + (tempChildRect.width * 2 > 20 ? 0 : 20)
|
3036
|
+
});
|
3037
|
+
}
|
3009
3038
|
}
|
3010
3039
|
}
|
3011
3040
|
};
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
|
3041
|
+
if ((_a = this.range) == null ? void 0 : _a.focus.element.elm) {
|
3042
|
+
let root = this.range.focus.element.elm;
|
3043
|
+
while (obj$1.element.isElement(root) && root != document.documentElement) {
|
3044
|
+
fn(root);
|
3045
|
+
root = root.parentNode;
|
3046
|
+
}
|
3016
3047
|
}
|
3017
3048
|
};
|
3018
3049
|
const handleStackEmpty = function() {
|
@@ -3089,6 +3120,7 @@ const handleSelectionChange = function() {
|
|
3089
3120
|
} else {
|
3090
3121
|
this.range = new AlexRange(anchor, focus);
|
3091
3122
|
}
|
3123
|
+
this.history.updateCurrentRange(this.range);
|
3092
3124
|
this.emit("rangeUpdate", this.range);
|
3093
3125
|
}
|
3094
3126
|
}
|
@@ -4124,6 +4156,7 @@ class AlexEditor {
|
|
4124
4156
|
setTimeout(() => {
|
4125
4157
|
setRangeInVisible.apply(this);
|
4126
4158
|
this.__innerSelectionChange = false;
|
4159
|
+
this.history.updateCurrentRange(this.range);
|
4127
4160
|
this.emit("rangeUpdate", this.range);
|
4128
4161
|
}, 0);
|
4129
4162
|
}
|
@@ -19934,7 +19967,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
19934
19967
|
]);
|
19935
19968
|
}
|
19936
19969
|
const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-227ede65"]]);
|
19937
|
-
const
|
19970
|
+
const Menu_vue_vue_type_style_index_0_scoped_c607fd63_lang = "";
|
19938
19971
|
const _sfc_main$1 = {
|
19939
19972
|
name: "Menu",
|
19940
19973
|
props: {
|
@@ -21152,8 +21185,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
21152
21185
|
}), 256))
|
21153
21186
|
], 14, _hoisted_1$1);
|
21154
21187
|
}
|
21155
|
-
const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-
|
21156
|
-
const
|
21188
|
+
const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-c607fd63"]]);
|
21189
|
+
const Editify_vue_vue_type_style_index_0_scoped_dba8a206_lang = "";
|
21157
21190
|
const _sfc_main = {
|
21158
21191
|
name: "editify",
|
21159
21192
|
props: { ...editorProps },
|
@@ -22750,7 +22783,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
22750
22783
|
])) : createCommentVNode("", true)
|
22751
22784
|
]);
|
22752
22785
|
}
|
22753
|
-
const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
22786
|
+
const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-dba8a206"]]);
|
22754
22787
|
const iconfont = "";
|
22755
22788
|
const en_US = {
|
22756
22789
|
textWrapUp: "Up feed",
|
@@ -22929,7 +22962,7 @@ const i18n = (locale) => {
|
|
22929
22962
|
return translations[locale][key];
|
22930
22963
|
};
|
22931
22964
|
};
|
22932
|
-
const version = "0.0.
|
22965
|
+
const version = "0.0.30";
|
22933
22966
|
const install = (app, props) => {
|
22934
22967
|
const locale = (props ? props.locale : "zh_CN") || "zh_CN";
|
22935
22968
|
app.provide("$editTrans", i18n(locale));
|