I want to give the user the minimal RTE for some kinds of custom content elements in TYPO3 8.7.
I found this old approach here but it is not compatible with the ckeditor of TYPO3 8.
RTE.config.tt_content.bodytext.types.ccc_teasertext {
showButtons = bold, italic, underline, link, chMode, orderedlist, unorderedlist
RTEHeightOverride = 600
}
RTE.config.tt_content.bodytext.types.ccc_introtext {
showButtons = bold, italic, chMode
RTEHeightOverride = 300
}
How do I use RTE.config with the new ckeditor syntax like this RTE.tt_content.types.textmedia.bodytext.preset = minimal ?
https://stackoverflow.com/a/55391407/4062341
Fellow TYPO3 developer gautamsinh mori pointed me here to a solution for the problem:
Don't configure the RTE in the PageTS but in the TCA Overrides per content element like this:
$GLOBALS['TCA']['tt_content']['types']['myCustomContentElement']=[
'showitem' => '
--palette--; LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.general; general,header,subheader,header_link,bodytext,image,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:tabs.appearance,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.frames;frames,
--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,
--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.visibility;visibility,
--palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.access;access,
--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category, categories, tx_gridelements_container, tx_gridelements_columns
',
'columnsOverrides' => [
'bodytext' => [
'config' => [
'enableRichtext' => true,
'richtextConfiguration' => 'minimal'
]
]
]
];
Note: 'minimal' is the preset.
Related
I’ve got a Problem with spam protection in TYPO3 v9.5 for a long time in my own template extension and custom content elements.
I would expect, that the E-Mail Links inserted via TypoLink in ckEditor would be transformed to name(at)domain.de in the frontend by using the following snippet in my Setup. But its simply is ignored:
config.spamProtectEmailAddresses = 2
config.spamProtectEmailAddresses_atSubst = <span>(at)</span>
I’ve set up a clean Installation with 9.5.15 and it just works. So I think it has something to do with my template-extension or my custom components with custom ckEditor config.
Can someone with a better understanding of TYPO3 please guide me to the right direction?
Here is my TCA for the Textfield:
'bodytext' => [
'exclude' => true,
'label' => 'Kontaktdaten',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 3,
'softref' => 'rtehtmlarea_images,typolink_tag,email[subst],url',
],
'defaultExtras' => 'richtext:rte_transform[flag=rte_enabled|mode=ts_css]'
],
compare your TCA field configuration with the configuration of the field tt_content.bodytext
I guess you missed: config.softref = typolink_tag,images,email[subst],url
I'm trying to create an export button which converts an HTML page to PDF then downloads it.
I'm using Windows 10, XAMPP, Laravel 5.8, wkhtmltopdf.
Here is the error screenshot :
Snappy Config:
'pdf' => [
'enabled' => true,
'binary' => '"F:\wkhtmltopdf\bin\wkhtmltopdf.exe"',
'timeout' => false,
'options' => [],
'env' => [],
],
'image' => [
'enabled' => true,
'binary' => '"F:\wkhtmltopdf\bin\wkhtmltoimage.exe"',
'timeout' => false,
'options' => [],
'env' => [],
],
Export Code :
$export_data = $this->exportData($checklist, $request);
$pdf_content = view('checklist.pdf.content')->with($export_data);
$pdf = PDF::loadHTML($pdf_content);
$pdf->setPaper('letter');
if ($checklist->weekly_monthly) {
$pdf->setOrientation('landscape');
}
$pdf->setOption('header-spacing', 30);
$pdf->setOption('header-html', view('checklist.pdf.header')->with($export_data));
$pdf->setOption('footer-html', view('report.pdf.footer'));
return $pdf->download($save_path);
Check your view checklist.pdf.content. In my experience with wkhtmltopdf, 99% of the time, the view was the issue.
Make sure that if you are using any image or external stylesheet in your view, their paths are properly defined. In case they are not, your HTML will work fine in your browser but using it for wkhtmltopdf will throw an error like this one.
In order to give paths for your images and external stylesheets, use following format:
<head>
<link href="{{public_path()}}/css/app.css" rel="stylesheet">
</head>
<body>
<img src="{{public_path()}}/images/test.png" />
</body>
Of course, the exact path might differ based upon your folder configuration but they must be publically accessible and they should be accessed using the remote path.
I hope it helps
I have some problems with integration CKeditor 4 and CKFinder 3 in My Laravel Vue app.
I just want the functionality when I click on "image button" in my Ckeditor - CKFinder window appears and I'm able to upload all needed images.
What problems I have? (a few, but they must be related with each other):
I have that error in my devtools console: "[CKEDITOR] Error code: cloudservices-no-token-url." (I'm supposing that issue must be resolved when I properly integrate CKeditor with CKFinder)
(as WARN in devtools) - " [CKEDITOR] Error code: editor-plugin-conflict. {plugin: "image", replacedWith: "easyimage"} "
"Image Button" in my CKeditor disappeared (ckeck screenshot below):
You can see my Vue component code with config for ckeditor:
...
export default {
components: { VueCkeditor },
data() {
return {
content: '',
config: {
toolbar: [
{ name: 'styles', items : [ 'Styles','Format', 'FontSize' ] },
{ name: 'clipboard', items : ['Undo','Redo' ] },
{ name: 'editing', items : [ 'Scayt' ] },
{ name: 'insert', items : [ 'Image','Table','HorizontalRule','SpecialChar','Iframe' ] },
{ name: 'tools', items : [ 'Maximize' ] },
'/',
{ name: 'basicstyles', items : [ 'Bold','Italic','Strike','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
],
height: 400,
extraPlugins: 'autogrow,uploadimage',
filebrowserBrowseUrl: '/filemanager_storage?type=Files',
filebrowserUploadUrl: '/filemanager_storage/upload?type=Files&_token='+window.Laravel.csrfToken,
},
};
},
...
Other details which may be useful:
I use CKFinder 3 Package for Laravel 5.5+ (https://github.com/ckfinder/ckfinder-laravel-package)
In my ckfinder.php (configurations for CKFinder) I set temporally that code:
$config['authentication'] = function () {
return true;
};
I'm not sure in that paths (in my config object in vue):
filebrowserBrowseUrl: '/filemanager_storage?type=Files',
filebrowserUploadUrl: '/filemanager_storage/upload?type=Files&_token='+window.Laravel.csrfToken,
},
*I created 'filemanager_storage' directory in my 'public' directory
Thanks guys a lot for any help!
I was facing similar issues regarding a ckeditor4.x integration I did recently in an opencart site with php. While it's not the same environment with vue, maybe this could prove useful to you.
Instead of using the easyimage plugin for managing the image upload , I replaced it with the image2 (enhanced image plugin) . After you've downloaded the image2 plugin and placed it under the ckeditor4/plugins/ directory, make sure to add this in your ckeditor instance:
extraPlugins : 'image2',
removePlugins: 'easyimage,cloudservices'
Regarding the urls in the ckeditor instance, while I'm not using the filebrowserBrowseUrl , I've declared the filebrowserUploadUrl as such :
filebrowserUploadUrl: '/path_where_ckfinder_is_installed/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json
While in my case it made the image upload possible, I'm still getting the warning [CKEDITOR] Error code: editor-plugin-conflict. {plugin: "image", replacedWith: "image2"} " This is something that I haven't been able to solve yet, but at least the image upload works in my case with no fuss.
Also, make sure in the config.php of ckfinder that you've declared the BaseUrl and root path for the user files directory, i.e
$config['backends'][] = array(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => $your_file_path,
'root' => '/your_root_dir/' . $your_file_path, // Can be used to explicitly set the CKFinder user files directory.
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8'
);
Let me know if this solution suits your case.
OK, i know this question has been asked many times, however not one of the answers seems to work, i can only assume Yii2 has been updated since then.
Here goes:
I am trying to change the frontend theme of my Yii2 Advance Application.
I chose a theme from http://yii2.themefactory.net/
I downloaded the theme and completed the following steps that i have found on various sites on the web.
Created a folder myApp/frontend/themes
Placed the files from the download into this folder
Changed the myApp/frontend/config/main.php to include the following
'view' => [
'theme' => [
'pathMap' => [
'#app/views' => '#app/themes/interior'
],
'baseUrl' => '#web/themes/interior',
],
],
I have tried various ways of the baseUrl. and it doesn't seem to find the CSS file, as i have read the theme files shouldn't be placed in the web folder.
However i cannot see anyway of reading these CSS files without them being placed in the web folder.
So do i have to split the theme and place the views in the theme folder and then the CSS in another folder under the web folder.
Sorry if this makes no sense, but i have read so many posts across so many sites that all contradict each other.
Let me know any thoughts
Thanks.
Further information.
The issue seems to be that the themes folder myApp/frontend/themes contains all the theme files including the CSS. When the website is run it cannot link to these CSS files.
So is the answer that i need to split the themes folder, keep the layouts in the myApp/frontend/themes and then put the CSS in a similar folder in myApp/frontend/web/themes ??
** OK Solution - However i am not sue this is the correct way **
In the theme folder i downloaded there was two folders layouts and files
I created two folders myApp/frontend/themes and myApp/frontend/web/themes
I put the layouts folder into the mayApp/frontend/themes/THEME_NAME folder and the files folder into myApp/frontend/themes/web/THEME_NAME/ folder
I then setup the main.php confgi file like this
'view' => [
'theme' => [
'pathMap' => ['#app/views' => '#app/themes/houses-on-water'],
'baseUrl' => '#web/themes/houses-on-water',
],
],
I am not sure this is the correct way but it is working
Regards
Liam
Copy content in:
MYAPP/frontend/web/themes/MYTHEME
Change your MYAPP/frontend/config/main.php
'view' => [
'theme' => [
'pathMap' => [
//Only for change layout/main.php location
'#app/views' => '#webroot/themes/MYTHEME'
],
'baseUrl' => '#web/themes/MYTHEME',
'basePath' => '#webroot/themes/MYTHEME',
],
],
Reference:
https://www.yiiframework.com/wiki/667/yii-2-list-of-path-aliases-available-with-default-basic-and-advanced-app
https://www.yiiframework.com/doc/guide/2.0/en/output-theming
Enjoy
For frontend try changing this way:
'view' => [ 'theme' => [
'pathMap' => [ '#frontend/views' => '#frontend/themes/interior' ],
'baseUrl' => '#web/themes/interior'],
],
Just use theme under web/themes folder, and change your code to this :
'view' => [
'theme' => [
'pathMap' => ['#app/views' => '#app/web/themes/houses-on-water'],
'baseUrl' => '#web/themes/houses-on-water',
],
],
It's work to me.
I have written my own custom plugin for inserting images in CKEDITOR. I disable the image button in toolbar . I use the editor.insertHtml() function to insert the image from my custom plugin . When I remove the standard image button from the toolset it disables insertion of image tag in the CKEDITOR box . All other html tags are accepted but for the <img/> tag .
This is my config(without the 'Image' in config.toolbar) :
CKEDITOR.editorConfig = function( config )
{
CKEDITOR.plugins.addExternal('insert_blank','http://localhost:3000/assets/ckeditor/plugins/insert_blank/', 'plugin.js');
CKEDITOR.plugins.addExternal('qimage','http://localhost:3000/assets/ckeditor/plugins/qimage/', 'plugin.js');
config.extraPlugins = 'insert_blank,qimage' ;
config.toolbar =
[
{ name: 'basicstyles', items : [ 'Bold','-','Italic' ] },
{ name: 'insert', items : [ 'insert_blank.btn','-','qimage.btn'
] },
];
config.keystrokes = [
[ CKEDITOR.CTRL + 75, 'InsertBlank' ],
[ CKEDITOR.CTRL + 85, 'qimage' ],
];
config.height = 300 ;
config.width = 350 ;
config.removePlugins = 'elementspath,resize' ;
};
Is there a way to enable image tag insert ?
UPDATE : Worked by adding the following command to the config file :
config.allowedContent = 'b i img[!src,alt,width,height]' ;
Have you read how to integrate plugin with Allowed Filter Content? You need to define that your plugin adds button/command which allow img tag and its attributes. You can also define which tag and its attributes are definitely required for this button/command to be enabled, what will activate/deactivate it when someone will set config.allowedContent.
What you need is just to enable the img[src] attribute.
So you should use config.extraAllowedContent = 'img[src,alt,width,height]';
the config.allowedContent will override all the others DOMs.