12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import Plugin from './Plugin'
- import html from '../core/html'
- /**
- * Dummy
- *
- */
- export default class Dummy extends Plugin {
- constructor (core, opts, props) {
- super(core, opts)
- this.type = 'acquirer'
- this.id = 'Dummy'
- this.title = 'Mr. Plugin'
- this.props = props
- // set default options
- const defaultOptions = {}
- // merge default options with the ones set by user
- this.opts = Object.assign({}, defaultOptions, opts)
- this.strange = html`<h1>this is strange 1</h1>`
- this.render = this.render.bind(this)
- this.install = this.install.bind(this)
- }
- addFakeFileJustToTest () {
- const blob = new Blob(
- ['data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTIwIDEyMCI+CiAgPGNpcmNsZSBjeD0iNjAiIGN5PSI2MCIgcj0iNTAiLz4KPC9zdmc+Cg=='],
- {type: 'image/svg+xml'}
- )
- const file = {
- source: 'acceptance-test',
- name: 'test-file',
- type: 'image/svg+xml',
- data: blob
- }
- this.props.log('Adding fake file blob')
- this.props.addFile(file)
- }
- render () {
- const bla = html`<h2>this is strange 2</h2>`
- return html`
- <div class="wow-this-works">
- <input class="UppyDummy-firstInput" type="text" value="hello">
- ${this.strange}
- ${bla}
- </div>
- `
- }
- focus () {
- const firstInput = document.querySelector(`${this.target} .UppyDummy-firstInput`)
- // only works for the first time if wrapped in setTimeout for some reason
- // firstInput.focus()
- setTimeout(function () {
- firstInput.focus()
- }, 10)
- setTimeout(() => {
- this.core.emit('informer', 'Hello! I’m a test Informer message', 'info', 4500)
- this.addFakeFileJustToTest()
- }, 1000)
- }
- install () {
- const target = this.opts.target
- const plugin = this
- this.target = this.mount(target, plugin)
- }
- }
|