Skip to content

Commit a2538e6

Browse files
committed
Merge remote-tracking branch 'origin/6.0' into 6.0
2 parents 7bb60dc + 7c899cc commit a2538e6

18 files changed

+126
-38
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# CKEditor 5 - JavaScript API
2+
3+
WoltLab Suite 6.0 ships with a customized version of CKEditor 5 that is enriched by multiple plugins to integrate into the framework.
4+
The editor can be accessed through an abstraction layer and event system to interact with basic functionality and to alter its initialization process.
5+
6+
## The `Ckeditor` API
7+
8+
The `WoltLabSuite/Core/Component/Ckeditor` API offers multiple helper methods to interface with CKEditor and to insert and extract content.
9+
You can get access to the instance using the `getCkeditor()` and `getCkeditorById()` methods once the editor has been initialized.
10+
11+
Please refer to the typings of this component to learn about its API methods.
12+
13+
## The Event System for CKEditor 5
14+
15+
The event system of CKEditor 5 was designed for actions from within the editor but not to interface with the “outside world”.
16+
In order to provide a deeper integration there is `WoltLabSuite/Core/Component/Ckeditor/Event` and its exported function `listenToCkeditor()`.
17+
18+
`listenToCkeditor()` expects the source element of the editor which usually is the `<textarea>` for the content.
19+
There is also `dispatchToCkeditor()` which is considered to be an internal API used from within the editor.
20+
21+
### Lifecycle of CKEditor 5
22+
23+
The initialization of any CKEditor 5 instance is asynchronous and goes through multiple steps to collect the data needed to initialize the editor.
24+
25+
1. `setupFeatures()` is an override to disable the available features of this instance. The list of features becomes immutable after this event.
26+
2. `setupConfiguration()` is called at the end of the configuration phase and allows changes to the `EditorConfig` before it is passed to CKEditor.
27+
3. The `ready()` is fired as soon as the editor has been fully initialized and provides the `Ckeditor` object to access the editor.
28+
4. `collectMetaData()` is used in inline editors to request the injection of additional payloads that should be included in the server request.
29+
5. `reset()` notifies that the editor is being fully reset and reliant components should perform a reset themselves.
30+
6. `destroy()` signals that the editor has been destroyed and is no longer available.
31+
32+
### Custom BBCode Buttons in the Editor Toolbar
33+
34+
Custom buttons in the editor can be injected by pushing them to the toolbar in `setupConfiguration()`.
35+
This is implicitly takes place for buttons that are registered through the BBCode system and are set to appear in the editor.
36+
37+
```ts
38+
listenToCkeditor(element).setupConfiguration(({ configuration }) => {
39+
configuration.woltlabBbcode.push({
40+
icon: "fire;false",
41+
name: "foo",
42+
label: "Button label for foo",
43+
});
44+
});
45+
```
46+
47+
Clicks on the buttons are forwarded through the `bbcode()` event.
48+
The only data passed to the callback is the name of the BBCode that was invoked.
49+
50+
The default action of the custom buttons is to insert the BBCode into the editor, including the ability to wrap the selected text in the BBCode tags.
51+
Every event listener registered to this event MUST return a boolean to indicate if it wants to suppress the insertion of the text BBCode, for example to open a dialog or trigger another action.
52+
53+
```ts
54+
listenToCkeditor(element).ready(({ ckeditor }) => {
55+
listenToCkeditor(element).bbcode(({ bbcode }) => {
56+
if (bbcode !== "foo") {
57+
return false;
58+
}
59+
60+
// Do something when the button for `foo` was clicked.
61+
62+
return true;
63+
});
64+
});
65+
```
66+
67+
### Submit the Editor on Enter
68+
69+
The editor supports the special feature flag `submitOnEnter` that can be enabled through `setupFeatures()`.
70+
Once enabled it changes the behavior of the Enter key to signal that the contents should be submitted to the server.
71+
72+
```ts
73+
listenToCkeditor(element).setupFeatures(({ features }) => {
74+
features.submitOnEnter = true;
75+
});
76+
```
77+
78+
You can subscribe to the `submitOnEnter()` to be notified when the Enter key was pressed and the editor is not empty.
79+
The contents of the editor is provided through the `html` key.
80+
81+
This mode does not suppress the insertion of hard breaks through Shift + Enter.
82+
83+
```ts
84+
listenToCkeditor(element).submitOnEnter(({ ckeditor, html }) => {
85+
// Do something with the resulting `html`.
86+
});
87+
```

docs/javascript/components_confirmation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ You can exclude extra information or form elements in confirmation dialogs, but
88
## Example
99

1010
```ts
11+
import { confirmationFactory } from "WoltLabSuite/Core/Component/Confirmation";
12+
1113
const result = await confirmationFactory()
1214
.custom("Do you want a cookie?")
1315
.withoutMessage();

docs/javascript/components_dialog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Dialogs may contain just an explanation or extra information that should be pres
2121
The dialog can be closed via the “X” button or by clicking the modal backdrop.
2222

2323
```ts
24+
import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
25+
2426
const dialog = dialogFactory().fromHtml("<p>Hello World</p>").withoutControls();
2527
dialog.show("Greetings from my dialog");
2628
```
@@ -43,6 +45,8 @@ An alert will only provide a single button to acknowledge the dialog and must no
4345
The dialog itself will be limited to a width of 500px, the title can wrap into multiple lines and there will be no “X” button to close the dialog.
4446

4547
```ts
48+
import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
49+
4650
const dialog = dialogFactory()
4751
.fromHtml("<p>ERROR: Something went wrong!</p>")
4852
.asAlert();
@@ -106,6 +110,8 @@ A possible use case for an “extra” button would be a dialog that includes an
106110
```
107111

108112
```ts
113+
import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
114+
109115
document.getElementById("showMyDialog")!.addEventListener("click", () => {
110116
const dialog = dialogFactory().fromId("myDialog").asPrompt();
111117

docs/migration/wsc54/php.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ See [WoltLab/WCF#4356](https://github.com/WoltLab/WCF/pull/4356) for details.
244244

245245
[WoltLab/WCF#4275](https://github.com/WoltLab/WCF/pull/4275) added support for embedded objects like mentions for comments and comment responses.
246246
To properly render embedded objects whenever you are using comments in your packages, you have to use `ViewableCommentList`/`ViewableCommentResponseList` in these places or `ViewableCommentRuntimeCache`/`ViewableCommentResponseRuntimeCache`.
247-
While these runtime caches are only available since version 5.5, the viewable list classes have always been available so that changing `CommentList` to `ViewableCommentList`, for example, is a backwards-compatible change.
248247

249248
## Emails
250249

docs/migration/wsc55/deprecations_removals.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ With version 6.0, we have deprecated certain components and removed several othe
268268
- `WCF.Date.Util` ([WoltLab/WCF#4945](https://github.com/WoltLab/WCF/pull/4945))
269269
- `WCF.Dropdown.Interactive.Handler` ([WoltLab/WCF#4944](https://github.com/WoltLab/WCF/pull/4944))
270270
- `WCF.Dropdown.Interactive.Instance` ([WoltLab/WCF#4944](https://github.com/WoltLab/WCF/pull/4944))
271+
- `WCF.Label.ACPList`
271272
- `WCF.Message.Share.Page` ([WoltLab/WCF#4945](https://github.com/WoltLab/WCF/pull/4945))
272273
- `WCF.Message.Smilies` ([WoltLab/WCF#4945](https://github.com/WoltLab/WCF/pull/4945))
273274
- `WCF.ModeratedUserGroup.AddMembers`
@@ -280,7 +281,9 @@ With version 6.0, we have deprecated certain components and removed several othe
280281
- `WCF.System.PageNavigation` ([WoltLab/WCF#4945](https://github.com/WoltLab/WCF/pull/4945))
281282
- `WCF.Template` ([WoltLab/WCF#5070](https://github.com/WoltLab/WCF/pull/5070))
282283
- `WCF.ToggleOptions` ([WoltLab/WCF#4945](https://github.com/WoltLab/WCF/pull/4945))
284+
- `WCF.User.LikeLoader`
283285
- `WCF.User.Panel.Abstract` ([WoltLab/WCF#4944](https://github.com/WoltLab/WCF/pull/4944))
286+
- `WCF.User.ProfilePreview`
284287
- `WCF.User.Registration.Validation.Password` ([WoltLab/WCF#5244](https://github.com/WoltLab/WCF/pull/5244))
285288
- `window.shuffle()` ([WoltLab/WCF#4945](https://github.com/WoltLab/WCF/pull/4945))
286289
- `WSC_API_VERSION` ([WoltLab/WCF#4943](https://github.com/WoltLab/WCF/pull/4943))

docs/migration/wsc55/libraries.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Symfony PHP Polyfills
44

55
The Symfony Polyfills for 7.3, 7.4, and 8.0 were removed, as the minimum PHP version was increased to PHP 8.1.
6-
The Polyfill for PHP 8.2 was added.
6+
The Polyfills for PHP 8.2 and PHP 8.3 were added.
77

88
Refer to the documentation within the [symfony/polyfill](https://github.com/symfony/polyfill/) repository for details.
99

@@ -18,7 +18,7 @@ Diactoros was updated from version 2.4 to 3.0.
1818

1919
## Input Validation
2020

21-
WoltLab Suite 6.0 ships with cuyz/valinor 1.4 as a reliable solution to validate untrusted external input values.
21+
WoltLab Suite 6.0 ships with cuyz/valinor 1.6 as a reliable solution to validate untrusted external input values.
2222

2323
Refer to the documentation within the [CuyZ/Valinor](https://github.com/CuyZ/Valinor) repository for details.
2424

docs/package/pip/acp-template-delete.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# ACP Template Delete Package Installation Plugin
22

3-
!!! info "Available since WoltLab Suite 5.5."
4-
53
Deletes admin panel templates installed with the [acpTemplate](acp-template.md) package installation plugin.
64

75
!!! warning "You cannot delete acp templates provided by other packages."

docs/package/pip/database.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Database Package Installation Plugin
22

3-
!!! info "Available since WoltLab Suite 5.4."
4-
53
Update the database layout using [the PHP API](../database-php-api.md).
64

75
!!! warning "You must install the PHP script through the [file package installation plugin](file.md)."

docs/package/pip/event-listener.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@ If the nice value of two event listeners is equal, they are sorted by the listen
4848

4949
### `<options>`
5050

51+
!!! info "The use of `<options>` has been deprecated in WoltLab Suite 6.0. Use a regular `{if}` statement in the template instead."
52+
5153
The options element can contain a comma-separated list of options of which at least one needs to be enabled for the event listener to be executed.
5254

5355
### `<permissions>`
5456

57+
!!! info "The use of `<permissions>` has been deprecated in WoltLab Suite 6.0. Use a regular `{if}` statement in the template instead."
58+
5559
The permissions element can contain a comma-separated list of permissions of which the active user needs to have at least one for the event listener to be executed.
5660

5761

docs/package/pip/file-delete.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# File Delete Package Installation Plugin
22

3-
!!! info "Available since WoltLab Suite 5.5."
4-
53
Deletes files installed with the [file](file.md) package installation plugin.
64

75
!!! warning "You cannot delete files provided by other packages."

0 commit comments

Comments
 (0)