fix: 修复工作流节点交互与旧浏览器兼容
- 修复 Tinyflow Vue wrapper 可选 boolean 默认关闭节点拖拽和连线的问题 - 为 Tinyflow 增加 structuredClone 兼容与 Chrome 90 构建目标 - 增加节点交互归一化与 Tab 空值防御
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
import {store} from '#store/stores.svelte';
|
||||
import type {TinyflowData, TinyflowOptions} from '#types';
|
||||
import {setContext} from 'svelte';
|
||||
import {createTinyflowNodeNormalizer} from '../utils/nodeInteraction';
|
||||
|
||||
const props = $props<{
|
||||
options: TinyflowOptions,
|
||||
@@ -49,6 +50,7 @@
|
||||
}) as TinyflowOptions;
|
||||
const data = parseData(getOptions().data);
|
||||
const initialViewport = data?.viewport || null;
|
||||
store.setNodeNormalizer(createTinyflowNodeNormalizer(getOptions()));
|
||||
store.init(
|
||||
data?.nodes || [],
|
||||
data?.edges || [],
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div style={rest.style} class="tf-collapse {rest.class}">
|
||||
{#each items as item, index}
|
||||
<div class="tf-collapse-item">
|
||||
<div class="tf-collapse-item-title" role="button" tabindex={index}
|
||||
<div class="tf-collapse-item-title tf-node-drag-handle" role="button" tabindex={index}
|
||||
onclick={() => handlerOnChange(item)}
|
||||
onkeydown={(event) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
@@ -112,6 +112,14 @@
|
||||
background: var(--tf-bg-hover);
|
||||
}
|
||||
|
||||
.tf-node-drag-handle {
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
:global(.svelte-flow__node.dragging) .tf-node-drag-handle {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.tf-collapse-item-title-help::after {
|
||||
content: attr(data-help);
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user