Skip to content
Newer
Older
100644 75 lines (68 sloc) 2.4 KB
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6cbb3ca @frost-nzcr4 blueprint in examples
frost-nzcr4 authored Mar 5, 2011
5 <title>Example: Custom controls - jWYSIWYG</title>
6 <link rel="stylesheet" type="text/css" href="../lib/blueprint/screen.css" media="screen, projection" />
7 <link rel="stylesheet" type="text/css" href="../lib/blueprint/print.css" media="print" />
8 <!--[if lt IE 8]><link rel="stylesheet" href="../lib/blueprint/ie.css" type="text/css" media="screen, projection" /><![endif]-->
e80cb5f @frost-nzcr4 Updated paths
frost-nzcr4 authored Jan 11, 2011
9 <link rel="stylesheet" href="../../jquery.wysiwyg.css" type="text/css"/>
0b8ea1e @akzhan Rename jQuery scipt to jquery.js to simplify upgrading process of the…
authored Mar 4, 2011
10 <script type="text/javascript" src="../lib/jquery.js"></script>
e80cb5f @frost-nzcr4 Updated paths
frost-nzcr4 authored Jan 11, 2011
11 <script type="text/javascript" src="../../jquery.wysiwyg.js"></script>
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
12 <script type="text/javascript">
13 (function($) {
14 $(document).ready(function() {
15 $("textarea").wysiwyg({
16 rmUnusedControls: true,
17 controls: {
18 bold: { visible : true },
0a207f1 @frost-nzcr4 Added DOM in example
frost-nzcr4 authored Jan 25, 2011
19 html: { visible : true },
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
20 insertOrderedList: { visible : true },
21 removeFormat: { visible : true }
22 }
23 });
d9c47df @frost-nzcr4 addControl works again with some changes. See #26, #33
frost-nzcr4 authored Dec 26, 2010
24
cec6273 @frost-nzcr4 update custom controls example
frost-nzcr4 authored Feb 2, 2011
25 $("input[name=add]").click(function () {
d9c47df @frost-nzcr4 addControl works again with some changes. See #26, #33
frost-nzcr4 authored Dec 25, 2010
26 $("textarea").wysiwyg("addControl", "quote", {
27 groupIndex: 2,
28 icon: './../tests/images/quote02.gif',
29 tooltip: 'Quote',
30 tags: ['blockquote'],
d5d0b20 @frost-nzcr4 Proper use of exec and callback in example
frost-nzcr4 authored Feb 4, 2011
31 exec: function () {
32 var range = this.getInternalRange(),
0a207f1 @frost-nzcr4 Added DOM in example
frost-nzcr4 authored Jan 25, 2011
33 common = range.commonAncestorContainer,
d5d0b20 @frost-nzcr4 Proper use of exec and callback in example
frost-nzcr4 authored Feb 4, 2011
34 blockquote = this.dom.getElement("blockquote");
a23e173 @frost-nzcr4 Rollback selection
frost-nzcr4 authored Jan 18, 2011
35
36 // if a text node is selected, we want to make the wrap the whole element, not just some text
0a207f1 @frost-nzcr4 Added DOM in example
frost-nzcr4 authored Jan 25, 2011
37 if (common.nodeType === 3) {
a23e173 @frost-nzcr4 Rollback selection
frost-nzcr4 authored Jan 18, 2011
38 common = common.parentNode;
39 }
40
0a207f1 @frost-nzcr4 Added DOM in example
frost-nzcr4 authored Jan 25, 2011
41 if (blockquote && $(blockquote).hasClass("quote")) {
a23e173 @frost-nzcr4 Rollback selection
frost-nzcr4 authored Jan 18, 2011
42 $(common).unwrap();
43 }
44 else {
d5d0b20 @frost-nzcr4 Proper use of exec and callback in example
frost-nzcr4 authored Feb 4, 2011
45 if ("body" !== common.nodeName.toLowerCase()) {
46 $(common).wrap("<blockquote class='quote' />");
47 }
a23e173 @frost-nzcr4 Rollback selection
frost-nzcr4 authored Jan 18, 2011
48 }
d5d0b20 @frost-nzcr4 Proper use of exec and callback in example
frost-nzcr4 authored Feb 4, 2011
49 },
50 callback: function (event, Wysiwyg) {
51 alert("callback triggered!");
d9c47df @frost-nzcr4 addControl works again with some changes. See #26, #33
frost-nzcr4 authored Dec 25, 2010
52 }
53 });
54 });
cec6273 @frost-nzcr4 update custom controls example
frost-nzcr4 authored Feb 2, 2011
55
56 $("input[name=makeBold]").click(function () {
57 $("textarea").wysiwyg("triggerControl", "bold");
58 });
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
59 });
60 })(jQuery);
61 </script>
62 </head>
6cbb3ca @frost-nzcr4 blueprint in examples
frost-nzcr4 authored Mar 5, 2011
63 <body><div class="container">
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
64 <h1>jWYSIWYG</h1>
65 <h2>Example: Custom controls</h2>
66
cec6273 @frost-nzcr4 update custom controls example
frost-nzcr4 authored Feb 2, 2011
67 <input type="button" value="Add new control" name="add"/>
68 <input type="button" value="Make selected text bold" name="makeBold"/>
d9c47df @frost-nzcr4 addControl works again with some changes. See #26, #33
frost-nzcr4 authored Dec 25, 2010
69
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
70 <textarea name="text"></textarea>
b6f6966 @frost-nzcr4 Plugins
frost-nzcr4 authored Jan 15, 2011
71
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
72 <hr/>
73 <a href="index.html">Index</a>
6cbb3ca @frost-nzcr4 blueprint in examples
frost-nzcr4 authored Mar 5, 2011
74 </div></body>
709d8df @frost-nzcr4 Added new option rmUnusedControls (see #52)
frost-nzcr4 authored Dec 25, 2010
75 </html>
Something went wrong with that request. Please try again.