Skip to content

Commit

Permalink
feat(demo): add image demo #WIK-563
Browse files Browse the repository at this point in the history
  • Loading branch information
王焕 committed May 19, 2021
1 parent ba112ce commit e05f556
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo/app/components/image/image-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BaseElementComponent } from 'slate-angular';
template: `<slate-children [children]="children" [context]="childrenContext" [viewContext]="viewContext"></slate-children>
<img [src]="element.url" alt="" [class.outline]="selection"> `,
host: {
class: 'demo-element-image',
class: 'demo-element-image'
}
})
export class DemoElementImageComponent extends BaseElementComponent {
Expand Down
8 changes: 4 additions & 4 deletions demo/app/images/images.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export class DemoImagesComponent implements OnInit {

isImgUrl(imgUrl: string) {
return new Promise((resolve, reject) => {
var ImgObj = new Image();
ImgObj.src = imgUrl;
ImgObj.onload = () => {
const imgObj = new Image();
imgObj.src = imgUrl;
imgObj.onload = () => {
resolve(true);
}
ImgObj.onerror = () => {
imgObj.onerror = () => {
reject(false)
}
}).catch(error => { });
Expand Down

0 comments on commit e05f556

Please sign in to comment.