mirror of
https://github.com/HKUDS/CLI-Anything.git
synced 2026-08-28 23:27:04 +08:00
fix: #132 add drawio custom id
This commit is contained in:
@@ -38,6 +38,9 @@ def add_connector(session: Session, source_id: str, target_id: str,
|
||||
if drawio_xml.find_cell_by_id(session.root, target_id, diagram_index) is None:
|
||||
raise ValueError(f"Target cell not found: {target_id}")
|
||||
|
||||
if edge_id is not None and drawio_xml.find_cell_by_id(session.root, edge_id, diagram_index) is not None:
|
||||
raise ValueError(f"Cell ID already exists: {edge_id}")
|
||||
|
||||
session.checkpoint()
|
||||
edge_id = drawio_xml.add_edge(
|
||||
session.root, source_id, target_id, edge_style, label,
|
||||
|
||||
@@ -35,6 +35,9 @@ def add_shape(session: Session, shape_type: str = "rectangle",
|
||||
if not session.is_open:
|
||||
raise RuntimeError("No project is open")
|
||||
|
||||
if cell_id is not None and drawio_xml.find_cell_by_id(session.root, cell_id, diagram_index) is not None:
|
||||
raise ValueError(f"Cell ID already exists: {cell_id}")
|
||||
|
||||
session.checkpoint()
|
||||
cell_id = drawio_xml.add_vertex(
|
||||
session.root, shape_type, x, y, width, height, label,
|
||||
|
||||
Reference in New Issue
Block a user