Prechádzať zdrojové kódy

Fixes #20245: Fix Markdown preview functionality within "quick add" modal

Jeremy Stretch 4 mesiacov pred
rodič
commit
d222466882

+ 2 - 1
netbox/netbox/views/generic/object_views.py

@@ -238,7 +238,8 @@ class ObjectEditView(GetReturnURLMixin, BaseObjectView):
         model = self.queryset.model
         model = self.queryset.model
 
 
         initial_data = normalize_querydict(request.GET)
         initial_data = normalize_querydict(request.GET)
-        form = self.form(instance=obj, initial=initial_data)
+        form_prefix = 'quickadd' if request.GET.get('_quickadd') else None
+        form = self.form(instance=obj, initial=initial_data, prefix=form_prefix)
         restrict_form_fields(form, request.user)
         restrict_form_fields(form, request.user)
 
 
         context = {
         context = {

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
netbox/project-static/dist/netbox.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
netbox/project-static/dist/netbox.js.map


+ 0 - 11
netbox/project-static/src/buttons/markdownPreview.ts

@@ -1,5 +1,3 @@
-import { isTruthy } from 'src/util';
-
 /**
 /**
  * interface for htmx configRequest event
  * interface for htmx configRequest event
  */
  */
@@ -17,15 +15,6 @@ function initMarkdownPreview(markdownWidget: HTMLDivElement) {
   const textarea = markdownWidget.querySelector('textarea') as HTMLTextAreaElement;
   const textarea = markdownWidget.querySelector('textarea') as HTMLTextAreaElement;
   const preview = markdownWidget.querySelector('div.preview') as HTMLDivElement;
   const preview = markdownWidget.querySelector('div.preview') as HTMLDivElement;
 
 
-  /**
-   * Make sure the textarea has style attribute height
-   * So that it can be copied over to preview div.
-   */
-  if (!isTruthy(textarea.style.height)) {
-    const { height } = textarea.getBoundingClientRect();
-    textarea.style.height = `${height}px`;
-  }
-
   /**
   /**
    * Add the value of the textarea to the body of the htmx request
    * Add the value of the textarea to the body of the htmx request
    * and copy the height of text are to the preview div
    * and copy the height of text are to the preview div

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov