md-editor-v3 4.17.1 → 4.17.2
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/lib/cjs/MdEditor.cjs +12 -10
- package/lib/cjs/chunks/index.cjs +3 -1
- package/lib/es/MdEditor.mjs +12 -10
- package/lib/es/chunks/index.mjs +3 -1
- package/lib/umd/index.js +39 -39
- package/package.json +1 -1
package/lib/cjs/MdEditor.cjs
CHANGED
|
@@ -1334,7 +1334,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1334
1334
|
let pLock = 0;
|
|
1335
1335
|
let cLock = 0;
|
|
1336
1336
|
const pEleHandler = () => {
|
|
1337
|
-
var _a, _b
|
|
1337
|
+
var _a, _b;
|
|
1338
1338
|
if (cLock !== 0) {
|
|
1339
1339
|
return false;
|
|
1340
1340
|
}
|
|
@@ -1354,7 +1354,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1354
1354
|
const cMaxScrollLength = cEle.scrollHeight - cEle.clientHeight;
|
|
1355
1355
|
let startTop = getTopByLine(blockData.start);
|
|
1356
1356
|
let endBottom = getBottomByLine(blockData.end);
|
|
1357
|
-
let startEleOffetTop = startEle.offsetTop;
|
|
1357
|
+
let startEleOffetTop = startEle.offsetTop - getComputedStyleNum(startEle, "margin-top");
|
|
1358
1358
|
let blockHeight = endEle.offsetTop - startEleOffetTop;
|
|
1359
1359
|
if (startTop === 0) {
|
|
1360
1360
|
startEleOffetTop = 0;
|
|
@@ -1367,11 +1367,12 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
1369
|
scale = (scrollDOM.scrollTop - startTop + getComputedStyleNum(view2.contentDOM, "padding-bottom")) / (endBottom - startTop);
|
|
1370
|
-
if (startTop
|
|
1370
|
+
if (startTop >= 0 && (endBottom >= pMaxScrollLength || endEle.offsetTop + endEle.clientHeight > cMaxScrollLength)) {
|
|
1371
1371
|
const lineNumer = getLineNumber(pMaxScrollLength, cMaxScrollLength);
|
|
1372
1372
|
startTop = getTopByLine(lineNumer);
|
|
1373
1373
|
scale = (scrollDOM.scrollTop - startTop) / (pMaxScrollLength - startTop);
|
|
1374
|
-
|
|
1374
|
+
const _startEle = document.querySelector(`[data-line="${lineNumer}"]`);
|
|
1375
|
+
startEleOffetTop = _startEle ? _startEle.offsetTop - getComputedStyleNum(_startEle, "margin-top") : startEleOffetTop;
|
|
1375
1376
|
blockHeight = cMaxScrollLength - startEleOffetTop + getComputedStyleNum(cEle, "padding-top");
|
|
1376
1377
|
}
|
|
1377
1378
|
const scrollToTop = startEleOffetTop - cElePaddingTop + blockHeight * scale;
|
|
@@ -1380,7 +1381,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1380
1381
|
});
|
|
1381
1382
|
};
|
|
1382
1383
|
const cEleHandler = () => {
|
|
1383
|
-
var _a, _b, _c, _d, _e, _f
|
|
1384
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1384
1385
|
if (pLock !== 0) {
|
|
1385
1386
|
return;
|
|
1386
1387
|
}
|
|
@@ -1436,7 +1437,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1436
1437
|
}
|
|
1437
1438
|
}
|
|
1438
1439
|
}
|
|
1439
|
-
let eleStartOffsetTop = realEleStart === ((_e = cEle.firstElementChild) == null ? void 0 : _e.firstElementChild) ? 0 : realEleStart.offsetTop;
|
|
1440
|
+
let eleStartOffsetTop = realEleStart === ((_e = cEle.firstElementChild) == null ? void 0 : _e.firstElementChild) ? 0 : realEleStart.offsetTop - getComputedStyleNum(realEleStart, "margin-top");
|
|
1440
1441
|
let eleEndOffsetTop = realEleEnd.offsetTop;
|
|
1441
1442
|
let scale = 0;
|
|
1442
1443
|
const { start, end } = blockMap[Number(realEleStart.dataset.line || 0)];
|
|
@@ -1447,11 +1448,12 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1447
1448
|
let blockHeight = 0;
|
|
1448
1449
|
if (endLineScrollTop > pMaxScrollLength || realEleEnd.offsetTop + realEleEnd.offsetHeight > cMaxScrollLength) {
|
|
1449
1450
|
const lineNumer = getLineNumber(pMaxScrollLength, cMaxScrollLength);
|
|
1450
|
-
|
|
1451
|
+
const _startEle = document.querySelector(`[data-line="${lineNumer}"]`);
|
|
1452
|
+
eleStartOffsetTop = _startEle ? _startEle.offsetTop - getComputedStyleNum(_startEle, "margin-top") : eleStartOffsetTop;
|
|
1451
1453
|
firstLineScrollTop = getTopByLine(lineNumer);
|
|
1452
1454
|
scale = (cScrollTop - eleStartOffsetTop) / (cMaxScrollLength - eleStartOffsetTop);
|
|
1453
1455
|
blockHeight = pMaxScrollLength - firstLineScrollTop;
|
|
1454
|
-
} else if (realEleStart === ((
|
|
1456
|
+
} else if (realEleStart === ((_f = cEle.firstElementChild) == null ? void 0 : _f.firstElementChild)) {
|
|
1455
1457
|
if (realEleStart === realEleEnd) {
|
|
1456
1458
|
eleEndOffsetTop = realEleEnd.offsetTop + realEleEnd.offsetHeight + +getComputedStyle(realEleEnd).marginBottom.replace("px", "");
|
|
1457
1459
|
blockHeight = endLineScrollTop;
|
|
@@ -1470,7 +1472,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1470
1472
|
cLock--;
|
|
1471
1473
|
});
|
|
1472
1474
|
};
|
|
1473
|
-
const scrollHandler =
|
|
1475
|
+
const scrollHandler = (e) => {
|
|
1474
1476
|
var _a;
|
|
1475
1477
|
const { scrollDOM, contentHeight } = view2;
|
|
1476
1478
|
const scrollDomHeight = scrollDOM.clientHeight;
|
|
@@ -1485,7 +1487,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1485
1487
|
} else {
|
|
1486
1488
|
cEleHandler();
|
|
1487
1489
|
}
|
|
1488
|
-
}
|
|
1490
|
+
};
|
|
1489
1491
|
return [
|
|
1490
1492
|
() => {
|
|
1491
1493
|
buildMap();
|
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -43,7 +43,9 @@ const userZoom = (props, html) => {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
vue.onMounted(() => {
|
|
46
|
-
|
|
46
|
+
if (!noImgZoomIn && props.setting.preview) {
|
|
47
|
+
zoomHander();
|
|
48
|
+
}
|
|
47
49
|
});
|
|
48
50
|
vue.watch([html, vue.toRef(props.setting, "preview")], () => {
|
|
49
51
|
if (!noImgZoomIn && props.setting.preview) {
|
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1333,7 +1333,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1333
1333
|
let pLock = 0;
|
|
1334
1334
|
let cLock = 0;
|
|
1335
1335
|
const pEleHandler = () => {
|
|
1336
|
-
var _a, _b
|
|
1336
|
+
var _a, _b;
|
|
1337
1337
|
if (cLock !== 0) {
|
|
1338
1338
|
return false;
|
|
1339
1339
|
}
|
|
@@ -1353,7 +1353,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1353
1353
|
const cMaxScrollLength = cEle.scrollHeight - cEle.clientHeight;
|
|
1354
1354
|
let startTop = getTopByLine(blockData.start);
|
|
1355
1355
|
let endBottom = getBottomByLine(blockData.end);
|
|
1356
|
-
let startEleOffetTop = startEle.offsetTop;
|
|
1356
|
+
let startEleOffetTop = startEle.offsetTop - getComputedStyleNum(startEle, "margin-top");
|
|
1357
1357
|
let blockHeight = endEle.offsetTop - startEleOffetTop;
|
|
1358
1358
|
if (startTop === 0) {
|
|
1359
1359
|
startEleOffetTop = 0;
|
|
@@ -1366,11 +1366,12 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
1368
|
scale = (scrollDOM.scrollTop - startTop + getComputedStyleNum(view.contentDOM, "padding-bottom")) / (endBottom - startTop);
|
|
1369
|
-
if (startTop
|
|
1369
|
+
if (startTop >= 0 && (endBottom >= pMaxScrollLength || endEle.offsetTop + endEle.clientHeight > cMaxScrollLength)) {
|
|
1370
1370
|
const lineNumer = getLineNumber(pMaxScrollLength, cMaxScrollLength);
|
|
1371
1371
|
startTop = getTopByLine(lineNumer);
|
|
1372
1372
|
scale = (scrollDOM.scrollTop - startTop) / (pMaxScrollLength - startTop);
|
|
1373
|
-
|
|
1373
|
+
const _startEle = document.querySelector(`[data-line="${lineNumer}"]`);
|
|
1374
|
+
startEleOffetTop = _startEle ? _startEle.offsetTop - getComputedStyleNum(_startEle, "margin-top") : startEleOffetTop;
|
|
1374
1375
|
blockHeight = cMaxScrollLength - startEleOffetTop + getComputedStyleNum(cEle, "padding-top");
|
|
1375
1376
|
}
|
|
1376
1377
|
const scrollToTop = startEleOffetTop - cElePaddingTop + blockHeight * scale;
|
|
@@ -1379,7 +1380,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1379
1380
|
});
|
|
1380
1381
|
};
|
|
1381
1382
|
const cEleHandler = () => {
|
|
1382
|
-
var _a, _b, _c, _d, _e, _f
|
|
1383
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1383
1384
|
if (pLock !== 0) {
|
|
1384
1385
|
return;
|
|
1385
1386
|
}
|
|
@@ -1435,7 +1436,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1435
1436
|
}
|
|
1436
1437
|
}
|
|
1437
1438
|
}
|
|
1438
|
-
let eleStartOffsetTop = realEleStart === ((_e = cEle.firstElementChild) == null ? void 0 : _e.firstElementChild) ? 0 : realEleStart.offsetTop;
|
|
1439
|
+
let eleStartOffsetTop = realEleStart === ((_e = cEle.firstElementChild) == null ? void 0 : _e.firstElementChild) ? 0 : realEleStart.offsetTop - getComputedStyleNum(realEleStart, "margin-top");
|
|
1439
1440
|
let eleEndOffsetTop = realEleEnd.offsetTop;
|
|
1440
1441
|
let scale = 0;
|
|
1441
1442
|
const { start, end } = blockMap[Number(realEleStart.dataset.line || 0)];
|
|
@@ -1446,11 +1447,12 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1446
1447
|
let blockHeight = 0;
|
|
1447
1448
|
if (endLineScrollTop > pMaxScrollLength || realEleEnd.offsetTop + realEleEnd.offsetHeight > cMaxScrollLength) {
|
|
1448
1449
|
const lineNumer = getLineNumber(pMaxScrollLength, cMaxScrollLength);
|
|
1449
|
-
|
|
1450
|
+
const _startEle = document.querySelector(`[data-line="${lineNumer}"]`);
|
|
1451
|
+
eleStartOffsetTop = _startEle ? _startEle.offsetTop - getComputedStyleNum(_startEle, "margin-top") : eleStartOffsetTop;
|
|
1450
1452
|
firstLineScrollTop = getTopByLine(lineNumer);
|
|
1451
1453
|
scale = (cScrollTop - eleStartOffsetTop) / (cMaxScrollLength - eleStartOffsetTop);
|
|
1452
1454
|
blockHeight = pMaxScrollLength - firstLineScrollTop;
|
|
1453
|
-
} else if (realEleStart === ((
|
|
1455
|
+
} else if (realEleStart === ((_f = cEle.firstElementChild) == null ? void 0 : _f.firstElementChild)) {
|
|
1454
1456
|
if (realEleStart === realEleEnd) {
|
|
1455
1457
|
eleEndOffsetTop = realEleEnd.offsetTop + realEleEnd.offsetHeight + +getComputedStyle(realEleEnd).marginBottom.replace("px", "");
|
|
1456
1458
|
blockHeight = endLineScrollTop;
|
|
@@ -1469,7 +1471,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1469
1471
|
cLock--;
|
|
1470
1472
|
});
|
|
1471
1473
|
};
|
|
1472
|
-
const scrollHandler =
|
|
1474
|
+
const scrollHandler = (e) => {
|
|
1473
1475
|
var _a;
|
|
1474
1476
|
const { scrollDOM, contentHeight } = view;
|
|
1475
1477
|
const scrollDomHeight = scrollDOM.clientHeight;
|
|
@@ -1484,7 +1486,7 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1484
1486
|
} else {
|
|
1485
1487
|
cEleHandler();
|
|
1486
1488
|
}
|
|
1487
|
-
}
|
|
1489
|
+
};
|
|
1488
1490
|
return [
|
|
1489
1491
|
() => {
|
|
1490
1492
|
buildMap();
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -42,7 +42,9 @@ const userZoom = (props, html) => {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
onMounted(() => {
|
|
45
|
-
|
|
45
|
+
if (!noImgZoomIn && props.setting.preview) {
|
|
46
|
+
zoomHander();
|
|
47
|
+
}
|
|
46
48
|
});
|
|
47
49
|
watch([html, toRef(props.setting, "preview")], () => {
|
|
48
50
|
if (!noImgZoomIn && props.setting.preview) {
|