浏览代码

Merge branch 'master' into t/4

# Conflicts:
#	package.json
Maciej Gołaszewski 6 年之前
父节点
当前提交
4f3f4381ae

+ 1 - 1
packages/ckeditor5-mention/.github/PULL_REQUEST_TEMPLATE.md

@@ -1,6 +1,6 @@
 ### Suggested merge commit message ([convention](https://github.com/ckeditor/ckeditor5-design/wiki/Git-commit-message-convention))
 
-Type: Message. Closes #000.
+Type: Message. Closes ckeditor/ckeditor5#000.
 
 ---
 

+ 3 - 0
packages/ckeditor5-mention/.stylelintrc

@@ -0,0 +1,3 @@
+{
+	"extends": "stylelint-config-ckeditor5"
+}

+ 3 - 3
packages/ckeditor5-mention/.travis.yml

@@ -1,9 +1,11 @@
 sudo: required
-dist: trusty
+dist: xenial
 addons:
   chrome: stable
   firefox: latest
 language: node_js
+services:
+- xvfb
 node_js:
 - '8'
 cache:
@@ -13,8 +15,6 @@ branches:
   - 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

+ 14 - 0
packages/ckeditor5-mention/CHANGELOG.md

@@ -1,6 +1,20 @@
 Changelog
 =========
 
+## [16.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v15.0.0...v16.0.0) (2019-12-04)
+
+Internal changes only (updated dependencies, documentation, etc.).
+
+
+## [15.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v13.0.0...v15.0.0) (2019-10-23)
+
+### Other changes
+
+* Bind the `feed` callback function to the editor instance. ([0ba40a9](https://github.com/ckeditor/ckeditor5-mention/commit/0ba40a9))
+
+  Thanks [@oliverguenther](https://github.com/oliverguenther) for the contribution!
+
+
 ## [13.0.0](https://github.com/ckeditor/ckeditor5-mention/compare/v12.0.1...v13.0.0) (2019-08-26)
 
 ### Other changes

+ 0 - 1
packages/ckeditor5-mention/README.md

@@ -1,7 +1,6 @@
 CKEditor 5 mention 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-mention.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-mention)
 [![Build Status](https://travis-ci.org/ckeditor/ckeditor5-mention.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-mention)
 [![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5-mention/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-mention?branch=master)

+ 1 - 1
packages/ckeditor5-mention/docs/api/mention.md

@@ -30,5 +30,5 @@ The source code of this package is available on GitHub in https://github.com/cke
 
 * [`@ckeditor/ckeditor5-mention` on npm](https://www.npmjs.com/package/@ckeditor/ckeditor5-mention)
 * [`ckeditor/ckeditor5-mention` on GitHub](https://github.com/ckeditor/ckeditor5-mention)
-* [Issue tracker](https://github.com/ckeditor/ckeditor5-mention/issues)
+* [Issue tracker](https://github.com/ckeditor/ckeditor5/issues)
 * [Changelog](https://github.com/ckeditor/ckeditor5-mention/blob/master/CHANGELOG.md)

+ 7 - 2
packages/ckeditor5-mention/docs/examples/chat-with-mentions.md

@@ -184,14 +184,19 @@ The HTML code of the application is listed below:
 JavaScript code required to run the editor:
 
 ```js
-import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
+import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
+import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
 import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough';
 import Mention from '@ckeditor/ckeditor5-mention/src/mention';
+import Link from '@ckeditor/ckeditor5-link/src/link';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 
 ClassicEditor
 	.create( document.querySelector( '.chat__editor' ), {
-		extraPlugins: [ Mention, MentionLinks, Underline, Strikethrough ],
+		extraPlugins: [ Essentials, Paragraph, Mention, MentionLinks, Bold, Italic, Underline, Strikethrough, Link ],
 		toolbar: {
 			items: [
 				'bold', 'italic', 'underline', 'strikethrough', '|', 'link', '|', 'undo', 'redo'

+ 1 - 1
packages/ckeditor5-mention/docs/features/mentions.md

@@ -406,7 +406,7 @@ function customItemRenderer( item ) {
 
 #### Using CSS variables
 
-The mention feature is using the power of [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) which are defined in the [Lark theme stylesheet](https://github.com/ckeditor/ckeditor5-theme-lark/blob/master/theme/ckeditor5-mention/mentionediting.css). Thanks to that, mention styles can be {@link framework/guides/theme-customization easily customized}:
+The mention feature is using the power of [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) which are defined in the [Lark theme stylesheet](https://github.com/ckeditor/ckeditor5-theme-lark/blob/master/theme/ckeditor5-mention/mention.css). Thanks to that, mention styles can be {@link framework/guides/theme-customization easily customized}:
 
 ```css
 :root {

+ 24 - 18
packages/ckeditor5-mention/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@ckeditor/ckeditor5-mention",
-  "version": "13.0.0",
+  "version": "16.0.0",
   "description": "Mention feature for CKEditor 5.",
   "keywords": [
     "ckeditor",
@@ -10,29 +10,31 @@
     "ckeditor5-plugin"
   ],
   "dependencies": {
-    "@ckeditor/ckeditor5-core": "^12.3.0",
-    "@ckeditor/ckeditor5-ui": "^14.0.0",
-    "@ckeditor/ckeditor5-typing": "^12.2.0",
-    "@ckeditor/ckeditor5-utils": "^14.0.0",
+    "@ckeditor/ckeditor5-core": "^16.0.0",
+    "@ckeditor/ckeditor5-ui": "^16.0.0",
+    "@ckeditor/ckeditor5-typing": "^16.0.0",
+    "@ckeditor/ckeditor5-utils": "^16.0.0",
     "lodash-es": "^4.17.10"
   },
   "devDependencies": {
-    "@ckeditor/ckeditor5-basic-styles": "^11.1.4",
-    "@ckeditor/ckeditor5-block-quote": "^11.1.3",
-    "@ckeditor/ckeditor5-clipboard": "^12.0.2",
-    "@ckeditor/ckeditor5-editor-classic": "^12.1.4",
-    "@ckeditor/ckeditor5-engine": "^14.0.0",
-    "@ckeditor/ckeditor5-font": "^11.2.2",
-    "@ckeditor/ckeditor5-link": "^11.1.2",
-    "@ckeditor/ckeditor5-paragraph": "^11.0.5",
-    "@ckeditor/ckeditor5-table": "^14.0.0",
-    "@ckeditor/ckeditor5-undo": "^11.0.5",
-    "@ckeditor/ckeditor5-widget": "^11.1.0",
+    "@ckeditor/ckeditor5-basic-styles": "^16.0.0",
+    "@ckeditor/ckeditor5-block-quote": "^16.0.0",
+    "@ckeditor/ckeditor5-clipboard": "^16.0.0",
+    "@ckeditor/ckeditor5-editor-classic": "^16.0.0",
+    "@ckeditor/ckeditor5-engine": "^16.0.0",
+    "@ckeditor/ckeditor5-font": "^16.0.0",
+    "@ckeditor/ckeditor5-link": "^16.0.0",
+    "@ckeditor/ckeditor5-paragraph": "^16.0.0",
+    "@ckeditor/ckeditor5-table": "^16.0.0",
+    "@ckeditor/ckeditor5-undo": "^16.0.0",
+    "@ckeditor/ckeditor5-widget": "^16.0.0",
     "eslint": "^5.5.0",
     "eslint-config-ckeditor5": "^2.0.0",
     "husky": "^1.3.1",
     "lint-staged": "^7.0.0",
-    "lodash": "^4.17.11"
+    "lodash": "^4.17.11",
+    "stylelint": "^11.1.1",
+    "stylelint-config-ckeditor5": "^1.0.0"
   },
   "engines": {
     "node": ">=8.0.0",
@@ -52,11 +54,15 @@
     "theme"
   ],
   "scripts": {
-    "lint": "eslint --quiet '**/*.js'"
+    "lint": "eslint --quiet '**/*.js'",
+    "stylelint": "stylelint --quiet --allow-empty-input 'theme/**/*.css' 'docs/**/*.css'"
   },
   "lint-staged": {
     "**/*.js": [
       "eslint --quiet"
+    ],
+    "**/*.css": [
+      "stylelint --quiet --allow-empty-input"
     ]
   },
   "eslintIgnore": [

+ 1 - 1
packages/ckeditor5-mention/src/mention.js

@@ -156,7 +156,7 @@ export default class Mention extends Plugin {
  * @property {String} [marker] The character which triggers autocompletion for mention. It must be a single character.
  * @property {Array.<module:mention/mention~MentionFeedItem>|Function} feed Autocomplete items. Provide an array for
  * a static configuration (the mention feature will show matching items automatically) or a function which returns an array of
- * matching items (directly, or via a promise).
+ * matching items (directly, or via a promise). If a function is passed, it is executed in the context of the editor instance.
  * @property {Number} [minimumCharacters=0] Specifies after how many characters the autocomplete panel should be shown.
  * @property {Function} [itemRenderer] A function that renders a {@link module:mention/mention~MentionFeedItem}
  * to the autocomplete panel.

+ 1 - 1
packages/ckeditor5-mention/src/mentionui.js

@@ -165,7 +165,7 @@ export default class MentionUI extends Plugin {
 			}
 
 			const minimumCharacters = mentionDescription.minimumCharacters || 0;
-			const feedCallback = typeof feed == 'function' ? feed : createFeedCallback( feed );
+			const feedCallback = typeof feed == 'function' ? feed.bind( this.editor ) : createFeedCallback( feed );
 			const watcher = this._setupTextWatcherForFeed( marker, minimumCharacters );
 			const itemRenderer = mentionDescription.itemRenderer;
 

+ 31 - 0
packages/ckeditor5-mention/tests/mentionui.js

@@ -880,6 +880,37 @@ describe( 'MentionUI', () => {
 			} );
 		} );
 
+		describe( 'callback function using data from editor', () => {
+			beforeEach( () => {
+				return createClassicTestEditor( {
+					feeds: [
+						{
+							marker: '#',
+							feed() {
+								expect( this ).to.equal( editor );
+								return Promise.resolve( [ 'foo', 'bar' ] );
+							}
+						}
+					]
+				} );
+			} );
+
+			it( 'should bind the instance panel for matched marker', () => {
+				setData( model, '<paragraph>foo []</paragraph>' );
+
+				model.change( writer => {
+					writer.insertText( '#', doc.selection.getFirstPosition() );
+				} );
+
+				return waitForDebounce()
+					.then( () => {
+						expect( panelView.isVisible ).to.be.true;
+						expect( editor.model.markers.has( 'mention' ) ).to.be.true;
+						expect( mentionsView.items ).to.have.length( 2 );
+					} );
+			} );
+		} );
+
 		describe( 'asynchronous list with custom trigger', () => {
 			const issuesNumbers = [ '#100', '#101', '#102', '#103' ];