forked from Vitris/tinymce-variable
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
73 lines (68 loc) · 2.65 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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Preview TinyMCE variable plugin</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.1.9/tinymce.min.js"></script>
<script src="src/plugin.js"></script>
<style>
body .mce-tinymce {
border: 1px solid #9e9e9e;
border-radius: 5px;
overflow: hidden;
}
body .mce-edit-area {
border: none;
}
</style>
</head>
<body>
<script type="text/javascript">
tinymce.init({
// basic tinyMCE stuff
selector: "textarea",
content_css: 'style.css',
menubar: false,
toolbar: "bold,italic,mybutton,code",
statusbar: false,
setup : function(ed) {
window.tester = ed;
ed.addButton('mybutton', {
title : 'My button',
text : 'Insert variable',
onclick : function() {
ed.plugins.variables.addVariable('account_id');
}
});
ed.on('variableClick', function(e) {
console.log('click', e);
});
},
// variable plugin related
plugins: "variable,code",
variable_mapper: {
username: 'Username',
phone: 'Phone',
community_name: 'Community name',
email: 'Email address',
sender: 'Sender name',
account_id: 'Account ID'
}
// variable_prefix: '{{',
// variable_suffix: '}}'
// variable_class: 'bbbx-my-variable',
//variable_valid: ['username', 'sender', 'phone', 'community_name', 'email']
});
</script>
<!-- Place this in the body of the page content -->
<form method="post">
<textarea rows="18">Dear {{username}},
<p>Thanks for joining our {{community_name}} community. I hope you'll enjoy your time here. If you would have any question don't hasitate to call me on {{phone}} or shoot me an email at {{email}}.</p>
Sincerely,<br />
{{sender}}</textarea>
</form>
</body>
</html>