From f8d84814e079bdca892c1c2cac75c53baa96f20b Mon Sep 17 00:00:00 2001 From: meinzzzz Date: Wed, 26 Nov 2025 23:02:34 +0100 Subject: [PATCH] Fix differential d problems --- .../src/ui/mathliveinputview.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/ckeditor5-math/src/ui/mathliveinputview.ts b/packages/ckeditor5-math/src/ui/mathliveinputview.ts index a3863077c..f761be787 100644 --- a/packages/ckeditor5-math/src/ui/mathliveinputview.ts +++ b/packages/ckeditor5-math/src/ui/mathliveinputview.ts @@ -8,7 +8,8 @@ interface MathFieldElement extends HTMLElement { value: string; readOnly: boolean; mathVirtualKeyboardPolicy: string; - + // Interface includes the shortcuts property + inlineShortcuts: Record; } /** @@ -56,11 +57,23 @@ export default class MathLiveInputView extends View { // 2. Configure Options 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' ); if ( MathfieldConstructor ) { - ( MathfieldConstructor as any ).soundsDirectory = null; - ( MathfieldConstructor as any ).plonkSound = null; + const proto = MathfieldConstructor as any; + if ( proto.soundsDirectory !== null ) proto.soundsDirectory = null; + if ( proto.plonkSound !== null ) proto.plonkSound = null; } // 3. Set Initial State @@ -84,7 +97,7 @@ export default class MathLiveInputView extends View { mathfield.readOnly = nextValue; } ); - // 6. Mount + // 6. Mount to the wrapper view this.element?.appendChild( mathfield ); this.mathfield = mathfield; }