diff --git a/static/js/event/impl/MutationObserverImpl.js b/static/js/event/impl/MutationObserverImpl.js
index 62a4aef..224a55d 100644
--- a/static/js/event/impl/MutationObserverImpl.js
+++ b/static/js/event/impl/MutationObserverImpl.js
@@ -48,14 +48,15 @@ define(function (require, exports, module) {
function addNewP(mutation) {
let target = mutation.target;
+ // target.clone()
if (target.nodeName === "DIV" && mutation.previousSibling !== null) {
- let targetP = mutation.previousSibling.nextSibling;
+ let newParagraph = mutation.previousSibling.nextSibling;
console.log(
"addNewP target: ", target,
"\nnodeType: ", target.nodeType,
"\nnodeName: ", target.nodeName,
"\ndata: ", target.value,
- "\n next: ", targetP
+ "\n next: ", newParagraph
)
@@ -64,11 +65,11 @@ define(function (require, exports, module) {
if (ctx.getCurRowNo() === 0) {
return
}
- if (targetP !== undefined && targetP !== null) {
- targetP.id = utils.Uuid(ctx.usn, ctx.docType);
- targetP.setAttribute("data-order", ctx.incrementNumThenReturn());
+ if (newParagraph !== undefined && newParagraph !== null) {
+ newParagraph.id = utils.Uuid(ctx.usn, ctx.docType);
+ newParagraph.setAttribute("data-order", ctx.incrementNumThenReturn());
- let newParagraph = document.getElementById(targetP.id);
+ // let newParagraph = document.getElementById(targetP.id);
//前置 span
let preSpan = newParagraph.querySelector("span[data-flag='span_pre']");
if (preSpan === undefined || preSpan === null) {
@@ -76,6 +77,8 @@ define(function (require, exports, module) {
preSpan.setAttribute("contenteditable", "false")
preSpan.setAttribute("data-flag", "span_pre")
newParagraph.appendChild(preSpan);
+ } else {
+ console.log("newParagraph preSpan exist ", newParagraph," ",preSpan)
}
//内置span
@@ -85,16 +88,10 @@ define(function (require, exports, module) {
spanContent.append(document.createElement("br"));
spanContent.setAttribute("data-flag", "span_content")
newParagraph.appendChild(spanContent);
+ } else {
+ console.log("newParagraph preSpan spanContent ", newParagraph)
}
- // newParagraph.innerHTML = '
'
-
- // newParagraph.insertAdjacentHTML('beforeend',
- // '
');
- console.log("newParagraph addChildren ", newParagraph)
- //收起选区到一个点,光标落在一个可编辑元素上
- // utils.GetSelection().removeAllRanges();
- // utils.GetSelection().setPosition(newParagraph, 0);
utils.GetSelection().setPosition(spanContent, 0);
spanContent.focus();
}