// 顏色選項集中管理 // Color options management export const PALETTE_COLORS = [ '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#000000', '#666666', '#999999', '#FFFFFF', ] // 心智圖初始數據 export const INITIAL_MIND = { meta: {}, format: 'node_array', data: [ { id: 'root', topic: 'FirstNode', expanded: true, isroot: true, }, ], } // 模擬打 API // Simulate an API call to search based on the query export async function mockSearchApi(query, tableUID) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open("GET", '/admin/universal_tables/get_entries?uid=' + tableUID + "&q=" + query + "&links=true"); xhr.setRequestHeader("Accept", "application/json"); xhr.onload = function () { if (xhr.status >= 200 && xhr.status < 300) { try { const data = JSON.parse(xhr.responseText); resolve(data); // success } catch (e) { reject(new Error("Invalid JSON response")); } } else { reject(new Error(`Request failed with status ${xhr.status}`)); } }; xhr.onerror = function () { reject(new Error("Network error")); }; xhr.send(); }); }