'use strict';

window.mySettings = {
    onShiftEnter:   {keepDefault: false, replaceWith: '<br />\n'},
    onCtrlEnter:    {keepDefault: false, openWith: '\n<p>', closeWith: '</p>\n'},
    onTab: {keepDefault: false, replaceWith:'   '},
    markupSet: [
        {name: 'Жирный', className:'edit-bold', key:'B', openWith:'<strong>', closeWith:'</strong>'},
        {name: 'Курсив', className:'edit-italic', key:'I', openWith:'<em>', closeWith:'</em>'},
        {name: 'Зачеркнуть', className:'edit-strike', key:'S', openWith:'<s>', closeWith:'</s>'},
        {name: 'Подчеркнуть', className:'edit-underline', key:'U', openWith:'<u>', closeWith:'</u>'},
        {separator: '---------------'},
        {name: 'H3', className:'edit-h3', openWith:'<h3>', closeWith:'</h3>'},
        {name: 'H4', className:'edit-h4', openWith:'<h4>', closeWith:'</h4>'},
        {name: 'H5', className:'edit-h5', openWith:'<h5>', closeWith:'</h5>'},
        {separator: '---------------'},
        {name: 'По левому краю', className:'edit-alignment-left', openWith:'<span align="left">', closeWith:'</span>'},
        {name: 'По центру', className:'edit-alignment-center', openWith:'<span align="center">', closeWith:'</span>'},
        {name: 'По правому краю', className:'edit-alignment-right', openWith:'<span align="right">', closeWith:'</span>'},
        {separator: '---------------'},
        {name: 'Новая строка', className:'edit-br', replaceWith:'<br>'},
        {name: 'Разделитель', className:'edit-hr', replaceWith:'<hr>'},
        {separator: '---------------'},
        {name: 'Добавить изображение', className:'edit-image', replaceWith:'<img src="[!['+'Введите адрес изображения:'+':!:http://]!]" />' },
        {name: 'Добавить ссылку', className:'edit-anchor', key:'L', openWith:'<a href="[!['+'Введите url адрес:'+':!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Введите адрес ссылки...' },
        {separator: '---------------'},
        {name: 'Обычный список', className:'edit-list', openWith:'<li>', closeWith:'</li>', multiline: true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>' },
        {name: 'Нумерованный список', className:'edit-list-order', openWith:'<li>', closeWith:'</li>', multiline: true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>' },
        {name: 'Элемент списка', className:'edit-list-item', openWith:'<li>', closeWith:'</li>'},
        {separator: '---------------'},
        {name: 'Цитировать', className:'edit-quotation', key:'Q', replaceWith: function(m) { if (m.selectionOuter) return '<blockquote>'+m.selectionOuter+'</blockquote>'; else if (m.selection) return '<blockquote>'+m.selection+'</blockquote>'; else return '<blockquote></blockquote>'}},
        {name: 'Верхний индекс', className:'edit-superscript', openWith:'<sup>', closeWith:'</sup>'},
        {name: 'Нижний индекс', className:'edit-subscript', openWith:'<sub>', closeWith:'</sub>'},
        {name: 'Код', className:'edit-code', openWith: '<pre>', closeWith:'</pre>'},
        {name: 'Уменьшить размер', className:'edit-small', openWith:'<small>', closeWith:'</small>'},
        {separator: '---------------'},
        {name: 'Очистка от тегов', className:'edit-tag', replaceWith: function(markitup) {return markitup.selection.replace(/<(.*?)>/g, "")}},
    ]
};
