Restyle code block header
This looks much nicer, and removes a DB field.
This commit is contained in:
parent
dde014860a
commit
e504da0bcf
9 changed files with 1307 additions and 23 deletions
|
@ -78,21 +78,37 @@ div.block-tangent {
|
||||||
}
|
}
|
||||||
|
|
||||||
div.block-code {
|
div.block-code {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.code-header {
|
.code-header {
|
||||||
|
position: absolute;
|
||||||
font-family: $family-code;
|
font-family: $family-code;
|
||||||
background-color: $grey-lighter;
|
width: 100%;
|
||||||
font-size: 80%;
|
|
||||||
padding: 0.25rem 1rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
padding-right: 0.5rem;
|
||||||
|
|
||||||
@include dark-mode {
|
.tag {
|
||||||
background-color: $grey-darker;
|
border-radius: 0 !important;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
&:not(:hover) .code-header:not(.always-show) {
|
.code-copy-tag {
|
||||||
visibility: hidden;
|
background-color: transparent;
|
||||||
|
color: $dark;
|
||||||
|
|
||||||
|
@include dark-mode {
|
||||||
|
color: $dark-mode-text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.language-tag {
|
||||||
|
background-color: $primary-light;
|
||||||
|
|
||||||
|
@include dark-mode {
|
||||||
|
background-color: $primary-dark;
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight {
|
.highlight {
|
||||||
|
|
|
@ -22,3 +22,4 @@ $code-padding: 0;
|
||||||
$code: inherit;
|
$code: inherit;
|
||||||
$pre: unset;
|
$pre: unset;
|
||||||
$content-heading-weight: $weight-medium;
|
$content-heading-weight: $weight-medium;
|
||||||
|
$content-pre-padding: 1.5em 1.25em 1.25em;
|
||||||
|
|
|
@ -0,0 +1,656 @@
|
||||||
|
# Generated by Django 4.1.8 on 2023-04-19 20:19
|
||||||
|
|
||||||
|
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", "0003_alter_blogpostcollectionlistpage_body_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
blank=True,
|
||||||
|
use_json_field=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,232 @@
|
||||||
|
# Generated by Django 4.1.8 on 2023-04-19 20:19
|
||||||
|
|
||||||
|
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", "0005_remove_footersetting_site"),
|
||||||
|
]
|
||||||
|
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
blank=True,
|
||||||
|
use_json_field=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
126
website/contact/migrations/0004_alter_contactpage_body.py
Normal file
126
website/contact/migrations/0004_alter_contactpage_body.py
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
# Generated by Django 4.1.8 on 2023-04-19 20:19
|
||||||
|
|
||||||
|
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", "0003_alter_contactpage_body"),
|
||||||
|
]
|
||||||
|
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
blank=True,
|
||||||
|
use_json_field=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -4,15 +4,9 @@ from django.utils.safestring import mark_safe
|
||||||
from pygments import highlight
|
from pygments import highlight
|
||||||
from pygments.formatters.html import HtmlFormatter
|
from pygments.formatters.html import HtmlFormatter
|
||||||
from pygments.lexers import find_lexer_class, get_all_lexers
|
from pygments.lexers import find_lexer_class, get_all_lexers
|
||||||
|
from pygments.lexers.python import PythonConsoleLexer, PythonLexer
|
||||||
from pygments.lexers.special import TextLexer
|
from pygments.lexers.special import TextLexer
|
||||||
from wagtail.blocks import (
|
from wagtail.blocks import CharBlock, ChoiceBlock, StructBlock, StructValue, TextBlock
|
||||||
BooleanBlock,
|
|
||||||
CharBlock,
|
|
||||||
ChoiceBlock,
|
|
||||||
StructBlock,
|
|
||||||
StructValue,
|
|
||||||
TextBlock,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_language_choices() -> Iterator[tuple[str, str]]:
|
def get_language_choices() -> Iterator[tuple[str, str]]:
|
||||||
|
@ -21,6 +15,8 @@ def get_language_choices() -> Iterator[tuple[str, str]]:
|
||||||
|
|
||||||
|
|
||||||
class CodeStructValue(StructValue):
|
class CodeStructValue(StructValue):
|
||||||
|
LANGUAGE_DISPLAY_MAPPING = {PythonConsoleLexer.name: PythonLexer.name}
|
||||||
|
|
||||||
def code(self) -> str:
|
def code(self) -> str:
|
||||||
lexer = find_lexer_class(self["language"])()
|
lexer = find_lexer_class(self["language"])()
|
||||||
formatter = HtmlFormatter(
|
formatter = HtmlFormatter(
|
||||||
|
@ -32,11 +28,17 @@ class CodeStructValue(StructValue):
|
||||||
if filename := self["filename"]:
|
if filename := self["filename"]:
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
if (language := self["language"]) != TextLexer.name:
|
if self["language"] != TextLexer.name:
|
||||||
return language
|
return self.language_display()
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
def language_display(self) -> str:
|
||||||
|
"""
|
||||||
|
Map ugly language names to something more useful
|
||||||
|
"""
|
||||||
|
return self.LANGUAGE_DISPLAY_MAPPING.get(self["language"], self["language"])
|
||||||
|
|
||||||
|
|
||||||
class CodeBlock(StructBlock):
|
class CodeBlock(StructBlock):
|
||||||
filename = CharBlock(max_length=128, required=False)
|
filename = CharBlock(max_length=128, required=False)
|
||||||
|
@ -44,7 +46,6 @@ class CodeBlock(StructBlock):
|
||||||
choices=get_language_choices,
|
choices=get_language_choices,
|
||||||
)
|
)
|
||||||
source = TextBlock()
|
source = TextBlock()
|
||||||
always_show_header = BooleanBlock(default=False, required=False)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
icon = "code"
|
icon = "code"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% if value.header_text %}
|
{% if value.header_text %}
|
||||||
<div class="code-header {% if value.always_show_header %}always-show{% endif %}">
|
<div class="code-header tags">
|
||||||
<span title="{{ value.language }}">{{ value.header_text }}</span>
|
{% if value.header_text %}<span class="tag ml-auto mr-5 language-tag" title="{{ value.language }}">{{ value.header_text }}</span>{% endif %}
|
||||||
<span>
|
<span class="tag code-copy-tag">
|
||||||
<i class="fa-regular fa-clipboard is-clickable code-copy" title="Copy to clipboard"></i>
|
<i class="fa-regular fa-clipboard is-clickable code-copy" title="Copy to clipboard"></i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
126
website/search/migrations/0004_alter_searchpage_body.py
Normal file
126
website/search/migrations/0004_alter_searchpage_body.py
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
# Generated by Django 4.1.8 on 2023-04-19 20:19
|
||||||
|
|
||||||
|
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", "0003_alter_searchpage_body"),
|
||||||
|
]
|
||||||
|
|
||||||
|
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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
blank=True,
|
||||||
|
use_json_field=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,126 @@
|
||||||
|
# Generated by Django 4.1.8 on 2023-04-19 20:19
|
||||||
|
|
||||||
|
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", "0003_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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"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()),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"iframe",
|
||||||
|
wagtail.blocks.StructBlock(
|
||||||
|
[
|
||||||
|
("url", wagtail.blocks.URLBlock()),
|
||||||
|
(
|
||||||
|
"caption",
|
||||||
|
wagtail.blocks.RichTextBlock(
|
||||||
|
editor="plain", required=False
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
blank=True,
|
||||||
|
use_json_field=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in a new issue