In the current stage, there is not OnEdit trigger for Google Document. But I sometimes have the case that I want to use OnEdit trigger. So, as the current workaround, I created this sample script. I think that this workaround can be also used for Google Slides, Google Form and also Google Spreadsheet. In the case of Spreadsheet, what the existing OnEdit trigger and the time-driven trigger cannot do can be achieved.
Source: Pseudo OnEdit Trigger for Google Document using Google Apps Script
Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.
I’m using the same approach. But search is not an exhaustive determinant of validity. I prefer to store the paragraph hash (MD2 is fine) on the client and return an additional query if the hash does not match.
Nice tip!