From f57020b3da44c546ff8e1816b73e822f4c7e5406 Mon Sep 17 00:00:00 2001 From: Arne Hassel Date: Thu, 21 Nov 2019 15:46:34 +0100 Subject: [PATCH] Making use of the new context object Related to https://github.com/solid/solid-panes/pull/199 --- sourcePane.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sourcePane.js b/sourcePane.js index 550833e..799a68e 100644 --- a/sourcePane.js +++ b/sourcePane.js @@ -7,14 +7,14 @@ const UI = require('solid-ui') const mime = require('mime-types') -const kb = UI.store module.exports = { icon: UI.icons.iconBase + 'noun_109873.svg', // noun_109873_51A7F9.svg name: 'source', - label: function (subject) { + label: function (subject, context) { + var kb = context.session.store var typeURIs = kb.findTypeURIs(subject) var prefix = $rdf.Util.mediaTypeClass('text/*').uri.split('*')[0] for (var t in typeURIs) { @@ -25,7 +25,8 @@ module.exports = { }, // Create a new text file in a Solid system, - mintNew: function (newPaneOptions) { + mintNew: function (context, newPaneOptions) { + var kb = context.session.store var newInstance = newPaneOptions.newInstance if (!newInstance) { let uri = newPaneOptions.newBase @@ -68,8 +69,9 @@ module.exports = { }) }, - render: function (subject, dom) { - const kb = UI.store + render: function (subject, context) { + const dom = context.dom + const kb = context.session.store const fetcher = kb.fetcher const editStyle = 'font-family: monospace; font-size: 100%; min-width:60em; margin: 1em 0.2em 1em 0.2em; padding: 1em; border: 0.1em solid #888; border-radius: 0.5em;'