diff --git a/pwiki/page.js b/pwiki/page.js
index d3e3848..b51bd19 100755
--- a/pwiki/page.js
+++ b/pwiki/page.js
@@ -2361,7 +2361,11 @@ module.Config = {
text: '' },
// XXX
Config: {
- text: '{}' },
+ text: object.doc`{
+ }` },
+ Style: {
+ text: object.doc`
+ ` },
}
diff --git a/pwiki2.html b/pwiki2.html
index 9271e7d..56e355d 100755
--- a/pwiki2.html
+++ b/pwiki2.html
@@ -165,6 +165,11 @@ body.loading .page.spinner span {
}
+
+
@@ -234,6 +239,21 @@ require.config({
//---------------------------------------------------------------------
// Editor -- save changes...
+// XXX might be a good idea to make this a method of pwiki???
+var STYLE_UPDATED = false
+var updateStyle = async function(){
+ document.querySelector('#style').innerHTML =
+ await pwiki.get('/.config/Style/_raw').text }
+
+// XXX might be a good idea to make this a method of pwiki???
+var CONFIG_UPDATED = false
+var updateConfig = async function(){
+ // XXX need to set this to something...
+ // XXX
+ // XXX need to use a parser that supports comments and stuff...
+ return JSON.parse(await pwiki.get('/.config/Config/_raw').text) }
+
+
// XXX versioning??
var SAVE_LIVE_TIMEOUT = 5000
var SAVE_LIVE_QUEUE = {}
@@ -347,6 +367,14 @@ require(['./browser'], function(browser){
+(this.hash ?
'#'+this.hash
: ''))
+ // style...
+ if(STYLE_UPDATED){
+ STYLE_UPDATED = false
+ await updateStyle() }
+ // config...
+ if(CONFIG_UPDATED){
+ CONFIG_UPDATED = false
+ await updateConfig() }
// NOTE: we are intentionally not awaiting for this -- this
// separates the navigate and load events...
logTime(
@@ -379,12 +407,24 @@ require(['./browser'], function(browser){
for(var lnk of this.dom.querySelectorAll(`a[href="${location.hash}"]`)){
lnk.addEventListener('click', refresh) } })
+ // handle special file updates...
+ // NOTE: the actual updates are done .onNavigate(..)
+ pwiki.store
+ .update(function(_, path){
+ if(path == '/.config/Style'){
+ STYLE_UPDATED = true }
+ if(path == '/.config/Config'){
+ CONFIG_UPDATED = true } })
+
// wait for stuff to finish...
browser.setup.then(async function(){
// index...
await logTime(
pwiki.store.index(),
'Indexing')
+ // setup global stuff...
+ updateStyle()
+ updateConfig()
// show current page...
pwiki.location = decodeURI(location.hash).slice(1) }) })
diff --git a/pwiki2.js b/pwiki2.js
index fa796b0..acbf89b 100755
--- a/pwiki2.js
+++ b/pwiki2.js
@@ -18,6 +18,7 @@
* - CLI -
*
*
+* XXX NAMING: revise .onNavigate(..) and .onBeforeNavigate(..) event names...
* XXX BUG: parser:
* This will break:
* @source(.)
@@ -28,13 +29,15 @@
* - add tags to page -- macro/filter
* - .text -> .tags (cached on .update(..))
* - ???
-* - manual - DONE
+* - manual/API - DONE
+* - editor -
* - a way to list tags -- folder like? - DONE
* - tag cache .tags - DONE
* - tag-path filtering... - DONE
* XXX TAGS add a more advanced query -- e.g. "/**:tagged=y,z:untagged=x" ???
* XXX TAGS do we need page actions to tag/untag pages???
-* XXX INDEX store index (IndexedDB?) and update as the stores are updated...
+* XXX INDEX persistent index -- store index (IndexedDB?) and update as
+* the stores are updated...
* XXX INDEX DOC can index validation be async???
* ...likely no
* XXX INDEX add option to set default action (get/lazy/cached)