mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-01 03:20:08 +00:00
tweaking and minor tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
811ed21223
commit
901683bcca
@ -2093,21 +2093,22 @@ object.Constructor('pWikiPageElement', Page, {
|
|||||||
|
|
||||||
// XXX CACHE...
|
// XXX CACHE...
|
||||||
__last_refresh_location: undefined,
|
__last_refresh_location: undefined,
|
||||||
refresh: async function(full=false){
|
refresh: types.event.Event('refresh',
|
||||||
// drop cache if re-refreshing or when full refresh requested...
|
async function(full=false){
|
||||||
// XXX CACHE...
|
// drop cache if re-refreshing or when full refresh requested...
|
||||||
;(full
|
// XXX CACHE...
|
||||||
|| this.__last_refresh_location == this.location)
|
;(full
|
||||||
&& this.cache
|
|| this.__last_refresh_location == this.location)
|
||||||
&& (this.cache = null)
|
&& this.cache
|
||||||
this.__last_refresh_location = this.location
|
&& (this.cache = null)
|
||||||
var dom = this.dom
|
this.__last_refresh_location = this.location
|
||||||
dom.innerHTML = await this.text
|
var dom = this.dom
|
||||||
for(var filter of Object.values(this.domFilters)){
|
dom.innerHTML = await this.text
|
||||||
filter
|
for(var filter of Object.values(this.domFilters)){
|
||||||
&& filter.call(this, dom) }
|
filter
|
||||||
this.trigger('onLoad')
|
&& filter.call(this, dom) }
|
||||||
return this },
|
this.trigger('onLoad')
|
||||||
|
return this }),
|
||||||
|
|
||||||
// handle dom as first argument...
|
// handle dom as first argument...
|
||||||
__init__: function(dom, ...args){
|
__init__: function(dom, ...args){
|
||||||
|
|||||||
15
pwiki2.html
15
pwiki2.html
@ -374,6 +374,7 @@ var logTime = async function(promise, msg=''){
|
|||||||
REFRESH_DELAY = 20
|
REFRESH_DELAY = 20
|
||||||
|
|
||||||
var refresh = async function(){
|
var refresh = async function(){
|
||||||
|
pwiki.__prev_path = pwiki.path
|
||||||
startSpinner()
|
startSpinner()
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
logTime(
|
logTime(
|
||||||
@ -381,6 +382,9 @@ var refresh = async function(){
|
|||||||
pwiki.location) }, REFRESH_DELAY) }
|
pwiki.location) }, REFRESH_DELAY) }
|
||||||
|
|
||||||
|
|
||||||
|
history.scrollRestoration = 'manual'
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// start loading pWiki...
|
// start loading pWiki...
|
||||||
require(['./browser'], function(browser){
|
require(['./browser'], function(browser){
|
||||||
@ -425,6 +429,7 @@ require(['./browser'], function(browser){
|
|||||||
|
|
||||||
pwiki
|
pwiki
|
||||||
.onBeforeNavigate(function(){
|
.onBeforeNavigate(function(){
|
||||||
|
this.__prev_path = this.path
|
||||||
saveAll() })
|
saveAll() })
|
||||||
.navigate(async function(){
|
.navigate(async function(){
|
||||||
// NOTE: we do not need to directly update location.hash here as
|
// NOTE: we do not need to directly update location.hash here as
|
||||||
@ -471,11 +476,11 @@ require(['./browser'], function(browser){
|
|||||||
.querySelector('#'+ this.hash)
|
.querySelector('#'+ this.hash)
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
// restore history position...
|
// restore history position...
|
||||||
// XXX HACK this will work only on full page...
|
// NOTE: only on navigate to new page...
|
||||||
: (document.scrollingElement.scrollTop = this.__scroll ?? 0)
|
// XXX HACK this will work only on full page pWiki and
|
||||||
|
// not on a element/nested pWiki...
|
||||||
// XXX MediumEditor...
|
: (this.__prev_path != this.path
|
||||||
//setupMediumEditor()
|
&& (document.scrollingElement.scrollTop = this.__scroll ?? 0))
|
||||||
|
|
||||||
// handle refresh...
|
// handle refresh...
|
||||||
// NOTE: we need to do this as hashchange is only triggered
|
// NOTE: we need to do this as hashchange is only triggered
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user