2025-05-06 21:51:36 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								diff --git a/build/mention.js b/build/mention.js
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								deleted file mode 100644
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-08 20:12:40 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								index 3ef262a2fb7cbb953b35cb7e07a999edce6dc72a..0000000000000000000000000000000000000000
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 21:51:36 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								diff --git a/dist/index.js b/dist/index.js
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-08 20:12:40 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								index bbe511c5550e1cac8612e998034382b4eea1f1b8..8394fd8bba89f8a7b82d62fe613be6f12703ff53 100644
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 21:51:36 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								--- a/dist/index.js
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+++ b/dist/index.js
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-08 20:12:40 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -603,6 +603,16 @@ const defaultCommitKeyCodes = [
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 21:51:36 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 if (data.keyCode == keyCodes.esc) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     this._hideUIAndRemoveMarker();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    editor.model.change(writer => {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+						// insert a zero-width space as a special marker that we don't want a mention active anymore
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+						// see e.g. https://github.com/zadam/trilium/issues/4692
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+						const insertPosition = editor.model.document.selection.getLastPosition();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+						if (insertPosition !== null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+							writer.insertText('\u2002', insertPosition);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+						}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+					});
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }, {
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-08 20:12:40 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -1067,12 +1077,11 @@ const defaultCommitKeyCodes = [
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 21:51:36 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  */ function createRegExp(marker, minimumCharacters) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     const numberOfCharacters = minimumCharacters == 0 ? '*' : `{${minimumCharacters},}`;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     const openAfterCharacters = env.features.isRegExpUnicodePropertySupported ? '\\p{Ps}\\p{Pi}"\'' : '\\(\\[{"\'';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-    const mentionCharacters = '.';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    const mentionCharacters = '^=\u2002';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // I wanted to make an util out of it, but since this regexp uses "u" flag, it became difficult.
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 15:56:36 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // When "u" flag is used, the regexp has "strict" escaping rules, i.e. if you try to escape a character that does not need
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // to be escaped, RegExp() will throw. It made it difficult to write a generic util, because different characters are
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // allowed in different context. For example, escaping "-" sometimes was correct, but sometimes it threw an error.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-    marker = marker.replace(/[.*+?^${}()\-|[\]\\]/g, '\\$&');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // The pattern consists of 3 groups:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     //
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // - 0 (non-capturing): Opening sequence - start of the line, space or an opening punctuation character like "(" or "\"",
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-08 20:12:40 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -1081,7 +1090,7 @@ const defaultCommitKeyCodes = [
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 15:56:36 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     //
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     // The pattern matches up to the caret (end of string switch - $).
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-08 20:12:40 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     //               (0:      opening sequence       )(1: marker  )(2:                typed mention              )$
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-    const pattern = `(?:^|[ ${openAfterCharacters}])(${marker})(${mentionCharacters}${numberOfCharacters})$`;
							 | 
						
					
						
							
								
									
										
										
										
											2025-05-06 15:56:36 +03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    const pattern = `(?:^|[= ${ openAfterCharacters }])([${ marker }])([${ mentionCharacters }]${ numberOfCharacters })$`;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     return new RegExp(pattern, 'u');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 /**
							 |