Skip to content
Merged
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
6 changes: 3 additions & 3 deletions core/src/useCodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getStatistics } from './utils';
import { type ReactCodeMirrorProps } from '.';
import { TimeoutLatch, getScheduler } from './timeoutLatch';

const External = Annotation.define<boolean>();
export const ExternalChange = Annotation.define<boolean>();
const TYPING_TIMOUT = 200; // ms

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