refactor(enhance-content): extend from HTMLElement
This commit is contained in:
parent
81a17fa93c
commit
b6593651a8
3 changed files with 6 additions and 17 deletions
|
@ -1,15 +1,8 @@
|
||||||
import { WebComponent } from "web-component-base";
|
class EnhanceContent extends HTMLElement {
|
||||||
|
connectedCallback() {
|
||||||
class EnhanceContent extends WebComponent {
|
|
||||||
static props = {
|
|
||||||
server: "",
|
|
||||||
tagUrl: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
onInit() {
|
|
||||||
const el = this.getElementsByClassName("hashtag");
|
const el = this.getElementsByClassName("hashtag");
|
||||||
const server = this.props.server;
|
const server = this.dataset.server;
|
||||||
const tagUrl = this.props.tagUrl;
|
const tagUrl = this.dataset.tagUrl;
|
||||||
|
|
||||||
for (let i = 0; i < el.length; i++) {
|
for (let i = 0; i < el.length; i++) {
|
||||||
const tagEl = el.item(i);
|
const tagEl = el.item(i);
|
||||||
|
@ -38,10 +31,6 @@ class EnhanceContent extends WebComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get template() {
|
|
||||||
return this.innerHtml;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("enhance-content", EnhanceContent);
|
customElements.define("enhance-content", EnhanceContent);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
|
|
||||||
<enhance-content server={{server}} tag-url={{url_for('threads.tag', id='' )}}>
|
<enhance-content data-server={{server}} data-tag-url={{url_for('threads.tag', id='' )}}>
|
||||||
{{thread.content | safe}}
|
{{thread.content | safe}}
|
||||||
</enhance-content>
|
</enhance-content>
|
||||||
{% for media in thread.media_attachments %}
|
{% for media in thread.media_attachments %}
|
||||||
|
|
Loading…
Reference in a new issue