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 WebComponent {
|
||||
static props = {
|
||||
server: "",
|
||||
tagUrl: "",
|
||||
};
|
||||
|
||||
onInit() {
|
||||
class EnhanceContent extends HTMLElement {
|
||||
connectedCallback() {
|
||||
const el = this.getElementsByClassName("hashtag");
|
||||
const server = this.props.server;
|
||||
const tagUrl = this.props.tagUrl;
|
||||
const server = this.dataset.server;
|
||||
const tagUrl = this.dataset.tagUrl;
|
||||
|
||||
for (let i = 0; i < el.length; i++) {
|
||||
const tagEl = el.item(i);
|
||||
|
@ -38,10 +31,6 @@ class EnhanceContent extends WebComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
get template() {
|
||||
return this.innerHtml;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("enhance-content", EnhanceContent);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<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}}
|
||||
</enhance-content>
|
||||
{% for media in thread.media_attachments %}
|
||||
|
|
Loading…
Reference in a new issue