How to use the dropzone.createElement function in dropzone

To help you get started, we’ve selected a few dropzone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mshossain110 / examinee / resources / assets / js / components / common / dropzone / Dropzone.vue View on Github external
this.dropzone.on('addedfile', function (file) {
            let isDuplicate = false // eslint-disable-line no-unused-vars

            const _removeLink = Dropzone.createElement('<a data-dz-remove="" class="dz-remove btn-icon"><i class="fas fa-times"></i></a>')
            file.previewElement.appendChild(_removeLink)

            if (vm.duplicateCheck) {
                if (this.files.length) {
                    var _i, _len
                    // -1 to exclude current file
                    for (_i = 0, _len = this.files.length; _i &lt; _len - 1; _i++) {
                        if (this.files[_i].name === file.name &amp;&amp;
                            this.files[_i].size === file.size &amp;&amp;
                            this.files[_i].lastModifiedDate.toString() === file.lastModifiedDate.toString()) {
                            this.removeFile(file)
                            isDuplicate = true
                            vm.$emit('vdropzone-duplicate-file', file)
                        }
                    }
                }
github orchidsoftware / platform / resources / js / controllers / fields / upload_controller.js View on Github external
this.on('addedfile', (e) =&gt; {
                    console.log('dropzone.addedfile');

                    if (this.files.length &gt; this.options.maxFiles) {
                        window.platform.alert('Validation error', 'Max files');
                        this.removeFile(e);
                    }

                    const removeButton = Dropzone.createElement('<a class="btn-remove">×</a>');
                    const editButton = Dropzone.createElement('<a class="btn-edit"><i aria-hidden="true" class="icon-note"></i></a>');

                    removeButton.addEventListener('click', (event) =&gt; {
                        event.preventDefault();
                        event.stopPropagation();
                        this.removeFile(e);
                    });

                    editButton.addEventListener('click', () =&gt; {
                        loadInfo(e.data);
                        $(`${dropname} .attachment.modal`).modal('show');
                    });

                    e.previewElement.appendChild(removeButton);
                    e.previewElement.appendChild(editButton);

                    if (e.data !== undefined) {
github orchidsoftware / platform / resources / js / controllers / fields / upload_controller.js View on Github external
this.on('addedfile', (e) =&gt; {
                    console.log('dropzone.addedfile');

                    if (this.files.length &gt; this.options.maxFiles) {
                        window.platform.alert('Validation error', 'Max files');
                        this.removeFile(e);
                    }

                    const removeButton = Dropzone.createElement('<a class="btn-remove">×</a>');
                    const editButton = Dropzone.createElement('<a class="btn-edit"><i aria-hidden="true" class="icon-note"></i></a>');

                    removeButton.addEventListener('click', (event) =&gt; {
                        event.preventDefault();
                        event.stopPropagation();
                        this.removeFile(e);
                    });

                    editButton.addEventListener('click', () =&gt; {
                        loadInfo(e.data);
                        $(`${dropname} .attachment.modal`).modal('show');
                    });

                    e.previewElement.appendChild(removeButton);
                    e.previewElement.appendChild(editButton);