SlideShare a Scribd company logo
HTMLarea → CKEditor
Frans Saris
2
■ developer @beech.it (in the Netherlands)
■ TYPO3 core/extension dev
■ slack/typo3.org: minifranske
■ twitter: @franssaris
■ github: fsaris - frans-beech-it - beechit
Why the switch
to CKEditor?
3
Why the switch to CKEditor?
■ We don’t have to fully maintain it our self
■ Superb browser support
■ Complying with the latest web accessibility standards
■ Inline editing features
■ Advanced Content Filter
4
The big changes
5
Big changes
6
■ Presets in YAML
■ <p> are now saved in database!
■ No <typolink> anymore
■ No automatic migration of existing configs
But why YAML?
7
Why YAML
8
■ CKEditor uses plain javascript for configuration
■ typoscript for BE config is confusing for newcomers
■ A new structure (new start)
separate “processing” and Editor-related configuration
■ Allows options to be extend
but no conditions or unsetting values
Presets
9
What do these presets do?
10
■ Define editor appearance
■ Define what tags and styles are allowed
■ Define what plugin’s to load
■ Define database processing `RTE.proc`
Preset: default
11
●
Preset: minimal
12
●
Preset: full
13
●
So I want my
own preset
14
Add your own preset
15
// Register or own text-element config
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['text-element'] =
'EXT:config_examples/Configuration/RTE/TextElement.yaml';
ext_localconf.php
Configure your own preset
16
# Load default processing options
imports:
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
# Minimal configuration for the editor
editor:
config:
toolbarGroups:
- { name: basicstyles, groups: [ basicstyles ] }
removeButtons:
- Underline
- Strike
EXT:config_examples/Configuration/RTE/TextElement.yaml
Configure your own preset
17
editor:
config:
# Limit the height of the editor
height: 200
extraPlugins:
- justify
removePlugins:
- image
YAML
CKEditor js to YAML
CKEDITOR.editorConfig = function( config ) {
config.toolbarGroups = [
{ name: 'basicstyles', groups: [ 'basicstyles' ] }
];
config.removeButtons = 'Underline,Strike';
};
http://ckeditor.com/tmp/4.5.0-beta/ckeditor/samples/toolbarconfigurator/ js
editor:
config:
toolbarGroups:
- { name: basicstyles, groups: [ basicstyles ] }
removeButtons:
- Underline
- Strike
YAML
Define some custom style options
19
editor:
config:
stylesSet:
# block level styles
- { name: "Orange title H2", element: "h2", styles: { color: "orange", background: "blue" } }
- { name: "Orange title H3", element: "h3", styles: { color: "orange", background: "blue" } }
- { name: "Quote / Citation", element: "blockquote" }
- { name: "Code block", element: "code" }
# Inline styles
- { name: "Yellow marker", element: "span", styles: { background-color: "yellow" } }
yaml
Paragraph format options
20
editor:
config:
format_tags: "p;h2;h3;pre"
http://docs.ckeditor.com/#!/guide/dev_format yaml
Migrate existing
config
21
PageTS -> YAML
editor:
config:
toolbar:
- [ 'Bold', 'Italic', 'Underline', '-']
- [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ]
- [ 'NumberedList', 'BulletedList', '-', 'Indent', 'Outdent' ]
- '/'
- [ 'HorizontalRule', 'Link', 'RemoveFormat', '-' ]
- [ 'Copy', 'Cut', 'Paste', '-', 'Undo', 'Redo' ]
extraPlugins:
- justify
RTE.default {
showButtons (
bold, italic, underline,
left, center, right, justifyfull,
orderedlist, unorderedlist, indent, outdent,
line, link, removeformat,
copy, cut, paste, undo, redo
)
toolbarOrder (
bold, italic, underline, bar,
left, center, right, justifyfull,
orderedlist, unorderedlist, bar, indent, outdent, linebreak,
line, link, removeformat, bar,
copy, cut, paste, bar, undo, redo
)
}
pageTS
yaml
Advanced
Content Filter
23
Advanced Content Filter?
24
■ Only tags/classes/styles that are configured are kept
■ Filters content during editing and paste
■ Enabled by default
■ Makes `processing` config most of the times obsolete
“RTE.proc”
Disable Advanced Content Filter
25
editor:
config:
allowedContent: true
YAML
Using your own
preset
26
Set default RTE preset
27
RTE.default.preset = my_config
PageTSconfig
Set preset in TCA
28
'content' => [
'label' => 'LLL:EXT:lang/Res...eneral.xlf:LGL.text',
'config' => [
'type' => 'text',
'cols' => 48,
'rows' => 5,
'enableRichtext' => true,
'richtextConfiguration' => 'minimal',
],
],
Using PageTS to define what specific preset to use
29
RTE {
config {
[table].[field].preset = something
[table].[field].types.[type].preset = something
}
}
RTE {
config {
tt_content {
bodytext {
preset = minimal
types {
textmedia.preset = default
my_ce.preset = full
}
}
}
}
}
Using PageTS to define preset to use
30
Plugins
31
Plugins delivered by TYPO3
32
■ Default set provided by CKEditor
typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/
■ typo3link
■ quicktables
Using a CKEditor core plugin
33
editor:
extraPlugins:
- justify
YAML
Using external plugins
34
editor:
externalPlugins:
quicktable: { resource:
"EXT:rte_ckeditor/Resources/Public/JavaScript/Plugins/quicktable/plugin.js" }
typo3/sysext/rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml
Adding plugins
35
■ Donwload from //ckeditor.com/addons/plugins
■ Add to EXT:my_ext/Resources/Public/Javascript/Plugins/*
■ Register it in your YAML as external plugin
Create your own
plugin
36
Our goal
37
■ A custom button in the toolbar of the RTE
■ Some magic happening when we click that button
So what do we need
38
■ Our own plugin.js
■ Tell TYPO3 to use our plugin
■ An icon for our button
example_plugin.js
39
'use strict';
(function () {
CKEDITOR.plugins.add('example_plugin', {
init: function (editor) {
console.log('example_plugin is loaded');
}
});
})();
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Tell TYPO3 to use our plugin
40
# Load default processing options
imports:
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml"
}
editor:
# Load my plugin as external plugin
externalPlugins:
example_plugin: { resource: "EXT:...path.../example_plugin.js" }
EXT:config_examples/Configuration/RTE/PluginExample.yaml
Tell TYPO3 to use our plugin
41
// Register or own plugin-example config
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['plugin-example'] =
'EXT:config_examples/Configuration/RTE/PluginExample.yaml';
EXT:config_examples/ext_localconf.php
Tell TYPO3 to use our plugin
42
RTE.default.preset = plugin-example
PageTS
The result
43
So let’s add
a button
44
So let’s add our button
45
'use strict';
(function () {
CKEDITOR.plugins.add('example_plugin', {
init: function (editor) {
editor.ui.addButton( 'ExamplePlugin', {
label: 'My button',
toolbar: 'basicstyles'
});
}
});
})();
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Select a visible toolbar
46
'use strict';
(function () {
CKEDITOR.plugins.add('example_plugin', {
init: function (editor) {
editor.ui.addButton( 'ExamplePlugin', {
label: 'My button',
toolbar: 'basicstyles'
});
}
});
})();
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Cool we have a button
47
Add some magic to the button
48
CKEDITOR.plugins.add('example_plugin', {
init: function (editor) {
editor.ui.addButton( 'ExamplePlugin', {
label: 'My button',
toolbar: 'basicstyles',
command: 'insertTimestamp'
});
editor.addCommand( 'insertTimestamp', {
exec: function( editor ) {}
});
}
});
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Add some magic to the button
49
editor.addCommand( 'insertTimestamp', {
exec: function( editor ) {
var now = new Date();
editor.insertHtml(
'The current date and time is: <em>' +
now.toString() + '</em>'
);
}
});
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
The magic works
50
But we want
an icon
51
Register the icon
52
CKEDITOR.plugins.add('example_plugin', {
init: function (editor) {
icons: 'exampleplugin',
editor.ui.addButton( 'ExamplePlugin', {
label: 'My button',
toolbar: 'basicstyles',
command: 'insertTimestamp'
});
…
}
});
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Yeah
53
next step
adding some interaction
54
Let’s use the TYPO3 modal
55
CKEDITOR.plugins.add('example_plugin', {
init: function (editor) {
editor.ui.addButton( 'ExamplePlugin', {
label: 'My button',
toolbar: 'basicstyles',
command: 'openExampleModal'
});
editor.addCommand( 'openExampleModal', {
exec: openModal
});
}
});
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Let’s use the TYPO3 modal
56
…
exec: openModal
});
}
});
function openModal(editor) {
require([
'TYPO3/CMS/Backend/Modal'
], function (Modal) {
Modal.show(
'Example plugin',
'hi'
);
});
}
EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
Our modal
57
Get the selected text
58
function openModal(editor) {
var selection = editor.getSelection(),
content = 'No text selected';
if (selection && selection.getSelectedText()) {
content =
'<em>You selected:</em> ' +
selection.getSelectedText();
}
require([
'TYPO3/CMS/Backend/Modal'
], function (Modal) {
Modal.show(
'Example plugin',
content
);
});
}
Some text selected
59
Do something with the selected text
60
require([
'TYPO3/CMS/Backend/Modal'
], function (Modal) {
if (selection && selection.getSelectedText()) {
content = '<em>Remove:</em> ' +
selection.getSelectedText();
Modal.confirm(
'Example plugin',
content
)
} else {
Modal.show(
'Example plugin',
content
);
}
});
Do something with the selected text
61
Modal.confirm(
'Example plugin',
content
).on('confirm.button.cancel', function () {
Modal.dismiss();
}).on('confirm.button.ok', function () {
var range = editor.getSelection().getRanges()[0];
range.deleteContents();
range.select();
Modal.dismiss();
});
And the real interaction
62
Loading stuff over ajax
63
Tell TYPO3 what route you want to use
64
editor:
# Load my plugin as external plugin
externalPlugins:
example_plugin:
resource: "EXT:...path.../example_plugin.js"
route: "configexamples_some_route"
EXT:config_examples/Configuration/RTE/PluginExample.yaml
Open an modal with iframe
65
function openModal(editor) {
var url = editor.config.example_plugin.routeUrl;
require([
'TYPO3/CMS/Backend/Modal'
], function (Modal) {
Modal.advanced({
type: Modal.types.iframe,
title: 'Example plugin',
content: url,
size: Modal.sizes.large
});
});
}
But I don’t want
to switch :(
66
Some things to consider
67
■ Deprecated in TYPO3 8 LTS
■ Moved to FriendsOfTYPO3/rtehtmlarea for 9
■ https://github.com/FriendsOfTYPO3/rtehtmlarea
Questions?
68
And now?
69
■ github.com/frans-beech-it/t3ext-config_examples
■ github.com/netresearch/t3x-rte_ckeditor_image
■ typo3worx.eu/2017/02/configure-ckeditor-in-typo3/
■ docs.typo3.org/typo3cms/extensions/core/Changelog/8.6/Featur
e-79216-AddYAMLConfigurationForCKEditorRTE.html
■ docs.ckeditor.com/#!/api/CKEDITOR.config

More Related Content

Similar to HTMLarea to CKEditor - create presets and your own plugin for TYPO3

TYPO3 CKEditor for integrators
TYPO3 CKEditor for integratorsTYPO3 CKEditor for integrators
TYPO3 CKEditor for integrators
Frans Saris
 
TYPO3 create a CKEditor plugin
TYPO3 create a CKEditor pluginTYPO3 create a CKEditor plugin
TYPO3 create a CKEditor plugin
Frans Saris
 
2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin
2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin
2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin
TYPO3 CertiFUNcation
 
TYPO3 + CKEditor: Heaven for TYPO3 Developer & Editor
TYPO3 + CKEditor: Heaven for TYPO3 Developer & EditorTYPO3 + CKEditor: Heaven for TYPO3 Developer & Editor
TYPO3 + CKEditor: Heaven for TYPO3 Developer & Editor
NITSAN Technologies
 
TYPO3 6.1. What's new
TYPO3 6.1. What's newTYPO3 6.1. What's new
TYPO3 6.1. What's new
Rafal Brzeski
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21
Stamatis Zampetakis
 
How to create an Angular builder
How to create an Angular builderHow to create an Angular builder
How to create an Angular builder
Maurizio Vitale
 
Odoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMSOdoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMS
ElínAnna Jónasdóttir
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
James Williams
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
Giorgio Cefaro
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
eugenio pombi
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
Omnia Helmi
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico Ces
Leonardo Fernandes
 
IntroJs
IntroJsIntroJs
The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202
Mahmoud Samir Fayed
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Pantheon
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios
 
Building Your First App with Shawn Mcarthy
Building Your First App with Shawn Mcarthy Building Your First App with Shawn Mcarthy
Building Your First App with Shawn Mcarthy
MongoDB
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
RapidValue
 
Adding powerful ext js components to react apps
Adding powerful ext js components to react appsAdding powerful ext js components to react apps
Adding powerful ext js components to react apps
Sandeep Adwankar
 

Similar to HTMLarea to CKEditor - create presets and your own plugin for TYPO3 (20)

TYPO3 CKEditor for integrators
TYPO3 CKEditor for integratorsTYPO3 CKEditor for integrators
TYPO3 CKEditor for integrators
 
TYPO3 create a CKEditor plugin
TYPO3 create a CKEditor pluginTYPO3 create a CKEditor plugin
TYPO3 create a CKEditor plugin
 
2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin
2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin
2017 - TYPO3 CertiFUNcation: Frans-Saris - TYPO3 create CKeditor plugin
 
TYPO3 + CKEditor: Heaven for TYPO3 Developer & Editor
TYPO3 + CKEditor: Heaven for TYPO3 Developer & EditorTYPO3 + CKEditor: Heaven for TYPO3 Developer & Editor
TYPO3 + CKEditor: Heaven for TYPO3 Developer & Editor
 
TYPO3 6.1. What's new
TYPO3 6.1. What's newTYPO3 6.1. What's new
TYPO3 6.1. What's new
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21
 
How to create an Angular builder
How to create an Angular builderHow to create an Angular builder
How to create an Angular builder
 
Odoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMSOdoo Experience 2018 - From a Web Controller to a Full CMS
Odoo Experience 2018 - From a Web Controller to a Full CMS
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico Ces
 
IntroJs
IntroJsIntroJs
IntroJs
 
The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wiz...
 
Building Your First App with Shawn Mcarthy
Building Your First App with Shawn Mcarthy Building Your First App with Shawn Mcarthy
Building Your First App with Shawn Mcarthy
 
How to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular FrameworkHow to Implement Micro Frontend Architecture using Angular Framework
How to Implement Micro Frontend Architecture using Angular Framework
 
Adding powerful ext js components to react apps
Adding powerful ext js components to react appsAdding powerful ext js components to react apps
Adding powerful ext js components to react apps
 

Recently uploaded

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

HTMLarea to CKEditor - create presets and your own plugin for TYPO3

  • 2. Frans Saris 2 ■ developer @beech.it (in the Netherlands) ■ TYPO3 core/extension dev ■ slack/typo3.org: minifranske ■ twitter: @franssaris ■ github: fsaris - frans-beech-it - beechit
  • 3. Why the switch to CKEditor? 3
  • 4. Why the switch to CKEditor? ■ We don’t have to fully maintain it our self ■ Superb browser support ■ Complying with the latest web accessibility standards ■ Inline editing features ■ Advanced Content Filter 4
  • 6. Big changes 6 ■ Presets in YAML ■ <p> are now saved in database! ■ No <typolink> anymore ■ No automatic migration of existing configs
  • 8. Why YAML 8 ■ CKEditor uses plain javascript for configuration ■ typoscript for BE config is confusing for newcomers ■ A new structure (new start) separate “processing” and Editor-related configuration ■ Allows options to be extend but no conditions or unsetting values
  • 10. What do these presets do? 10 ■ Define editor appearance ■ Define what tags and styles are allowed ■ Define what plugin’s to load ■ Define database processing `RTE.proc`
  • 14. So I want my own preset 14
  • 15. Add your own preset 15 // Register or own text-element config $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['text-element'] = 'EXT:config_examples/Configuration/RTE/TextElement.yaml'; ext_localconf.php
  • 16. Configure your own preset 16 # Load default processing options imports: - { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" } - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" } # Minimal configuration for the editor editor: config: toolbarGroups: - { name: basicstyles, groups: [ basicstyles ] } removeButtons: - Underline - Strike EXT:config_examples/Configuration/RTE/TextElement.yaml
  • 17. Configure your own preset 17 editor: config: # Limit the height of the editor height: 200 extraPlugins: - justify removePlugins: - image YAML
  • 18. CKEditor js to YAML CKEDITOR.editorConfig = function( config ) { config.toolbarGroups = [ { name: 'basicstyles', groups: [ 'basicstyles' ] } ]; config.removeButtons = 'Underline,Strike'; }; http://ckeditor.com/tmp/4.5.0-beta/ckeditor/samples/toolbarconfigurator/ js editor: config: toolbarGroups: - { name: basicstyles, groups: [ basicstyles ] } removeButtons: - Underline - Strike YAML
  • 19. Define some custom style options 19 editor: config: stylesSet: # block level styles - { name: "Orange title H2", element: "h2", styles: { color: "orange", background: "blue" } } - { name: "Orange title H3", element: "h3", styles: { color: "orange", background: "blue" } } - { name: "Quote / Citation", element: "blockquote" } - { name: "Code block", element: "code" } # Inline styles - { name: "Yellow marker", element: "span", styles: { background-color: "yellow" } } yaml
  • 20. Paragraph format options 20 editor: config: format_tags: "p;h2;h3;pre" http://docs.ckeditor.com/#!/guide/dev_format yaml
  • 22. PageTS -> YAML editor: config: toolbar: - [ 'Bold', 'Italic', 'Underline', '-'] - [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] - [ 'NumberedList', 'BulletedList', '-', 'Indent', 'Outdent' ] - '/' - [ 'HorizontalRule', 'Link', 'RemoveFormat', '-' ] - [ 'Copy', 'Cut', 'Paste', '-', 'Undo', 'Redo' ] extraPlugins: - justify RTE.default { showButtons ( bold, italic, underline, left, center, right, justifyfull, orderedlist, unorderedlist, indent, outdent, line, link, removeformat, copy, cut, paste, undo, redo ) toolbarOrder ( bold, italic, underline, bar, left, center, right, justifyfull, orderedlist, unorderedlist, bar, indent, outdent, linebreak, line, link, removeformat, bar, copy, cut, paste, bar, undo, redo ) } pageTS yaml
  • 24. Advanced Content Filter? 24 ■ Only tags/classes/styles that are configured are kept ■ Filters content during editing and paste ■ Enabled by default ■ Makes `processing` config most of the times obsolete “RTE.proc”
  • 25. Disable Advanced Content Filter 25 editor: config: allowedContent: true YAML
  • 27. Set default RTE preset 27 RTE.default.preset = my_config PageTSconfig
  • 28. Set preset in TCA 28 'content' => [ 'label' => 'LLL:EXT:lang/Res...eneral.xlf:LGL.text', 'config' => [ 'type' => 'text', 'cols' => 48, 'rows' => 5, 'enableRichtext' => true, 'richtextConfiguration' => 'minimal', ], ],
  • 29. Using PageTS to define what specific preset to use 29 RTE { config { [table].[field].preset = something [table].[field].types.[type].preset = something } }
  • 30. RTE { config { tt_content { bodytext { preset = minimal types { textmedia.preset = default my_ce.preset = full } } } } } Using PageTS to define preset to use 30
  • 32. Plugins delivered by TYPO3 32 ■ Default set provided by CKEditor typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Contrib/plugins/ ■ typo3link ■ quicktables
  • 33. Using a CKEditor core plugin 33 editor: extraPlugins: - justify YAML
  • 34. Using external plugins 34 editor: externalPlugins: quicktable: { resource: "EXT:rte_ckeditor/Resources/Public/JavaScript/Plugins/quicktable/plugin.js" } typo3/sysext/rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml
  • 35. Adding plugins 35 ■ Donwload from //ckeditor.com/addons/plugins ■ Add to EXT:my_ext/Resources/Public/Javascript/Plugins/* ■ Register it in your YAML as external plugin
  • 37. Our goal 37 ■ A custom button in the toolbar of the RTE ■ Some magic happening when we click that button
  • 38. So what do we need 38 ■ Our own plugin.js ■ Tell TYPO3 to use our plugin ■ An icon for our button
  • 39. example_plugin.js 39 'use strict'; (function () { CKEDITOR.plugins.add('example_plugin', { init: function (editor) { console.log('example_plugin is loaded'); } }); })(); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 40. Tell TYPO3 to use our plugin 40 # Load default processing options imports: - { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml" } editor: # Load my plugin as external plugin externalPlugins: example_plugin: { resource: "EXT:...path.../example_plugin.js" } EXT:config_examples/Configuration/RTE/PluginExample.yaml
  • 41. Tell TYPO3 to use our plugin 41 // Register or own plugin-example config $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['plugin-example'] = 'EXT:config_examples/Configuration/RTE/PluginExample.yaml'; EXT:config_examples/ext_localconf.php
  • 42. Tell TYPO3 to use our plugin 42 RTE.default.preset = plugin-example PageTS
  • 44. So let’s add a button 44
  • 45. So let’s add our button 45 'use strict'; (function () { CKEDITOR.plugins.add('example_plugin', { init: function (editor) { editor.ui.addButton( 'ExamplePlugin', { label: 'My button', toolbar: 'basicstyles' }); } }); })(); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 46. Select a visible toolbar 46 'use strict'; (function () { CKEDITOR.plugins.add('example_plugin', { init: function (editor) { editor.ui.addButton( 'ExamplePlugin', { label: 'My button', toolbar: 'basicstyles' }); } }); })(); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 47. Cool we have a button 47
  • 48. Add some magic to the button 48 CKEDITOR.plugins.add('example_plugin', { init: function (editor) { editor.ui.addButton( 'ExamplePlugin', { label: 'My button', toolbar: 'basicstyles', command: 'insertTimestamp' }); editor.addCommand( 'insertTimestamp', { exec: function( editor ) {} }); } }); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 49. Add some magic to the button 49 editor.addCommand( 'insertTimestamp', { exec: function( editor ) { var now = new Date(); editor.insertHtml( 'The current date and time is: <em>' + now.toString() + '</em>' ); } }); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 51. But we want an icon 51
  • 52. Register the icon 52 CKEDITOR.plugins.add('example_plugin', { init: function (editor) { icons: 'exampleplugin', editor.ui.addButton( 'ExamplePlugin', { label: 'My button', toolbar: 'basicstyles', command: 'insertTimestamp' }); … } }); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 54. next step adding some interaction 54
  • 55. Let’s use the TYPO3 modal 55 CKEDITOR.plugins.add('example_plugin', { init: function (editor) { editor.ui.addButton( 'ExamplePlugin', { label: 'My button', toolbar: 'basicstyles', command: 'openExampleModal' }); editor.addCommand( 'openExampleModal', { exec: openModal }); } }); EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 56. Let’s use the TYPO3 modal 56 … exec: openModal }); } }); function openModal(editor) { require([ 'TYPO3/CMS/Backend/Modal' ], function (Modal) { Modal.show( 'Example plugin', 'hi' ); }); } EXT:config_examples/Resources/Public/CkEditorPlugins/example_plugin.js
  • 58. Get the selected text 58 function openModal(editor) { var selection = editor.getSelection(), content = 'No text selected'; if (selection && selection.getSelectedText()) { content = '<em>You selected:</em> ' + selection.getSelectedText(); } require([ 'TYPO3/CMS/Backend/Modal' ], function (Modal) { Modal.show( 'Example plugin', content ); }); }
  • 60. Do something with the selected text 60 require([ 'TYPO3/CMS/Backend/Modal' ], function (Modal) { if (selection && selection.getSelectedText()) { content = '<em>Remove:</em> ' + selection.getSelectedText(); Modal.confirm( 'Example plugin', content ) } else { Modal.show( 'Example plugin', content ); } });
  • 61. Do something with the selected text 61 Modal.confirm( 'Example plugin', content ).on('confirm.button.cancel', function () { Modal.dismiss(); }).on('confirm.button.ok', function () { var range = editor.getSelection().getRanges()[0]; range.deleteContents(); range.select(); Modal.dismiss(); });
  • 62. And the real interaction 62
  • 64. Tell TYPO3 what route you want to use 64 editor: # Load my plugin as external plugin externalPlugins: example_plugin: resource: "EXT:...path.../example_plugin.js" route: "configexamples_some_route" EXT:config_examples/Configuration/RTE/PluginExample.yaml
  • 65. Open an modal with iframe 65 function openModal(editor) { var url = editor.config.example_plugin.routeUrl; require([ 'TYPO3/CMS/Backend/Modal' ], function (Modal) { Modal.advanced({ type: Modal.types.iframe, title: 'Example plugin', content: url, size: Modal.sizes.large }); }); }
  • 66. But I don’t want to switch :( 66
  • 67. Some things to consider 67 ■ Deprecated in TYPO3 8 LTS ■ Moved to FriendsOfTYPO3/rtehtmlarea for 9 ■ https://github.com/FriendsOfTYPO3/rtehtmlarea
  • 69. And now? 69 ■ github.com/frans-beech-it/t3ext-config_examples ■ github.com/netresearch/t3x-rte_ckeditor_image ■ typo3worx.eu/2017/02/configure-ckeditor-in-typo3/ ■ docs.typo3.org/typo3cms/extensions/core/Changelog/8.6/Featur e-79216-AddYAMLConfigurationForCKEditorRTE.html ■ docs.ckeditor.com/#!/api/CKEDITOR.config