Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into ck/epic/ime-typing
Browse files Browse the repository at this point in the history
  • Loading branch information
niegowski committed Apr 30, 2024
2 parents 5e6c2b3 + d45d3e0 commit 4e0b1cb
Show file tree
Hide file tree
Showing 185 changed files with 6,001 additions and 1,036 deletions.
8 changes: 8 additions & 0 deletions .circleci/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ jobs:
when: always
name: Execute Stylelint
command: yarn run stylelint
- run:
when: always
name: Check if all CSS files from the "ckeditor5-theme-lark" are imported in "index.css" file
command: yarn run check-theme-lark-imports
- run:
when: always
name: Check if all packages are exported in the "ckeditor5" package
command: yarn run check-exports

cke5_coverage:
machine: true
Expand Down
217 changes: 111 additions & 106 deletions CHANGELOG.md

Large diffs are not rendered by default.

Binary file modified docs/assets/img/favicons/16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/img/favicons/200x200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/img/favicons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/img/favicons/96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 35 additions & 2 deletions docs/installation/integrations/drupal-real-time-collaboration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ order: 90
modified_at: 2023-10-06
---

{@snippet installation/integrations/framework-integration}

# Real-time editing in Drupal

Drupal is a free and open-source web content management system (CMS) written in PHP. CKEditor 5 WYSIWYG rich text editor is the default editor module for Drupal. The [CKEditor 5 Premium Features module](https://www.drupal.org/project/ckeditor5_premium_features) provides instant integration of the real-time collaboration features with the editing platform.
Expand Down Expand Up @@ -69,3 +67,38 @@ Easily defined document and content {@link features/template templates} make con
## Installation and configuration

Refer to the [Adding CKEditor–5 Premium Features module to Drupal 10](https://www.drupal.org/docs/contributed-modules/ckeditor-5-premium-features/how-to-install-and-set-up-the-module) guide in the Drupal documentation for details on how to install and set up the module.

## CKEditor 5 Plugin Pack

The [CKEditor 5 Plugin Pack](https://www.drupal.org/project/ckeditor5_plugin_pack) is a free-to-use module that offers multiple CKEditor 5 plugins that are not available in the Drupal core, extending editor's functionality.

### Features available in the CKEditor 5 Plugin Pack module

* {@link features/indent Block indentation}
* {@link features/find-and-replace Find and replace}
* {@link features/font Fonts family, size and colors}
* {@link features/highlight Highlight}
* {@link features/text-transformation Text transformation}
* {@link features/todo-lists To-do lists}
* {@link features/word-count Word count}
* Free version of {@link features/spelling-and-grammar-checking WProofreader} – limitation of the free version are listed [on this page](https://www.drupal.org/docs/extending-drupal/contributed-modules/contributed-module-documentation/ckeditor-5-plugin-pack/wproofreader-free-vs-premium-feature-comparison)

Plugin Pack also makes it possible to use some of the premium features for free.

Currently available premium features:

* {@link features/template Templates}
* Full-screen mode

Detailed descriptions of each plugin can be found on the [CKEditor 5 Plugin Pack module page](https://www.drupal.org/project/ckeditor5_plugin_pack)

### Requirements

* PHP 8.0+
* Drupal 9/10 with CKEditor 5 enabled
* To-do list module requires Drupal 10.2+
* Templates module requires Drupal 10.3+

### Installation and configuration

Refer to the [Adding CKEditor 5 Plugin Pack module to Drupal 10](https://www.drupal.org/docs/extending-drupal/contributed-modules/contributed-module-documentation/ckeditor-5-plugin-pack/how-to-install-and-set-up-the-module) guide in the Drupal documentation for details on how to install and set up the module.
137 changes: 137 additions & 0 deletions docs/installation/integrations/react-multiroot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
menu-title: Multi-root integration
meta-title: React rich text editor component | CKEditor 5 documentation
category: react
order: 20
modified_at: 2024-04-25
---

{@snippet installation/integrations/framework-integration}

# React rich text multi-root editor hook

<p>
<a href="https://www.npmjs.com/package/@ckeditor/ckeditor5-react" target="_blank" rel="noopener">
<img src="https://badge.fury.io/js/%40ckeditor%2Fckeditor5-react.svg" alt="npm version" loading="lazy">
</a>
</p>

This page focuses on describing the usage of the multi-root editor in React applications. If you would like to use a different type of editor, you can find more information {@link installation/integrations/react here}.

The easiest way to use multi-root CKEditor&nbsp;5 in your React application is by using the {@link installation/getting-started/predefined-builds#multi-root-editor multi-root rich text editor build}.

<info-box hint>
The multi-root editors in React is supported since version 6.2.0 of this package.

Unlike the {@link installation/integrations/react default integration}, in the multi-root editor we prepared the integration based on the hooks and new React mechanisms.
</info-box>

## Quick start

This guide assumes you already have a React project. If you want to create a new one, you can use the [`create-react-app`](https://create-react-app.dev/) CLI. It allows you to create and customize your project with templates. For example, you can set up your project with TypeScript support.

Install the [CKEditor&nbsp;5 WYSIWYG editor package for React](https://www.npmjs.com/package/@ckeditor/ckeditor5-react) and the {@link installation/getting-started/predefined-builds#multi-root-editor multi-root editor build}. Assuming that you picked [`@ckeditor/ckeditor5-build-multi-root`](https://www.npmjs.com/package/@ckeditor/ckeditor5-build-multi-root):

```bash
npm install --save @ckeditor/ckeditor5-react @ckeditor/ckeditor5-build-multi-root
```

Use the `useMultiRootEditor` hook inside your project:

```tsx
// App.jsx / App.tsx

import React from 'react';
import { useMultiRootEditor } from '@ckeditor/ckeditor5-react';
import MultiRootEditor from '@ckeditor/ckeditor5-build-multi-root';

const App = () => {
const editorProps = {
editor: MultiRootEditor,
data: {
intro: '<h1>React multi-root editor</h1>',
content: '<p>Hello from CKEditor&nbsp;5 multi-root!</p>'
},
config: {
// your editor config
}
};

const {
editor, toolbarElement, editableElements,
data, setData,
attributes, setAttributes
} = useMultiRootEditor( editorProps );

return (
<div className="App">
<h2>Using CKEditor&nbsp;5 multi-root build in React</h2>

{ toolbarElement }

{ editableElements }
</div>
);
}

export default App;
```

## Hook properties

The `useMultiRootEditor` hook supports the following properties:

* `editor: MultiRootEditor` (required) &ndash; The {@link module:editor-multi-root/multirooteditor~MultiRootEditor `MultiRootEditor`} constructor to use.
* `data: Object` &ndash; The initial data for the created editor. See the {@link installation/getting-started/getting-and-setting-data Getting and setting data} guide.
* `rootsAttributes: Object` &ndash; The initial roots attributes for the created editor.
* `config: Object` &ndash; The editor configuration. See the {@link installation/getting-started/configuration Configuration} guide.
* `disabled: Boolean` &ndash; The {@link module:editor-multi-root/multirooteditor~MultiRootEditor `MultiRootEditor`} is being switched to read-only mode if the property is set to `true`.
* `disableWatchdog: Boolean` &ndash; If set to `true`, {@link features/watchdog the watchdog feature} will be disabled. It is set to `false` by default.
* `watchdogConfig: WatchdogConfig` &ndash; {@link module:watchdog/watchdog~WatchdogConfig Configuration object} for the [watchdog feature](https://ckeditor.com/docs/ckeditor5/latest/features/watchdog.html).
* `isLayoutReady: Boolean` &ndash; A property that delays the editor creation when set to `false`. It starts the initialization of the multi-root editor when sets to `true`. Useful when the CKEditor&nbsp;5 annotations or a presence list are used.
* `disableTwoWayDataBinding: Boolean` &ndash; Allows disabling the two-way data binding mechanism between the editor state and `data` object to improve editor efficiency. The default value is `false`.
* `onReady: Function` &ndash; It is called when the editor is ready with a {@link module:editor-multi-root/multirooteditor~MultiRootEditor `MultiRootEditor`} instance. This callback is also called after the reinitialization of the component if an error occurred.
* `onChange: Function` &ndash; It is called when the editor data has changed. See the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`} event.
* `onBlur: Function` &ndash; It is called when the editor was blurred. See the {@link module:engine/view/document~Document#event:blur `editor.editing.view.document#blur`} event.
* `onFocus: Function` &ndash; It is called when the editor was focused. See the {@link module:engine/view/document~Document#event:focus `editor.editing.view.document#focus`} event.
* `onError: Function` &ndash; It is called when the editor has crashed during the initialization or during the runtime. It receives two arguments: the error instance and the error details.
Error details is an object that contains two properties:
* `phase: 'initialization'|'runtime'` &ndash; Informs when the error has occurred (during the editor or context initialization, or after the initialization).
* `willEditorRestart: Boolean` &ndash; When `true`, it means that the editor component will restart itself.

The editor event callbacks (`onChange`, `onBlur`, `onFocus`) receive two arguments:

1. An {@link module:utils/eventinfo~EventInfo `EventInfo`} object.
2. An {@link module:editor-multi-root/multirooteditor~MultiRootEditor `MultiRootEditor`} instance.

## Hook values

The `useMultiRootEditor` hook returns the following values:

* `editor` &ndash; The instance of created editor.
* `toolbarElement` &ndash; `ReactElement` that contains the toolbar. It could be rendered anywhere in the application.
* `editableElements` &ndash; An array of `ReactElements` that describes the editor's roots. This array is updated after detaching an existing root or adding a new root.
* `data` &ndash; The current state of the editor's data. It is updated after each editor update. Note that you should not use it if you disabled two-way binding by passing the `disableTwoWayDataBinding` property.
* `setData` &ndash; The function used for updating the editor's data.
* `attributes` &ndash; The current state of the editor's attributes. It is updated after each editor attributes update. Note that you should not use it if you disabled two-way binding by passing the `disableTwoWayDataBinding` property.
* `setAttributes` &ndash; The function used for updating the editor's attributes.

## Context feature

The `useMultiRootEditor` hook also supports the {@link features/context-and-collaboration-features context feature}, as described in the main {@link installation/integrations/react#context-feature React integration} guide.

However, as the multi-root editor addresses most use cases of the context feature, consider if you need to employ it.

## Two-way data binding

By default, the two-way data binding is enabled. It means that every change done in the editor is automatically applied in the `data` object returned from the `useMultiRootEditor` hook. Additionally, if you want to change or set data in the editor, you can simply use `setData` method provided by the hook. It works the same way in case of attributes &ndash; the hook provides the `attributes` object and the `setAttributes` method to update them. It ensures that if you want to use or save the state of the editor, these objects are always up-to-date.

<info-box>
Two-way data binding may lead to performance issues with large editor content. In such cases, it is recommended to disable it by setting the `disableTwoWayDataBinding` property to `true` when using the `useMultiRootEditor` hook. When this is disabled, you will need to handle data synchronization manually if it is needed.

The recommended approach for achieving this is based on utilizing the {@link features/autosave autosave plugin}. The second approach involves providing the `onChange` callback, which is called on each editor update.
</info-box>

## Contributing and reporting issues

The source code of rich text editor component for React is available on GitHub in [https://github.com/ckeditor/ckeditor5-react](https://github.com/ckeditor/ckeditor5-react).
6 changes: 3 additions & 3 deletions docs/installation/integrations/react.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
menu-title: React
menu-title: Default integration
meta-title: React rich text editor component | CKEditor 5 documentation
category: integrations
order: 30
category: react
order: 10
---

{@snippet installation/integrations/framework-integration}
Expand Down
11 changes: 10 additions & 1 deletion docs/umberto.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
"installation/getting-started/quick-start.html#creating-custom-builds-with-online-builder": "installation/getting-started/quick-start-other.html#creating-custom-builds-with-online-builder",
"installation/overview.html": "installation/index.html",
"installation/getting-started/configuration.html#adding-simple-standalone-features": "installation/getting-started/extending-features.html",
"installation/integrations/react.html": "installation/integrations/react/react.html",
"support/getting-support.html": "support/index.html",
"support/versioning-policy.html": "updating/versioning-policy.html",
"support/license-and-legal.html": "support/licensing/license-and-legal.html",
Expand Down Expand Up @@ -382,7 +383,15 @@
"name": "Integrations",
"id": "integrations",
"slug": "integrations",
"order": 30
"order": 30,
"categories": [
{
"name": "React",
"id": "react",
"slug": "react",
"order": 30
}
]
},
{
"name": "Advanced concepts",
Expand Down
37 changes: 23 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,18 @@
"@ckeditor/ckeditor5-ai": "41.3.1",
"@ckeditor/ckeditor5-case-change": "41.3.1",
"@ckeditor/ckeditor5-comments": "41.3.1",
"@ckeditor/ckeditor5-dev-bump-year": "^39.0.0",
"@ckeditor/ckeditor5-dev-ci": "^39.0.0",
"@ckeditor/ckeditor5-dev-dependency-checker": "^39.0.0",
"@ckeditor/ckeditor5-dev-docs": "^39.0.0",
"@ckeditor/ckeditor5-dev-release-tools": "^39.0.0",
"@ckeditor/ckeditor5-dev-stale-bot": "^39.0.0",
"@ckeditor/ckeditor5-dev-tests": "^39.0.0",
"@ckeditor/ckeditor5-dev-transifex": "^39.0.0",
"@ckeditor/ckeditor5-dev-translations": "^39.0.0",
"@ckeditor/ckeditor5-dev-utils": "^39.0.0",
"@ckeditor/ckeditor5-dev-web-crawler": "^39.0.0",
"@ckeditor/ckeditor5-dev-build-tools": "^39.7.0",
"@ckeditor/ckeditor5-dev-bump-year": "^39.7.0",
"@ckeditor/ckeditor5-dev-ci": "^39.7.0",
"@ckeditor/ckeditor5-dev-dependency-checker": "^39.7.0",
"@ckeditor/ckeditor5-dev-docs": "^39.7.0",
"@ckeditor/ckeditor5-dev-release-tools": "^39.7.0",
"@ckeditor/ckeditor5-dev-stale-bot": "^39.7.0",
"@ckeditor/ckeditor5-dev-tests": "^39.7.0",
"@ckeditor/ckeditor5-dev-transifex": "^39.7.0",
"@ckeditor/ckeditor5-dev-translations": "^39.7.0",
"@ckeditor/ckeditor5-dev-utils": "^39.7.0",
"@ckeditor/ckeditor5-dev-web-crawler": "^39.7.0",
"@ckeditor/ckeditor5-document-outline": "41.3.1",
"@ckeditor/ckeditor5-export-pdf": "41.3.1",
"@ckeditor/ckeditor5-export-word": "41.3.1",
Expand All @@ -120,13 +121,16 @@
"@ocular-d/vale-bin": "^2.29.1",
"@webspellchecker/wproofreader-ckeditor5": "^2.0.1",
"@wiris/mathtype-ckeditor5": "^7.24.0",
"acorn": "^8.11.3",
"assert": "^2.0.0",
"babel-standalone": "^6.26.0",
"chalk": "^4.1.0",
"ckeditor5-premium-features": "0.0.1",
"coveralls": "^3.1.0",
"date-fns": "^2.30.0",
"eslint": "^7.19.0",
"eslint-config-ckeditor5": "^5.3.0",
"estree-walker": "^3.0.3",
"fs-extra": "^11.1.1",
"glob": "^10.2.5",
"http-server": "^14.1.1",
Expand Down Expand Up @@ -172,7 +176,7 @@
},
"scripts": {
"postinstall": "node ./scripts/postinstall.js",
"lint": "eslint --quiet \"**/*.{js,ts}\" --format ./scripts/eslint-formatter.js",
"lint": "eslint --quiet \"**/*.{js,ts,mjs}\" --format ./scripts/eslint-formatter.js",
"stylelint": "stylelint --quiet --allow-empty-input \"packages/**/*.css\" \"docs/**/*.css\"",
"test": "node --max_old_space_size=4096 node_modules/@ckeditor/ckeditor5-dev-tests/bin/testautomated.js",
"manual": "node --max_old_space_size=8192 node_modules/@ckeditor/ckeditor5-dev-tests/bin/testmanual.js",
Expand All @@ -192,6 +196,7 @@
"translations:download": "node ./scripts/translations/download.js",
"translations:upload": "node ./scripts/translations/upload.js",
"build": "tsc -p ./tsconfig.release-ckeditor5.json",
"build:dist": "node ./scripts/build-ckeditor5.mjs",
"predll:build": "npm run build",
"dll:build": "node ./scripts/dll/build-dlls.js --base-dll-config ./scripts/dll/webpack.config.dll.js",
"changelog": "node ./scripts/release/changelog.js",
Expand All @@ -203,10 +208,12 @@
"clean-up-svg-icons": "node ./scripts/clean-up-svg-icons.js",
"collect-svg-icons": "node scripts/collect-svg-icons.js",
"check-dependencies": "ckeditor5-dev-dependency-checker",
"check-dependencies:versions-match": "node ./scripts/ci/check-dependencies-versions-match.js"
"check-dependencies:versions-match": "node ./scripts/ci/check-dependencies-versions-match.js",
"check-theme-lark-imports": "node ./scripts/check-theme-lark-imports.js",
"check-exports": "node ./scripts/check-exports.mjs --input=ckeditor5"
},
"lint-staged": {
"**/*.{js,ts}": [
"**/*.{js,ts,mjs}": [
"eslint --quiet"
],
"**/*.css": [
Expand All @@ -218,8 +225,10 @@
},
"eslintIgnore": [
"build/**",
"dist/**",
"packages/*/node_modules/**",
"packages/*/build/**",
"packages/*/dist/**",
"packages/*/src/lib/**",
"coverage/**",
"external/**"
Expand Down
6 changes: 4 additions & 2 deletions packages/ckeditor5-adapter-ckfinder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@ckeditor/ckeditor5-basic-styles": "41.3.1",
"@ckeditor/ckeditor5-core": "41.3.1",
"@ckeditor/ckeditor5-clipboard": "41.3.1",
"@ckeditor/ckeditor5-dev-utils": "^39.0.0",
"@ckeditor/ckeditor5-dev-utils": "^39.7.0",
"@ckeditor/ckeditor5-editor-classic": "41.3.1",
"@ckeditor/ckeditor5-enter": "41.3.1",
"@ckeditor/ckeditor5-heading": "41.3.1",
Expand All @@ -44,6 +44,7 @@
"directory": "packages/ckeditor5-adapter-ckfinder"
},
"files": [
"dist",
"lang",
"src/**/*.js",
"src/**/*.d.ts",
Expand All @@ -54,6 +55,7 @@
],
"scripts": {
"dll:build": "webpack",
"build": "tsc -p ./tsconfig.json"
"build": "tsc -p ./tsconfig.json",
"build:dist": "node ../../scripts/build-package.mjs"
}
}
12 changes: 12 additions & 0 deletions packages/ckeditor5-adapter-ckfinder/tsconfig.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.dist.json",
"compilerOptions": {
"rootDir": "src",
"types": [
"../../typings/types"
]
},
"include": [
"src"
]
}
6 changes: 4 additions & 2 deletions packages/ckeditor5-alignment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"@ckeditor/ckeditor5-block-quote": "41.3.1",
"@ckeditor/ckeditor5-core": "41.3.1",
"@ckeditor/ckeditor5-dev-utils": "^39.0.0",
"@ckeditor/ckeditor5-dev-utils": "^39.7.0",
"@ckeditor/ckeditor5-editor-classic": "41.3.1",
"@ckeditor/ckeditor5-engine": "41.3.1",
"@ckeditor/ckeditor5-enter": "41.3.1",
Expand All @@ -42,6 +42,7 @@
"directory": "packages/ckeditor5-alignment"
},
"files": [
"dist",
"lang",
"src/**/*.js",
"src/**/*.d.ts",
Expand All @@ -52,6 +53,7 @@
],
"scripts": {
"dll:build": "webpack",
"build": "tsc -p ./tsconfig.json"
"build": "tsc -p ./tsconfig.json",
"build:dist": "node ../../scripts/build-package.mjs"
}
}
Loading

0 comments on commit 4e0b1cb

Please sign in to comment.