+ }
+
+ flush() {
+ let self = this;
+ return new Promise((resolve, reject) => {
+ if ($('#html-view .error').length > 0) {
+ reject()
+ } else {
+ //return _finalize(failure);
+ html2text({
+ element: $('#html-view').get(0),
+ stripOuter: true,
+ success: (text) => {
+ self.doc.setText(text);
+ resolve();
+ },
+ error: (text) => {
+ reject(text);
+ //$('#source-editor').html('<p>Wystąpił błąd:</p><pre>' + text + '</pre>');
+ }
+ });
+ }
+ });
+ }