import MarkdowneditorUndo from "./markdowneditor.undo";
import MarkdowneditorSave from "./markdowneditor.save";
import MarkdowneditorVersions from "./markdowneditor.versions";
+
import tippy from "tippy.js";
import 'tippy.js/dist/tippy.css';
+import Noty from "noty";
+import 'noty/lib/noty.css';
+import 'noty/lib/themes/mint.css';
+
window.$ = window.jQuery = require('jquery');
window.key = require('keymaster-reloaded');
$("body").removeClass("user-select-none")
})
- $(document).on('keyup', function (e) {
+ $(document).on('keyup', '.markdown-editor', function (e) {
$this.undo.pushState()
+ $this.save.hasChanged()
})
},
i.select();
},
- /*isSpecialPage: function (page) {
- if (page === undefined) {
- page = this.linkeditor.currentPage;
+ notification: function (text, type, timeout) {
+ if (timeout === undefined) {
+ timeout = 5000;
}
- return page.toString().indexOf('link_') === 0 || (THEME[page] !== undefined && THEME[page] !== null);
- },*/
+ if (type === undefined) {
+ type = 'success';
+ }
+ new Noty({
+ type: type,
+ text: text,
+ timeout: timeout,
+ }).show();
+ },
}
},
save: function (message, notify, callback) {
- console.log(message)
if (notify === undefined) {
notify = true;
}
},
success: function (data) {
if (notify) {
- //$this.linkeditor.notification(TRANSLATIONS.success_save);
+ $this.markdowneditor.notification(TRANSLATIONS.success_save);
}
clearTimeout($this.automaticSaveTimeout);
$this.unsavedChanges = false;
callback();
},
error: function (jqXHR, status, error) {
- //$this.linkeditor.hasChanged();
- //$this.linkeditor.notification(TRANSLATIONS.error_save + ' : ' + error, 'error');
+ $this.markdowneditor.hasChanged();
+ $this.markdowneditor.notification(TRANSLATIONS.error_save + ' : ' + error, 'error');
},
});
},
$fbdata['settings']['imageFormat']=$fluidbook->getImageFormat();
$fbdata['page_dimensions']=[];
$translations=[
- 'success_save'=>__('Liens sauvegardés'),
- 'error_save'=>__('Une erreur s\'est produite lors de la sauvegarde des liens'),
+ 'success_save'=> 'Markdown sauvegardé',
+ 'error_save'=>__('Une erreur s\'est produite lors de la sauvegarde du markdown'),
'error'=>__('Une erreur s\'est produite'),
'manual_save_message'=>__('Sauvegarde manuelle'),
'automatic_save_message'=>__('Sauvegarde automatique'),