- \r
- \r
- var observer = new MutationObserver(function(mutations) {\r
- mutations.forEach(function(mutation) {\r
- _.each(mutation.addedNodes, function(node) {\r
- node = $(node);\r
- node.parent().find('[wlxml-tag]').each(function() {\r
- var tag = $(this);\r
- if(!tag.attr('id'))\r
- tag.attr('id', 'xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}));\r
- });\r
- });\r
- }); \r
- });\r
- var config = { attributes: true, childList: true, characterData: true, subtree: true };\r
- observer.observe(this.node.find('#rng-module-documentCanvas-contentWrapper')[0], config);\r
- \r
+ \r
+ this.node.onShow = function() {\r
+ if(!view.shownAlready) {\r
+ view.shownAlready = true;\r
+ view.selectFirstNode();\r
+ } else if(view.currentNode) {\r
+ view.movecaretToNode(view.getNodeElement(view.currentNode));\r
+ view.node.find('#rng-module-documentCanvas-contentWrapper').scrollTop(view.scrollbarPosition);\r
+ }\r
+ };\r
+ this.node.onHide = function() {\r
+ view.scrollbarPosition = view.node.find('#rng-module-documentCanvas-contentWrapper').scrollTop();\r
+ }\r
+ \r