mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-17 16:41:39 +00:00
added loading styles from the pwiki -- see: /.config/Style
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e574e2cc2f
commit
2c6c3d367b
@ -2361,7 +2361,11 @@ module.Config = {
|
||||
text: '<button onclick="exportData()">Export</button>' },
|
||||
// XXX
|
||||
Config: {
|
||||
text: '{}' },
|
||||
text: object.doc`{
|
||||
}` },
|
||||
Style: {
|
||||
text: object.doc`
|
||||
` },
|
||||
}
|
||||
|
||||
|
||||
|
||||
40
pwiki2.html
40
pwiki2.html
@ -165,6 +165,11 @@ body.loading .page.spinner span {
|
||||
}
|
||||
|
||||
</style>
|
||||
<!--
|
||||
Do not edit here...
|
||||
This is loaded with the style defined by the system
|
||||
-->
|
||||
<style id="style"></style>
|
||||
|
||||
<!-- XXX do we need this??? -->
|
||||
<script src="bootstrap.js"></script>
|
||||
@ -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) }) })
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
* - CLI -
|
||||
*
|
||||
*
|
||||
* XXX NAMING: revise .onNavigate(..) and .onBeforeNavigate(..) event names...
|
||||
* XXX BUG: parser:
|
||||
* This will break:
|
||||
* <macro src=../tags join=", ">@source(.)</macro><br>
|
||||
@ -28,13 +29,15 @@
|
||||
* - add tags to page -- macro/filter
|
||||
* - <page>.text -> <page>.tags (cached on .update(..))
|
||||
* - ???
|
||||
* - manual - DONE
|
||||
* - manual/API - DONE
|
||||
* - editor -
|
||||
* - a way to list tags -- folder like? - DONE
|
||||
* - tag cache <store>.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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user