md-editor-v3 4.17.2 → 4.17.4-0
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 +8 -5
- package/lib/cjs/chunks/index.cjs +3 -1
- package/lib/es/MdEditor.mjs +8 -5
- package/lib/es/chunks/index.mjs +3 -1
- package/lib/umd/index.js +31 -31
- 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, _c;
|
|
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;
|
|
1358
1358
|
let blockHeight = endEle.offsetTop - startEleOffetTop;
|
|
1359
1359
|
if (startTop === 0) {
|
|
1360
1360
|
startEleOffetTop = 0;
|
|
@@ -1366,13 +1366,16 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1366
1366
|
blockHeight = endEle.offsetTop;
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
|
-
scale = (scrollDOM.scrollTop - startTop
|
|
1370
|
-
|
|
1369
|
+
scale = (scrollDOM.scrollTop - startTop) / (endBottom - startTop);
|
|
1370
|
+
const endElePos = endEle == ((_c = cEle.lastElementChild) == null ? void 0 : _c.lastElementChild) ? endEle.offsetTop + endEle.clientHeight : endEle.offsetTop;
|
|
1371
|
+
if (endBottom >= pMaxScrollLength || endElePos > cMaxScrollLength) {
|
|
1371
1372
|
const lineNumer = getLineNumber(pMaxScrollLength, cMaxScrollLength);
|
|
1372
1373
|
startTop = getTopByLine(lineNumer);
|
|
1373
1374
|
scale = (scrollDOM.scrollTop - startTop) / (pMaxScrollLength - startTop);
|
|
1374
1375
|
const _startEle = document.querySelector(`[data-line="${lineNumer}"]`);
|
|
1375
|
-
|
|
1376
|
+
if (startTop > 0 && _startEle) {
|
|
1377
|
+
startEleOffetTop = _startEle.offsetTop;
|
|
1378
|
+
}
|
|
1376
1379
|
blockHeight = cMaxScrollLength - startEleOffetTop + getComputedStyleNum(cEle, "padding-top");
|
|
1377
1380
|
}
|
|
1378
1381
|
const scrollToTop = startEleOffetTop - cElePaddingTop + blockHeight * scale;
|
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -34,7 +34,9 @@ const userZoom = (props, html) => {
|
|
|
34
34
|
const editorId = vue.inject("editorId");
|
|
35
35
|
const { noImgZoomIn } = props;
|
|
36
36
|
const zoomHander = util$2.debounce(() => {
|
|
37
|
-
const imgs = document.querySelectorAll(
|
|
37
|
+
const imgs = document.querySelectorAll(
|
|
38
|
+
`#${editorId}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
39
|
+
);
|
|
38
40
|
if (imgs.length === 0) {
|
|
39
41
|
return;
|
|
40
42
|
}
|
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, _c;
|
|
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;
|
|
1357
1357
|
let blockHeight = endEle.offsetTop - startEleOffetTop;
|
|
1358
1358
|
if (startTop === 0) {
|
|
1359
1359
|
startEleOffetTop = 0;
|
|
@@ -1365,13 +1365,16 @@ const scrollAuto = (pEle, cEle, codeMirrorUt) => {
|
|
|
1365
1365
|
blockHeight = endEle.offsetTop;
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
|
-
scale = (scrollDOM.scrollTop - startTop
|
|
1369
|
-
|
|
1368
|
+
scale = (scrollDOM.scrollTop - startTop) / (endBottom - startTop);
|
|
1369
|
+
const endElePos = endEle == ((_c = cEle.lastElementChild) == null ? void 0 : _c.lastElementChild) ? endEle.offsetTop + endEle.clientHeight : endEle.offsetTop;
|
|
1370
|
+
if (endBottom >= pMaxScrollLength || endElePos > cMaxScrollLength) {
|
|
1370
1371
|
const lineNumer = getLineNumber(pMaxScrollLength, cMaxScrollLength);
|
|
1371
1372
|
startTop = getTopByLine(lineNumer);
|
|
1372
1373
|
scale = (scrollDOM.scrollTop - startTop) / (pMaxScrollLength - startTop);
|
|
1373
1374
|
const _startEle = document.querySelector(`[data-line="${lineNumer}"]`);
|
|
1374
|
-
|
|
1375
|
+
if (startTop > 0 && _startEle) {
|
|
1376
|
+
startEleOffetTop = _startEle.offsetTop;
|
|
1377
|
+
}
|
|
1375
1378
|
blockHeight = cMaxScrollLength - startEleOffetTop + getComputedStyleNum(cEle, "padding-top");
|
|
1376
1379
|
}
|
|
1377
1380
|
const scrollToTop = startEleOffetTop - cElePaddingTop + blockHeight * scale;
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -33,7 +33,9 @@ const userZoom = (props, html) => {
|
|
|
33
33
|
const editorId = inject("editorId");
|
|
34
34
|
const { noImgZoomIn } = props;
|
|
35
35
|
const zoomHander = debounce(() => {
|
|
36
|
-
const imgs = document.querySelectorAll(
|
|
36
|
+
const imgs = document.querySelectorAll(
|
|
37
|
+
`#${editorId}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
38
|
+
);
|
|
37
39
|
if (imgs.length === 0) {
|
|
38
40
|
return;
|
|
39
41
|
}
|