vue-editify 0.1.17 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -3
- package/examples/App.vue +62 -53
- package/examples/main.ts +4 -4
- package/lib/components/button/button.vue.d.ts +11 -11
- package/lib/components/checkbox/checkbox.vue.d.ts +8 -8
- package/lib/components/colors/colors.vue.d.ts +4 -4
- package/lib/components/icon/icon.vue.d.ts +1 -1
- package/lib/components/insertImage/insertImage.vue.d.ts +9 -9
- package/lib/components/insertLink/insertLink.vue.d.ts +2 -2
- package/lib/components/insertTable/insertTable.vue.d.ts +2 -2
- package/lib/components/insertVideo/insertVideo.vue.d.ts +9 -9
- package/lib/components/layer/layer.vue.d.ts +9 -9
- package/lib/components/menu/menu.vue.d.ts +4 -4
- package/lib/components/toolbar/toolbar.vue.d.ts +9 -9
- package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
- package/lib/components/triangle/triangle.vue.d.ts +4 -4
- package/lib/editify/editify.vue.d.ts +88 -70
- package/lib/editify/props.d.ts +11 -3
- package/lib/editify.es.js +65 -46
- package/lib/editify.umd.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/style.css +1 -1
- package/package.json +45 -45
- package/src/components/button/button.less +145 -145
- package/src/components/button/button.vue +197 -197
- package/src/components/button/props.ts +95 -95
- package/src/components/checkbox/checkbox.less +84 -84
- package/src/components/checkbox/checkbox.vue +68 -68
- package/src/components/checkbox/props.ts +49 -49
- package/src/components/colors/colors.less +75 -75
- package/src/components/colors/colors.vue +36 -36
- package/src/components/colors/props.ts +29 -29
- package/src/components/icon/icon.less +14 -14
- package/src/components/icon/icon.vue +12 -12
- package/src/components/icon/props.ts +11 -11
- package/src/components/insertImage/insertImage.less +135 -135
- package/src/components/insertImage/insertImage.vue +146 -146
- package/src/components/insertImage/props.ts +43 -43
- package/src/components/insertLink/insertLink.less +64 -64
- package/src/components/insertLink/insertLink.vue +58 -58
- package/src/components/insertLink/props.ts +16 -16
- package/src/components/insertTable/insertTable.less +54 -54
- package/src/components/insertTable/insertTable.vue +85 -85
- package/src/components/insertTable/props.ts +27 -27
- package/src/components/insertVideo/insertVideo.less +135 -135
- package/src/components/insertVideo/insertVideo.vue +146 -146
- package/src/components/insertVideo/props.ts +43 -43
- package/src/components/layer/layer.less +49 -49
- package/src/components/layer/layer.vue +598 -598
- package/src/components/layer/props.ts +71 -71
- package/src/components/menu/menu.less +63 -63
- package/src/components/menu/menu.vue +1569 -1569
- package/src/components/menu/props.ts +17 -17
- package/src/components/toolbar/props.ts +35 -35
- package/src/components/toolbar/toolbar.less +89 -89
- package/src/components/toolbar/toolbar.vue +1101 -1101
- package/src/components/tooltip/props.ts +21 -21
- package/src/components/tooltip/tooltip.less +23 -23
- package/src/components/tooltip/tooltip.vue +37 -37
- package/src/components/triangle/props.ts +26 -26
- package/src/components/triangle/triangle.less +79 -79
- package/src/components/triangle/triangle.vue +65 -65
- package/src/core/function.ts +1144 -1144
- package/src/core/rule.ts +259 -259
- package/src/core/tool.ts +1137 -1137
- package/src/css/base.less +30 -30
- package/src/css/hljs.less +54 -54
- package/src/editify/editify.less +404 -403
- package/src/editify/editify.vue +803 -792
- package/src/editify/props.ts +156 -146
- package/src/hljs/index.ts +197 -197
- package/src/icon/iconfont.css +219 -219
- package/src/index.ts +32 -32
- package/src/locale/en_US.ts +88 -88
- package/src/locale/index.ts +12 -12
- package/src/locale/zh_CN.ts +88 -88
- package/tsconfig.json +27 -27
- package/tsconfig.node.json +11 -11
- package/vite-env.d.ts +1 -1
- package/vite.config.ts +42 -42
package/lib/editify.es.js
CHANGED
@@ -2978,11 +2978,11 @@ const doPaste = async function(html, text, files) {
|
|
2978
2978
|
} else {
|
2979
2979
|
let length = files.length;
|
2980
2980
|
for (let i = 0; i < length; i++) {
|
2981
|
-
const url = await file$1.dataFileToBase64(files[i]);
|
2982
2981
|
if (files[i].type.startsWith("image/")) {
|
2983
2982
|
if (typeof this.customImagePaste == "function") {
|
2984
|
-
await this.customImagePaste.apply(this, [
|
2983
|
+
await this.customImagePaste.apply(this, [files[i]]);
|
2985
2984
|
} else {
|
2985
|
+
const url = await file$1.dataFileToBase64(files[i]);
|
2986
2986
|
const image = new AlexElement(
|
2987
2987
|
"closed",
|
2988
2988
|
"img",
|
@@ -2997,8 +2997,9 @@ const doPaste = async function(html, text, files) {
|
|
2997
2997
|
}
|
2998
2998
|
} else if (files[i].type.startsWith("video/")) {
|
2999
2999
|
if (typeof this.customVideoPaste == "function") {
|
3000
|
-
await this.customVideoPaste.apply(this, [
|
3000
|
+
await this.customVideoPaste.apply(this, [files[i]]);
|
3001
3001
|
} else {
|
3002
|
+
const url = await file$1.dataFileToBase64(files[i]);
|
3002
3003
|
const video = new AlexElement(
|
3003
3004
|
"closed",
|
3004
3005
|
"video",
|
@@ -3013,7 +3014,7 @@ const doPaste = async function(html, text, files) {
|
|
3013
3014
|
}
|
3014
3015
|
} else {
|
3015
3016
|
if (typeof this.customFilePaste == "function") {
|
3016
|
-
await this.customFilePaste.apply(this, [
|
3017
|
+
await this.customFilePaste.apply(this, [files[i]]);
|
3017
3018
|
}
|
3018
3019
|
}
|
3019
3020
|
}
|
@@ -20002,7 +20003,7 @@ const _export_sfc = (sfc, props) => {
|
|
20002
20003
|
}
|
20003
20004
|
return target;
|
20004
20005
|
};
|
20005
|
-
const Triangle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-
|
20006
|
+
const Triangle = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-c92dc653"]]);
|
20006
20007
|
const LayerProps = {
|
20007
20008
|
//是否显示
|
20008
20009
|
modelValue: {
|
@@ -20618,7 +20619,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
20618
20619
|
};
|
20619
20620
|
}
|
20620
20621
|
});
|
20621
|
-
const Layer = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
20622
|
+
const Layer = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-a390950f"]]);
|
20622
20623
|
const TooltipProps = {
|
20623
20624
|
//提示内容
|
20624
20625
|
content: {
|
@@ -20694,7 +20695,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
20694
20695
|
};
|
20695
20696
|
}
|
20696
20697
|
});
|
20697
|
-
const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-
|
20698
|
+
const Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-92a30ff2"]]);
|
20698
20699
|
const IconProps = {
|
20699
20700
|
//图标值
|
20700
20701
|
value: {
|
@@ -20716,7 +20717,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
20716
20717
|
};
|
20717
20718
|
}
|
20718
20719
|
});
|
20719
|
-
const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-
|
20720
|
+
const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-a639e8dc"]]);
|
20720
20721
|
const ButtonProps = {
|
20721
20722
|
//按钮类型
|
20722
20723
|
type: {
|
@@ -21028,7 +21029,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
21028
21029
|
};
|
21029
21030
|
}
|
21030
21031
|
});
|
21031
|
-
const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-
|
21032
|
+
const Button = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-73d00a90"]]);
|
21032
21033
|
const CheckboxProps = {
|
21033
21034
|
//是否禁用
|
21034
21035
|
disabled: {
|
@@ -21157,7 +21158,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
21157
21158
|
};
|
21158
21159
|
}
|
21159
21160
|
});
|
21160
|
-
const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
21161
|
+
const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-dae0c4a0"]]);
|
21161
21162
|
const ColorsProps = {
|
21162
21163
|
//颜色数组
|
21163
21164
|
data: {
|
@@ -21234,7 +21235,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
21234
21235
|
};
|
21235
21236
|
}
|
21236
21237
|
});
|
21237
|
-
const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
|
21238
|
+
const Colors = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-8be143e5"]]);
|
21238
21239
|
const ToolbarProps = {
|
21239
21240
|
//是否显示
|
21240
21241
|
modelValue: {
|
@@ -22764,7 +22765,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
22764
22765
|
};
|
22765
22766
|
}
|
22766
22767
|
});
|
22767
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
22768
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-485ac49d"]]);
|
22768
22769
|
const InsertLinkProps = {
|
22769
22770
|
//主题色
|
22770
22771
|
color: {
|
@@ -22867,7 +22868,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
22867
22868
|
};
|
22868
22869
|
}
|
22869
22870
|
});
|
22870
|
-
const InsertLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
22871
|
+
const InsertLink = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f5a1fedb"]]);
|
22871
22872
|
const InsertImageProps = {
|
22872
22873
|
//主题色
|
22873
22874
|
color: {
|
@@ -23065,7 +23066,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
23065
23066
|
};
|
23066
23067
|
}
|
23067
23068
|
});
|
23068
|
-
const InsertImage = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
23069
|
+
const InsertImage = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-876ab662"]]);
|
23069
23070
|
const InsertVideoProps = {
|
23070
23071
|
//主题色
|
23071
23072
|
color: {
|
@@ -23263,7 +23264,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
23263
23264
|
};
|
23264
23265
|
}
|
23265
23266
|
});
|
23266
|
-
const InsertVideo = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
23267
|
+
const InsertVideo = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4131f4db"]]);
|
23267
23268
|
const InsertTableProps = {
|
23268
23269
|
//主题色
|
23269
23270
|
color: {
|
@@ -23281,7 +23282,7 @@ const InsertTableProps = {
|
|
23281
23282
|
default: 10
|
23282
23283
|
}
|
23283
23284
|
};
|
23284
|
-
const _withScopeId = (n) => (pushScopeId("data-v-
|
23285
|
+
const _withScopeId = (n) => (pushScopeId("data-v-49473a7c"), n = n(), popScopeId(), n);
|
23285
23286
|
const _hoisted_1$2 = { class: "editify-table" };
|
23286
23287
|
const _hoisted_2$1 = ["onMouseenter", "onClick"];
|
23287
23288
|
const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, null, -1));
|
@@ -23372,7 +23373,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
23372
23373
|
};
|
23373
23374
|
}
|
23374
23375
|
});
|
23375
|
-
const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
23376
|
+
const InsertTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-49473a7c"]]);
|
23376
23377
|
const MenuProps = {
|
23377
23378
|
//菜单栏配置
|
23378
23379
|
config: {
|
@@ -24714,7 +24715,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
24714
24715
|
};
|
24715
24716
|
}
|
24716
24717
|
});
|
24717
|
-
const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
24718
|
+
const Menu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-98216646"]]);
|
24718
24719
|
const EditifyProps = {
|
24719
24720
|
//国际化语言类型
|
24720
24721
|
locale: {
|
@@ -24789,6 +24790,16 @@ const EditifyProps = {
|
|
24789
24790
|
type: Boolean,
|
24790
24791
|
default: false
|
24791
24792
|
},
|
24793
|
+
//自定义粘贴纯文字
|
24794
|
+
customTextPaste: {
|
24795
|
+
type: Function,
|
24796
|
+
default: null
|
24797
|
+
},
|
24798
|
+
//自定义粘贴html
|
24799
|
+
customHtmlPaste: {
|
24800
|
+
type: Function,
|
24801
|
+
default: null
|
24802
|
+
},
|
24792
24803
|
//自定义粘贴图片
|
24793
24804
|
customImagePaste: {
|
24794
24805
|
type: Function,
|
@@ -25227,9 +25238,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25227
25238
|
allowPaste: props.allowPaste,
|
25228
25239
|
allowCut: props.allowCut,
|
25229
25240
|
allowPasteHtml: props.allowPasteHtml,
|
25241
|
+
customTextPaste: props.customTextPaste,
|
25230
25242
|
customImagePaste: props.customImagePaste,
|
25231
25243
|
customVideoPaste: props.customVideoPaste,
|
25232
25244
|
customFilePaste: props.customFilePaste,
|
25245
|
+
customHtmlPaste: handleCustomHtmlPaste,
|
25233
25246
|
customMerge: handleCustomMerge,
|
25234
25247
|
customParseNode: handleCustomParseNode
|
25235
25248
|
});
|
@@ -25239,7 +25252,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25239
25252
|
editor.value.on("blur", handleEditorBlur);
|
25240
25253
|
editor.value.on("insertParagraph", handleInsertParagraph);
|
25241
25254
|
editor.value.on("rangeUpdate", handleRangeUpdate);
|
25242
|
-
editor.value.on("pasteHtml", handlePasteHtml);
|
25243
25255
|
editor.value.on("deleteInStart", handleDeleteInStart);
|
25244
25256
|
editor.value.on("deleteComplete", handleDeleteComplete);
|
25245
25257
|
editor.value.on("afterRender", handleAfterRender);
|
@@ -25340,7 +25352,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25340
25352
|
const element$12 = editor.value.getElementByKey(key);
|
25341
25353
|
if (isTask(element$12)) {
|
25342
25354
|
const rect = element.getElementBounding(elm);
|
25343
|
-
if (e.pageX >= Math.abs(rect.left) && e.pageX <= Math.abs(rect.left + 16) && e.pageY >= Math.abs(rect.top + 2) && e.pageY <= Math.abs(rect.top +
|
25355
|
+
if (e.pageX >= Math.abs(rect.left) && e.pageX <= Math.abs(rect.left + 16) && e.pageY >= Math.abs(rect.top + elm.offsetHeight / 2 - 8) && e.pageY <= Math.abs(rect.top + elm.offsetHeight / 2 + 8)) {
|
25344
25356
|
if (element$12.marks["data-editify-task"] == "checked") {
|
25345
25357
|
element$12.marks["data-editify-task"] = "uncheck";
|
25346
25358
|
} else {
|
@@ -25359,6 +25371,37 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25359
25371
|
}
|
25360
25372
|
}
|
25361
25373
|
};
|
25374
|
+
const handleCustomHtmlPaste = async (elements) => {
|
25375
|
+
const keepStyles = Object.assign(pasteKeepData.styles, props.pasteKeepStyles || {});
|
25376
|
+
const keepMarks = Object.assign(pasteKeepData.marks, props.pasteKeepMarks || {});
|
25377
|
+
AlexElement.flatElements(elements).forEach((el) => {
|
25378
|
+
let marks = {};
|
25379
|
+
let styles = {};
|
25380
|
+
if (el.hasMarks()) {
|
25381
|
+
for (let key in keepMarks) {
|
25382
|
+
if (el.marks.hasOwnProperty(key) && (Array.isArray(keepMarks[key]) && keepMarks[key].includes(el.parsedom) || keepMarks[key] == "*")) {
|
25383
|
+
marks[key] = el.marks[key];
|
25384
|
+
}
|
25385
|
+
}
|
25386
|
+
el.marks = marks;
|
25387
|
+
}
|
25388
|
+
if (el.hasStyles() && !el.isText()) {
|
25389
|
+
for (let key in keepStyles) {
|
25390
|
+
if (el.styles.hasOwnProperty(key) && (Array.isArray(keepStyles[key]) && keepStyles[key].includes(el.parsedom) || keepStyles[key] == "*")) {
|
25391
|
+
styles[key] = el.styles[key];
|
25392
|
+
}
|
25393
|
+
}
|
25394
|
+
el.styles = styles;
|
25395
|
+
}
|
25396
|
+
});
|
25397
|
+
if (typeof props.customHtmlPaste == "function") {
|
25398
|
+
await props.customHtmlPaste.apply(this, [elements]);
|
25399
|
+
} else {
|
25400
|
+
for (let i = 0; i < elements.length; i++) {
|
25401
|
+
editor.value.insertElement(elements[i], false);
|
25402
|
+
}
|
25403
|
+
}
|
25404
|
+
};
|
25362
25405
|
const handleCustomMerge = (ele, preEle) => {
|
25363
25406
|
const uneditable = preEle.getUneditableElement();
|
25364
25407
|
if (uneditable) {
|
@@ -25498,30 +25541,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25498
25541
|
}, 200);
|
25499
25542
|
emits("rangeupdate");
|
25500
25543
|
};
|
25501
|
-
const handlePasteHtml = (elements) => {
|
25502
|
-
const keepStyles = Object.assign(pasteKeepData.styles, props.pasteKeepStyles || {});
|
25503
|
-
const keepMarks = Object.assign(pasteKeepData.marks, props.pasteKeepMarks || {});
|
25504
|
-
AlexElement.flatElements(elements).forEach((el) => {
|
25505
|
-
let marks = {};
|
25506
|
-
let styles = {};
|
25507
|
-
if (el.hasMarks()) {
|
25508
|
-
for (let key in keepMarks) {
|
25509
|
-
if (el.marks.hasOwnProperty(key) && (Array.isArray(keepMarks[key]) && keepMarks[key].includes(el.parsedom) || keepMarks[key] == "*")) {
|
25510
|
-
marks[key] = el.marks[key];
|
25511
|
-
}
|
25512
|
-
}
|
25513
|
-
el.marks = marks;
|
25514
|
-
}
|
25515
|
-
if (el.hasStyles() && !el.isText()) {
|
25516
|
-
for (let key in keepStyles) {
|
25517
|
-
if (el.styles.hasOwnProperty(key) && (Array.isArray(keepStyles[key]) && keepStyles[key].includes(el.parsedom) || keepStyles[key] == "*")) {
|
25518
|
-
styles[key] = el.styles[key];
|
25519
|
-
}
|
25520
|
-
}
|
25521
|
-
el.styles = styles;
|
25522
|
-
}
|
25523
|
-
});
|
25524
|
-
};
|
25525
25544
|
const handleDeleteInStart = (element2) => {
|
25526
25545
|
if (element2.isBlock()) {
|
25527
25546
|
elementToParagraph(element2);
|
@@ -25719,8 +25738,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25719
25738
|
};
|
25720
25739
|
}
|
25721
25740
|
});
|
25722
|
-
const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
25723
|
-
const version = "0.1.
|
25741
|
+
const Editify = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8c5f5909"]]);
|
25742
|
+
const version = "0.1.19";
|
25724
25743
|
const install = (app) => {
|
25725
25744
|
app.component(Editify.name, Editify);
|
25726
25745
|
};
|