-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
52 lines (45 loc) · 1.05 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
class Hello extends React.Component {
constructor() {
super();
this.buttons = ['bold', 'italic', 'h2'];
}
componentDidMount() {
$.FroalaEditor.DefineIcon('h2', {NAME: 'star'});
$.FroalaEditor.RegisterCommand('h2', {
title: 'H2',
focus: true,
undo: true,
callback: function () {
debugger;
if (this.format.is('h2')) {
this.paragraphFormat.apply('p');
}
else {
this.paragraphFormat.apply('h2');
}
},
refresh: function ($btn) {
$btn.toggleClass('fr-active', this.format.is('h2'));
}
});
$('#edit').froalaEditor({
toolbarButtonsSM: this.buttons,
toolbarButtonsMD: this.buttons,
toolbarButtonsXS: this.buttons,
toolbarButtons: this.buttons,
});
}
render() {
return (
<textarea id="edit">
some text
</textarea>
);
}
}
ReactDOM.render(
<Hello />,
document.getElementById('container')
);