/
vshmidt
/
label-studio
Обзор
Документация
Войти
/
vshmidt
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
web/libs/editor/src/core/Helpers.ts
30 строк
684 B
Sergei Koshevarov
fix: BROS-291: Fix using Taxonomy as second labeling control (#8103)
14 авг 2025, 14:31
Не верифицирован
14 авг 2025, 14:31
40afcf3
Код
Авторство
О чём код?
import { getSnapshot, getType, type IStateTreeNode } from "mobx-state-tree"; import { guidGenerator } from "../utils/unique"; /** * TODO: refactor */ export { guidGenerator }; /** * Helper function to detect HTX Component */ export function isHtx(component: any, name: string) { return typeof component.type === "function" && component.type.name === `Htx${name}`; } /** * Clone node with new ID * @param {*} node */ export function cloneNode(node: IStateTreeNode) { const snapshot = getSnapshot(node); const snapshotRandomId = getType(node).create({ ...snapshot, id: guidGenerator(), }); snapshotRandomId.afterClone?.(node); return snapshotRandomId; }