mirror of
https://github.com/codex-team/editor.js
synced 2024-06-27 01:40:22 +02:00
c3ee7560f1
* cover restoring fixed * upd * fetch fixed in safari * updated * plugins * plugins ready * code improved * fixed bug with backspace * improved architecture * Versioning (#102) * start versioning * codex.version * eslint settings * versioning improved * cover restoring and fetch function fixed (#101) * cover restoring fixed * upd * fetch fixed in safari * updated * plugins * plugins ready * code improved * fixed bug with backspace * improved architecture * new sanitize method (#103) * new sanitize method Need to fix caret position * removed console logs * version updated * eslint style * caret position * big fixed on sanitize method * sanitize improved, using observers * sanitize: using html-janitor * fixes * last fixes, code improved after review * updated * new bundle * webpack config improved * upd * upd * upd * upd * clear from conflicts * upd * upd
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
/**
|
|
* Codex Editor Notification Module
|
|
*
|
|
* @author Codex Team
|
|
* @version 1.0
|
|
*/
|
|
|
|
var notifications = (function(notifications) {
|
|
|
|
/**
|
|
* Error notificator. Shows block with message
|
|
* @protected
|
|
*/
|
|
notifications.errorThrown = function(errorMsg, event) {
|
|
|
|
codex.notifications.send('This action is not available currently', event.type, false);
|
|
|
|
};
|
|
|
|
/**
|
|
* Appends notification with different types
|
|
* @param message {string} - Error or alert message
|
|
* @param type {string} - Type of message notification. Ex: Error, Warning, Danger ...
|
|
* @param append {boolean} - can be True or False when notification should be inserted after
|
|
*/
|
|
notifications.send = function(message, type, append) {
|
|
|
|
var notification = codex.draw.block('div');
|
|
|
|
notification.textContent = message;
|
|
notification.classList.add('ce_notification-item', 'ce_notification-' + type, 'flipInX');
|
|
|
|
if (!append) {
|
|
codex.nodes.notifications.innerHTML = '';
|
|
}
|
|
|
|
codex.nodes.notifications.appendChild(notification);
|
|
|
|
setTimeout(function () {
|
|
notification.remove();
|
|
}, 3000);
|
|
|
|
};
|
|
|
|
return notifications;
|
|
|
|
})({});
|
|
|
|
module.exports = notifications; |