|
|
|
@ -1,11 +1,12 @@ |
|
|
|
import Component from './Component'; |
|
|
|
import { toLowerCase } from 'utils/mixins'; |
|
|
|
import { toLowerCase } from '../../utils/mixins'; |
|
|
|
|
|
|
|
const type = 'script'; |
|
|
|
|
|
|
|
export default class ComponentScript extends Component { |
|
|
|
get defaults() { |
|
|
|
return { |
|
|
|
// @ts-ignore
|
|
|
|
...super.defaults, |
|
|
|
type, |
|
|
|
tagName: type, |
|
|
|
@ -14,17 +15,17 @@ export default class ComponentScript extends Component { |
|
|
|
layerable: false, |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ComponentScript.isComponent = el => { |
|
|
|
if (toLowerCase(el.tagName) == type) { |
|
|
|
const result = { type }; |
|
|
|
static isComponent(el: HTMLImageElement) { |
|
|
|
if (toLowerCase(el.tagName) == type) { |
|
|
|
const result: any = { type }; |
|
|
|
|
|
|
|
if (el.src) { |
|
|
|
result.src = el.src; |
|
|
|
result.onload = el.onload; |
|
|
|
} |
|
|
|
if (el.src) { |
|
|
|
result.src = el.src; |
|
|
|
result.onload = el.onload; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
} |