()
| 846 | } |
| 847 | |
| 848 | save() { |
| 849 | if (this.saving) { |
| 850 | return this; |
| 851 | } |
| 852 | this.saving = true; |
| 853 | const btn = this.baseEl.querySelector(`#${this.toolByName.save.buttonId}`); |
| 854 | const icon = this.baseEl.querySelector(`#${this.toolByName.save.buttonId} > i`); |
| 855 | if (this.toolByName.save.buttonId && btn) { |
| 856 | btn.setAttribute('disabled', 'true'); |
| 857 | } |
| 858 | this.hasUnsaved = false; |
| 859 | |
| 860 | if (icon) { |
| 861 | icon.className = 'ptro-icon ptro-icon-loading ptro-spinning'; |
| 862 | } |
| 863 | |
| 864 | if (this.params.saveHandler !== undefined) { |
| 865 | this.params.saveHandler(this.imageSaver, (hide) => { |
| 866 | if (hide === true) { |
| 867 | this.hide(); |
| 868 | } |
| 869 | if (icon) { |
| 870 | icon.className = 'ptro-icon ptro-icon-save'; |
| 871 | } |
| 872 | this.saving = false; |
| 873 | }); |
| 874 | } else { |
| 875 | logError('No saveHandler defined, please check documentation'); |
| 876 | if (icon) { |
| 877 | icon.className = 'ptro-icon ptro-icon-save'; |
| 878 | } |
| 879 | this.saving = false; |
| 880 | } |
| 881 | return this; |
| 882 | } |
| 883 | |
| 884 | close() { |
| 885 | if (this.params.onClose !== undefined) { |
no test coverage detected