1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Comments: Further range of content reference ux improvements

- Added reference indicator to comment create form.
  - Added remove action.
- Extracted reference text to translations.
- Changed reference hash to be text-based instead of HTML based.
- Added reference display for newly added comments.
- Handled reference marker delete on comment delete.
This commit is contained in:
Dan Brown
2025-05-01 17:22:12 +01:00
parent 15c79c38db
commit c82fa33210
9 changed files with 74 additions and 28 deletions

View 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);
}