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

fix(FF): it works #14

Merged
merged 8 commits into from
Dec 9, 2020
Merged
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
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lls/mathlive",
"version": "0.59.0",
"version": "0.59.1",
"description": "Render and edit beautifully typeset math",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -76,47 +76,47 @@
"paosder <[email protected]>"
],
"devDependencies": {
"@babel/cli": "7.12.1",
"@babel/cli": "7.12.8",
"@babel/plugin-proposal-class-properties": "7.12.1",
"@babel/plugin-transform-classes": "7.12.1",
"@babel/preset-env": "7.12.1",
"@babel/preset-env": "7.12.7",
"@babel/types": "^7.12.6",
"@cortex-js/prettier-config": "^1.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "11.0.0",
"@types/css-font-loading-module": "0.0.4",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.7",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"@typescript-eslint/typescript-estree": "^4.7.0",
"@types/jest": "26.0.16",
"@typescript-eslint/eslint-plugin": "4.9.0",
"@typescript-eslint/parser": "4.9.0",
"@typescript-eslint/typescript-estree": "4.9.0",
"acorn-private-class-elements": "0.2.7",
"autoprefixer": "^9.8.6",
"check-node-version": "^4.0.3",
"cssnano": "^4.1.10",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint": "7.15.0",
"eslint-config-prettier": "7.0.0",
"eslint-plugin-no-unsanitized": "^3.1.4",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-prettier": "3.2.0",
"http-server": "^0.12.3",
"husky": "^4.3.0",
"husky": "4.3.5",
"jest": "^26.6.3",
"jest-silent-reporter": "^0.3.0",
"jest-silent-reporter": "0.4.0",
"less": "^3.12.2",
"lint-staged": "^10.5.1",
"lint-staged": "10.5.3",
"postcss-cli": "^7.1.2",
"prettier": "^2.1.2",
"prettier": "2.2.1",
"rimraf": "^3.0.2",
"rollup": "^2.33.2",
"rollup": "2.34.2",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-polyfill": "3.0.0",
"rollup-plugin-postcss": "^3.1.8",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"ts-jest": "^26.4.4",
"typescript": "^4.0.5"
},
"dependencies": {
"@webcomponents/webcomponentsjs": "2.5.0"
"@webcomponents/webcomponentsjs": "2.2.10"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FF 54 doesn't work with webcomponents polyfill > 2.2

},
"keywords": [
"math",
Expand Down
7 changes: 7 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import postcss from 'rollup-plugin-postcss';
import pkg from './package.json';
import path from 'path';
import chalk from 'chalk';
import polyfill from 'rollup-plugin-polyfill';

const { exec } = require('child_process');

Expand Down Expand Up @@ -172,6 +173,9 @@ const ROLLUP = [
moduleDirectory: 'submodules/math-json/src',
},
}),
polyfill([
'@webcomponents/webcomponentsjs/webcomponents-bundle.js',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject polyfill via rollup
polyfill injected in code doesn't work with multi-instance

]),
typescript(TYPESCRIPT_OPTIONS),
],
output: [
Expand Down Expand Up @@ -211,6 +215,9 @@ if (PRODUCTION) {
minimize: true,
}),
resolve(),
polyfill([
'@webcomponents/webcomponentsjs/webcomponents-bundle.js',
]),
typescript(TYPESCRIPT_OPTIONS),
terser(TERSER_OPTIONS),
],
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ rm -rf ./declarations
echo -e "\033[2K\033[80D\033[32m ✔ \033[0m Declaration files built"

# Copy fonts
printf "\033[32m ● \033[0m Copying static assets (fonts, sounds)"
printf "\033[32m ● \033[0m Copying static assets (fonts)"
cp -f -R css/fonts dist/
cp -f -R sounds dist/
echo -e "\033[2K\033[80D\033[32m ✔ \033[0m Static assest copied"

# Build CSS
Expand Down
1 change: 0 additions & 1 deletion src/editor-mathfield/keyboard-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ export function onTypedText(
if (mathfield.options.keypressVibration && navigator?.vibrate) {
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
}
//mathfield.keypressSound?.play().catch(console.warn);
}
//
// 2/ Switch mode if requested
Expand Down
42 changes: 15 additions & 27 deletions src/editor-mathfield/mathfield-private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,21 @@ export class MathfieldPrivate implements Mathfield {
) {
// Setup default config options
this.options = updateOptions(getDefaultOptions(), {
plonkSound: 'plonk.wav',
plonkSound: false,
keypressSound: {
spacebar: 'keypress-spacebar.wav',
return: 'keypress-return.wav',
delete: 'keypress-delete.wav',
default: 'keypress-standard.wav',
spacebar: false,
return: false,
delete: false,
default: false,
},
...options,
});

this.plonkSound = false

this.keypressSound = false
this.spacebarKeypressSound = false
this.returnKeypressSound = false
this.deleteKeypressSound = false

this.plonkSound = false;
this.keypressSound = false;
this.spacebarKeypressSound = false;
this.returnKeypressSound = false;
this.deleteKeypressSound = false;

this.element = element;
element['mathfield'] = this;
Expand Down Expand Up @@ -570,20 +568,11 @@ export class MathfieldPrivate implements Mathfield {
}
);

this.plonkSound = this.options.plonkSound as HTMLAudioElement;
if ( this.options.keypressSound &&
typeof this.options.keypressSound !== 'string' &&
!(this.options.keypressSound instanceof HTMLAudioElement)
) {
this.keypressSound = this.options.keypressSound
.default as HTMLAudioElement;
this.spacebarKeypressSound = this.options.keypressSound
.spacebar as HTMLAudioElement;
this.returnKeypressSound = this.options.keypressSound
.return as HTMLAudioElement;
this.deleteKeypressSound = this.options.keypressSound
.delete as HTMLAudioElement;
}
this.plonkSound = false;
this.keypressSound = false;
this.spacebarKeypressSound = false;
this.returnKeypressSound = false;
this.deleteKeypressSound = false;

if (!this.options.readOnly) {
this.onBlur();
Expand Down Expand Up @@ -1024,7 +1013,6 @@ export class MathfieldPrivate implements Mathfield {
if (this.options.keypressVibration && navigator?.vibrate) {
navigator.vibrate(HAPTIC_FEEDBACK_DURATION);
}
//this.keypressSound?.play();
}
if (s === '\\\\') {
// This string is interpreted as an "insert row after" command
Expand Down
1 change: 0 additions & 1 deletion src/editor/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export function defaultAnnounceHook(
if (action === 'plonk') {
// Use this sound to indicate minor errors, for
// example when an action has no effect.
//mathfield.plonkSound?.play().catch((err) => console.warn(err));
// As a side effect, reset the keystroke buffer
mathfield.resetKeystrokeBuffer();
} else if (action === 'delete') {
Expand Down
21 changes: 1 addition & 20 deletions src/editor/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,26 +149,7 @@ export function performWithFeedback(
selector = selector.replace(/-\w/g, (m) =>
m[1].toUpperCase()
) as SelectorPrivate;
if (
selector === 'moveToNextPlaceholder' ||
selector === 'moveToPreviousPlaceholder' ||
selector === 'complete'
) {
//mathfield.returnKeypressSound?.play().catch(console.warn);
} else if (
selector === 'deleteBackward' ||
selector === 'deleteForward' ||
selector === 'deletePreviousWord' ||
selector === 'deleteNextWord' ||
selector === 'deleteToGroupStart' ||
selector === 'deleteToGroupEnd' ||
selector === 'deleteToMathFieldStart' ||
selector === 'deleteToMathFieldEnd'
) {
//mathfield.deleteKeypressSound?.play().catch(console.warn);
} else {
//mathfield.keypressSound?.play().catch(console.warn);
}

return mathfield.executeCommand(selector);
}

Expand Down
Loading