mirror of
https://github.com/zadam/trilium.git
synced 2026-03-06 17:58:10 +01:00
Fix differential d problems
This commit is contained in:
parent
c46cf41842
commit
f8d84814e0
@ -8,7 +8,8 @@ interface MathFieldElement extends HTMLElement {
|
|||||||
value: string;
|
value: string;
|
||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
mathVirtualKeyboardPolicy: string;
|
mathVirtualKeyboardPolicy: string;
|
||||||
|
// Interface includes the shortcuts property
|
||||||
|
inlineShortcuts: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,11 +57,23 @@ export default class MathLiveInputView extends View {
|
|||||||
// 2. Configure Options
|
// 2. Configure Options
|
||||||
mathfield.mathVirtualKeyboardPolicy = 'manual';
|
mathfield.mathVirtualKeyboardPolicy = 'manual';
|
||||||
|
|
||||||
// Disable sounds
|
//Disable differential D
|
||||||
|
mathfield.addEventListener( 'mount', () => {
|
||||||
|
mathfield.inlineShortcuts = {
|
||||||
|
...mathfield.inlineShortcuts, // Safe to read now
|
||||||
|
dx: 'dx',
|
||||||
|
dy: 'dy',
|
||||||
|
dt: 'dt'
|
||||||
|
};
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
// Disable sounds safely
|
||||||
const MathfieldConstructor = customElements.get( 'math-field' );
|
const MathfieldConstructor = customElements.get( 'math-field' );
|
||||||
if ( MathfieldConstructor ) {
|
if ( MathfieldConstructor ) {
|
||||||
( MathfieldConstructor as any ).soundsDirectory = null;
|
const proto = MathfieldConstructor as any;
|
||||||
( MathfieldConstructor as any ).plonkSound = null;
|
if ( proto.soundsDirectory !== null ) proto.soundsDirectory = null;
|
||||||
|
if ( proto.plonkSound !== null ) proto.plonkSound = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Set Initial State
|
// 3. Set Initial State
|
||||||
@ -84,7 +97,7 @@ export default class MathLiveInputView extends View {
|
|||||||
mathfield.readOnly = nextValue;
|
mathfield.readOnly = nextValue;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// 6. Mount
|
// 6. Mount to the wrapper view
|
||||||
this.element?.appendChild( mathfield );
|
this.element?.appendChild( mathfield );
|
||||||
this.mathfield = mathfield;
|
this.mathfield = mathfield;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user