' tags only. +If no configuration value `tagsToKeep` is available or it is empty, a default set is used. The fallback condition is to restrict to `
` tags only.
The editor is provided a set of `tagsToRemove` for client-side editing (see _config/config.yml). This configuration is not used in saving the value, as value saving is determined by the `tagsToKeep` only.
## Options
-If no configuration is provided, the following configuration is set:
-
-```php
-$options = [
- "semantic" => true, // Generates a better, more semantic oriented HTML
- "removeformatPasted" => true, // remove pasted styles from Word and friends
- "resetCss" => true, // ref: https://alex-d.github.io/Trumbowyg/documentation/#reset-css
- "autogrow" => true, // allow the text edit zone to extend
- "buttons" => [
- [ "undo", "redo" ],
- [ "p","h3", "h4", "h5", "strong", "em" ], // basic formatting
- [ "link", "" ], // support adding links
- [ "unorderedList", "orderedList" ], // ul and ol
- [ "removeformat" ], // clear all formatting to assist with removing cruft
- [ "fullscreen" ] // go full screen edit
- ],
- "tagsToKeep" => [
- "p" // only keep tags by default
- ]
-];
-```
+If no configuration is provided, the default configuration defined in [TrumbowygEditorField::getFieldOptions()](../../src/Fields/TrumbowygEditorField.php) is used.
## Basic example
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
deleted file mode 100644
index fe58f6f..0000000
--- a/phpcs.xml.dist
+++ /dev/null
@@ -1,11 +0,0 @@
-
- ";// disallow all
}
diff --git a/tests/FieldTest.php b/tests/FieldTest.php
index e6ee235..8ac5b58 100644
--- a/tests/FieldTest.php
+++ b/tests/FieldTest.php
@@ -124,4 +124,29 @@ public function testGenerateConfig() {
$this->assertEquals( $expected, $config, "Configuration is not as expected" );
}
+ /**
+ * test that only tags are returned
+ */
+ public function testEmptyConfig() {
+ $tags = "";
+ Config::inst()->update(
+ ContentSanitiser::class,
+ 'default_allowed_html_tags',
+ $tags
+ );
+ $expectedGeneratedTags = ['p'];
+ $generatedTags = ContentSanitiser::getAllowedHTMLTagsAsArray();
+ $this->assertEquals( $expectedGeneratedTags, $generatedTags, "Generated tags should match expected");
+
+ $config = ContentSanitiser::generateConfig();
+ $expected = [
+ 'Core.Encoding' => 'UTF-8',
+ 'HTML.AllowedElements' => $expectedGeneratedTags,
+ 'HTML.AllowedAttributes' => ['href'],
+ 'URI.AllowedSchemes' => ['http','https', 'mailto', 'callto'],
+ 'Attr.ID.HTML5' => true
+ ];
+ $this->assertEquals( $expected, $config, "Configuration is not as expected" );
+ }
+
}