Define rich text features in settings
This removes them from migrations, avoiding the need to create new ones when they change
This commit is contained in:
parent
210ad88a2e
commit
ee307bcfbf
11 changed files with 1224 additions and 75 deletions
|
@ -0,0 +1,596 @@
|
|||
# Generated by Django 4.0.6 on 2022-09-03 20:05
|
||||
|
||||
import wagtail.blocks
|
||||
import wagtail.contrib.typed_table_block.blocks
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.fields
|
||||
import wagtail.images.blocks
|
||||
from django.db import migrations
|
||||
|
||||
import website.contrib.code_block.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("blog", "0023_alter_blogpostpage_subtitle"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="blogpostcollectionlistpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="blogpostcollectionpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="blogpostlistpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="blogpostpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="blogposttaglistpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="blogposttagpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,212 @@
|
|||
# Generated by Django 4.0.6 on 2022-09-03 20:05
|
||||
|
||||
import wagtail.blocks
|
||||
import wagtail.contrib.typed_table_block.blocks
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.fields
|
||||
import wagtail.images.blocks
|
||||
from django.db import migrations
|
||||
|
||||
import website.contrib.code_block.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("common", "0023_alter_contentpage_subtitle"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="contentpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="listingpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -24,7 +24,6 @@ from wagtailmetadata.models import MetadataMixin
|
|||
|
||||
from website.contrib.unsplash.widgets import UnsplashPhotoChooser
|
||||
|
||||
from .rich_text import RICH_TEXT_FEATURES_PLAIN
|
||||
from .serializers import PaginationSerializer
|
||||
from .streamfield import add_heading_anchors, get_blocks, get_content_html
|
||||
from .utils import (
|
||||
|
@ -63,7 +62,7 @@ class BasePage(Page):
|
|||
|
||||
|
||||
class BaseContentPage(BasePage, MetadataMixin):
|
||||
subtitle = RichTextField(blank=True, features=RICH_TEXT_FEATURES_PLAIN)
|
||||
subtitle = RichTextField(blank=True, editor="plain")
|
||||
hero_image = models.ForeignKey(
|
||||
get_image_model_string(), null=True, blank=True, on_delete=models.SET_NULL
|
||||
)
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
RICH_TEXT_FEATURES = [
|
||||
"h2",
|
||||
"h3",
|
||||
"h4",
|
||||
"h5",
|
||||
"h6",
|
||||
"bold",
|
||||
"italic",
|
||||
"ol",
|
||||
"ul",
|
||||
"link",
|
||||
"document-link",
|
||||
"code",
|
||||
"strikethrough",
|
||||
"snippet-link",
|
||||
"snippet-embed",
|
||||
]
|
||||
|
||||
RICH_TEXT_FEATURES_PLAIN = [
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
"document-link",
|
||||
"code",
|
||||
"strikethrough",
|
||||
"snippet-link",
|
||||
]
|
||||
|
||||
RICH_TEXT_FEATURES_SIMPLE = [
|
||||
"bold",
|
||||
"italic",
|
||||
"ol",
|
||||
"ul",
|
||||
"link",
|
||||
"document-link",
|
||||
"code",
|
||||
"strikethrough",
|
||||
"snippet-link",
|
||||
]
|
|
@ -13,12 +13,6 @@ from website.common.utils import HEADER_TAGS
|
|||
from website.contrib.code_block.blocks import CodeBlock
|
||||
from website.contrib.mermaid_block.blocks import MermaidBlock
|
||||
|
||||
from .rich_text import (
|
||||
RICH_TEXT_FEATURES,
|
||||
RICH_TEXT_FEATURES_PLAIN,
|
||||
RICH_TEXT_FEATURES_SIMPLE,
|
||||
)
|
||||
|
||||
|
||||
class LoremBlock(blocks.StructBlock):
|
||||
paragraphs = blocks.IntegerBlock(min_value=1)
|
||||
|
@ -37,7 +31,7 @@ class LoremBlock(blocks.StructBlock):
|
|||
|
||||
class ImageCaptionBlock(blocks.StructBlock):
|
||||
image = ImageChooserBlock()
|
||||
caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN, required=False)
|
||||
caption = blocks.RichTextBlock(editor="plain", required=False)
|
||||
|
||||
class Meta:
|
||||
icon = "image"
|
||||
|
@ -47,7 +41,7 @@ class ImageCaptionBlock(blocks.StructBlock):
|
|||
|
||||
class TangentBlock(blocks.StructBlock):
|
||||
name = blocks.CharBlock(max_length=64)
|
||||
content = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_SIMPLE)
|
||||
content = blocks.RichTextBlock(editor="simple")
|
||||
|
||||
class Meta:
|
||||
icon = "comment"
|
||||
|
@ -67,7 +61,7 @@ IGNORE_HEADING_BLOCKS = (*IGNORE_PLAINTEXT_BLOCKS, LoremBlock)
|
|||
def get_blocks() -> list[tuple[str, blocks.BaseBlock]]:
|
||||
return [
|
||||
("embed", EmbedBlock()),
|
||||
("rich_text", blocks.RichTextBlock(features=RICH_TEXT_FEATURES)),
|
||||
("rich_text", blocks.RichTextBlock()),
|
||||
("lorem", LoremBlock()),
|
||||
("html", blocks.RawHTMLBlock()),
|
||||
("image", ImageCaptionBlock()),
|
||||
|
@ -80,7 +74,7 @@ def get_blocks() -> list[tuple[str, blocks.BaseBlock]]:
|
|||
[
|
||||
(
|
||||
"rich_text",
|
||||
blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN),
|
||||
blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", blocks.FloatBlock()),
|
||||
("text", blocks.CharBlock()),
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
from django.conf import settings
|
||||
from django.test import SimpleTestCase
|
||||
from wagtail.rich_text import features as richtext_feature_registry
|
||||
|
||||
from website.common.embed import YouTubeLiteEmbedFinder
|
||||
from website.common.rich_text import (
|
||||
RICH_TEXT_FEATURES,
|
||||
RICH_TEXT_FEATURES_PLAIN,
|
||||
RICH_TEXT_FEATURES_SIMPLE,
|
||||
)
|
||||
from website.common.utils import count_words, extract_text, get_table_of_contents
|
||||
|
||||
|
||||
|
@ -109,19 +105,9 @@ class CountWordsTestCase(SimpleTestCase):
|
|||
|
||||
class RichTextFeaturesTestCase(SimpleTestCase):
|
||||
def test_features_exist(self) -> None:
|
||||
for feature in RICH_TEXT_FEATURES:
|
||||
self.assertIsNotNone(
|
||||
richtext_feature_registry.get_editor_plugin("draftail", feature)
|
||||
)
|
||||
|
||||
def test_plain_features_exist(self) -> None:
|
||||
for feature in RICH_TEXT_FEATURES_PLAIN:
|
||||
self.assertIsNotNone(
|
||||
richtext_feature_registry.get_editor_plugin("draftail", feature)
|
||||
)
|
||||
|
||||
def test_simple_features_exist(self) -> None:
|
||||
for feature in RICH_TEXT_FEATURES_SIMPLE:
|
||||
for editor, editor_config in settings.WAGTAILADMIN_RICH_TEXT_EDITORS.items():
|
||||
for feature in editor_config["OPTIONS"]["features"]:
|
||||
with self.subTest(editor=editor, feature=feature):
|
||||
self.assertIsNotNone(
|
||||
richtext_feature_registry.get_editor_plugin("draftail", feature)
|
||||
)
|
||||
|
|
116
website/contact/migrations/0009_alter_contactpage_body.py
Normal file
116
website/contact/migrations/0009_alter_contactpage_body.py
Normal file
|
@ -0,0 +1,116 @@
|
|||
# Generated by Django 4.0.6 on 2022-09-03 20:05
|
||||
|
||||
import wagtail.blocks
|
||||
import wagtail.contrib.typed_table_block.blocks
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.fields
|
||||
import wagtail.images.blocks
|
||||
from django.db import migrations
|
||||
|
||||
import website.contrib.code_block.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("contact", "0008_alter_contactpage_subtitle"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="contactpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -4,8 +4,6 @@ import zlib
|
|||
|
||||
from wagtail.blocks import RichTextBlock, StructBlock, StructValue, TextBlock
|
||||
|
||||
from website.common.rich_text import RICH_TEXT_FEATURES_PLAIN
|
||||
|
||||
|
||||
class MermaidStructValue(StructValue):
|
||||
def config(self) -> dict:
|
||||
|
@ -25,7 +23,7 @@ class MermaidStructValue(StructValue):
|
|||
|
||||
class MermaidBlock(StructBlock):
|
||||
source = TextBlock()
|
||||
caption = RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN, required=False)
|
||||
caption = RichTextBlock(editor="plain", required=False)
|
||||
|
||||
class Meta:
|
||||
icon = "edit"
|
||||
|
|
116
website/search/migrations/0007_alter_searchpage_body.py
Normal file
116
website/search/migrations/0007_alter_searchpage_body.py
Normal file
|
@ -0,0 +1,116 @@
|
|||
# Generated by Django 4.0.6 on 2022-09-03 20:05
|
||||
|
||||
import wagtail.blocks
|
||||
import wagtail.contrib.typed_table_block.blocks
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.fields
|
||||
import wagtail.images.blocks
|
||||
from django.db import migrations
|
||||
|
||||
import website.contrib.code_block.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("search", "0006_alter_searchpage_subtitle"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="searchpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -220,6 +220,61 @@ WAGTAILEMBEDS_FINDERS = [
|
|||
},
|
||||
]
|
||||
|
||||
WAGTAILADMIN_RICH_TEXT_EDITORS = {
|
||||
"default": {
|
||||
"WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea",
|
||||
"OPTIONS": {
|
||||
"features": [
|
||||
"h2",
|
||||
"h3",
|
||||
"h4",
|
||||
"h5",
|
||||
"h6",
|
||||
"bold",
|
||||
"italic",
|
||||
"ol",
|
||||
"ul",
|
||||
"link",
|
||||
"document-link",
|
||||
"code",
|
||||
"strikethrough",
|
||||
"snippet-link",
|
||||
"snippet-embed",
|
||||
]
|
||||
},
|
||||
},
|
||||
"plain": {
|
||||
"WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea",
|
||||
"OPTIONS": {
|
||||
"features": [
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
"document-link",
|
||||
"code",
|
||||
"strikethrough",
|
||||
"snippet-link",
|
||||
]
|
||||
},
|
||||
},
|
||||
"simple": {
|
||||
"WIDGET": "wagtail.admin.rich_text.DraftailRichTextArea",
|
||||
"OPTIONS": {
|
||||
"features": [
|
||||
"bold",
|
||||
"italic",
|
||||
"ol",
|
||||
"ul",
|
||||
"link",
|
||||
"document-link",
|
||||
"code",
|
||||
"strikethrough",
|
||||
"snippet-link",
|
||||
]
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
UNSPLASH_CLIENT_ID = env("UNSPLASH_CLIENT_ID")
|
||||
SPOTIFY_PROXY_HOST = env("SPOTIFY_PROXY_HOST")
|
||||
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
# Generated by Django 4.0.6 on 2022-09-03 20:05
|
||||
|
||||
import wagtail.blocks
|
||||
import wagtail.contrib.typed_table_block.blocks
|
||||
import wagtail.embeds.blocks
|
||||
import wagtail.fields
|
||||
import wagtail.images.blocks
|
||||
from django.db import migrations
|
||||
|
||||
import website.contrib.code_block.blocks
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("spotify", "0006_alter_spotifyplaylistpage_body"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="spotifyplaylistpage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
("embed", wagtail.embeds.blocks.EmbedBlock()),
|
||||
("rich_text", wagtail.blocks.RichTextBlock()),
|
||||
(
|
||||
"lorem",
|
||||
wagtail.blocks.StructBlock(
|
||||
[("paragraphs", wagtail.blocks.IntegerBlock(min_value=1))]
|
||||
),
|
||||
),
|
||||
("html", wagtail.blocks.RawHTMLBlock()),
|
||||
(
|
||||
"image",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("image", wagtail.images.blocks.ImageChooserBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"filename",
|
||||
wagtail.blocks.CharBlock(
|
||||
max_length=128, required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"language",
|
||||
wagtail.blocks.ChoiceBlock(
|
||||
choices=website.contrib.code_block.blocks.get_language_choices
|
||||
),
|
||||
),
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"always_show_header",
|
||||
wagtail.blocks.BooleanBlock(default=False),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"tangent",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("name", wagtail.blocks.CharBlock(max_length=64)),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.RichTextBlock(editor="simple"),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"mermaid",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("source", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"caption",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
editor="plain", required=False
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"table",
|
||||
wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
|
||||
[
|
||||
(
|
||||
"rich_text",
|
||||
wagtail.blocks.RichTextBlock(editor="plain"),
|
||||
),
|
||||
("numeric", wagtail.blocks.FloatBlock()),
|
||||
("text", wagtail.blocks.CharBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
Loading…
Reference in a new issue