diff --git a/editor/editor.php b/editor/editor.php index bdf353b3776568d9d527c9e421ec0a84e60892c5..96866b5b68ddb17b7c521ec049b969d853b2aa76 100644 --- a/editor/editor.php +++ b/editor/editor.php @@ -14,6 +14,7 @@ <ul id="selected-targets"></ul> </section> </section> + <button id="save" type="submit" class="primary">Save and publish</button> <section> <h3>Collected items</h3> <ul id="selected-items"></ul> diff --git a/editor/js/interactions.js b/editor/js/interactions.js index c2957e377a384c6c211056d87599c82910ba0d1f..a0583f13c4e49bc366a44c5047fa118d4e3fc571 100644 --- a/editor/js/interactions.js +++ b/editor/js/interactions.js @@ -1,5 +1,6 @@ import jQuery from "jquery"; -import { state } from "./editor"; +import { state, graph } from "./editor"; +import { saveGraphJson } from "../../datasets/datasets"; /** * Initiates all the handlers for button presses and input changes. @@ -8,4 +9,7 @@ export function initInteractions() { jQuery("button#clear-collection").on("click", () => { state.clearSelectedItems(); }); + jQuery("button#save").on("click", () => { + saveGraphJson(space_id, graph.getCleanData()); // space_id defined globaly through knowledge-space.php + }); }