Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in variable #32

Merged
merged 1 commit into from
Apr 17, 2021
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
16 changes: 8 additions & 8 deletions src/mathui.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export default class MathUI extends Plugin {
this.formView.destroy();

// Destroy preview element
const prewviewEl = global.document.getElementById( this._previewUid );
if ( prewviewEl ) {
prewviewEl.parentNode.removeChild( prewviewEl );
const previewEl = global.document.getElementById( this._previewUid );
if ( previewEl ) {
previewEl.parentNode.removeChild( previewEl );
}
}

Expand Down Expand Up @@ -125,8 +125,8 @@ export default class MathUI extends Plugin {
}

// Show preview element
const prewviewEl = global.document.getElementById( this._previewUid );
if ( prewviewEl && this.formView.previewEnabled ) {
const previewEl = global.document.getElementById( this._previewUid );
if ( previewEl && this.formView.previewEnabled ) {
// Force refresh preview
this.formView.mathView.updateMath();
}
Expand Down Expand Up @@ -167,9 +167,9 @@ export default class MathUI extends Plugin {
this._balloon.remove( this.formView );

// Hide preview element
const prewviewEl = global.document.getElementById( this._previewUid );
if ( prewviewEl ) {
prewviewEl.style.visibility = 'hidden';
const previewEl = global.document.getElementById( this._previewUid );
if ( previewEl ) {
previewEl.style.visibility = 'hidden';
}

this.editor.editing.view.focus();
Expand Down
28 changes: 14 additions & 14 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function getBalloonPositionData( editor ) {
positions: [
defaultPositions.southArrowNorth,
defaultPositions.southArrowNorthWest,
defaultPositions.southArrowNorthEast,
defaultPositions.southArrowNorthEast
]
};
}
Expand All @@ -127,16 +127,16 @@ export function getBalloonPositionData( editor ) {
positions: [
defaultPositions.southArrowNorth,
defaultPositions.southArrowNorthWest,
defaultPositions.southArrowNorthEast,
defaultPositions.southArrowNorthEast
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

✖ eslint --quiet:

/home/t/work/javascript/ckeditor5-math/src/utils.js
  119:41  error  Unexpected trailing comma  comma-dangle
  130:41  error  Unexpected trailing comma  comma-dangle

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

]
};
}
}

function selectRenderMode( element, preview, previewUid, cb ) {
if ( preview ) {
createPreviewElement( element, previewUid, prewviewEl => {
cb( prewviewEl );
createPreviewElement( element, previewUid, previewEl => {
cb( previewEl );
} );
} else {
cb( element );
Expand Down Expand Up @@ -173,25 +173,25 @@ function renderMathJax2( equation, element, display ) {
}

function createPreviewElement( element, previewUid, render ) {
const prewviewEl = getPreviewElement( element, previewUid );
render( prewviewEl );
const previewEl = getPreviewElement( element, previewUid );
render( previewEl );
}

function getPreviewElement( element, previewUid ) {
let prewviewEl = global.document.getElementById( previewUid );
let previewEl = global.document.getElementById( previewUid );
// Create if not found
if ( !prewviewEl ) {
prewviewEl = global.document.createElement( 'div' );
prewviewEl.setAttribute( 'id', previewUid );
prewviewEl.style.visibility = 'hidden';
global.document.body.appendChild( prewviewEl );
if ( !previewEl ) {
previewEl = global.document.createElement( 'div' );
previewEl.setAttribute( 'id', previewUid );
previewEl.style.visibility = 'hidden';
global.document.body.appendChild( previewEl );

let ticking = false;

const renderTransformation = () => {
if ( !ticking ) {
global.window.requestAnimationFrame( () => {
moveElement( element, prewviewEl );
moveElement( element, previewEl );
ticking = false;
} );

Expand All @@ -203,7 +203,7 @@ function getPreviewElement( element, previewUid ) {
global.window.addEventListener( 'resize', renderTransformation );
global.window.addEventListener( 'scroll', renderTransformation );
}
return prewviewEl;
return previewEl;
}

function moveAndScaleElement( parent, child ) {
Expand Down