瀏覽代碼

More samples, more config options.

Piotrek Koszuliński 8 年之前
父節點
當前提交
c8c068e805

+ 0 - 3
docs/_snippets/basic/integration1.html

@@ -1,3 +0,0 @@
-<div id="editor">
-	<p>This is the editor!</p>
-</div>

+ 3 - 0
docs/_snippets/samples/classic-editor.html

@@ -0,0 +1,3 @@
+<div id="snippet-classic-editor">
+	<p>This is <a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a>.</p>
+</div>

+ 1 - 1
docs/_snippets/basic/integration1.js

@@ -9,7 +9,7 @@ import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'
 
 import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
+ClassicEditor.create( document.querySelector( '#snippet-classic-editor' ), {
 	plugins: [ ArticlePreset ],
 	toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
 	image: {

+ 3 - 0
docs/_snippets/samples/inline-editor.html

@@ -0,0 +1,3 @@
+<div id="snippet-inline-editor">
+	<p>This is <a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a>.</p>
+</div>

+ 24 - 0
docs/_snippets/samples/inline-editor.js

@@ -0,0 +1,24 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import InlineEditor from '@ckeditor/ckeditor5-editor-inline/src/inlineeditor';
+
+import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
+
+InlineEditor.create( document.querySelector( '#snippet-inline-editor' ), {
+	plugins: [ ArticlePreset ],
+	toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
+	image: {
+		toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
+	}
+} )
+.then( editor => {
+	window.editor = editor;
+} )
+.catch( err => {
+	console.error( err.stack );
+} );

+ 1 - 1
docs/samples/builds/classic-editor.md

@@ -6,4 +6,4 @@ order: 10
 
 Classic editor sample.
 
-{@snippet basic/integration1}
+{@snippet samples/classic-editor}

+ 9 - 0
docs/samples/builds/inline-editor.md

@@ -0,0 +1,9 @@
+---
+title: Inline editor sample
+category: samples-builds
+order: 10
+---
+
+Inline editor sample.
+
+{@snippet samples/inline-editor}

+ 22 - 5
gulpfile.js

@@ -38,12 +38,28 @@ function getTestOptions() {
 // Documentation. -------------------------------------------------------------
 
 gulp.task( 'docs', () => {
-	if ( process.argv[ 3 ] == '--no-api' ) {
-		return runUmberto();
+	const skipLiveSnippets = process.argv.includes( '--skip-snippets' );
+	const skipApi = process.argv.includes( '--skip-api' );
+
+	if ( skipApi ) {
+		const fs = require( 'fs' );
+		const apiJsonPath = './docs/api/output.json';
+
+		if ( fs.existsSync( apiJsonPath ) ) {
+			fs.unlinkSync( apiJsonPath );
+		}
+
+		return runUmberto( {
+			skipLiveSnippets
+		} );
 	}
 
 	return buildApiDocs()
-		.then( runUmberto );
+		.then( () => {
+			return runUmberto( {
+				skipLiveSnippets
+			} );
+		} );
 } );
 
 gulp.task( 'docs:api', buildApiDocs );
@@ -64,13 +80,14 @@ function buildApiDocs() {
 		} );
 }
 
-function runUmberto() {
+function runUmberto( options ) {
 	assertIsInstalled( 'umberto' );
 	const umberto = require( 'umberto' );
 
 	return umberto.buildSingleProject( {
 		configDir: 'docs',
-		clean: true
+		clean: true,
+		skipLiveSnippets: options.skipLiveSnippets
 	} );
 }