@@ -193,7 +193,7 @@ def _get_published_page_version(self):
193193 def _add_view_published_button (self ):
194194 """Helper method to add a publish button to the toolbar
195195 """
196- # Check if object is registered with versioning otherwise dont add
196+ # Check if object is registered with versioning otherwise don't add
197197 if not self ._is_versioned ():
198198 return
199199
@@ -213,8 +213,20 @@ def _add_view_published_button(self):
213213 )
214214 self .toolbar .add_item (item )
215215
216+ def _add_preview_button (self ):
217+ """Helper method to add a preview button to the toolbar when not in preview mode"""
218+ # Check if object is registered with versioning otherwise don't add
219+ if not self ._is_versioned ():
220+ return
221+
222+ if not self .toolbar .preview_mode_active and not self .toolbar .edit_mode_active :
223+ # Any mode not preview mode can have a preview button
224+ # Exclude edit mode, however, since the django CMS core already ads the preview button for edit mode
225+ self .add_preview_button ()
226+
216227 def post_template_populate (self ):
217228 super (VersioningToolbar , self ).post_template_populate ()
229+ self ._add_preview_button ()
218230 self ._add_view_published_button ()
219231 self ._add_revert_button ()
220232 self ._add_publish_button ()
@@ -256,7 +268,7 @@ def override_language_menu(self):
256268 language_menu .remove_item (item = _item )
257269
258270 for code , name in get_language_tuple (self .current_site .pk ):
259- # Get the pagw content, it could be draft too!
271+ # Get the page content, it could be draft too!
260272 page_content = self .get_page_content (language = code )
261273 if page_content :
262274 url = get_object_preview_url (page_content , code )
0 commit comments