瀏覽代碼

Docs: Used existing builds and enabled EI.

Piotrek Koszuliński 8 年之前
父節點
當前提交
86610744cd
共有 2 個文件被更改,包括 26 次插入47 次删除
  1. 11 13
      docs/_snippets/examples/balloon-editor.js
  2. 15 34
      docs/_snippets/examples/inline-editor.js

+ 11 - 13
docs/_snippets/examples/balloon-editor.js

@@ -5,20 +5,18 @@
 
 /* globals console, window, document */
 
-import BalloonEditor from '@ckeditor/ckeditor5-editor-balloon/src/ballooneditor';
+import BalloonEditor from '@ckeditor/ckeditor5-build-balloon/src/ckeditor';
+import getToken from '@ckeditor/ckeditor5-easy-image/tests/_utils/gettoken';
 
-import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
-
-BalloonEditor
-	.create( document.querySelector( '#snippet-balloon-editor' ), {
-		plugins: [ ArticlePluginSet ],
-		toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
-		image: {
-			toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
-		}
-	} )
-	.then( editor => {
-		window.editor = editor;
+getToken()
+	.then( token => {
+		return BalloonEditor
+			.create( document.querySelector( '#snippet-balloon-editor' ), {
+				cloudServices: { token }
+			} )
+			.then( editor => {
+				window.editor = editor;
+			} );
 	} )
 	.catch( err => {
 		console.error( err );

+ 15 - 34
docs/_snippets/examples/inline-editor.js

@@ -5,52 +5,33 @@
 
 /* globals console, window, document */
 
-import InlineEditor from '@ckeditor/ckeditor5-editor-inline/src/inlineeditor';
-import fullSizeIcon from '@ckeditor/ckeditor5-core/theme/icons/object-center.svg';
-import alignLeftIcon from '@ckeditor/ckeditor5-core/theme/icons/object-left.svg';
-import alignRightIcon from '@ckeditor/ckeditor5-core/theme/icons/object-right.svg';
-
-import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
+import InlineEditor from '@ckeditor/ckeditor5-build-inline/src/ckeditor';
+import getToken from '@ckeditor/ckeditor5-easy-image/tests/_utils/gettoken';
 
 const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor [data-inline-inject]' );
 
-Array.prototype.map.call( inlineInjectElements, inlineElement => {
+Array.from( inlineInjectElements ).forEach( inlineElement => {
 	const config = {
-		plugins: [ ArticlePluginSet ],
-		toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
 		image: {
-			toolbar: [ 'imageTextAlternative', '|', 'imageStyleLeft', 'imageStyleFull', 'imageStyleRight' ],
-			styles: [
-				{
-					name: 'imageStyleFull',
-					title: 'Full size image',
-					icon: fullSizeIcon,
-					isDefault: true
-				},
-				{
-					name: 'imageStyleLeft',
-					title: 'Left aligned image',
-					icon: alignLeftIcon,
-					className: 'image-style-left'
-				},
-				{
-					name: 'imageStyleRight',
-					title: 'Right aligned image',
-					icon: alignRightIcon,
-					className: 'image-style-right'
-				}
-			]
+			toolbar: [ 'imageTextAlternative', '|', 'imageStyleAlignLeft', 'imageStyleFull', 'imageStyleAlignRight' ],
+			styles: [ 'imageStyleFull', 'imageStyleAlignLeft', 'imageStyleAlignRight' ]
 		}
 	};
 
 	if ( inlineElement.tagName.toLowerCase() == 'header' ) {
-		config.removePlugins = [ 'Blockquote', 'Image', 'ImageToolbar', 'List' ];
+		config.removePlugins = [ 'Blockquote', 'Image', 'ImageToolbar', 'List', 'EasyImage', 'ImageUpload', 'CKFinderUploadAdapter' ];
 		config.toolbar = [ 'headings', 'bold', 'italic', 'link' ];
 	}
 
-	InlineEditor.create( inlineElement, config )
-		.then( editor => {
-			window.editor = editor;
+	getToken()
+		.then( token => {
+			config.cloudServices = { token };
+
+			return InlineEditor
+				.create( inlineElement, config )
+				.then( editor => {
+					window.editor = editor;
+				} );
 		} )
 		.catch( err => {
 			console.error( err );