to:sync
This commit is contained in:
parent
4f675f46b2
commit
6fd9b831e2
@ -162,7 +162,7 @@ export class MyBiz {
|
||||
//rowNo
|
||||
let rowNo = 0;
|
||||
let emptyRowNoList = window.myEdit.ctx.MyDocMap.get("emptyRowNoList");
|
||||
console.log(emptyRowNoList);
|
||||
// console.log(emptyRowNoList);
|
||||
let empListIsEmpty = (emptyRowNoList === undefined || emptyRowNoList === null || emptyRowNoList.length <= 0);
|
||||
if (!empListIsEmpty) {
|
||||
let tmpArr = [];
|
||||
@ -243,18 +243,18 @@ export class MyBiz {
|
||||
let curP = window.myEdit.utils.GetEventTarget(event);
|
||||
let myDocItem = new MyDocItem(curP);
|
||||
let inputLength = curP.innerText.length
|
||||
console.log("emptyKeyWorkHandler :", curP, " _'", curP.innerHTML, "'_'", curP.innerText, "'_",
|
||||
"\neq1", curP.innerHTML.startsWith(" # "),
|
||||
"\neq2", curP.innerHTML.startsWith(" # "),
|
||||
"\neq3", curP.innerHTML.startsWith("# "),
|
||||
"\neq4", curP.innerHTML.startsWith("# "),
|
||||
|
||||
"\neqV1", curP.innerText.startsWith(" # "),
|
||||
"\neqV2", curP.innerText.startsWith(" # "),
|
||||
"\neqV3", curP.innerText.startsWith("# "),
|
||||
"\neqV4", curP.innerText.startsWith("# "),
|
||||
|
||||
)
|
||||
// console.log("emptyKeyWorkHandler :", curP, " _'", curP.innerHTML, "'_'", curP.innerText, "'_",
|
||||
// "\neq1", curP.innerHTML.startsWith(" # "),
|
||||
// "\neq2", curP.innerHTML.startsWith(" # "),
|
||||
// "\neq3", curP.innerHTML.startsWith("# "),
|
||||
// "\neq4", curP.innerHTML.startsWith("# "),
|
||||
//
|
||||
// "\neqV1", curP.innerText.startsWith(" # "),
|
||||
// "\neqV2", curP.innerText.startsWith(" # "),
|
||||
// "\neqV3", curP.innerText.startsWith("# "),
|
||||
// "\neqV4", curP.innerText.startsWith("# "),
|
||||
//
|
||||
// )
|
||||
/**
|
||||
* h1 ~ h6
|
||||
*/
|
||||
@ -410,18 +410,18 @@ export class MyBiz {
|
||||
start = end;
|
||||
end = tmpS;
|
||||
}
|
||||
console.log(" 当前选区信息 : ", curSec,
|
||||
"\ncurPe: ", curPe,
|
||||
"\ncurPeP: ", curPe.parentNode, curPe.parentNode.nodeType, curPe.parentNode.nodeName,
|
||||
|
||||
"\ncurPeIsP: ", curPeIsP,
|
||||
"\ncurPeParentIsP : ", curPeParentIsP,
|
||||
"\ncurPeParentIsDIV", curPeParentIsDIV,
|
||||
"\ncurPeParentIsSpan", curPeParentIsSpan,
|
||||
|
||||
"\nclassName: ", className,
|
||||
"\ntart: ", start,
|
||||
"\nend: ", end)
|
||||
// console.log(" 当前选区信息 : ", curSec,
|
||||
// "\ncurPe: ", curPe,
|
||||
// "\ncurPeP: ", curPe.parentNode, curPe.parentNode.nodeType, curPe.parentNode.nodeName,
|
||||
//
|
||||
// "\ncurPeIsP: ", curPeIsP,
|
||||
// "\ncurPeParentIsP : ", curPeParentIsP,
|
||||
// "\ncurPeParentIsDIV", curPeParentIsDIV,
|
||||
// "\ncurPeParentIsSpan", curPeParentIsSpan,
|
||||
//
|
||||
// "\nclassName: ", className,
|
||||
// "\ntart: ", start,
|
||||
// "\nend: ", end)
|
||||
|
||||
let curPEle = null;
|
||||
//第一次选择的时候将整行转换成<p><span></span></p>
|
||||
@ -433,7 +433,7 @@ export class MyBiz {
|
||||
// div
|
||||
}
|
||||
let curStartP = curSec.startContainer.parentElement;
|
||||
console.log("debug1: ", curStartP, curStartP.nodeType, curStartP.nodeName)
|
||||
// console.log("debug1: ", curStartP, curStartP.nodeType, curStartP.nodeName)
|
||||
//维护最近一次编辑的内容(暂时只支持恢复最近一次编辑)
|
||||
window.myEdit.ctx.latestOpDoc = new MyRecovery(curStartP.cloneNode(true), function () {
|
||||
console.log("恢复上一步样式1", this.innerHTML)
|
||||
@ -474,7 +474,7 @@ export class MyBiz {
|
||||
if (!curPeIsP && curPeParentIsSpan) {
|
||||
tmpPNode = curSec.commonAncestorContainer.parentNode.parentNode;
|
||||
}
|
||||
console.log("debug2: ", curSec.commonAncestorContainer, tmpPNode, tmpPNode.children, tmpPNode.childNodes)
|
||||
// console.log("debug2: ", curSec.commonAncestorContainer, tmpPNode, tmpPNode.children, tmpPNode.childNodes)
|
||||
//维护最近一次编辑的内容(暂时只支持恢复最近一次编辑)
|
||||
window.myEdit.ctx.latestOpDoc = new MyRecovery(tmpPNode.cloneNode(true), function () {
|
||||
console.log("恢复上一步样式1", this.data)
|
||||
|
@ -44,7 +44,7 @@ export class MyEventListener {
|
||||
|
||||
//删除
|
||||
if (keyCode === 46 || keyCode === 8) {
|
||||
window.myEdit.biz.deleteHandle(event);
|
||||
// window.myEdit.biz.deleteHandle(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ export class MyEventListener {
|
||||
//空格键
|
||||
if (keyCode === 32) {
|
||||
console.log('触发 空格 事件', e.target)
|
||||
window.myEdit.biz.emptyKeyWorkHandler(event);
|
||||
// window.myEdit.biz.emptyKeyWorkHandler(event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -85,6 +85,12 @@ export class MyEventListener {
|
||||
if (keyCode === 13) {
|
||||
window.myEdit.utils.ProhibitDefaultEvent(event);
|
||||
}
|
||||
|
||||
//在鼠标按下的时候删除,体验更好
|
||||
if (keyCode === 46 || keyCode === 8) {
|
||||
window.myEdit.biz.deleteHandle(event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,8 +100,16 @@ export class MyEventListener {
|
||||
*/
|
||||
InputListener(e) {
|
||||
const event = window.myEdit.utils.ParseEvent(e);
|
||||
console.log("input : ", event)
|
||||
// console.log("input : ", event, " text: '", event.data + "'")
|
||||
let testDiv = document.getElementById("testDevice")
|
||||
testDiv.innerText = testDiv.innerText +
|
||||
"\n输入内容: '" + (event.data === " ") + "'";
|
||||
window.myEdit.biz.inputHandle(event);
|
||||
|
||||
//处理空行转换
|
||||
if (event.data === " ") {
|
||||
window.myEdit.biz.emptyKeyWorkHandler(event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user