diff --git a/geemap/map_widgets.py b/geemap/map_widgets.py index 13b112d568..01838352e5 100644 --- a/geemap/map_widgets.py +++ b/geemap/map_widgets.py @@ -1501,18 +1501,22 @@ def import_button_clicked(self): contents = "".join(code).strip() # create_code_cell(contents) - + copy_success = False try: import pyperclip pyperclip.copy(str(contents)) + copy_success = True except Exception as e: pass - dataset_model["additional_html"] = ( - "
"
-                "# The code has been copied to the clipboard.\n"
-                "# Press Ctrl+V in a new cell to paste it.\n"
-                f"{contents}"
-                ""
+                    "# The code has been copied to the clipboard.\n"
+                    "# Press Ctrl+V in a new cell to paste it.\n"
+                    f"{contents}"
+                    "{contents} p {
-                margin: 5px 3px;
+                margin: 8px 3px;
                 max-width: 230px;
             }
 
@@ -61,7 +61,7 @@ export class SearchBar extends LitWidget<
                 list-style-type: none;
                 margin: 0;
                 margin-bottom: 4px;
-                padding: 0;
+                padding: 8px 0;
             }
 
             label.result {
@@ -72,6 +72,7 @@ export class SearchBar extends LitWidget<
             .import-button, .reset-button {
                 margin: 0 2px 2px 2px;
                 padding: 0 8px;
+                white-space: nowrap;
             }
 
             .dataset-select {
@@ -82,6 +83,7 @@ export class SearchBar extends LitWidget<
             .additional-html-container {
                 max-height: 300px;
                 overflow: auto;
+                padding: 8px 0;
             }
 
             .additional-html-container pre {
@@ -200,9 +202,11 @@ export class SearchBar extends LitWidget<
                 ${results}
             `);
         }
-        renderedInputs.push(html`
- ${unsafeHTML(locationModel.additional_html)} -
`); + if (locationModel.additional_html) { + renderedInputs.push(html`
+ ${unsafeHTML(locationModel.additional_html)} +
`); + } if (locationModel.search || locationModel.results.length || locationModel.selected) { @@ -248,7 +252,7 @@ export class SearchBar extends LitWidget< @click="${() => { this.model?.send({ type: "click", id: "import" }); }}"> - Import + Reveal Code `; const results = html`