mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-10-23 19:22:33 +00:00
Add local image preview and auto-conversion to node editor and local loopback browsing
This commit is contained in:
2 files changed
+9
No files matched your search
@@ -864,6 +864,13 @@ class Browser:
|
||||
if image_destination_hash == self.loopback:
|
||||
local_image = path.replace("/media/", "")
|
||||
local_path = f"{self.app.pagespath}/{local_image}"
|
||||
|
||||
if self.app.node:
|
||||
image_ext = os.path.splitext(local_path)[-1]
|
||||
if not image_ext in self.app.node.NATIVE_MEDIA_EXTS:
|
||||
RNS.log(f"Non-native media type for {local_path}, attempting auto-conversion", RNS.LOG_DEBUG)
|
||||
local_path = self.app.node.convert_media_to_webp(local_path)
|
||||
|
||||
if self.image_rendering_supported:
|
||||
w.load(local_path)
|
||||
self.refresh_page_layout()
|
||||
|
||||
@@ -445,6 +445,8 @@ class PageEditorDisplay():
|
||||
self.register_styles()
|
||||
|
||||
self.preview_browser = Browser(self.app, "nomadnetwork", "node", delegate=None)
|
||||
self.preview_browser.loopback = self.app.node.destination.hash
|
||||
self.preview_browser.destination_hash = self.app.node.destination.hash
|
||||
self.preview_browser.handle_link = self._preview_handle_link
|
||||
self.preview_browser.marked_link = lambda *a, **k: None
|
||||
self.preview_browser._content_cols = self._preview_cols
|
||||
|
||||
Reference in new issue
Block a user