deblan.io-murph/assets/js/admin_modules/simplemde.js
2021-06-15 14:33:51 +02:00

96 lines
2.3 KiB
JavaScript

const Editor = require('simplemde')
const $ = require('jquery')
module.exports = () => {
const elements = $('textarea[data-simplemde]')
elements.each((i, element) => {
$(element).removeClass('form-control')
new Editor({
element: element,
forceSync: true,
autoDownloadFontAwesome: false,
spellChecker: false,
styleSelectedText: false,
toolbar: [
{
name: 'bold',
action: Editor.toggleBold,
className: 'fa fa-bold',
title: 'Bold'
},
{
name: 'italic',
action: Editor.toggleItalic,
className: 'fa fa-italic',
title: 'Italic'
},
{
name: 'heading',
action: Editor.toggleHeadingSmaller,
className: 'fa fa-heading',
title: 'Heading'
},
'|',
{
name: 'quote',
action: Editor.toggleBlockquote,
className: 'fa fa-quote-left',
title: 'Quote'
},
{
name: 'unordered-list',
action: Editor.toggleUnorderedList,
className: 'fa fa-list-ul',
title: 'Generic List'
},
{
name: 'ordered-list',
action: Editor.toggleOrderedList,
className: 'fa fa-list-ol',
title: 'Numbered List'
},
{
name: 'table',
action: Editor.drawTable,
className: 'fa fa-table',
title: 'Insert Table'
},
'|',
{
name: 'link',
action: Editor.drawLink,
className: 'fa fa-link',
title: 'Create Link'
},
{
name: 'image',
action: Editor.drawImage,
className: 'fa fa-image',
title: 'Insert Image'
},
'|',
{
name: 'preview',
action: Editor.togglePreview,
className: 'fa fa-eye no-disable',
title: 'togglePreview'
},
{
name: 'side-by-side',
action: Editor.toggleSideBySide,
className: 'fa fa-columns no-disable no-mobile',
title: 'Toggle Side by Side'
},
{
name: 'fullscreen',
action: Editor.toggleFullScreen,
className: 'fa fa-arrows-alt no-disable no-mobile',
title: 'Toggle Fullscreen'
}
]
})
})
}