2017-02-27 07:44:15 +03:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
|
|
|
export default function (editor, toolbar) {
|
|
|
|
return [
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'H1',
|
|
|
|
class: 'h1',
|
|
|
|
icon: '',
|
|
|
|
label: 'Heading One',
|
2017-02-27 07:44:15 +03:00
|
|
|
visibility: 'primary',
|
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
2017-02-27 15:05:31 +03:00
|
|
|
toolbar: true,
|
2017-02-27 07:44:15 +03:00
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('h1');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'h1').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'H2',
|
|
|
|
class:'h2',
|
|
|
|
label: 'Heading Two',
|
|
|
|
icon: '',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
|
|
|
visibility: 'primary',
|
2017-02-27 15:05:31 +03:00
|
|
|
toolbar: true,
|
2017-02-27 07:44:15 +03:00
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('h2');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'h2').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'H3',
|
|
|
|
label: 'Heading Three',
|
|
|
|
icon: '',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
|
|
|
visibility: 'primary',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('h3');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'h3').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'p',
|
|
|
|
label: 'Paragraph',
|
|
|
|
icon: 'paragraph.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('p');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'p').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: '“',
|
|
|
|
label: 'Quote',
|
|
|
|
class: 'quote',
|
|
|
|
icon: 'quote.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
2017-02-27 15:05:31 +03:00
|
|
|
toolbar: true,
|
2017-02-27 07:44:15 +03:00
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('blockquote');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'blockquote').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
2017-02-27 15:05:31 +03:00
|
|
|
{
|
|
|
|
name: 'ul',
|
|
|
|
label: 'List Unordered',
|
|
|
|
icon: 'list-bullets.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('ul');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'ul').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'ol',
|
|
|
|
label: 'List Ordered',
|
|
|
|
icon: 'list-number.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'block',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleSection('ol');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'ol').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'B',
|
|
|
|
label: 'Bold',
|
|
|
|
class: 'bold',
|
|
|
|
icon: 'bold.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'markup',
|
|
|
|
visibility: 'primary',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleMarkup('strong');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'strong').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'I',
|
|
|
|
label: 'Italic',
|
|
|
|
class: 'italic',
|
|
|
|
icon: 'italic.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'markup',
|
|
|
|
visibility: 'primary',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleMarkup('em');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'em').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'S',
|
|
|
|
label: 'Strike',
|
|
|
|
class: 'strike',
|
|
|
|
icon: 'strikethrough.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'markup',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.toggleMarkup('s');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 's').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'L',
|
|
|
|
label: 'Link',
|
|
|
|
class: 'link',
|
|
|
|
icon: 'link.svg',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'markup',
|
2017-02-27 15:05:31 +03:00
|
|
|
visibility: 'primary',
|
2017-02-27 07:44:15 +03:00
|
|
|
onClick: (editor) => {
|
2017-02-27 15:05:31 +03:00
|
|
|
toolbar.doLink(editor.range);
|
2017-02-27 07:44:15 +03:00
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'a').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
2017-02-27 15:05:31 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
|
2017-02-27 07:44:15 +03:00
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'img',
|
|
|
|
label: 'Image',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'card',
|
|
|
|
icon: 'file-picture-add.svg',
|
2017-02-27 15:05:31 +03:00
|
|
|
visibility: 'primary',
|
2017-02-27 07:44:15 +03:00
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 15:05:31 +03:00
|
|
|
let card = postEditor.builder.createCardSection('image-card', {pos: 'top'});
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.replaceSection(editor.range.headSection, card);
|
|
|
|
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function (elements) {
|
2017-02-27 15:05:31 +03:00
|
|
|
Ember.set(this, 'selected', elements.filter(element => element.tagName === 'sup').length > 0);
|
2017-02-27 07:44:15 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'html',
|
|
|
|
label: 'Embed HTML',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'card',
|
|
|
|
icon: 'html-five.svg',
|
2017-02-27 15:05:31 +03:00
|
|
|
visibility: 'primary',
|
2017-02-27 07:44:15 +03:00
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 15:05:31 +03:00
|
|
|
let card = postEditor.builder.createCardSection('html-card', {pos: 'top'});
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.replaceSection(editor.range.headSection, card);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-02-27 15:05:31 +03:00
|
|
|
name: 'md',
|
|
|
|
label: 'Embed Markdown',
|
2017-02-27 07:44:15 +03:00
|
|
|
selected: false,
|
|
|
|
type: 'card',
|
2017-02-27 15:05:31 +03:00
|
|
|
visibility: 'primary',
|
2017-02-27 07:44:15 +03:00
|
|
|
icon: 'file-code-1.svg',
|
|
|
|
onClick: (editor) => {
|
2017-03-01 10:28:46 +03:00
|
|
|
editor.run((postEditor) => {
|
2017-02-27 15:05:31 +03:00
|
|
|
let card = postEditor.builder.createCardSection('markdown-card', {pos: 'top'});
|
2017-02-27 07:44:15 +03:00
|
|
|
postEditor.replaceSection(editor.range.headSection, card);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
checkElements: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|