@@ -144,9 +144,83 @@ def colors_example():
144
144
}
145
145
146
146
147
+ DOC_DISPLAY_TIPTAP = """
148
+ Display Mode
149
+ ------------
150
+
151
+ In Display Mode, the widget is not editable and Actions will not be rendered.
152
+ The ``display_class`` widget property can be used to style the div containing the
153
+ widget value.
154
+
155
+ .. code-block:: python
156
+
157
+ tiptap = factory(
158
+ 'tiptap',
159
+ value=(
160
+ '<p>'
161
+ 'This widget is in '
162
+ '<strong style="color: rgb(66,209,245)">display mode</strong>, '
163
+ 'but it will still show <strong>custom formatting</strong>.'
164
+ '<br />'
165
+ 'Its border was adding with the <strong>display_class</strong> property.'
166
+ '</p>'
167
+ ),
168
+ props={
169
+ 'label': 'Tiptap Widget in display mode',
170
+ 'actions': ['color'],
171
+ 'colors': [
172
+ {'name': 'Purple', 'color': 'rgb(161,66,245)'},
173
+ {'name': 'Blue', 'color': 'rgb(66,111,245)'},
174
+ {'name': 'Turqoise', 'color': 'rgb(66,209,245)'},
175
+ {'name': 'Green', 'color': 'rgb(105,245,66)'},
176
+ {'name': 'Yellow', 'color': 'rgb(245,236,66)'},
177
+ {'name': 'Orange', 'color': 'rgb(245,167,66'},
178
+ {'name': 'Red', 'color': 'rgb(245,66,66)'}
179
+ ],
180
+ 'display_class': 'form-control border-2 border-info'
181
+ },
182
+ mode='display')
183
+ """
184
+
185
+
186
+ def display_example ():
187
+ part = factory (u'fieldset' , name = 'yafowil.widget.tiptap' )
188
+ part ['tiptap' ] = factory (
189
+ 'tiptap' ,
190
+ value = (
191
+ '<p>'
192
+ 'This widget is in '
193
+ '<strong style="color: rgb(66,209,245)">display mode</strong>, '
194
+ 'but it will still show <strong>custom formatting</strong>.'
195
+ '<br />'
196
+ 'Its border was adding with the <strong>display_class</strong> property.'
197
+ '</p>'
198
+ ),
199
+ props = {
200
+ 'label' : 'Tiptap Widget in display mode' ,
201
+ 'actions' : ['color' ],
202
+ 'colors' : [
203
+ {'name' : 'Purple' , 'color' : 'rgb(161,66,245)' },
204
+ {'name' : 'Blue' , 'color' : 'rgb(66,111,245)' },
205
+ {'name' : 'Turqoise' , 'color' : 'rgb(66,209,245)' },
206
+ {'name' : 'Green' , 'color' : 'rgb(105,245,66)' },
207
+ {'name' : 'Yellow' , 'color' : 'rgb(245,236,66)' },
208
+ {'name' : 'Orange' , 'color' : 'rgb(245,167,66' },
209
+ {'name' : 'Red' , 'color' : 'rgb(245,66,66)' }
210
+ ],
211
+ 'display_class' : 'form-control border-2 border-info'
212
+ }, mode = 'display' )
213
+ return {
214
+ 'widget' : part ,
215
+ 'doc' : DOC_DISPLAY_TIPTAP ,
216
+ 'title' : 'Tiptap Widget in display mode' ,
217
+ }
218
+
219
+
147
220
def get_example ():
148
221
return [
149
222
default_example (),
150
223
actions_example (),
151
- colors_example ()
224
+ colors_example (),
225
+ display_example ()
152
226
]
0 commit comments