Skip to content

Commit 51125ec

Browse files
authored
feat: Add External annotation to the public API (#740)
1 parent e0bf55d commit 51125ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/useCodeMirror.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getStatistics } from './utils';
66
import { type ReactCodeMirrorProps } from '.';
77
import { TimeoutLatch, getScheduler } from './timeoutLatch';
88

9-
const External = Annotation.define<boolean>();
9+
export const ExternalChange = Annotation.define<boolean>();
1010
const TYPING_TIMOUT = 200; // ms
1111

1212
export interface UseCodeMirror extends ReactCodeMirrorProps {
@@ -64,7 +64,7 @@ export function useCodeMirror(props: UseCodeMirror) {
6464
typeof onChange === 'function' &&
6565
// Fix echoing of the remote changes:
6666
// If transaction is market as remote we don't have to call `onChange` handler again
67-
!vu.transactions.some((tr) => tr.annotation(External))
67+
!vu.transactions.some((tr) => tr.annotation(ExternalChange))
6868
) {
6969
if (typingLatch.current) {
7070
typingLatch.current.reset();
@@ -193,7 +193,7 @@ export function useCodeMirror(props: UseCodeMirror) {
193193
if (view && value !== view.state.doc.toString()) {
194194
view.dispatch({
195195
changes: { from: 0, to: view.state.doc.toString().length, insert: value || '' },
196-
annotations: [External.of(true)],
196+
annotations: [ExternalChange.of(true)],
197197
});
198198
}
199199
};

0 commit comments

Comments
 (0)