]> BookStack Code Mirror - bookstack/blobdiff - resources/js/services/dom.ts
Comments: Further range of content reference ux improvements
[bookstack] / resources / js / services / dom.ts
index 661ed7ca3e5068a2907cae785299c592a4b86ba6..77c19a761058aa2aa9d2f08f8ba4f55e996a5298 100644 (file)
@@ -251,9 +251,9 @@ export function findTargetNodeAndOffset(parentNode: HTMLElement, offset: number)
 }
 
 /**
- * Create a hash for the given HTML element.
+ * Create a hash for the given HTML element content.
  */
 export function hashElement(element: HTMLElement): string {
-    const normalisedElemHtml = element.outerHTML.replace(/\s{2,}/g, '');
-    return cyrb53(normalisedElemHtml);
+    const normalisedElemText = (element.textContent || '').replace(/\s{2,}/g, '');
+    return cyrb53(normalisedElemText);
 }
\ No newline at end of file