bugfix -- revise...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-08-11 23:56:43 +03:00
parent 6c7bb94e95
commit c5577fb8c9
2 changed files with 20 additions and 5 deletions

View File

@ -64,6 +64,10 @@ module.BasePage =
object.Constructor('BasePage', {
// root page used to clone new instances via the .clone(..) method...
//root: undefined,
// a base page to be used as a base for cloning if root is of a
// different "class"...
//__clone_base__: undefined,
// NOTE: this can be inherited...
//store: undefined,
@ -412,7 +416,10 @@ object.Constructor('BasePage', {
// the common root...
// this will make all the non-shadowed attrs set on the
// root visible to all sub-pages.
: Object.create(this.root ?? this),
: Object.create(
(this.root || {}).__clone_base__
?? this.root
?? this),
{
root: this.root ?? this,
location: this.location,
@ -1197,10 +1204,13 @@ object.Constructor('pWikiPageElement', Page, {
// handle dom as first argument...
__init__: function(dom, ...args){
if(dom instanceof Element){
this.dom = dom
} else {
args.unshift(dom) }
if(typeof(Element) != 'undefined'){
if(dom instanceof Element){
this.dom = dom
} else {
args.unshift(dom) } }
// XXX is this the correct way to go???
this.__clone_base__ = this.clone()
return object.parentCall(pWikiPageElement.prototype.__init__, this, ...args) },
})

View File

@ -6,6 +6,10 @@
* pwiki.get(..).get(..) -> pWikiPageElement object
* pwiki.get(..).get(..).get(..) -> Page object
* ...
* ..the problem here is trivial, we are doing Object.construct(this.root)
* in clone -- the question is what are we going to clone if .root
* is of a different type (without ending up with long inheritance
* chains)???
*
* XXX BUG: .get('/*').raw hangs...
* XXX add action to reset overloaded (bootstrap) pages...
@ -26,6 +30,7 @@
* - editor and interactivity
* - migrate bootstrap
* - store topology
* - sync and sync conf
* - markdown -- DONE
* - WikiWord -- DONE
* - dom filter mechanics -- DONE