2018-03-24 11:45:31 +01:00
|
|
|
<?php
|
2018-05-13 17:32:50 +02:00
|
|
|
|
|
|
|
use SilverStripe\Forms\HTMLEditor\HtmlEditorConfig;
|
|
|
|
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
2018-05-28 14:42:05 +02:00
|
|
|
use SilverStripe\ORM\Search\FulltextSearchable;
|
2020-01-22 10:46:53 +01:00
|
|
|
use SilverStripe\View\Parsers\ShortcodeParser;
|
|
|
|
use Site\Extensions\EmbedShortcodeProvider;
|
2018-05-13 17:32:50 +02:00
|
|
|
|
2020-01-22 10:46:53 +01:00
|
|
|
// setup TinyMCE editor
|
2018-12-03 17:12:41 +01:00
|
|
|
$config = HtmlEditorConfig::get('cms');
|
|
|
|
$config->enablePlugins([
|
2018-05-13 17:32:50 +02:00
|
|
|
'template',
|
|
|
|
'fullscreen',
|
|
|
|
'hr',
|
|
|
|
'contextmenu',
|
|
|
|
'charmap',
|
|
|
|
'visualblocks',
|
|
|
|
'lists',
|
2018-07-02 03:54:18 +02:00
|
|
|
'charcount' => ModuleResourceLoader::resourceURL(
|
|
|
|
'drmartingonzo/ss-tinymce-charcount:client/dist/js/bundle.js'
|
|
|
|
),
|
2018-05-13 17:32:50 +02:00
|
|
|
]);
|
2018-12-03 17:12:41 +01:00
|
|
|
$config->addButtonsToLine(2, 'hr');
|
|
|
|
$config->setOption('block_formats', 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Address=address;Pre=pre');
|
|
|
|
$config->setOption('invalid_elements', 'h1');
|
2019-04-11 00:15:29 +02:00
|
|
|
$config->setOption(
|
|
|
|
'table_class_list',
|
|
|
|
[
|
|
|
|
['title' => 'Transparent Table', 'value' => 'table-none'],
|
|
|
|
['title' => 'Shaded rows', 'value' => 'table table-striped table-bordered'],
|
|
|
|
]
|
|
|
|
);
|
2018-05-28 14:42:05 +02:00
|
|
|
|
|
|
|
FulltextSearchable::enable();
|
2020-01-22 10:46:53 +01:00
|
|
|
|
|
|
|
// replace embed parser
|
2021-03-29 09:55:04 +02:00
|
|
|
/*$parser = ShortcodeParser::get('default');
|
2020-01-22 10:46:53 +01:00
|
|
|
$parser->unregister('embed');
|
2021-03-29 09:55:04 +02:00
|
|
|
$parser->register('embed', [EmbedShortcodeProvider::class, 'handle_shortcode']);*/
|