Add a tangent block

This commit is contained in:
Jake Howard 2022-07-05 09:03:45 +01:00
parent e8c3ec86ae
commit ef9128313d
Signed by: jake
GPG Key ID: 57AFB45680EDD477
7 changed files with 3020 additions and 1 deletions

View File

@ -34,3 +34,10 @@ div.block-embed {
@include center-block(50%);
}
}
div.block-tangent {
.inner {
margin: math.div($content-block-margin-bottom, 4) 0;
padding-left: 1.5rem;
}
}

View File

@ -5,3 +5,8 @@ $pre-background: unset;
$family-code: "Fira Code", monospace;
$dropdown-content-radius: 0px;
$dropdown-content-offset: 0px;
$code-background: none;
$pre-background: none;
$code-padding: 0px;
$code: inherit;

View File

@ -1,3 +1,5 @@
@use "sass:math";
@use "variables" as *;
@use "bulma_overrides" as *;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,9 +27,20 @@ RICH_TEXT_FEATURES = [
"strikethrough",
]
RICH_TEXT_FEATURES_PLAIN = [
"bold",
"italic",
"link",
"document-link",
"code",
"strikethrough",
]
RICH_TEXT_FEATURES_SIMPLE = [
"bold",
"italic",
"ol",
"ul",
"link",
"document-link",
"code",
@ -54,7 +65,7 @@ class LoremBlock(blocks.StructBlock):
class ImageCaptionBlock(blocks.StructBlock):
image = ImageChooserBlock()
caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_SIMPLE)
caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN)
class Meta:
icon = "image"
@ -62,6 +73,16 @@ class ImageCaptionBlock(blocks.StructBlock):
template = "common/blocks/image-caption.html"
class TangentBlock(blocks.StructBlock):
name = blocks.CharBlock(max_length=64)
content = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_SIMPLE)
class Meta:
icon = "comment"
label = "Tangent"
template = "common/blocks/tangent.html"
IGNORE_PLAINTEXT_BLOCKS = (blocks.RawHTMLBlock, EmbedBlock, ImageCaptionBlock)
IGNORE_HEADING_BLOCKS = (*IGNORE_PLAINTEXT_BLOCKS, LoremBlock)
@ -74,6 +95,7 @@ def get_blocks() -> list[tuple[str, blocks.BaseBlock]]:
("html", blocks.RawHTMLBlock()),
("image", ImageCaptionBlock()),
("code", CodeBlock()),
("tangent", TangentBlock()),
]

View File

@ -0,0 +1,9 @@
{% load wagtailcore_tags %}
<code>&lt;{{ value.name }}&gt;</code>
<div class="inner">
{{ value.content|richtext }}
</div>
<code>&lt;/{{ value.name }}&gt;</code>