forked from immense/knockout-tinymce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
131 lines (116 loc) · 4.69 KB
/
demo.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Knockout TinyMCE</title>
<link rel='stylesheet' type='text/css' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'>
<link rel="stylesheet" type='text/css' href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<script src='http://code.jquery.com/jquery-2.1.1.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/knockout/3.1.0/knockout-min.js'></script>
<script src='demo/tinymce/tinymce.js'></script>
<script src='knockout-tinymce.min.js'></script>
<link href='demo/style.css' type='text/css' rel='stylesheet'></link>
<script type='text/javascript'>
$(function() {
// Example 1
window.view1 = {
string_of_html: ko.observable()
};
ko.applyBindings(view1, document.querySelector('#simple-example-result'));
// Example 2
window.view2 = {
string_of_html: ko.observable("<strong>click on me!</strong>")
};
ko.applyBindings(view2, document.querySelector('#options-example-result'));
});
</script>
</head>
<body>
<div class='container'>
<div class='header'>
<ul class='nav nav-pills pull-right'>
<li class='active'><a href="#">Demo</a></li>
<li><a href='https://github.com/immense/knockout-tinymce'>Code</a></li>
</ul>
<h3 class='text-muted'>Knockout TinyMCE</h3>
</div>
<div class='jumbotron'>
<h1>Knockout TinyMCE Demo</h1>
</div>
<div class='row'>
<div class='col-md-12'>
<h2><a href="#simple-example" name="simple-example">§</a> Simple example</h2>
<section id="simple-example-section">
<p>Use the <code>tinymce</code> binding on any <code>textarea</code> element.</p>
<label>View Model:</label>
<pre>window.view1 = {
string_of_html: ko.observable()
};
ko.applyBindings(view1, document.querySelector('#simple-example-result'));</pre>
<label>Markup:</label>
<pre><section id='simple-example-result'>
<textarea data-bind='tinymce: string_of_html'>
</section></pre>
<h3>Result:</h3>
<section id='simple-example-result'>
<textarea id='string-of-html' class='form-control' data-bind="tinymce: string_of_html"></textarea>
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-3">Value</label>
<div class="col-sm-9">
<p class="form-control-static" data-bind="text: string_of_html"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Value (as html)</label>
<div class="col-sm-9">
<p class="form-control-static" data-bind="html: string_of_html"></p>
</div>
</div>
</div>
</section>
</section>
</div>
<div class='col-md-12'>
<h2><a href="#options-example" name="options-example">§</a> Example with options</h2>
<section id="options-example-section">
<p>
You can also pass options via the <code>tinymceConfig</code> binding.
</p>
<label>View Model:</label>
<pre>window.view2 = {
string_of_html: ko.observable("<strong>click on me!</strong>")
};
ko.applyBindings(view2, document.querySelector('#options-example-result'));</pre>
<label>Markup:</label>
<pre><section id='options-example-result'>
<div data-bind='tinymce: string_of_html, tinymceConfig: { inline: true }'><div>
</section></pre>
<h3>Result:</h3>
<section id='options-example-result'>
<div data-bind="tinymce: string_of_html, tinymceConfig: { inline: true }"></div>
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-3">Value</label>
<div class="col-sm-9">
<p class="form-control-static" data-bind="text: string_of_html"></p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Value (as html)</label>
<div class="col-sm-9">
<p class="form-control-static" data-bind="html: string_of_html"></p>
</div>
</div>
</div>
</section>
</section>
</div>
</div>
<div class='footer'>
<p>© Immense Networks 2016</p>
</div>
</div>
</body>
</html>