Add a tangent block
This commit is contained in:
parent
e8c3ec86ae
commit
ef9128313d
7 changed files with 3020 additions and 1 deletions
|
@ -34,3 +34,10 @@ div.block-embed {
|
||||||
@include center-block(50%);
|
@include center-block(50%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.block-tangent {
|
||||||
|
.inner {
|
||||||
|
margin: math.div($content-block-margin-bottom, 4) 0;
|
||||||
|
padding-left: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,3 +5,8 @@ $pre-background: unset;
|
||||||
$family-code: "Fira Code", monospace;
|
$family-code: "Fira Code", monospace;
|
||||||
$dropdown-content-radius: 0px;
|
$dropdown-content-radius: 0px;
|
||||||
$dropdown-content-offset: 0px;
|
$dropdown-content-offset: 0px;
|
||||||
|
|
||||||
|
$code-background: none;
|
||||||
|
$pre-background: none;
|
||||||
|
$code-padding: 0px;
|
||||||
|
$code: inherit;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
@use "sass:math";
|
||||||
|
|
||||||
@use "variables" as *;
|
@use "variables" as *;
|
||||||
@use "bulma_overrides" 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
|
@ -27,9 +27,20 @@ RICH_TEXT_FEATURES = [
|
||||||
"strikethrough",
|
"strikethrough",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
RICH_TEXT_FEATURES_PLAIN = [
|
||||||
|
"bold",
|
||||||
|
"italic",
|
||||||
|
"link",
|
||||||
|
"document-link",
|
||||||
|
"code",
|
||||||
|
"strikethrough",
|
||||||
|
]
|
||||||
|
|
||||||
RICH_TEXT_FEATURES_SIMPLE = [
|
RICH_TEXT_FEATURES_SIMPLE = [
|
||||||
"bold",
|
"bold",
|
||||||
"italic",
|
"italic",
|
||||||
|
"ol",
|
||||||
|
"ul",
|
||||||
"link",
|
"link",
|
||||||
"document-link",
|
"document-link",
|
||||||
"code",
|
"code",
|
||||||
|
@ -54,7 +65,7 @@ class LoremBlock(blocks.StructBlock):
|
||||||
|
|
||||||
class ImageCaptionBlock(blocks.StructBlock):
|
class ImageCaptionBlock(blocks.StructBlock):
|
||||||
image = ImageChooserBlock()
|
image = ImageChooserBlock()
|
||||||
caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_SIMPLE)
|
caption = blocks.RichTextBlock(features=RICH_TEXT_FEATURES_PLAIN)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
icon = "image"
|
icon = "image"
|
||||||
|
@ -62,6 +73,16 @@ class ImageCaptionBlock(blocks.StructBlock):
|
||||||
template = "common/blocks/image-caption.html"
|
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_PLAINTEXT_BLOCKS = (blocks.RawHTMLBlock, EmbedBlock, ImageCaptionBlock)
|
||||||
IGNORE_HEADING_BLOCKS = (*IGNORE_PLAINTEXT_BLOCKS, LoremBlock)
|
IGNORE_HEADING_BLOCKS = (*IGNORE_PLAINTEXT_BLOCKS, LoremBlock)
|
||||||
|
|
||||||
|
@ -74,6 +95,7 @@ def get_blocks() -> list[tuple[str, blocks.BaseBlock]]:
|
||||||
("html", blocks.RawHTMLBlock()),
|
("html", blocks.RawHTMLBlock()),
|
||||||
("image", ImageCaptionBlock()),
|
("image", ImageCaptionBlock()),
|
||||||
("code", CodeBlock()),
|
("code", CodeBlock()),
|
||||||
|
("tangent", TangentBlock()),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
9
website/common/templates/common/blocks/tangent.html
Normal file
9
website/common/templates/common/blocks/tangent.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{% load wagtailcore_tags %}
|
||||||
|
|
||||||
|
<code><{{ value.name }}></code>
|
||||||
|
|
||||||
|
<div class="inner">
|
||||||
|
{{ value.content|richtext }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<code></{{ value.name }}></code>
|
Loading…
Reference in a new issue