feat: add element group

This commit is contained in:
Hufe921
2023-08-25 20:00:02 +08:00
committed by Hufe
parent f19077b2ce
commit 3e183aefa5
27 changed files with 488 additions and 17 deletions
+11 -1
View File
@@ -1,4 +1,4 @@
import { cloneProperty, deepClone, getUUID, splitText } from '.'
import { cloneProperty, deepClone, getUUID, isArrayEqual, splitText } from '.'
import {
ElementType,
IEditorOption,
@@ -375,7 +375,17 @@ export function isSameElementExceptValue(
if (sourceKeys.length !== targetKeys.length) return false
for (let s = 0; s < sourceKeys.length; s++) {
const key = sourceKeys[s] as never
// 值不需要校验
if (key === 'value') continue
// groupIds数组需特殊校验数组是否相等
if (
key === 'groupIds' &&
Array.isArray(source[key]) &&
Array.isArray(target[key]) &&
isArrayEqual(source[key], target[key])
) {
continue
}
if (source[key] !== target[key]) {
return false
}