This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ckeditor/t/1
Feature: Introduce Watchdog. Closes #1.
- Loading branch information
Showing
17 changed files
with
1,526 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Configurations to normalize the IDE behavior. | ||
# http://editorconfig.org/ | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
tab_width = 4 | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'ckeditor5' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
* text=auto | ||
|
||
*.htaccess eol=lf | ||
*.cgi eol=lf | ||
*.sh eol=lf | ||
|
||
*.css text | ||
*.htm text | ||
*.html text | ||
*.js text | ||
*.json text | ||
*.php text | ||
*.txt text | ||
*.md text | ||
|
||
*.png -text | ||
*.gif -text | ||
*.jpg -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### Suggested merge commit message ([convention](https://github.com/ckeditor/ckeditor5-design/wiki/Git-commit-message-convention)) | ||
|
||
Type: Message. Closes #000. | ||
|
||
--- | ||
|
||
### Additional information | ||
|
||
*For example – encountered issues, assumptions you had to make, other affected tickets, etc.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
sudo: required | ||
dist: trusty | ||
addons: | ||
chrome: stable | ||
firefox: latest | ||
language: node_js | ||
node_js: | ||
- '8' | ||
cache: | ||
yarn: true | ||
branches: | ||
except: | ||
- stable | ||
before_install: | ||
- export START_TIME=$( date +%s ) | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- npm i -g yarn | ||
install: | ||
- yarn add @ckeditor/ckeditor5-dev-tests | ||
- ckeditor5-dev-tests-install-dependencies | ||
script: | ||
- ckeditor5-dev-tests-travis | ||
after_success: | ||
- ckeditor5-dev-tests-save-revision | ||
after_script: | ||
- export END_TIME=$( date +%s ) | ||
- ckeditor5-dev-tests-notify-travis-status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Contributing | ||
======================================== | ||
|
||
See the [official contributors' guide to CKEditor 5](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html) to learn more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Software License Agreement | ||
========================== | ||
|
||
**CKEditor 5 watchdog feature** – https://github.com/ckeditor/ckeditor5-watchdog <br> | ||
Copyright (c) 2003-2019, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved. | ||
|
||
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). | ||
|
||
Sources of Intellectual Property Included in CKEditor | ||
----------------------------------------------------- | ||
|
||
Where not otherwise indicated, all CKEditor content is authored by CKSource engineers and consists of CKSource-owned intellectual property. In some specific instances, CKEditor will incorporate work done by developers outside of CKSource with their express permission. | ||
|
||
The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT): | ||
|
||
* Lo-Dash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/. | ||
|
||
Trademarks | ||
---------- | ||
|
||
**CKEditor** is a trademark of [CKSource](http://cksource.com) Frederico Knabben. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
CKEditor 5 watchdog | ||
CKEditor 5 watchdog feature | ||
======================================== | ||
|
||
[![Join the chat at https://gitter.im/ckeditor/ckeditor5](https://badges.gitter.im/ckeditor/ckeditor5.svg)](https://gitter.im/ckeditor/ckeditor5?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-watchdog.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-watchdog) | ||
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-watchdog.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-watchdog) | ||
[![BrowserStack Status](https://automate.browserstack.com/automate/badge.svg?badge_key=d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)](https://automate.browserstack.com/public-build/d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0) | ||
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5-watchdog/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-watchdog?branch=master) | ||
<br> | ||
[![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-watchdog/status.svg)](https://david-dm.org/ckeditor/ckeditor5-watchdog) | ||
[![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-watchdog/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-watchdog?type=dev) | ||
|
||
This package implements the watchdog feature for CKEditor 5. | ||
|
||
## Documentation | ||
|
||
See the [`@ckeditor/ckeditor5-watchdog` package](https://ckeditor.com/docs/ckeditor5/latest/api/watchdog.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/). | ||
|
||
## License | ||
|
||
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
category: api-reference | ||
--- | ||
|
||
# CKEditor 5 watchdog feature | ||
|
||
[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-watchdog.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-watchdog) | ||
|
||
This package implements the watchdog feature for CKEditor 5. | ||
|
||
## Documentation | ||
|
||
See the {@link features/watchdog Watchdog feature} guide and the {@link module:watchdog/watchdog~Watchdog} plugin documentation. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install --save @ckeditor/ckeditor5-watchdog | ||
``` | ||
|
||
## Contribute | ||
|
||
The source code of this package is available on GitHub in https://github.com/ckeditor/ckeditor5-watchdog. | ||
|
||
## External links | ||
|
||
* [`@ckeditor/ckeditor5-watchdog` on npm](https://www.npmjs.com/package/@ckeditor/ckeditor5-watchdog) | ||
* [`ckeditor/ckeditor5-watchdog` on GitHub](https://github.com/ckeditor/ckeditor5-watchdog) | ||
* [Issue tracker](https://github.com/ckeditor/ckeditor5-watchdog/issues) | ||
* [Changelog](https://github.com/ckeditor/ckeditor5-watchdog/blob/master/CHANGELOG.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Watchdog | ||
category: features | ||
--- | ||
|
||
# Watchdog | ||
|
||
The {@link module:watchdog/watchdog~Watchdog} feature allows you to create a wrapper for the editor that will ensure that the editor instance is running. If a {@link module:utils/ckeditorerror~CKEditorError `CKEditorError` error} is thrown by the editor, it tries to restart the editor to the state before the crash. All other errors are transparent to the watchdog. By looking at the error context, the Watchdog restarts only the editor which crashed. | ||
|
||
**Note**: The watchdog does not handle errors during editor initialization (`Editor.create()`) and editor destruction (`editor.destroy()`). Errors at these stages mean that there is a serious problem in the code integrating the editor and such problem cannot be easily fixed restarting the editor. | ||
|
||
**Note**: A new editor instance is created each time the watchdog is restarted. Thus the editor instance should not be kept internally. Use the `watchdog.editor` each time you need to access the editor. It also means that you should not execute any actions on `editor.create` because these actions will not be executed when the editor restarts. Use `watchdog.create` instead, add a plugin and add your code in the `plugin#init`, or listen on `watchdog#restart` to handle restarts. | ||
|
||
## Basic implementation | ||
|
||
```js | ||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import Watchdog from '@ckeditor/ckeditor5-watchdog/src/watchdog'; | ||
|
||
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials'; | ||
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; | ||
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold'; | ||
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic'; | ||
|
||
const watchdog = Watchdog.for( ClassicEditor ); | ||
|
||
watchdog.create( document.querySelector( '#editor' ), { | ||
plugins: [ Essentials, Paragraph, Bold, Italic ], | ||
toolbar: [ 'bold', 'italic', 'alignment' ] | ||
} ) | ||
.then( () => { | ||
const editor = watchdog.editor; | ||
} ); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"name": "@ckeditor/ckeditor5-watchdog", | ||
"version": "0.1.0", | ||
"description": "A watchdog feature for CKEditor 5 editors. It keeps a CKEditor 5 editor instance running", | ||
"keywords": [ | ||
"ckeditor", | ||
"ckeditor5", | ||
"ckeditor 5", | ||
"ckeditor5-lib" | ||
], | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-utils": "^12.1.1", | ||
"lodash-es": "^4.17.10" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-paragraph": "^11.0.2", | ||
"eslint": "^5.5.0", | ||
"eslint-config-ckeditor5": "^1.0.11", | ||
"husky": "^2.4.1", | ||
"lint-staged": "^8.2.1" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0", | ||
"npm": ">=5.7.1" | ||
}, | ||
"author": "CKSource (http://cksource.com/)", | ||
"license": "GPL-2.0-or-later", | ||
"homepage": "https://ckeditor.com/ckeditor-5", | ||
"bugs": "https://github.com/ckeditor/ckeditor5-utils/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ckeditor/ckeditor5-utils.git" | ||
}, | ||
"files": [ | ||
"lang", | ||
"src", | ||
"theme" | ||
], | ||
"scripts": { | ||
"lint": "eslint --quiet '**/*.js'" | ||
}, | ||
"lint-staged": { | ||
"**/*.js": [ | ||
"eslint --quiet" | ||
] | ||
}, | ||
"eslintIgnore": [ | ||
"src/lib/**", | ||
"packages/**" | ||
], | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} | ||
} |
Oops, something went wrong.