Fixed image loading and client tags
This commit is contained in:
parent
84356be456
commit
ec6c2cab49
2 changed files with 9 additions and 4 deletions
|
@ -215,6 +215,7 @@ export namespace bbcode {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const load_callback = guid();
|
||||||
/* the image parse & displayer */
|
/* the image parse & displayer */
|
||||||
xbbcode.register.register_parser({
|
xbbcode.register.register_parser({
|
||||||
tag: ["img", "image"],
|
tag: ["img", "image"],
|
||||||
|
@ -237,10 +238,11 @@ export namespace bbcode {
|
||||||
return fallback_value;
|
return fallback_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitizer_escaped_map[uid] = "<div class='xbbcode-tag-img'><img src='img/loading_image.svg' onload='messages.formatter.bbcode.load_image(this)' x-image-url='" + encodeURIComponent(target) + "' title='" + sanitize_text(target) + "' /></div>";
|
sanitizer_escaped_map[uid] = "<div class='xbbcode-tag-img'><img src='img/loading_image.svg' onload='window[\"" + load_callback + "\"](this)' x-image-url='" + encodeURIComponent(target) + "' title='" + sanitize_text(target) + "' /></div>";
|
||||||
return sanitizer_escaped(uid);
|
return sanitizer_escaped(uid);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
window[load_callback] = load_image;
|
||||||
},
|
},
|
||||||
priority: 10
|
priority: 10
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {ChannelEntry} from "tc-shared/ui/channel";
|
||||||
import {ClientEntry} from "tc-shared/ui/client";
|
import {ClientEntry} from "tc-shared/ui/client";
|
||||||
import {htmlEscape} from "tc-shared/ui/frames/chat";
|
import {htmlEscape} from "tc-shared/ui/frames/chat";
|
||||||
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
import {server_connections} from "tc-shared/ui/frames/connection_handlers";
|
||||||
|
import {guid} from "tc-shared/crypto/uid";
|
||||||
|
|
||||||
let mouse_coordinates: {x: number, y: number} = {x: 0, y: 0};
|
let mouse_coordinates: {x: number, y: number} = {x: 0, y: 0};
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ export interface ChannelProperties {
|
||||||
add_braces?: boolean
|
add_braces?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const callback_object_id = guid();
|
||||||
/* required for the bbcodes */
|
/* required for the bbcodes */
|
||||||
function generate_client_open(properties: ClientProperties) : string {
|
function generate_client_open(properties: ClientProperties) : string {
|
||||||
let result = "";
|
let result = "";
|
||||||
|
@ -57,7 +59,7 @@ function generate_client_open(properties: ClientProperties) : string {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the click handler */
|
/* add the click handler */
|
||||||
result += "oncontextmenu='return htmltags.callbacks.callback_context_client($(this));'";
|
result += "oncontextmenu='return window[\"" + callback_object_id + "\"].callback_context_client($(this));'";
|
||||||
|
|
||||||
result = result + ">";
|
result = result + ">";
|
||||||
return result;
|
return result;
|
||||||
|
@ -100,7 +102,7 @@ function generate_channel_open(properties: ChannelProperties) : string {
|
||||||
result = result + "channel-name='" + encodeURIComponent(properties.channel_name) + "' ";
|
result = result + "channel-name='" + encodeURIComponent(properties.channel_name) + "' ";
|
||||||
|
|
||||||
/* add the click handler */
|
/* add the click handler */
|
||||||
result += "oncontextmenu='return htmltags.callbacks.callback_context_channel($(this));'";
|
result += "oncontextmenu='return window[\"" + callback_object_id + "\"].callback_context_channel($(this));'";
|
||||||
|
|
||||||
result = result + ">";
|
result = result + ">";
|
||||||
return result;
|
return result;
|
||||||
|
@ -186,6 +188,7 @@ export namespace callbacks {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window[callback_object_id] = callbacks;
|
||||||
|
|
||||||
declare const xbbcode;
|
declare const xbbcode;
|
||||||
namespace bbcodes {
|
namespace bbcodes {
|
||||||
|
|
Loading…
Add table
Reference in a new issue