Browse Source

Docs: Added <code> support in the Autoformat guide. Closes ckeditor/ckeditor5#586.

Piotrek Koszuliński 8 years ago
parent
commit
7514fe3e4a

+ 3 - 0
packages/ckeditor5-autoformat/docs/_snippets/features/autoformat.html

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

+ 35 - 0
packages/ckeditor5-autoformat/docs/_snippets/features/autoformat.js

@@ -0,0 +1,35 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
+import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
+
+ClassicEditor
+	.create( document.querySelector( '#snippet-autoformat' ), {
+		plugins: ClassicEditor.build.plugins.concat( [ Code ] ),
+		toolbar: {
+			items: [
+				'headings',
+				'bold',
+				'italic',
+				'code',
+				'link',
+				'bulletedList',
+				'numberedList',
+				'blockQuote',
+				'undo',
+				'redo'
+			],
+			viewportTopOffset: 60
+		}
+	} )
+	.then( editor => {
+		window.editorBasic = editor;
+	} )
+	.catch( err => {
+		console.error( err );
+	} );

+ 1 - 3
packages/ckeditor5-autoformat/docs/features/autoformat.md

@@ -3,8 +3,6 @@ title: Autoformatting
 category: features
 ---
 
-{@snippet build-classic-source}
-
 The {@link module:autoformat/autoformat~Autoformat} feature allows you to quickly apply formatting to the content you are writing.
 
 <info-box info>
@@ -36,7 +34,7 @@ Example:
 2. Press <kbd>#</kbd> and then <kbd>Space</kbd>.
 3. The current line will be turned into a heading.
 
-{@snippet examples/classic-editor-short}
+{@snippet features/autoformat}
 
 ## Installation