From ca409e5eaac8870ffe0d98bc16520b4bab62ccd1 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 11 Jul 2018 10:50:42 +0200 Subject: [PATCH] support import/export in kanban --- www/kanban/inner.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/www/kanban/inner.js b/www/kanban/inner.js index b79b6e381..2ffafa594 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -326,7 +326,21 @@ define([ if (framework.isReadOnly()) { $container.addClass('cp-app-readonly'); + } else { + framework.setFileImporter({}, function (content, file) { + var parsed; + try { parsed = JSON.parse(content); } + catch (e) { return void console.error(e); } + return { content: parsed }; + }); } + + framework.setFileExporter('json', function () { + return new Blob([JSON.stringify(kanban.getBoardsJSON())], { + type: 'application/json', + }); + }); + framework.onEditableChange(function (unlocked) { if (framework.isReadOnly()) { return; } if (!kanban) { return; }