Seeking Help - Performance Issue When Wrapping Large Selections

Hello TiddlyWiki Community,

I’m a new TiddlyWiki user currently working with the Node.js version 5.3.6. I’ve encountered a performance issue and would appreciate any guidance.

When using the “wrap selection with prefix/suffix” feature in the editor on very large text selections (e.g., 10,000+ characters), Microsoft Edge becomes unresponsive. The current implementation appears to work by replacing the selection with prefix + selectedText + suffix , which seems to cause performance bottlenecks with substantial content.

Would it be possible to optimize this functionality to instead insert the prefix before the selection and the suffix after the selection without manipulating the entire selected text as a single string? This approach might prevent browser freezes by avoiding massive text reflows.

Thank you for your time and expertise.