digi-mathchem-editor 1.0.28 → 1.0.30
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/digi-mathchem-editor.es.js +80 -38
- package/dist/digi-mathchem-editor.umd.js +36 -12
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,24 @@ const J = {
|
|
|
24
24
|
},
|
|
25
25
|
notni: {
|
|
26
26
|
def: "\\mathrel{\\char`∌}"
|
|
27
|
+
},
|
|
28
|
+
cmeNotEqual: {
|
|
29
|
+
def: "\\class{cme-not-equal}{=}"
|
|
30
|
+
},
|
|
31
|
+
cmeNotApprox: {
|
|
32
|
+
def: "\\class{cme-not-approx}{\\approx}"
|
|
33
|
+
},
|
|
34
|
+
cmeNotEquiv: {
|
|
35
|
+
def: "\\class{cme-not-equiv}{\\equiv}"
|
|
36
|
+
},
|
|
37
|
+
cmeNotSim: {
|
|
38
|
+
def: "\\class{cme-not-sim}{\\sim}"
|
|
39
|
+
},
|
|
40
|
+
napprox: {
|
|
41
|
+
def: "\\class{cme-not-approx}{\\approx}"
|
|
42
|
+
},
|
|
43
|
+
nequiv: {
|
|
44
|
+
def: "\\class{cme-not-equiv}{\\equiv}"
|
|
27
45
|
}
|
|
28
46
|
};
|
|
29
47
|
typeof window < "u" && (window.__cme_macros = {
|
|
@@ -210,7 +228,7 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
|
|
|
210
228
|
<rect x="9" y="7" width="6" height="10" rx="1" stroke="#2E7D32" stroke-width="2" fill="none" />
|
|
211
229
|
<line x1="9" y1="21" x2="15" y2="3" stroke="#666" stroke-width="2" stroke-linecap="round" />
|
|
212
230
|
</svg>`,
|
|
213
|
-
insert: "\\cancel{#?}",
|
|
231
|
+
insert: "\\class{cme-cancel-strike}{#?}",
|
|
214
232
|
isWidget: !0,
|
|
215
233
|
title: "Cancel strike"
|
|
216
234
|
},
|
|
@@ -269,9 +287,9 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
|
|
|
269
287
|
moreCols: 2,
|
|
270
288
|
small: !0,
|
|
271
289
|
moreItems: [
|
|
272
|
-
{ label: "≠", insert: "\\
|
|
273
|
-
{ label: "≉", insert: "\\not\\approx", title: "Not almost equal to" },
|
|
274
|
-
{ label: "≢", insert: "\\not\\equiv", title: "Not identical to" },
|
|
290
|
+
{ label: "≠", insert: "\\class{cme-not-equal}{=}", title: "Not equal" },
|
|
291
|
+
{ label: "≉", insert: "\\class{cme-not-approx}{\\approx}", title: "Not almost equal to" },
|
|
292
|
+
{ label: "≢", insert: "\\class{cme-not-equiv}{\\equiv}", title: "Not identical to" },
|
|
275
293
|
{ label: "≁", insert: "\\nsim", title: "Not similar" }
|
|
276
294
|
]
|
|
277
295
|
},
|
|
@@ -4265,7 +4283,7 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
|
|
|
4265
4283
|
<rect x="9" y="7" width="6" height="10" rx="1" stroke="#2E7D32" stroke-width="2" fill="none" />
|
|
4266
4284
|
<line x1="9" y1="21" x2="15" y2="3" stroke="#666" stroke-width="2" stroke-linecap="round" />
|
|
4267
4285
|
</svg>`,
|
|
4268
|
-
insert: "\\cancel{#?}",
|
|
4286
|
+
insert: "\\class{cme-cancel-strike}{#?}",
|
|
4269
4287
|
isWidget: !0,
|
|
4270
4288
|
title: "Cancel strike"
|
|
4271
4289
|
},
|
|
@@ -4324,9 +4342,9 @@ const z = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAA
|
|
|
4324
4342
|
moreCols: 2,
|
|
4325
4343
|
small: !0,
|
|
4326
4344
|
moreItems: [
|
|
4327
|
-
{ label: "≠", insert: "\\
|
|
4328
|
-
{ label: "≉", insert: "\\not\\approx", title: "Not almost equal to" },
|
|
4329
|
-
{ label: "≢", insert: "\\not\\equiv", title: "Not identical to" },
|
|
4345
|
+
{ label: "≠", insert: "\\class{cme-not-equal}{=}", title: "Not equal" },
|
|
4346
|
+
{ label: "≉", insert: "\\class{cme-not-approx}{\\approx}", title: "Not almost equal to" },
|
|
4347
|
+
{ label: "≢", insert: "\\class{cme-not-equiv}{\\equiv}", title: "Not identical to" },
|
|
4330
4348
|
{ label: "≁", insert: "\\not\\sim", title: "Not similar" }
|
|
4331
4349
|
]
|
|
4332
4350
|
},
|
|
@@ -7637,8 +7655,8 @@ const Z = "data-mathfield-shadow-styles", ot = `
|
|
|
7637
7655
|
position: absolute;
|
|
7638
7656
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
7639
7657
|
background: currentColor;
|
|
7640
|
-
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='
|
|
7641
|
-
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='
|
|
7658
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7659
|
+
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7642
7660
|
-webkit-mask-size: 100% 100%;
|
|
7643
7661
|
mask-size: 100% 100%;
|
|
7644
7662
|
pointer-events: none;
|
|
@@ -7652,8 +7670,8 @@ const Z = "data-mathfield-shadow-styles", ot = `
|
|
|
7652
7670
|
position: absolute;
|
|
7653
7671
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
7654
7672
|
background: currentColor;
|
|
7655
|
-
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='
|
|
7656
|
-
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='
|
|
7673
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7674
|
+
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7657
7675
|
-webkit-mask-size: 100% 100%;
|
|
7658
7676
|
mask-size: 100% 100%;
|
|
7659
7677
|
pointer-events: none;
|
|
@@ -7667,8 +7685,8 @@ const Z = "data-mathfield-shadow-styles", ot = `
|
|
|
7667
7685
|
position: absolute;
|
|
7668
7686
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
7669
7687
|
background: currentColor;
|
|
7670
|
-
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='
|
|
7671
|
-
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='
|
|
7688
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7689
|
+
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3Cline x1='0' y1='0' x2='100' y2='100' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7672
7690
|
-webkit-mask-size: 100% 100%;
|
|
7673
7691
|
mask-size: 100% 100%;
|
|
7674
7692
|
pointer-events: none;
|
|
@@ -7682,8 +7700,32 @@ const Z = "data-mathfield-shadow-styles", ot = `
|
|
|
7682
7700
|
position: absolute;
|
|
7683
7701
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
7684
7702
|
background: currentColor;
|
|
7685
|
-
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='
|
|
7686
|
-
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='
|
|
7703
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7704
|
+
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='0' y1='50' x2='100' y2='50' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' /%3E%3C/svg%3E");
|
|
7705
|
+
-webkit-mask-size: 100% 100%;
|
|
7706
|
+
mask-size: 100% 100%;
|
|
7707
|
+
pointer-events: none;
|
|
7708
|
+
}
|
|
7709
|
+
.cme-not-equal,
|
|
7710
|
+
.cme-not-approx,
|
|
7711
|
+
.cme-not-equiv,
|
|
7712
|
+
.cme-not-sim {
|
|
7713
|
+
display: inline-block;
|
|
7714
|
+
position: relative;
|
|
7715
|
+
}
|
|
7716
|
+
.cme-not-equal::after,
|
|
7717
|
+
.cme-not-approx::after,
|
|
7718
|
+
.cme-not-equiv::after,
|
|
7719
|
+
.cme-not-sim::after {
|
|
7720
|
+
content: '';
|
|
7721
|
+
position: absolute;
|
|
7722
|
+
top: -0.02em;
|
|
7723
|
+
bottom: -0.02em;
|
|
7724
|
+
left: 0;
|
|
7725
|
+
right: 0;
|
|
7726
|
+
background: currentColor;
|
|
7727
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='28' y1='86' x2='72' y2='14' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' stroke-linecap='round' /%3E%3C/svg%3E");
|
|
7728
|
+
mask-image: url("data:image/svg+xml,%3Csvg preserveAspectRatio='none' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='28' y1='86' x2='72' y2='14' stroke='black' stroke-width='1.5' vector-effect='non-scaling-stroke' stroke-linecap='round' /%3E%3C/svg%3E");
|
|
7687
7729
|
-webkit-mask-size: 100% 100%;
|
|
7688
7730
|
mask-size: 100% 100%;
|
|
7689
7731
|
pointer-events: none;
|
|
@@ -7978,7 +8020,7 @@ class dt {
|
|
|
7978
8020
|
this.close();
|
|
7979
8021
|
}
|
|
7980
8022
|
}
|
|
7981
|
-
const mt = "1.0.
|
|
8023
|
+
const mt = "1.0.30", E = {
|
|
7982
8024
|
version: mt
|
|
7983
8025
|
};
|
|
7984
8026
|
typeof window < "u" && (window.MathfieldElement ? window.MathfieldElement.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts" : V && (V.fontsDirectory = "https://cdn.jsdelivr.net/npm/mathlive/dist/fonts"));
|
|
@@ -8459,28 +8501,28 @@ const D = class D {
|
|
|
8459
8501
|
}
|
|
8460
8502
|
const c = h.action === "BOLD", g = h.action === "ITALIC", x = h.action === "TEXT_COLOR", u = h.action === "SPECIAL_CHARS", y = c && this.activeStyles.bold || g && this.activeStyles.italic || x && this.activeStyles.color !== "none", w = document.createElement("button");
|
|
8461
8503
|
w.type = "button", w.className = "cme-btn" + (e.isTemplate ? " template" : "") + (h.cls ? ` ${h.cls}` : "") + (y ? " active" : ""), w.title = h.title || h.label || h.insert || "", typeof h.label == "string" && (h.label.includes("<svg") || h.label.includes("<img") || h.label.includes("<strong") || h.label.includes("<em")) ? w.innerHTML = h.label : typeof h.label == "string" && (w.textContent = h.label), w.addEventListener("mousedown", (k) => {
|
|
8462
|
-
var p, b, m, M, d, S, C,
|
|
8504
|
+
var p, b, m, M, d, S, C, v, T, I;
|
|
8463
8505
|
k.preventDefault();
|
|
8464
8506
|
const i = this.mathField;
|
|
8465
8507
|
if (u) {
|
|
8466
8508
|
this.closeAllPopups();
|
|
8467
|
-
const
|
|
8468
|
-
this.openSpecialCharacters(
|
|
8509
|
+
const f = w.getBoundingClientRect();
|
|
8510
|
+
this.openSpecialCharacters(f);
|
|
8469
8511
|
} else if (x)
|
|
8470
8512
|
if (this.colorPickerPopup && this.activeColorBtn === w)
|
|
8471
8513
|
this.closeColorPicker();
|
|
8472
8514
|
else {
|
|
8473
|
-
const
|
|
8474
|
-
this.openColorPicker(
|
|
8515
|
+
const f = w.getBoundingClientRect();
|
|
8516
|
+
this.openColorPicker(f, w);
|
|
8475
8517
|
}
|
|
8476
8518
|
else if (c) {
|
|
8477
8519
|
if (this.closeAllPopups(), this.explicitToggle = !0, this.activeStyles.bold = !this.activeStyles.bold, i) {
|
|
8478
8520
|
if (i.selectionIsCollapsed)
|
|
8479
8521
|
this.activeStyles.bold || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontSeries));
|
|
8480
8522
|
else {
|
|
8481
|
-
const
|
|
8482
|
-
if (
|
|
8483
|
-
const R = F(
|
|
8523
|
+
const f = this.getSelectionLatex(i);
|
|
8524
|
+
if (f && f.trim()) {
|
|
8525
|
+
const R = F(f.trim()), A = B(
|
|
8484
8526
|
R,
|
|
8485
8527
|
this.activeStyles.bold,
|
|
8486
8528
|
this.activeStyles.italic,
|
|
@@ -8511,9 +8553,9 @@ const D = class D {
|
|
|
8511
8553
|
if (i.selectionIsCollapsed)
|
|
8512
8554
|
this.activeStyles.italic || (i.styleBias = "none", i.defaultStyle && (delete i.defaultStyle.variantStyle, delete i.defaultStyle.fontShape));
|
|
8513
8555
|
else {
|
|
8514
|
-
const
|
|
8515
|
-
if (
|
|
8516
|
-
const R = F(
|
|
8556
|
+
const f = this.getSelectionLatex(i);
|
|
8557
|
+
if (f && f.trim()) {
|
|
8558
|
+
const R = F(f.trim()), A = B(
|
|
8517
8559
|
R,
|
|
8518
8560
|
this.activeStyles.bold,
|
|
8519
8561
|
this.activeStyles.italic,
|
|
@@ -8546,15 +8588,15 @@ const D = class D {
|
|
|
8546
8588
|
else if (h.action === "CUT")
|
|
8547
8589
|
this.closeAllPopups(), (d = i == null ? void 0 : i.focus) == null || d.call(i), (S = i == null ? void 0 : i.executeCommand) == null || S.call(i, "cutToClipboard");
|
|
8548
8590
|
else if (h.action === "COPY")
|
|
8549
|
-
this.closeAllPopups(), (C = i == null ? void 0 : i.focus) == null || C.call(i), (
|
|
8591
|
+
this.closeAllPopups(), (C = i == null ? void 0 : i.focus) == null || C.call(i), (v = i == null ? void 0 : i.executeCommand) == null || v.call(i, "copyToClipboard");
|
|
8550
8592
|
else if (h.action === "PASTE")
|
|
8551
8593
|
this.closeAllPopups(), (T = i == null ? void 0 : i.focus) == null || T.call(i), (I = i == null ? void 0 : i.executeCommand) == null || I.call(i, "pasteFromClipboard");
|
|
8552
8594
|
else if (h.action === "MATRIX_HOVER")
|
|
8553
8595
|
if (this.activeMatrixPopup && this.activeMatrixBtn === w)
|
|
8554
8596
|
this.closeMatrixPopup();
|
|
8555
8597
|
else {
|
|
8556
|
-
const
|
|
8557
|
-
this.openMatrixGrid(h.matrixType || "matrix",
|
|
8598
|
+
const f = w.getBoundingClientRect();
|
|
8599
|
+
this.openMatrixGrid(h.matrixType || "matrix", f, w);
|
|
8558
8600
|
}
|
|
8559
8601
|
else
|
|
8560
8602
|
this.insertAtCursor(h);
|
|
@@ -8617,21 +8659,21 @@ const D = class D {
|
|
|
8617
8659
|
const m = document.createElement("button");
|
|
8618
8660
|
m.type = "button", m.className = "cme-matrix-insert-btn", m.textContent = "INSERT", h.appendChild(c), h.appendChild(m);
|
|
8619
8661
|
const M = (d, S) => {
|
|
8620
|
-
l = Math.max(1, Math.min(10, d)), n = Math.max(1, Math.min(10, S)), g.value = l, k.value = n, o.querySelectorAll(".cme-matrix-hover-cell").forEach((
|
|
8621
|
-
const T = parseInt(
|
|
8622
|
-
T <= l && I <= n ?
|
|
8662
|
+
l = Math.max(1, Math.min(10, d)), n = Math.max(1, Math.min(10, S)), g.value = l, k.value = n, o.querySelectorAll(".cme-matrix-hover-cell").forEach((v) => {
|
|
8663
|
+
const T = parseInt(v.dataset.row, 10), I = parseInt(v.dataset.col, 10);
|
|
8664
|
+
T <= l && I <= n ? v.classList.add("selected") : v.classList.remove("selected");
|
|
8623
8665
|
});
|
|
8624
8666
|
};
|
|
8625
8667
|
for (let d = 1; d <= 5; d++) {
|
|
8626
8668
|
const S = document.createElement("div");
|
|
8627
8669
|
S.className = "cme-matrix-hover-row";
|
|
8628
8670
|
for (let C = 1; C <= 10; C++) {
|
|
8629
|
-
const
|
|
8630
|
-
|
|
8671
|
+
const v = document.createElement("div");
|
|
8672
|
+
v.className = "cme-matrix-hover-cell" + (d <= l && C <= n ? " selected" : ""), v.dataset.row = d, v.dataset.col = C, v.addEventListener("mouseenter", () => {
|
|
8631
8673
|
M(d, C);
|
|
8632
|
-
}),
|
|
8674
|
+
}), v.addEventListener("click", (T) => {
|
|
8633
8675
|
T.stopPropagation(), this.insertMatrix(t, d, C), this.closeMatrixPopup();
|
|
8634
|
-
}), S.appendChild(
|
|
8676
|
+
}), S.appendChild(v);
|
|
8635
8677
|
}
|
|
8636
8678
|
o.appendChild(S);
|
|
8637
8679
|
}
|