fix: TinyMCE lokal bereitstellen und Rich-Text-Migration ergänzen
This commit is contained in:
@@ -5,10 +5,11 @@ class DocumentationConfig(PluginConfig):
|
||||
name = "netbox_documentation"
|
||||
verbose_name = "Dokumentation"
|
||||
description = "Wiki und Office-Dokumentation direkt in NetBox"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
author = "NetBox Documentation Contributors"
|
||||
base_url = "documentation"
|
||||
min_version = "4.0.0"
|
||||
django_apps = ["tinymce"]
|
||||
default_settings = {
|
||||
"allowed_object_types": [
|
||||
"dcim.region", "dcim.site", "dcim.location", "dcim.rack",
|
||||
@@ -17,8 +18,6 @@ class DocumentationConfig(PluginConfig):
|
||||
],
|
||||
"max_import_size_mb": 25,
|
||||
"keep_imported_file": True,
|
||||
# Can be replaced with a locally hosted TinyMCE bundle for offline use.
|
||||
"editor_script_url": "https://cdn.jsdelivr.net/npm/tinymce@7/tinymce.min.js",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ class Migration(migrations.Migration):
|
||||
("custom_field_data", models.JSONField(blank=True, default=dict, encoder=netbox.models.features.CustomFieldJSONEncoder)),
|
||||
("title", models.CharField(max_length=200)), ("slug", models.SlugField(max_length=200, unique=True)),
|
||||
("body", models.TextField(blank=True, help_text="Markdown")), ("summary", models.CharField(blank=True, max_length=500)),
|
||||
("body_format", models.CharField(choices=[("html", "Rich Text"), ("markdown", "Markdown")], default="html", max_length=10)),
|
||||
("is_published", models.BooleanField(default=True)),
|
||||
("tags", models.ManyToManyField(blank=True, related_name="netbox_documentation_document_items", to="extras.tag")),
|
||||
], options={"ordering": ("title",), "permissions": (("import_document", "Can import office documents"),)}),
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("netbox_documentation", "0001_initial")]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="document",
|
||||
name="body_format",
|
||||
field=models.CharField(
|
||||
choices=(("html", "Rich Text"), ("markdown", "Markdown")),
|
||||
default="html",
|
||||
max_length=10,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -1,8 +1,9 @@
|
||||
{% extends 'generic/object_edit.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block javascript %}
|
||||
{{ block.super }}
|
||||
<script src="{{ config.editor_script_url }}" referrerpolicy="origin"></script>
|
||||
<script src="{% static 'tinymce/tinymce.min.js' %}"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
if (typeof tinymce === 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user