Преглед изворни кода

Add table feature to inline widget manual test.

Maciej Gołaszewski пре 7 година
родитељ
комит
15f28a5ef0

+ 7 - 3
packages/ckeditor5-widget/tests/manual/inline-widget.js

@@ -21,6 +21,7 @@ import { toWidget } from '@ckeditor/ckeditor5-widget/src/utils';
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 import ShiftEnter from '@ckeditor/ckeditor5-enter/src/shiftenter';
 import ShiftEnter from '@ckeditor/ckeditor5-enter/src/shiftenter';
+import Table from '@ckeditor/ckeditor5-table/src/table';
 
 
 class InlineWidget extends Plugin {
 class InlineWidget extends Plugin {
 	constructor( editor ) {
 	constructor( editor ) {
@@ -107,8 +108,8 @@ class InlineWidget extends Plugin {
 
 
 ClassicEditor
 ClassicEditor
 	.create( global.document.querySelector( '#editor' ), {
 	.create( global.document.querySelector( '#editor' ), {
-		plugins: [ Enter, Typing, Paragraph, Heading, Bold, Undo, Clipboard, Widget, ShiftEnter, InlineWidget ],
-		toolbar: [ 'heading', '|', 'bold', '|', 'placeholder', '|', 'undo', 'redo' ]
+		plugins: [ Enter, Typing, Paragraph, Heading, Bold, Undo, Clipboard, Widget, ShiftEnter, InlineWidget, Table ],
+		toolbar: [ 'heading', '|', 'bold', '|', 'placeholder', '|', 'insertTable', '|', 'undo', 'redo' ]
 	} )
 	} )
 	.then( editor => {
 	.then( editor => {
 		editor.model.document.on( 'change', () => {
 		editor.model.document.on( 'change', () => {
@@ -128,5 +129,8 @@ function printModelContents( editor ) {
 }
 }
 
 
 function formatData( data ) {
 function formatData( data ) {
-	return data.replace( /<(paragraph)>/g, '\n<$1>' );
+	return data
+		.replace( /<(paragraph|\/tableRow|tableCell|table|heading[0-5])>/g, '\n<$1>' )
+		.replace( /(<tableCell>)\n(<paragraph>)/g, '$1$2' )
+		.replace( /\n(<tableCell>)/g, '\n\t$1' );
 }
 }

+ 3 - 1
packages/ckeditor5-widget/tests/manual/inline-widget.md

@@ -1,4 +1,6 @@
 ### Inline widget
 ### Inline widget
 
 
-* You should be able to type after inline widget (if it is last child of parent <heading> or <paragraph>)
+* You should be able to type after inline widget (if it is last child of parent <heading> or <paragraph>).
 * Select text before/after widget and expand selection beyond widget. The widget should be selected and selection expanded beyond it on further expanding.
 * Select text before/after widget and expand selection beyond widget. The widget should be selected and selection expanded beyond it on further expanding.
+* The inline-widget should work in nested editable widget (table).
+* Use "insert placeholder" toolbar button to insert inline widget.