8
0
Просмотр исходного кода

Added manual test for read-only mode.

Oskar Wróbel 8 лет назад
Родитель
Сommit
9f3d8e9225

+ 34 - 0
packages/ckeditor5-core/tests/manual/readonly.html

@@ -0,0 +1,34 @@
+<button id="read-only">Turn on read-only mode</button>
+
+<div id="editor">
+	<h2>Heading 1</h2>
+	<p>Paragraph</p>
+	<p><strong>Bold</strong> <i>Italic</i> <a href="foo">Link</a></p>
+	<ul>
+		<li>UL List item 1</li>
+		<li>UL List item 2</li>
+	</ul>
+	<ol>
+		<li>OL List item 1</li>
+		<li>OL List item 2</li>
+	</ol>
+	<figure class="image image-style-side">
+		<img alt="bar" src="sample.jpg">
+		<figcaption>Caption</figcaption>
+	</figure>
+	<blockquote>
+		<p>Quote</p>
+		<ul>
+			<li>Quoted UL List item 1</li>
+			<li>Quoted UL List item 2</li>
+		</ul>
+		<p>Quote</p>
+	</blockquote>
+</div>
+
+<style>
+	#read-only {
+		margin: 10px 0 15px;
+		font-size: 16px;
+	}
+</style>

+ 32 - 0
packages/ckeditor5-core/tests/manual/readonly.js

@@ -0,0 +1,32 @@
+/**
+ * @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-editor-classic/src/classiceditor';
+
+import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	plugins: [ ArticlePreset ],
+	toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
+	image: {
+		toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
+	}
+} )
+.then( editor => {
+	window.editor = editor;
+
+	const button = document.querySelector( '#read-only' );
+
+	button.addEventListener( 'click', () => {
+		editor.isReadOnly = !editor.isReadOnly;
+		button.textContent = editor.isReadOnly ? 'Turn off read-only mode' : 'Turn on read-only mode';
+	} );
+} )
+.catch( err => {
+	console.error( err.stack );
+} );
+

+ 0 - 0
packages/ckeditor5-core/tests/manual/readonly.md


BIN
packages/ckeditor5-core/tests/manual/sample.jpg