Skip to content

Commit

Permalink
fix(hyper-link): Move toString out of while loop to prevent memory le…
Browse files Browse the repository at this point in the history
…ak (#687)
  • Loading branch information
danielericlee authored Oct 2, 2024
1 parent 4e8730a commit e10f426
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/hyper-link/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class HyperLinkIcon extends WidgetType {

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

while ((match = defaultRegexp.exec(doc.toString())) !== null) {
while ((match = defaultRegexp.exec(doc)) !== null) {
const from = match.index;
const to = from + match[0].length;
const widget = Decoration.widget({
Expand Down

0 comments on commit e10f426

Please sign in to comment.