fix: 协同路径问题

This commit is contained in:
yanmao 2022-01-20 21:33:03 +08:00
parent dea662d4a3
commit 69ef914587
5 changed files with 18 additions and 12 deletions

View File

@ -574,7 +574,16 @@ class NodeModel implements NodeModelInterface {
splitNode = removeCurrentEmptyBlock
? commonAncestorNode
: undefined;
} else splitNode = block.split(range);
} else {
let isFirst = false;
if (block.isFirstOffset(range, 'start')) {
isFirst = true;
}
splitNode = block.split(range);
if (isFirst) {
splitNode = splitNode?.prev();
}
}
let blockNode = block.closest(
range.startNode.isEditable()
? range
@ -619,6 +628,8 @@ class NodeModel implements NodeModelInterface {
blockNode.remove();
} else {
blockNode.before(node);
if (splitNode && this.isEmptyWidthChild(splitNode))
splitNode.remove();
}
}
}

View File

@ -408,7 +408,6 @@ class Producer extends EventEmitter2 {
const pathValue = getValue(
this.doc?.data,
op.oldPath || [],
op.id,
);
if (pathValue !== undefined) {
const childIds = op.childIds || [];
@ -765,11 +764,8 @@ class Producer extends EventEmitter2 {
let emitOps: Op[] = [];
ops.forEach((op) => {
if ('path' in op && op.newValue !== undefined) {
const pathValue = getValue(
this.doc?.data,
op.oldPath || [],
op.id,
);
const pathValue = getValue(this.doc?.data, op.oldPath || []);
if (!pathValue) return;
const newOps = this.textToOps(
[...op.path!],
pathValue,

View File

@ -24,7 +24,6 @@
left: -1px;
right: auto;
height: 40px;
z-index: 130;
}
.data-toolbar-btn {

View File

@ -108,7 +108,7 @@ class ControllBar extends EventEmitter2 implements ControllBarInterface {
?.on('mouseenter', () => {
if (this.hideRowAddButtonTimeount)
clearTimeout(this.hideRowAddButtonTimeount);
this.rowsHeader?.css('z-index', 126);
this.rowsHeader?.css('z-index', 128);
})
.on('mouseleave', () => {
this.hideRowAddButtonTimeount = setTimeout(() => {
@ -355,7 +355,7 @@ class ControllBar extends EventEmitter2 implements ControllBarInterface {
})
.on('mousemove', (event: MouseEvent) => {
this.onMouseMoveRowsHeader(event);
this.rowsHeader?.css('z-index', 126);
this.rowsHeader?.css('z-index', 128);
})
.on('mouseleave', () => {
this.hideRowAddButtonTimeount = setTimeout(() => {
@ -405,7 +405,7 @@ class ControllBar extends EventEmitter2 implements ControllBarInterface {
this.moveColIndex = index; //+ (isEnd ? 1 : 0);
this.colAddButton?.show('flex');
this.colAddButton.css('left', `${left}px`);
this.colAddButton.css('z-index', 126);
this.colAddButton.css('z-index', 128);
const splitHeight =
(this.table.selection.tableModel?.height || 0) +
itemNode.height() +

View File

@ -254,7 +254,7 @@ div[data-card-key="table"].card-selected .data-table, div[data-card-key="table"]
left: -13px;
top: 42px;
width: 14px;
z-index: 1;
z-index: 128;
border-right: 0;
display: none;
}