Skip to content

Commit e10f426

Browse files
authoredOct 2, 2024··
fix(hyper-link): Move toString out of while loop to prevent memory leak (#687)
1 parent 4e8730a commit e10f426

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎extensions/hyper-link/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ class HyperLinkIcon extends WidgetType {
4141

4242
function hyperLinkDecorations(view: EditorView, anchor?: HyperLinkExtensionOptions['anchor']) {
4343
const widgets: Array<Range<Decoration>> = [];
44-
const doc = view.state.doc;
44+
const doc = view.state.doc.toString();
4545
let match;
4646

47-
while ((match = defaultRegexp.exec(doc.toString())) !== null) {
47+
while ((match = defaultRegexp.exec(doc)) !== null) {
4848
const from = match.index;
4949
const to = from + match[0].length;
5050
const widget = Decoration.widget({

0 commit comments

Comments
 (0)
Please sign in to comment.