mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 06:28:03 +08:00
REFACTOR: topic-entrance component (#7694)
This commit is contained in:
parent
6de3824b46
commit
f03a547a89
|
@ -58,7 +58,7 @@ export default Ember.Component.extend(CleansUp, {
|
|||
|
||||
_setCSS() {
|
||||
const pos = this._position;
|
||||
const $self = this.$();
|
||||
const $self = $(this.element);
|
||||
const width = $self.width();
|
||||
const height = $self.height();
|
||||
pos.left = parseInt(pos.left) - width / 2;
|
||||
|
@ -74,8 +74,7 @@ export default Ember.Component.extend(CleansUp, {
|
|||
_show(data) {
|
||||
this._position = data.position;
|
||||
|
||||
this.set("topic", data.topic);
|
||||
this.set("visible", true);
|
||||
this.setProperties({ topic: data.topic, visible: true });
|
||||
|
||||
Ember.run.scheduleOnce("afterRender", this, this._setCSS);
|
||||
|
||||
|
@ -85,7 +84,7 @@ export default Ember.Component.extend(CleansUp, {
|
|||
const $target = $(e.target);
|
||||
if (
|
||||
$target.prop("id") === "topic-entrance" ||
|
||||
this.$().has($target).length !== 0
|
||||
$(this.element).has($target).length !== 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -94,8 +93,7 @@ export default Ember.Component.extend(CleansUp, {
|
|||
},
|
||||
|
||||
cleanUp() {
|
||||
this.set("topic", null);
|
||||
this.set("visible", false);
|
||||
this.setProperties({ topic: null, visible: false });
|
||||
$("html").off("mousedown.topic-entrance");
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user