editate 0.6.24 → 0.6.25
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/README.md +1 -0
- package/lib/index.cjs +20 -21
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +25 -26
- package/lib/index.js.map +1 -1
- package/lib/plugins/transfer/internalTransfer.d.ts +6 -1
- package/package.json +3 -2
package/lib/index.js
CHANGED
|
@@ -995,21 +995,20 @@ function St(t, e) {
|
|
|
995
995
|
});
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
function Ot(t) {
|
|
998
|
+
function At(t, e) {
|
|
999
|
+
const n = e && e.mime || "application/x-editate-editor";
|
|
1001
1000
|
t.hook("copy", e => {
|
|
1002
|
-
e.setData(
|
|
1001
|
+
e.setData(n, JSON.stringify(w(t.doc, ...W(t.selection))));
|
|
1003
1002
|
}), t.hook("paste", t => {
|
|
1004
1003
|
try {
|
|
1005
|
-
return JSON.parse(t.getData(
|
|
1004
|
+
return JSON.parse(t.getData(n));
|
|
1006
1005
|
} catch (e) {
|
|
1007
1006
|
return null;
|
|
1008
1007
|
}
|
|
1009
1008
|
});
|
|
1010
1009
|
}
|
|
1011
1010
|
|
|
1012
|
-
function
|
|
1011
|
+
function Ot(t, e) {
|
|
1013
1012
|
const n = e.isLocked, r = e => n(h(t.doc, e)[0]), o = (e, r) => {
|
|
1014
1013
|
const [o, c] = e;
|
|
1015
1014
|
for (const [s, i] of v(t.doc, e)) {
|
|
@@ -1057,16 +1056,16 @@ function Rt(t, e) {
|
|
|
1057
1056
|
}
|
|
1058
1057
|
}
|
|
1059
1058
|
i(e);
|
|
1060
|
-
}), t.set(
|
|
1059
|
+
}), t.set(Ot, {
|
|
1061
1060
|
locked: t => F(t) ? r(t[0]) : o(t, !0)
|
|
1062
1061
|
});
|
|
1063
1062
|
}
|
|
1064
1063
|
|
|
1065
|
-
function
|
|
1066
|
-
return t.get(
|
|
1064
|
+
function Rt(t, e = W(t.selection)) {
|
|
1065
|
+
return t.get(Ot).locked(e);
|
|
1067
1066
|
}
|
|
1068
1067
|
|
|
1069
|
-
function
|
|
1068
|
+
function Dt(t) {
|
|
1070
1069
|
t.hook("apply", t => {
|
|
1071
1070
|
console.log("apply", t);
|
|
1072
1071
|
}), t.on("change", () => {
|
|
@@ -1076,26 +1075,26 @@ function Bt(t) {
|
|
|
1076
1075
|
});
|
|
1077
1076
|
}
|
|
1078
1077
|
|
|
1079
|
-
function
|
|
1078
|
+
function Bt(t, e) {
|
|
1080
1079
|
n(e).forEach(n => {
|
|
1081
1080
|
const r = e[n];
|
|
1082
1081
|
t.hook("keyboard", ht(n, r));
|
|
1083
1082
|
});
|
|
1084
1083
|
}
|
|
1085
1084
|
|
|
1086
|
-
var
|
|
1085
|
+
var It = (t, e) => {
|
|
1087
1086
|
const n = parseFloat(t);
|
|
1088
1087
|
return n ? t.endsWith("%") ? n / 100 * e : n : 0;
|
|
1089
|
-
},
|
|
1088
|
+
}, Lt = (t, e, n, r) => [ t + It(n, e), t + e - It(r, e) ], Pt = t => "auto" === t || "scroll" === t || "overlay" === t, Ht = (t, e, [n, r]) => t < n ? t - n : e > r ? e - r : 0, Nt = (t, e, n, r) => {
|
|
1090
1089
|
const o = r ? -n : 0;
|
|
1091
1090
|
return Math.max(o - e, Math.min(t, o + n - e));
|
|
1092
|
-
},
|
|
1091
|
+
}, Ct = (t, [e, n], r) => {
|
|
1093
1092
|
(n || e) && t.scrollBy({
|
|
1094
1093
|
top: n,
|
|
1095
1094
|
left: e,
|
|
1096
1095
|
behavior: r
|
|
1097
1096
|
});
|
|
1098
|
-
},
|
|
1097
|
+
}, Wt = t => {
|
|
1099
1098
|
const e = "auto";
|
|
1100
1099
|
t.hook("mount", (n, r) => {
|
|
1101
1100
|
const o = ct(n), c = o.defaultView, {documentElement: s} = o, i = ((t, e, n) => {
|
|
@@ -1103,7 +1102,7 @@ var Lt = (t, e) => {
|
|
|
1103
1102
|
let c = t;
|
|
1104
1103
|
for (;c && c !== r && c !== o; ) {
|
|
1105
1104
|
const {overflowX: t, overflowY: e} = n.getComputedStyle(c);
|
|
1106
|
-
if (
|
|
1105
|
+
if (Pt(t) || Pt(e)) return c;
|
|
1107
1106
|
c = c.parentElement;
|
|
1108
1107
|
}
|
|
1109
1108
|
return null;
|
|
@@ -1135,13 +1134,13 @@ var Lt = (t, e) => {
|
|
|
1135
1134
|
default:
|
|
1136
1135
|
return [ e, !1 ];
|
|
1137
1136
|
}
|
|
1138
|
-
})(e), h =
|
|
1139
|
-
return [
|
|
1137
|
+
})(e), h = Nt(Ht(n.top, n.bottom, Lt(f.top + l, u, e.scrollPaddingTop, e.scrollPaddingBottom)), o, s - u, p);
|
|
1138
|
+
return [ Nt(Ht(n.left, n.right, Lt(f.left + i, a, e.scrollPaddingLeft, e.scrollPaddingRight)), r, c - a, d), h ];
|
|
1140
1139
|
})(i, l, f) : [ 0, 0 ], p = ((t, e, n, [r, o]) => {
|
|
1141
|
-
const {clientWidth: c, clientHeight: s} = t, i =
|
|
1142
|
-
return [
|
|
1140
|
+
const {clientWidth: c, clientHeight: s} = t, i = Ht(n.top - o, n.bottom - o, Lt(0, s, e.scrollPaddingTop, e.scrollPaddingBottom));
|
|
1141
|
+
return [ Ht(n.left - r, n.right - r, Lt(0, c, e.scrollPaddingLeft, e.scrollPaddingRight)), i ];
|
|
1143
1142
|
})(s, a, f, d);
|
|
1144
|
-
i &&
|
|
1143
|
+
i && Ct(i, d, e), Ct(c, p, e);
|
|
1145
1144
|
}, 50));
|
|
1146
1145
|
});
|
|
1147
1146
|
return () => {
|
|
@@ -1150,7 +1149,7 @@ var Lt = (t, e) => {
|
|
|
1150
1149
|
});
|
|
1151
1150
|
};
|
|
1152
1151
|
|
|
1153
|
-
function
|
|
1152
|
+
function Ft(t, e) {
|
|
1154
1153
|
t.hook("mount", (n, r) => {
|
|
1155
1154
|
let o = !0, c = !1;
|
|
1156
1155
|
const s = t.on("selectionchange", () => {
|
|
@@ -1167,7 +1166,7 @@ function Ut(t, e) {
|
|
|
1167
1166
|
});
|
|
1168
1167
|
}
|
|
1169
1168
|
|
|
1170
|
-
function
|
|
1169
|
+
function Ut(t) {
|
|
1171
1170
|
t.hook("mount", t => {
|
|
1172
1171
|
t.ariaMultiLine = null;
|
|
1173
1172
|
}), t.hook("apply", (t, e) => {
|
|
@@ -1185,17 +1184,17 @@ function Vt(t) {
|
|
|
1185
1184
|
});
|
|
1186
1185
|
}
|
|
1187
1186
|
|
|
1188
|
-
var
|
|
1187
|
+
var Vt = ({text: t, singleline: e, onChange: n, ...r}) => {
|
|
1189
1188
|
const o = Et({
|
|
1190
1189
|
...r,
|
|
1191
1190
|
doc: {
|
|
1192
1191
|
children: M(t)
|
|
1193
1192
|
}
|
|
1194
1193
|
}).exec(Mt);
|
|
1195
|
-
return e && o.exec(
|
|
1194
|
+
return e && o.exec(Ut), o.on("change", () => {
|
|
1196
1195
|
n(E(o.doc));
|
|
1197
1196
|
}), o;
|
|
1198
1197
|
};
|
|
1199
1198
|
|
|
1200
|
-
export { xt as ClearHistory, q as Delete, Y as Format, G as InsertNode, z as InsertText, V as LeavesInRange,
|
|
1199
|
+
export { xt as ClearHistory, q as Delete, Y as Format, G as InsertNode, z as InsertText, V as LeavesInRange, Rt as LockedInRange, mt as Redo, _t as Redoable, X as ReplaceDoc, J as ReplaceText, j as SetBlockAttr, Q as SetVoidAttr, K as ToggleBlockAttr, Z as ToggleFormat, kt as Undo, gt as Undoable, Ot as blockLockPlugin, Et as createEditor, Vt as createPlainEditor, Dt as debugPlugin, wt as fileTransferPlugin, p as getChildAt, y as getLeafAt, h as getLeafBlockAt, k as getNodeOffset, d as getNodeSize, St as htmlTransferPlugin, At as internalTransferPlugin, v as iterLeafBlocks, T as iterLeaves, Bt as keymapPlugin, N as mapPosition, Mt as plainTransferPlugin, Wt as scrollToSelectionPlugin, Ft as selectionRectPlugin, Ut as singlelinePlugin, E as sliceText };
|
|
1201
1200
|
//# sourceMappingURL=index.js.map
|