mirror of
https://github.com/flynx/pWiki.git
synced 2026-01-07 10:31:08 +00:00
added basic editor + basic settings page...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
be3b1f11ff
commit
02ebc61a59
@ -31,6 +31,8 @@ module.store =
|
|||||||
|
|
||||||
store.update('System',
|
store.update('System',
|
||||||
Object.create(basestore.BaseStore).load(page.System))
|
Object.create(basestore.BaseStore).load(page.System))
|
||||||
|
store.update('Settings',
|
||||||
|
Object.create(basestore.BaseStore).load(page.Settings))
|
||||||
|
|
||||||
var pwiki =
|
var pwiki =
|
||||||
module.pwiki =
|
module.pwiki =
|
||||||
|
|||||||
@ -664,7 +664,7 @@ object.Constructor('Page', BasePage, {
|
|||||||
// XXX can we lose stuff from state this way???
|
// XXX can we lose stuff from state this way???
|
||||||
// ...at this stage it should more or less be static -- check!
|
// ...at this stage it should more or less be static -- check!
|
||||||
var res =
|
var res =
|
||||||
await this.__parser__.filter(this, ast, {
|
await this.__parser__.parse(this, ast, {
|
||||||
...state,
|
...state,
|
||||||
filters: local.includes(this.ISOLATED_FILTERS) ?
|
filters: local.includes(this.ISOLATED_FILTERS) ?
|
||||||
local
|
local
|
||||||
@ -1231,6 +1231,15 @@ module.System = {
|
|||||||
// XXX not sure if this is the right way to go...
|
// XXX not sure if this is the right way to go...
|
||||||
_code: {
|
_code: {
|
||||||
text: '<pre wikiwords="no"><quote filter="quote-tags" src="."/></pre>' },
|
text: '<pre wikiwords="no"><quote filter="quote-tags" src="."/></pre>' },
|
||||||
|
//_edit: {
|
||||||
|
_ed: {
|
||||||
|
text:
|
||||||
|
'<pre class="editor" '
|
||||||
|
+'wikiwords="no" '
|
||||||
|
+'contenteditable '
|
||||||
|
+'oninput="saveContent(\'@source(./path)\', this.innerText)">'
|
||||||
|
+'<quote filter="quote-tags" src="."/>'
|
||||||
|
+'</pre>' },
|
||||||
|
|
||||||
|
|
||||||
// base system pages...
|
// base system pages...
|
||||||
@ -1302,6 +1311,15 @@ module.System = {
|
|||||||
// XXX System/reverse
|
// XXX System/reverse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var Settings =
|
||||||
|
module.Settings = {
|
||||||
|
Export: {
|
||||||
|
text: '<button onclick="exportData()">Export</button>' },
|
||||||
|
// XXX
|
||||||
|
Settings: {
|
||||||
|
text: '{}' },
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
pwiki2.html
18
pwiki2.html
@ -131,8 +131,24 @@ require(['./browser'], function(pwiki){
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// XXX make this a 2 stage save -- first cache and then save to store...
|
||||||
|
// XXX versioning???
|
||||||
|
var SAVE_TIMEOUT = 5000
|
||||||
|
var SAVE_QUEUE = {}
|
||||||
|
var saveContent = function(path, text){
|
||||||
|
SAVE_QUEUE[path] = text }
|
||||||
|
var saveNow = function(){
|
||||||
|
var queue = Object.entries(SAVE_QUEUE)
|
||||||
|
SAVE_QUEUE = {}
|
||||||
|
queue
|
||||||
|
.forEach(function([path, text]){
|
||||||
|
console.log('saving changes to:', path)
|
||||||
|
pwiki.get(path).raw = text }) }
|
||||||
|
setInterval(saveNow, 5000)
|
||||||
|
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
var saveData = async function(){
|
var exportData = async function(){
|
||||||
var blob = new Blob([await pwiki.store.json(true)], {type: "text/plain;charset=utf-8"});
|
var blob = new Blob([await pwiki.store.json(true)], {type: "text/plain;charset=utf-8"});
|
||||||
|
|
||||||
var a = document.createElement('a')
|
var a = document.createElement('a')
|
||||||
|
|||||||
10
pwiki2.js
10
pwiki2.js
@ -1,6 +1,7 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* XXX BUG: comments seem to be broken -- see: /Doc/About
|
||||||
* XXX BUG: browser: .get('/*').raw hangs...
|
* XXX BUG: browser: .get('/*').raw hangs...
|
||||||
* XXX add action to reset overloaded (bootstrap) pages...
|
* XXX add action to reset overloaded (bootstrap) pages...
|
||||||
* - per page
|
* - per page
|
||||||
@ -17,8 +18,10 @@
|
|||||||
* - render page -- DONE
|
* - render page -- DONE
|
||||||
* - navigation -- DONE
|
* - navigation -- DONE
|
||||||
* - hash/anchor -- DONE
|
* - hash/anchor -- DONE
|
||||||
* - basic editor and interactivity
|
* - basic editor and interactivity -- DONE
|
||||||
* - export / zip
|
* - export
|
||||||
|
* - json -- DONE
|
||||||
|
* - zip
|
||||||
* - migrate bootstrap
|
* - migrate bootstrap
|
||||||
* - store topology
|
* - store topology
|
||||||
* - sync and sync conf
|
* - sync and sync conf
|
||||||
@ -229,6 +232,9 @@ module.store =
|
|||||||
// XXX nested system store...
|
// XXX nested system store...
|
||||||
store.update('System',
|
store.update('System',
|
||||||
Object.create(basestore.BaseStore).load(page.System))
|
Object.create(basestore.BaseStore).load(page.System))
|
||||||
|
store.update('Settings',
|
||||||
|
Object.create(basestore.BaseStore).load(page.Settings))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: in general the root wiki api is simply a page instance.
|
// NOTE: in general the root wiki api is simply a page instance.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user