From 3e773b13748adb1dced109b8a16eb4cab65534bc Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 1 Jun 2026 00:48:43 +0100 Subject: [PATCH] Support initial Ink start paths --- dist/sai.js | 13 +++++++++++++ src/sai.js | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/dist/sai.js b/dist/sai.js index ff86071..219eab8 100644 --- a/dist/sai.js +++ b/dist/sai.js @@ -995,6 +995,15 @@ return false; } + function initialStoryPath(container) { + return ( + container.dataset.inkStartPath || + container.dataset.inkInitialPath || + container.dataset.inkStart || + "" + ).trim(); + } + function renderAdventureGraph(stageState, manifest, story, metadata, render) { const graph = resolveAdventureGraph(manifest); if (!stageState.graphLayer || !graph) return; @@ -1432,6 +1441,10 @@ function reset() { const story = new window.inkjs.Story(JSON.stringify(storyJson)); + const startPath = initialStoryPath(container); + if (startPath) { + chooseStoryPath(story, startPath); + } status.textContent = container.dataset.inkTitle || "Interactive story"; choices.replaceChildren(); variables.replaceChildren(); diff --git a/src/sai.js b/src/sai.js index ff86071..219eab8 100644 --- a/src/sai.js +++ b/src/sai.js @@ -995,6 +995,15 @@ return false; } + function initialStoryPath(container) { + return ( + container.dataset.inkStartPath || + container.dataset.inkInitialPath || + container.dataset.inkStart || + "" + ).trim(); + } + function renderAdventureGraph(stageState, manifest, story, metadata, render) { const graph = resolveAdventureGraph(manifest); if (!stageState.graphLayer || !graph) return; @@ -1432,6 +1441,10 @@ function reset() { const story = new window.inkjs.Story(JSON.stringify(storyJson)); + const startPath = initialStoryPath(container); + if (startPath) { + chooseStoryPath(story, startPath); + } status.textContent = container.dataset.inkTitle || "Interactive story"; choices.replaceChildren(); variables.replaceChildren();