fix: 回车跳到多行之后

This commit is contained in:
shaoyongjun 2024-10-31 16:11:12 +08:00
parent 924174210f
commit 50b0824b5a
2 changed files with 26 additions and 9 deletions

View File

@ -163,7 +163,21 @@ export class MyBiz {
let rowNo = 0;
let emptyRowNoList = window.myEdit.ctx.MyDocMap.get("emptyRowNoList");
console.log(emptyRowNoList);
if (emptyRowNoList === undefined || emptyRowNoList === null) {
let empListIsEmpty = (emptyRowNoList === undefined || emptyRowNoList === null || emptyRowNoList.length <= 0);
if (!empListIsEmpty) {
let tmpArr = [];
for (let i = 0; i < emptyRowNoList.length; i++) {
let tmpNo = emptyRowNoList[i];
if (window.myEdit.ctx.getMapItem(tmpNo).getHidden()) {
tmpArr.push(emptyRowNoList[i]);
}
}
window.myEdit.ctx.MyDocMap.set("emptyRowNoList", tmpArr);
empListIsEmpty = tmpArr.length <= 0;
emptyRowNoList = tmpArr
}
if (empListIsEmpty) {
rowNo = window.myEdit.ctx.incrementNumThenReturn();
//添加新元素
let newParagraph = document.createElement("p")
@ -213,7 +227,8 @@ export class MyBiz {
return
}
mapItem.setSource(curP.innerText)
mapItem.setSource(curP.innerText);
mapItem.setHidden(false);
// console.log("curPTx: ", curP.innerText, "MyDocMap : ", utils.MyDocMap)
//显示用户的输入内容

View File

@ -298,10 +298,12 @@ export class MyUtils {
let dpr = window.devicePixelRatio || 1;//当前设置下 物理像素和虚拟像素的比值
let defaultFrontSize = window.myEdit.ctx.bodyFrontSize;
if (!dpr) {
let isAndroid = win.navigator.appVersion.match(/android/gi);
let isIPhone = win.navigator.appVersion.match(/iphone/gi);
if (isIPhone) {//只对iPhone做了处理
// iOS下对于2和3的屏用2倍的方案其余的用1倍方案
//devicePixelRatio这个属性是可以获取到设备的dpr
let devicePixelRatio = win.devicePixelRatio;
//判断dpr是否为整数
let isRegularDpr = devicePixelRatio.toString().match(/^[1-9]\d*$/g)
if (isRegularDpr) {
// 对于是整数的dpr对dpr进行操作
if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
dpr = 3;
} else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)) {