DEV: Sort styleguide icons alphabetically and fix render on refresh (#14463)
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
parent
b7fc576a8c
commit
574cb28b0e
|
@ -1,4 +1,5 @@
|
||||||
import { afterRender } from "discourse-common/utils/decorators";
|
import { afterRender } from "discourse-common/utils/decorators";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
tagName: "section",
|
tagName: "section",
|
||||||
|
@ -13,8 +14,12 @@ export default Ember.Component.extend({
|
||||||
@afterRender
|
@afterRender
|
||||||
setIconIds() {
|
setIconIds() {
|
||||||
let symbols = document.querySelectorAll("#svg-sprites symbol");
|
let symbols = document.querySelectorAll("#svg-sprites symbol");
|
||||||
|
if (symbols.length > 0) {
|
||||||
let ids = Array.from(symbols).mapBy("id");
|
let ids = Array.from(symbols).mapBy("id");
|
||||||
|
this.set("iconIds", ids.sort());
|
||||||
this.set("iconIds", ids);
|
} else {
|
||||||
|
// Let's try again a short time later if there are no svgs loaded yet
|
||||||
|
later(this, this.setIconIds, 1500);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue