1 """
2 * Copyright 2007 Google Inc.
3 # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http:#www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 """
17
18
19
20
21 from pyjamas.ui.FocusWidget import FocusWidget
22 from pyjamas.ui.RichTextAreaImplStandard import RichTextAreaImplStandard
23
24
25
26 """*
27 * A rich text editor that allows complex styling and formatting.
28 *
29 * Because some browsers do not support rich text editing, and others support
30 * only a limited subset of functionality, there are two formatter interfaces,
31 * accessed via {@link #getBasicFormatter()} and {@link #getExtendedFormatter()}.
32 * A browser that does not support rich text editing at all will return
33 * <code>None</code> for both of these, while one that supports only the basic
34 * functionality will return <code>None</code> for the latter.
35 *
36 * <p>
37 * <img class='gallery' src='RichTextArea.png'/>
38 * </p>
39 *
40 * <h3>CSS Style Rules</h3>
41 * <ul class="css">
42 * <li>.gwt-RichTextArea { }</li>
43 * </ul>
44 """
45 -class RichTextArea (FocusWidget) :
46
47 """*
48 * Creates a new, blank {@link RichTextArea} object with no stylesheet.
49 """
50 - def __init__(self, **kwargs):
51 if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-RichTextArea"
52 self.impl = RichTextAreaImplStandard()
53 FocusWidget.__init__(self, self.impl.getElement(), **kwargs)
54
55
56 - def setCssStyling(self, style):
57 """ sets whether cloning is to be done of the main document's
58 CSS Style elements into the iframe of the editor
59 """
60 if style:
61 self.impl.setCssStyling()
62
63 """*
64 * Gets the basic rich text formatting interface.
65 *
66 * @return <code>None</code> if basic formatting is not supported
67 """
73
74
75 """*
76 * Gets the full rich text formatting interface.
77 *
78 * @return <code>None</code> if full formatting is not supported
79 """
85
86
88 return self.impl.getHTML()
89
90
92 return self.impl.getText()
93
94
95 - def setFocus(self, focused):
96
97
98 if self.isAttached():
99 self.impl.setFocus(focused)
100
101
102
103 - def setHTML(self, html):
104 self.impl.setHTML(html)
105
106
107 - def setText(self, text):
108 self.impl.setText(text)
109
110
111 - def onAttach(self):
114
115
116 - def onDetach(self):
119
120
121
122
123