Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 158 additions & 19 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,160 @@
<?php
use SilverStripe\Forms\HTMLEditor\HtmlEditorConfig;

HtmlEditorConfig::get('cms')->setOption('table_class_list', [
[
'title' => 'Table',
'value' => 'nsw-table'
],
[
'title' => 'Striped',
'value' => 'nsw-table nsw-table--striped'
],
[
'title' => 'Bordered',
'value' => 'nsw-table nsw-table--bordered'
],
[
'title' => 'Stripe and bordered',
'value' => 'nsw-table nsw-table--striped nsw-table--bordered'
]
]);
use SilverStripe\Forms\HTMLEditor\TinyMCEConfig;

try {

TinyMCEConfig::get('cms')->setOption('table_class_list', [
[
'title' => 'Table',
'value' => 'nsw-table'
],
[
'title' => 'Striped',
'value' => 'nsw-table nsw-table--striped'
],
[
'title' => 'Bordered',
'value' => 'nsw-table nsw-table--bordered'
],
[
'title' => 'Stripe and bordered',
'value' => 'nsw-table nsw-table--striped nsw-table--bordered'
]
]);


TinyMCEConfig::get('cms')->setOptions([
'importcss_append' => true,
'style_formats' => [
[
'title' => 'Text',
'items' => [
[
'title' => 'Paragraph',
'block' => 'p',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Heading 1',
'block' => 'h1',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Heading 2',
'block' => 'h2',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Heading 3',
'block' => 'h3',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Heading 4',
'block' => 'h4',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Heading 5',
'block' => 'h5',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Heading 6',
'block' => 'h6',
'attributes' => [
'class' => ''
]
],
[
'title' => 'Paragraph (Intro)',
'selector' => 'p',
'attributes' => [
'class' => 'nsw-intro'
]
],
]
],
[
'title' => 'Buttons',
'items' => [
[
'title' => 'Dark button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--dark'
]
],
/*
[
'title' => 'Dark Outline button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--dark-outline'
]
],
[
'title' => 'Dark Outline Solid button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--dark-outline-solid'
]
],
*/
[
'title' => 'Light button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--light'
]
],
/*
[
'title' => 'Light Outline button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--light-outline'
]
],
[
'title' => 'White button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--white'
]
],
[
'title' => 'White Outline button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--white-outline'
]
],
*/
[
'title' => 'Danger button',
'selector' => 'a',
'attributes' => [
'class' => 'nsw-button nsw-button--danger'
]
]
],
]
]
]);


} catch (\Exception $exception) {}
2 changes: 2 additions & 0 deletions _config/tinymce.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
Name: nswdpc-waratah-tinymce
After:
- '#nswdpc-content-tinymce'
---
SilverStripe\Forms\HTMLEditor\TinyMCEConfig:
editor_css:
Expand Down
2 changes: 1 addition & 1 deletion src/Models/DesignSystemConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public static function get_per_layout_content($template): ?DBHTMLText
// do not include requirements when parsing the template
$viewer->includeRequirements(false);
// process template with current controller
$result = $viewer->process($controller, null, null);
$result = $viewer->process($controller);
return DBField::create_field(
DBHTMLText::class,
$result
Expand Down
67 changes: 38 additions & 29 deletions themes/nswds/app/static/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,63 @@
--nsw-font-family: 'Public Sans', sans-serif;
}

body {
/**
* Editor fields
* Styles applied to the editor field
*/
.mce-content-body.typography {
overflow-x: hidden;
font-size: 1rem;
color: #383838;
font-weight: 400;
line-height: 1.75;
}

html,
body,
button,
input,
select,
textarea {
.mce-content-body.typography,
.mce-content-body.typography button,
.mce-content-body.typography input,
.mce-content-body.typography select,
.mce-content-body.typography textarea {
font-family: var(--nsw-font-family);
}

table {
.mce-content-body.typography table {
width: 100%;
margin-bottom: 2rem;
}

table,
th,
td {
.mce-content-body.typography table,
.mce-content-body.typography th,
.mce-content-body.typography td {
border: 1px solid #DCDDDE;
}

thead td,
th {
.mce-content-body.typography thead td,
.mce-content-body.typography th {
background: #F1F2F2;
font-weight: 500;
font-style: normal;
}

th,
td {
.mce-content-body.typography th,
.mce-content-body.typography td {
padding: .5rem .825rem;
vertical-align: top;
}

a.nsw-button.nsw-button--dark,
a.nsw-button.nsw-button--primary {
.mce-content-body.typography blockquote {
font-size: 1.375rem;
line-height: 1.25;
margin-top: 1rem;
border-left: 6px solid #d7153a;
padding: 1.25rem 1.5rem;
}

/**
* tag.selector styles below will display in the 'style' menu
*/
.mce-content-body.typography a.nsw-button.nsw-button--dark,
.mce-content-body.typography a.nsw-button.nsw-button--primary {
font-family: var(--nsw-font-family);
font-weight: 600;
font-size: 1rem;
Expand All @@ -71,10 +85,11 @@ a.nsw-button.nsw-button--primary {
color: #fff !important;
background-color: #002664;
border-color: transparent;
outline-width: 0;
}

a.nsw-button.nsw-button--light,
a.nsw-button.nsw-button--secondary {
.mce-content-body.typography a.nsw-button.nsw-button--light,
.mce-content-body.typography a.nsw-button.nsw-button--secondary {
font-family: var(--nsw-font-family);
font-weight: 600;
font-size: 1rem;
Expand All @@ -99,9 +114,10 @@ a.nsw-button.nsw-button--secondary {
color: #22272b;
background-color: #cbedfd;
border-color: transparent;
outline: none;
}

a.nsw-button.nsw-button--danger {
.mce-content-body.typography a.nsw-button.nsw-button--danger {
font-family: var(--nsw-font-family);
font-weight: 600;
font-size: 1rem;
Expand All @@ -126,18 +142,11 @@ a.nsw-button.nsw-button--danger {
color: #fff;
background-color: #b81237;
border-color: transparent;
outline: none;
}

p.nsw-intro {
.mce-content-body.typography p.nsw-intro {
font-size: 1.125rem;
line-height: 1.33;
margin: 1rem 0 0;
}

blockquote {
font-size: 1.375rem;
line-height: 1.25;
margin-top: 1rem;
border-left: 6px solid #d7153a;
padding: 1.25rem 1.5rem;
}