-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
117 lines (96 loc) · 3.38 KB
/
index.html
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Froala test</title>
<!-- Include Font Awesome. -->
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.css">
<!-- Include Editor style. -->
<link rel="stylesheet" href="bower_components/FroalaWysiwygEditor/css/froala_editor.css">
<link rel="stylesheet" href="bower_components/FroalaWysiwygEditor/css/froala_style.css">
<link rel="stylesheet" href="bower_components/FroalaWysiwygEditor/css/plugins/code_view.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<div id="froala-edit" name="content"></div>
</div>
<!-- jQuery -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<!-- Froala -->
<script src="js/froala_editor.js"></script>
<script src="bower_components/FroalaWysiwygEditor/js/plugins/lists.min.js"></script>
<script src="bower_components/FroalaWysiwygEditor/js/plugins/paragraph_format.min.js"></script>
<script src="bower_components/FroalaWysiwygEditor/js/plugins/paragraph_style.min.js"></script>
<script src="bower_components/FroalaWysiwygEditor/js/plugins/code_view.min.js"></script>
<!-- Custom -->
<script>
$(function() {
// Extend the list of block tags the Froala editor keeps track of
$.FroalaEditor.BLOCK_TAGS.push("cc-factbox-intro", "cc-factbox");
// Define custom icons for custom buttons
$.FroalaEditor.DefineIcon('cc-factbox-intro', {NAME: 'header'});
$.FroalaEditor.DefineIcon('cc-factbox', {NAME: 'list-alt'});
// Create command: Toggle block 'factbox intro'
$.FroalaEditor.RegisterCommand('cc-factbox-intro', {
title: 'Fact box intro',
focus: false,
undo: true,
refreshAfterCallback: false,
callback: function () {
var element = $('#froala-edit').froalaEditor('selection.element');
if (element.nodeName == 'P') {
$('#froala-edit').froalaEditor('paragraphFormat.apply', 'cc-factbox-intro');
} else {
$('#froala-edit').froalaEditor('paragraphFormat.apply', 'P');
}
}
});
// Create command: Toggle block 'factbox'
$.FroalaEditor.RegisterCommand('cc-factbox', {
title: 'Fact box body',
focus: false,
undo: true,
refreshAfterCallback: false,
callback: function () {
var element = $('#froala-edit').froalaEditor('selection.element');
if (element.nodeName == 'P') {
$('#froala-edit').froalaEditor('paragraphFormat.apply', 'cc-factbox');
} else {
$('#froala-edit').froalaEditor('paragraphFormat.apply', 'P');
}
}
});
$('#froala-edit').on('froalaEditor.contentChanged', function(event, editor) {
console.log('CONTENT CHANGED: ' + editor.html.get());
});
// Set up the editor
$('#froala-edit').froalaEditor({
heightMin: 200,
toolbarButtons: [
'cc-factbox-intro',
'cc-factbox',
'html'
],
toolbarButtonsXS: [
'cc-factbox-intro',
'cc-factbox',
'html'
],
// content settings
fileAllowedTypes: [],
htmlAllowComments: false,
htmlAllowedAttrs: [],
htmlAllowedEmptyTags: [],
htmlAllowedTags: [
'b', 'strong', 'u', 'strike', 'em', // Style
'p', 'h1', // Blocks
'cc-factbox-intro', 'cc-factbox', // CC Specifics
'br', 'ul', 'ol', 'li' // Features
],
imageAllowedTypes: []
});
});
</script>
</body>
</html>