Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added boilerplate for emoji plugin #17384

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@ckeditor/ckeditor5-editor-decoupled": "43.3.0",
"@ckeditor/ckeditor5-editor-inline": "43.3.0",
"@ckeditor/ckeditor5-editor-multi-root": "43.3.0",
"@ckeditor/ckeditor5-emoji": "0.0.1",
"@ckeditor/ckeditor5-engine": "43.3.0",
"@ckeditor/ckeditor5-enter": "43.3.0",
"@ckeditor/ckeditor5-essentials": "43.3.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/ckeditor5-emoji/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changelog
=========

All changes in the package are documented in https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md.
4 changes: 4 additions & 0 deletions packages/ckeditor5-emoji/CONTRIBUTING.md
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/contributing/contributing.html) to learn more.
17 changes: 17 additions & 0 deletions packages/ckeditor5-emoji/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Software License Agreement
==========================

**CKEditor&nbsp;5 emoji feature** – https://github.com/ckeditor/ckeditor5-emoji <br>
Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) 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.

Trademarks
----------

**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
27 changes: 27 additions & 0 deletions packages/ckeditor5-emoji/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CKEditor&nbsp;5 emoji feature
=============================

[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-emoji.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-emoji)
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
[![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)

This package implements the emoji feature for CKEditor&nbsp;5.

## Demo

Check out the demo in the [emoji feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/emoji.html#demo).

## Documentation

See the [`@ckeditor/ckeditor5-emoji` package](https://ckeditor.com/docs/ckeditor5/latest/api/emoji.html) page as well as the [emoji feature](https://ckeditor.com/docs/ckeditor5/latest/features/emoji.html) guide in [CKEditor&nbsp;5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).

## Installation

```bash
npm install ckeditor5
```

## 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).

11 changes: 11 additions & 0 deletions packages/ckeditor5-emoji/ckeditor5-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": [
{
"name": "Emoji",
"className": "Emoji",
"description": "Allows for inserting emojis via a dropdown or by typing `:` followed by emoji name.",
"path": "src/emoji.js",
"docs": "features/emoji.html"
}
]
}
55 changes: 55 additions & 0 deletions packages/ckeditor5-emoji/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@ckeditor/ckeditor5-emoji",
"version": "0.0.1",
"description": "Emoji feature for CKEditor 5.",
"keywords": [
"ckeditor",
"ckeditor5",
"ckeditor 5",
"ckeditor5-feature",
"ckeditor5-plugin",
"ckeditor5-dll"
],
"type": "module",
"main": "src/index.ts",
"dependencies": {
"ckeditor5": "43.3.0",
"@ckeditor/ckeditor5-core": "43.3.0",
"@ckeditor/ckeditor5-typing": "43.3.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-dev-utils": "^45.0.0",
"@ckeditor/ckeditor5-editor-classic": "43.3.0",
"@ckeditor/ckeditor5-enter": "43.3.0",
"@ckeditor/ckeditor5-paragraph": "43.3.0",
"@ckeditor/ckeditor5-theme-lark": "43.3.0",
"@ckeditor/ckeditor5-undo": "43.3.0",
"typescript": "5.0.4",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4"
},
"author": "CKSource (http://cksource.com/)",
"license": "GPL-2.0-or-later",
"homepage": "https://ckeditor.com",
"bugs": "https://github.com/ckeditor/ckeditor5/issues",
"repository": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor5.git",
"directory": "packages/ckeditor5-emoji"
},
"files": [
"dist",
"lang",
"src/**/*.js",
"src/**/*.d.ts",
"theme",
"build",
"ckeditor5-metadata.json",
"CHANGELOG.md"
],
"scripts": {
"dll:build": "webpack",
"build": "tsc -p ./tsconfig.json",
"build:dist": "node ../../scripts/nim/build-package.mjs"
}
}
25 changes: 25 additions & 0 deletions packages/ckeditor5-emoji/src/augmentation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import type {
Emoji,
EmojiConfig
} from './index.js';

declare module '@ckeditor/ckeditor5-core' {
interface PluginsMap {
[Emoji.pluginName]: Emoji;
}

interface EditorConfig {

/**
* The configuration of the {@link module:emoji/emoji~Emoji} feature.
*
* Read more in {@link module:emoji/emojiconfig~EmojiConfig}.
*/
emoji?: EmojiConfig;
}
}
46 changes: 46 additions & 0 deletions packages/ckeditor5-emoji/src/emoji.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/**
* @module emoji/emoji
*/

import { Plugin } from 'ckeditor5/src/core.js';
import { Typing } from 'ckeditor5/src/typing.js';

import '../theme/emoji.css';

/**
* The emoji feature.
*/
export default class Emoji extends Plugin {
/**
* @inheritDoc
*/
public static get requires() {
return [ Typing ] as const;
}

/**
* @inheritDoc
*/
public static get pluginName() {
return 'Emoji' as const;
}

/**
* @inheritDoc
*/
public static override get isOfficialPlugin(): true {
return true;
}

/**
* @inheritDoc
*/
public init(): void {
console.log( 'Emoji plugin was initialized!' );
}
}
26 changes: 26 additions & 0 deletions packages/ckeditor5-emoji/src/emojiconfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/**
* @module emoji/emojiconfig
*/

/**
* The configuration of the emoji feature.
*
* Read more about {@glink features/emoji#configuration configuring the emoji feature}.
*
* ```ts
* ClassicEditor
* .create( editorElement, {
* emoji: ... // Emoji feature options.
* } )
* .then( ... )
* .catch( ... );
* ```
*
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
*/
export interface EmojiConfig {}
14 changes: 14 additions & 0 deletions packages/ckeditor5-emoji/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/**
* @module emoji
*/

export { default as Emoji } from './emoji.js';

export type { EmojiConfig } from './emojiconfig.js';

import './augmentation.js';
10 changes: 10 additions & 0 deletions packages/ckeditor5-emoji/tests/emoji.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

describe( 'Emoji', () => {
it( 'should pass tests', () => {
expect( true ).to.equal( true );
} );
} );
3 changes: 3 additions & 0 deletions packages/ckeditor5-emoji/tests/manual/emoji.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="editor">
<p>This is <a href="http://ckeditor.com">CKEditor5</a> from <a href="http://cksource.com">CKSource</a>.</p>
</div>
25 changes: 25 additions & 0 deletions packages/ckeditor5-emoji/tests/manual/emoji.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* globals console:false, window, document */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor.js';
import Enter from '@ckeditor/ckeditor5-enter/src/enter.js';
import Typing from '@ckeditor/ckeditor5-typing/src/typing.js';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph.js';
import Undo from '@ckeditor/ckeditor5-undo/src/undo.js';
import Emoji from '../../src/emoji.js';

ClassicEditor
.create( document.querySelector( '#editor' ), {
plugins: [ Typing, Paragraph, Undo, Enter, Emoji ],
toolbar: [ 'link', 'undo', 'redo' ]
} )
.then( editor => {
window.editor = editor;
} )
.catch( err => {
console.error( err.stack );
} );
5 changes: 5 additions & 0 deletions packages/ckeditor5-emoji/tests/manual/emoji.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## foo

### bar

1. baz
4 changes: 4 additions & 0 deletions packages/ckeditor5-emoji/theme/emoji.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
* Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
12 changes: 12 additions & 0 deletions packages/ckeditor5-emoji/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"
]
}
10 changes: 10 additions & 0 deletions packages/ckeditor5-emoji/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.release.json",
"include": [
"src",
"../../typings"
],
"exclude": [
"tests"
]
}
24 changes: 24 additions & 0 deletions packages/ckeditor5-emoji/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* eslint-env node */

import path from 'path';
import { fileURLToPath } from 'url';
import module from 'module';
import { builds } from '@ckeditor/ckeditor5-dev-utils';
import webpack from 'webpack';

const require = module.createRequire( import.meta.url );
const __filename = fileURLToPath( import.meta.url );
const __dirname = path.dirname( __filename );

export default builds.getDllPluginWebpackConfig( webpack, {
themePath: require.resolve( '@ckeditor/ckeditor5-theme-lark' ),
packagePath: __dirname,
manifestPath: require.resolve( 'ckeditor5/build/ckeditor5-dll.manifest.json' ),
isDevelopmentMode: process.argv.includes( '--mode=development' ),
tsconfigPath: require.resolve( 'ckeditor5/tsconfig.dll.json' )
} );
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export * from '@ckeditor/ckeditor5-editor-classic';
export * from '@ckeditor/ckeditor5-editor-decoupled';
export * from '@ckeditor/ckeditor5-editor-inline';
export * from '@ckeditor/ckeditor5-editor-multi-root';
export * from '@ckeditor/ckeditor5-emoji';
export * from '@ckeditor/ckeditor5-engine';
export * from '@ckeditor/ckeditor5-enter';
export * from '@ckeditor/ckeditor5-essentials';
Expand Down