Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

fix(chore): fixes webpack-stream error with missing catch var declaration #2291

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meta/bundle-size-stats/Draft.js.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion meta/bundle-size-stats/Draft.min.js.json

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions src/component/selection/setDraftEditorSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function addFocusToSelection(
// the call to 'selection.extend' is about to throw
DraftJsDebugLogging.logSelectionStateFailure({
anonymizedDom: getAnonymizedEditorDOM(node),
extraParams: JSON.stringify({offset: offset}),
extraParams: JSON.stringify({offset}),
selectionState: JSON.stringify(selectionState.toJS()),
});
}
Expand Down Expand Up @@ -292,7 +292,7 @@ function addFocusToSelection(
: null,
selectionFocusOffset: selection.focusOffset,
message: e ? '' + e : null,
offset: offset,
offset,
},
null,
2,
Expand Down Expand Up @@ -329,7 +329,7 @@ function addPointToSelection(
// in this case we know that the call to 'range.setStart' is about to throw
DraftJsDebugLogging.logSelectionStateFailure({
anonymizedDom: getAnonymizedEditorDOM(node),
extraParams: JSON.stringify({offset: offset}),
extraParams: JSON.stringify({offset}),
selectionState: JSON.stringify(selectionState.toJS()),
});
DraftEffects.handleExtensionCausedError();
Expand All @@ -340,8 +340,11 @@ function addPointToSelection(
if (isIE) {
try {
selection.addRange(range);
} catch {
// ignore
} catch (e) {
if (__DEV__) {
/* eslint-disable-next-line no-console */
console.warn('Call to selection.addRange() threw exception: ', e);
}
}
} else {
selection.addRange(range);
Expand Down