Falko Schindler 1 år sedan
förälder
incheckning
894ec272dd

+ 1 - 1
nicegui/page.py

@@ -29,7 +29,7 @@ class page:
                  ) -> None:
         """Page
 
-        This decorator marks a function to be a page-builder.
+        This decorator marks a function to be a page builder.
         Each user accessing the given route will see a new instance of the page.
         This means it is private to the user and not shared with others 
         (as it is done `when placing elements outside of a page decorator <https://nicegui.io/documentation#auto-index_page>`_).

+ 2 - 2
nicegui/storage.py

@@ -79,8 +79,8 @@ class Storage:
         """Small storage that is saved directly within the user's browser (encrypted cookie).
 
         The data is shared between all browser tabs and can only be modified before the initial request has been submitted.
-        Therefore is is normally better to use `app.storage.user` instead which can be modified anytime, 
-        reduces overall payload, improves security and has larger storage capacity.
+        Therefore it is normally better to use `app.storage.user` instead,
+        which can be modified anytime, reduces overall payload, improves security and has larger storage capacity.
         """
         request: Optional[Request] = request_contextvar.get()
         if request is None:

+ 5 - 3
website/more_documentation/bindings_documentation.py

@@ -1,4 +1,4 @@
-from nicegui import app, ui
+from nicegui import ui
 
 from ..documentation_tools import text_demo
 
@@ -59,9 +59,11 @@ def more() -> None:
         The note is also shared between all tabs of the same user.
     ''')
     def ui_state():
+        from nicegui import app
+
         # @ui.page('/')
         # def index():
-        #    ui.textarea('This note is kept between visits') \
-        #       .classes('w-full').bind_value(app.storage.user, 'note')
+        #     ui.textarea('This note is kept between visits') \
+        #         .classes('w-full').bind_value(app.storage.user, 'note')
         # END OF DEMO
         ui.textarea('This note is kept between visits').classes('w-full').bind_value(app.storage.user, 'note')

+ 6 - 4
website/more_documentation/storage_documentation.py

@@ -1,7 +1,7 @@
 from collections import Counter
 from datetime import datetime
 
-from nicegui import app, ui
+from nicegui import ui
 
 from ..documentation_tools import text_demo
 
@@ -21,7 +21,7 @@ def main_demo() -> None:
         Unlike the previous types, this dictionary is stored directly as the browser session cookie, shared among all browser tabs for the same user.
         However, `app.storage.user` is generally preferred due to its advantages in reducing data payload, enhancing security, and offering larger storage capacity.
 
-    The user storage and browser storage are only available within `page-builder functions </documentation/page>`_
+    The user storage and browser storage are only available within `page builder functions </documentation/page>`_
     because they are accessing the underlying `Request` object from FastAPI.
     Additionally these two types require the `storage_secret` parameter in`ui.run()` to encrypt the browser session cookie.
     """
@@ -75,9 +75,11 @@ def more() -> None:
         The note is also shared between all tabs of the same user.
     ''')
     def ui_state():
+        from nicegui import app
+
         # @ui.page('/')
         # def index():
-        #    ui.textarea('This note is kept between visits') \
-        #       .classes('w-full').bind_value(app.storage.user, 'note')
+        #     ui.textarea('This note is kept between visits') \
+        #         .classes('w-full').bind_value(app.storage.user, 'note')
         # END OF DEMO
         ui.textarea('This note is kept between visits').classes('w-full').bind_value(app.storage.user, 'note')