mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-10 17:30:26 +00:00
fix: wait until animation finish and dom show
This commit is contained in:
parent
d8bdd09eb0
commit
0863916f9b
@ -37,9 +37,14 @@ BlockIdWidget.prototype.hookFocusElementEvent = function(event) {
|
||||
if(!event.param) return event;
|
||||
var id = event.param.replace('#','');
|
||||
if(id !== this.id) return event;
|
||||
var element = this.parentDomNode;
|
||||
var selector = event.param || "",
|
||||
element,
|
||||
baseElement = event.event && event.event.target ? event.event.target.ownerDocument : document;
|
||||
element = $tw.utils.querySelectorSafe(selector,baseElement) || this.spanDomNode;
|
||||
if(!element.parentNode) return;
|
||||
element = element.parentNode;
|
||||
// need to check if the block is before this node
|
||||
if(this.previousSibling) {
|
||||
if(this.previousSibling && element.previousSibling) {
|
||||
element = element.previousSibling;
|
||||
}
|
||||
element.focus({ focusVisible: true });
|
||||
|
@ -168,11 +168,15 @@ LinkWidget.prototype.handleClickEvent = function(event) {
|
||||
event: event
|
||||
});
|
||||
if(this.toBlockId) {
|
||||
this.dispatchEvent({
|
||||
type: "tm-focus-selector",
|
||||
param: "#" + this.toBlockId,
|
||||
event: event,
|
||||
});
|
||||
var duration = $tw.utils.getAnimationDuration();
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
self.dispatchEvent({
|
||||
type: "tm-focus-selector",
|
||||
param: "#" + self.toBlockId,
|
||||
event: event,
|
||||
});
|
||||
},duration);
|
||||
}
|
||||
if(this.domNodes[0].hasAttribute("href")) {
|
||||
event.preventDefault();
|
||||
|
Loading…
Reference in New Issue
Block a user