Skip to content

Commit d222466

Browse files
committed
Fixes #20245: Fix Markdown preview functionality within "quick add" modal
1 parent 9e75a2f commit d222466

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

netbox/netbox/views/generic/object_views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ def get(self, request, *args, **kwargs):
238238
model = self.queryset.model
239239

240240
initial_data = normalize_querydict(request.GET)
241-
form = self.form(instance=obj, initial=initial_data)
241+
form_prefix = 'quickadd' if request.GET.get('_quickadd') else None
242+
form = self.form(instance=obj, initial=initial_data, prefix=form_prefix)
242243
restrict_form_fields(form, request.user)
243244

244245
context = {

netbox/project-static/dist/netbox.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netbox/project-static/dist/netbox.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

netbox/project-static/src/buttons/markdownPreview.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { isTruthy } from 'src/util';
2-
31
/**
42
* interface for htmx configRequest event
53
*/
@@ -17,15 +15,6 @@ function initMarkdownPreview(markdownWidget: HTMLDivElement) {
1715
const textarea = markdownWidget.querySelector('textarea') as HTMLTextAreaElement;
1816
const preview = markdownWidget.querySelector('div.preview') as HTMLDivElement;
1917

20-
/**
21-
* Make sure the textarea has style attribute height
22-
* So that it can be copied over to preview div.
23-
*/
24-
if (!isTruthy(textarea.style.height)) {
25-
const { height } = textarea.getBoundingClientRect();
26-
textarea.style.height = `${height}px`;
27-
}
28-
2918
/**
3019
* Add the value of the textarea to the body of the htmx request
3120
* and copy the height of text are to the preview div

0 commit comments

Comments
 (0)