class UiRedactorQuote {
protected readonly _editor: RedactorEditor;
protected readonly _elementId: string;
+ protected readonly _knownElements = new WeakSet<HTMLElement>();
protected _quote: HTMLElement | null = null;
/**
*/
protected _observeLoad(): void {
document.querySelectorAll("woltlab-quote").forEach((quote: HTMLElement) => {
- quote.addEventListener("mousedown", (ev) => this._edit(ev));
- this._setTitle(quote);
+ if (!this._knownElements.has(quote)) {
+ quote.addEventListener("mousedown", (ev) => this._edit(ev));
+ this._setTitle(quote);
+
+ this._knownElements.add(quote);
+ }
});
}
* Initializes the quote management.
*/
constructor(editor, button) {
+ this._knownElements = new WeakSet();
this._quote = null;
this._editor = editor;
this._elementId = this._editor.$element[0].id;
*/
_observeLoad() {
document.querySelectorAll("woltlab-quote").forEach((quote) => {
- quote.addEventListener("mousedown", (ev) => this._edit(ev));
- this._setTitle(quote);
+ if (!this._knownElements.has(quote)) {
+ quote.addEventListener("mousedown", (ev) => this._edit(ev));
+ this._setTitle(quote);
+ this._knownElements.add(quote);
+ }
});
}
/**