Skip to content

Commit

Permalink
TS fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
niegowski committed Oct 26, 2023
1 parent e7bb957 commit 8969c76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/ckeditor5-image/tests/manual/simple-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { GeneralHtmlSupport } from '@ckeditor/ckeditor5-html-support';
import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';

import type { Editor } from '@ckeditor/ckeditor5-core';
import type { ViewElement, UpcastElementEvent } from '@ckeditor/ckeditor5-engine';
import type { ViewElement, Element, UpcastElementEvent } from '@ckeditor/ckeditor5-engine';
import { AutoImage, ImageInsert, ImageResize, type ImageUtils } from '@ckeditor/ckeditor5-image';
import ImageLoadObserver from '@ckeditor/ckeditor5-image/src/image/imageloadobserver';
import ImageLoadObserver, { type ImageLoadedEvent } from '@ckeditor/ckeditor5-image/src/image/imageloadobserver';

declare global {
interface Window {
Expand Down Expand Up @@ -253,7 +253,7 @@ function SimpleImage( editor: Editor ) {
const imageUtils: ImageUtils = editor.plugins.get( 'ImageUtils' );

// Waiting for any new images loaded, so we can set their natural width and height.
editor.editing.view.document.on( 'imageLoaded', ( evt, domEvent ) => {
editor.editing.view.document.on<ImageLoadedEvent>( 'imageLoaded', ( evt, domEvent ) => {
const imgViewElement = editor.editing.view.domConverter.mapDomToView( domEvent.target as HTMLElement );

if ( !imgViewElement ) {
Expand All @@ -280,7 +280,7 @@ function SimpleImage( editor: Editor ) {
// Post-fixer to ensure we do not have redundant resizedX attributes if image is in original size.
editor.model.document.registerPostFixer( writer => {
const changes = writer.model.document.differ.getChanges();
const images = [];
const images: Array<Element> = [];
let wasFixed = false;

for ( const change of changes ) {
Expand All @@ -289,7 +289,7 @@ function SimpleImage( editor: Editor ) {
continue;
}

const item = change.range.start.nodeAfter;
const item = change.range.start.nodeAfter!;

if ( item.is( 'element', 'imageBlock' ) || item.is( 'element', 'imageInline' ) ) {
images.push( item );
Expand Down Expand Up @@ -328,7 +328,7 @@ function SimpleImage( editor: Editor ) {
}

ClassicEditor
.create( document.getElementById( 'editor' ), {
.create( document.getElementById( 'editor' )!, {
plugins: [
ArticlePluginSet, EasyImage, ImageResize, ImageInsert, LinkImage, AutoImage,
CloudServices, SourceEditing, GeneralHtmlSupport, SimpleImage
Expand Down

0 comments on commit 8969c76

Please sign in to comment.