Sfoglia il codice sorgente

Merge branch 'master' into i/7916

Piotrek Koszuliński 5 anni fa
parent
commit
9492ffef14
73 ha cambiato i file con 335 aggiunte e 136 eliminazioni
  1. 1 1
      docs/_snippets/examples/document-editor.html
  2. 27 0
      packages/ckeditor5-block-quote/docs/_snippets/features/block-quote.html
  3. 38 0
      packages/ckeditor5-block-quote/docs/_snippets/features/block-quote.js
  4. 6 2
      packages/ckeditor5-block-quote/docs/api/block-quote.md
  5. 69 0
      packages/ckeditor5-block-quote/docs/features/block-quote.md
  6. 1 1
      packages/ckeditor5-build-decoupled-document/build/ckeditor.js
  7. 1 1
      packages/ckeditor5-build-decoupled-document/build/ckeditor.js.map
  8. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ar.js
  9. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ast.js
  10. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/az.js
  11. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/bg.js
  12. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/cs.js
  13. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/da.js
  14. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/de.js
  15. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/el.js
  16. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/en-au.js
  17. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/en-gb.js
  18. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/eo.js
  19. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/es.js
  20. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/et.js
  21. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/eu.js
  22. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/fa.js
  23. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/fi.js
  24. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/fr.js
  25. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/gl.js
  26. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/he.js
  27. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/hr.js
  28. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/hu.js
  29. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/id.js
  30. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/it.js
  31. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ja.js
  32. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/km.js
  33. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/kn.js
  34. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ko.js
  35. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ku.js
  36. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/lt.js
  37. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/lv.js
  38. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/nb.js
  39. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ne.js
  40. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/nl.js
  41. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/no.js
  42. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/pl.js
  43. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/pt-br.js
  44. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/pt.js
  45. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ro.js
  46. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ru.js
  47. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/si.js
  48. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/sk.js
  49. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/sq.js
  50. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/sr-latn.js
  51. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/sr.js
  52. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/sv.js
  53. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/tr.js
  54. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/ug.js
  55. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/uk.js
  56. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/vi.js
  57. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/zh-cn.js
  58. 1 1
      packages/ckeditor5-build-decoupled-document/build/translations/zh.js
  59. 2 0
      packages/ckeditor5-build-decoupled-document/src/ckeditor.js
  60. 12 0
      packages/ckeditor5-build-decoupled-document/tests/ckeditor.js
  61. 2 2
      packages/ckeditor5-build-decoupled-document/tests/manual/ckeditor.html
  62. 1 1
      packages/ckeditor5-media-embed/src/automediaembed.js
  63. 4 4
      packages/ckeditor5-media-embed/src/mediaembedcommand.js
  64. 11 0
      packages/ckeditor5-media-embed/tests/automediaembed.js
  65. 22 0
      packages/ckeditor5-media-embed/tests/insertmediacommand.js
  66. 8 8
      packages/ckeditor5-page-break/docs/features/page-break.md
  67. 14 14
      packages/ckeditor5-paste-from-office/tests/_data/image/adjacent-groups/model.edge.word2016.html
  68. 8 8
      packages/ckeditor5-paste-from-office/tests/_data/image/adjacent-groups/model.safari.word2016.html
  69. 14 14
      packages/ckeditor5-paste-from-office/tests/_data/image/adjacent-groups/model.word2016.html
  70. 0 25
      packages/ckeditor5-table/src/converters/upcasttable.js
  71. 1 3
      packages/ckeditor5-table/src/tableediting.js
  72. 1 1
      packages/ckeditor5-table/tests/converters/upcasttable.js
  73. 41 0
      packages/ckeditor5-table/tests/tableclipboard-paste.js

+ 1 - 1
docs/_snippets/examples/document-editor.html

@@ -21,7 +21,7 @@
 							<td>9:30 AM - 11:30 AM</td>
 							<td>
 								<p><strong>Americano vs. Brewed</strong> - “know your coffee” with:&nbsp;</p>
-								<ul>
+								<ul style="list-style-type:circle;">
 									<li>Giulia Bianchi</li>
 									<li>Stefano Garau</li>
 									<li>Giuseppe Russo</li>

File diff suppressed because it is too large
+ 27 - 0
packages/ckeditor5-block-quote/docs/_snippets/features/block-quote.html


+ 38 - 0
packages/ckeditor5-block-quote/docs/_snippets/features/block-quote.js

@@ -0,0 +1,38 @@
+/**
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* globals window, document, console */
+
+import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
+
+ClassicEditor
+	.create( document.querySelector( '#snippet-block-quote' ), {
+		toolbar: {
+			items: [
+				'heading',
+				'|',
+				'bold',
+				'italic',
+				'link',
+				'|',
+				'bulletedList',
+				'numberedList',
+				'|',
+				'blockQuote',
+				'outdent',
+				'indent',
+				'|',
+				'undo',
+				'redo'
+			],
+			viewportTopOffset: window.getViewportTopOffsetConfig()
+		}
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err );
+	} );

+ 6 - 2
packages/ckeditor5-block-quote/docs/api/block-quote.md

@@ -8,13 +8,17 @@ category: api-reference
 
 This package implements block quote support for CKEditor 5.
 
+## Demo
+
+Check out the {@link features/block-quote#demo demo in the Block quote feature} guide.
+
 ## Documentation
 
-See the {@link module:block-quote/blockquote~BlockQuote} plugin documentation.
+See the {@link features/block-quote Block quote feature} guide and the {@link module:block-quote/blockquote~BlockQuote} plugin documentation.
 
 ## Installation
 
-```bash
+```
 npm install --save @ckeditor/ckeditor5-block-quote
 ```
 

+ 69 - 0
packages/ckeditor5-block-quote/docs/features/block-quote.md

@@ -0,0 +1,69 @@
+---
+category: features
+menu-title: Block quote
+---
+
+# Block quote
+
+The {@link module:block-quote/blockquote~BlockQuote} feature allows you to easily include block quotations or pull quotes in the rich-text content. This provides an attractive way to draw the readers' attention to selected parts of text. It also helps organize the content in a structured, elegant way and to manage the flow better.
+
+## Demo
+
+Use the editor below to see the block quote plugin in action.
+
+{@snippet features/block-quote}
+
+## Related features
+
+Here are some other CKEditor 5 features that you can use similarly to the block quote plugin to structure your text better:
+
+* The {@link features/indent block indentation feature} allows you to set indentation for text blocks such as paragraphs or lists.
+* The {@link features/code-blocks code block feature} allows for insertion of various code listings.
+
+## Installation
+
+To add this feature to your rich-text editor, install the [`@ckeditor/ckeditor5-block-quote`](https://www.npmjs.com/package/@ckeditor/ckeditor5-block-quote) package:
+
+```plaintext
+npm install --save @ckeditor/ckeditor5-block-quote
+```
+
+And add it to your plugin list configuration:
+
+```js
+import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ BlockQuote, ... ],
+		toolbar: [ 'blockQuote', ... ]
+	} )
+	.then( ... )
+	.catch( ... );
+```
+
+<info-box info>
+	Read more about {@link builds/guides/integration/installing-plugins installing plugins}.
+</info-box>
+
+## Common API
+
+The {@link module:block-quote/blockquote~BlockQuote} plugin registers:
+
+* the `'blockQuote'` UI button component implemented by the {@link module:block-quote/blockquoteui~BlockQuoteUI block quote UI feature},
+* the `'blockQuote'` command implemented by the {@link module:block-quote/blockquoteediting~BlockQuoteEditing block quote editing feature}.
+
+The command can be executed using the {@link module:core/editor/editor~Editor#execute `editor.execute()`} method:
+
+```js
+// Applies block quote to the selected content.
+editor.execute( 'blockQuote' );
+```
+
+<info-box>
+	We recommend using the official {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more.
+</info-box>
+
+## Contribute
+
+The source code of the feature is available on GitHub in https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-block-quote.

File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/ckeditor.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/ckeditor.js.map


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ar.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ast.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/az.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/bg.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/cs.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/da.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/de.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/el.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/en-au.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/en-gb.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/eo.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/es.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/et.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/eu.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/fa.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/fi.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/fr.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/gl.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/he.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/hr.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/hu.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/id.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/it.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ja.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/km.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/kn.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ko.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ku.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/lt.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/lv.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/nb.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ne.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/nl.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/no.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/pl.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/pt-br.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/pt.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ro.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ru.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/si.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/sk.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/sq.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/sr-latn.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/sr.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/sv.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/tr.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/ug.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/uk.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/vi.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/zh-cn.js


File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-build-decoupled-document/build/translations/zh.js


+ 2 - 0
packages/ckeditor5-build-decoupled-document/src/ckeditor.js

@@ -31,6 +31,7 @@ import Indent from '@ckeditor/ckeditor5-indent/src/indent';
 import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
 import Link from '@ckeditor/ckeditor5-link/src/link';
 import List from '@ckeditor/ckeditor5-list/src/list';
+import ListStyle from '@ckeditor/ckeditor5-list/src/liststyle';
 import MediaEmbed from '@ckeditor/ckeditor5-media-embed/src/mediaembed';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
@@ -67,6 +68,7 @@ DecoupledEditor.builtinPlugins = [
 	IndentBlock,
 	Link,
 	List,
+	ListStyle,
 	MediaEmbed,
 	Paragraph,
 	PasteFromOffice,

+ 12 - 0
packages/ckeditor5-build-decoupled-document/tests/ckeditor.js

@@ -180,6 +180,18 @@ describe( 'DecoupledEditor build', () => {
 				expect( editor.getData() ).to.equal( data );
 			} );
 
+			it( 'list style works', () => {
+				const data = [
+					'<ol style="list-style-type:upper-roman;">' +
+					'<li>Item 1.</li>' +
+					'<li>Item 2.</li>' +
+					'</ol>'
+				].join( '' );
+
+				editor.setData( data );
+				expect( editor.getData() ).to.equal( data );
+			} );
+
 			it( 'link works', () => {
 				const data = '<p><a href="//ckeditor.com">CKEditor.com</a></p>';
 

+ 2 - 2
packages/ckeditor5-build-decoupled-document/tests/manual/ckeditor.html

@@ -31,14 +31,14 @@
 		<p><a href="https://ckeditor.com">CKEditor&nbsp;5</a> is <i>under heavy development</i> and this demo
 		is not production-ready software. For example:</p>
 
-		<ul>
+		<ol style="list-style-type:upper-roman;">
 			<li><strong>Only Chrome, Opera and Safari are supported</strong>.</li>
 			<li>Firefox requires enabling the
 			<a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/onselectionchange">
 			&ldquo;dom.select_events.enabled&rdquo;</a> option.</li>
 			<li><a href="https://github.com/ckeditor/ckeditor5/issues/342">Support for pasting</a>
 			is under development (content filtering is unstable).</li>
-		</ul>
+		</ol>
 
 		<p>It has <em>bugs</em> that we are aware of &mdash; and that we will be working on in the next few
 		iterations of the project. Stay tuned for some updates soon!</p>

+ 1 - 1
packages/ckeditor5-media-embed/src/automediaembed.js

@@ -16,7 +16,7 @@ import Undo from '@ckeditor/ckeditor5-undo/src/undo';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import { insertMedia } from './utils';
 
-const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$/;
+const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/;
 
 /**
  * The auto-media embed plugin. It recognizes media links in the pasted content and embeds

+ 4 - 4
packages/ckeditor5-media-embed/src/mediaembedcommand.js

@@ -30,12 +30,13 @@ export default class MediaEmbedCommand extends Command {
 		const model = this.editor.model;
 		const selection = model.document.selection;
 		const schema = model.schema;
-		const position = selection.getFirstPosition();
+		const insertPosition = findOptimalInsertionPosition( selection, model );
 		const selectedMedia = getSelectedMediaModelWidget( selection );
 
-		let parent = position.parent;
+		let parent = insertPosition.parent;
 
-		if ( parent != parent.root ) {
+		// The model.insertContent() will remove empty parent (unless it is a $root or a limit).
+		if ( parent.isEmpty && !model.schema.isLimit( parent ) ) {
 			parent = parent.parent;
 		}
 
@@ -68,4 +69,3 @@ export default class MediaEmbedCommand extends Command {
 		}
 	}
 }
-

+ 11 - 0
packages/ckeditor5-media-embed/tests/automediaembed.js

@@ -398,6 +398,17 @@ describe( 'AutoMediaEmbed - integration', () => {
 					return newEditor.destroy();
 				} );
 		} );
+
+		it( 'works for URL with %-symbols', () => {
+			setData( editor.model, '<paragraph>[]</paragraph>' );
+			pasteHtml( editor, 'http://youtube.com/watch?v=H08tGjXNHO4%2' );
+
+			clock.tick( 100 );
+
+			expect( getData( editor.model ) ).to.equal(
+				'[<media url="http://youtube.com/watch?v=H08tGjXNHO4%2"></media>]'
+			);
+		} );
 	} );
 
 	describe( 'use real timers', () => {

+ 22 - 0
packages/ckeditor5-media-embed/tests/insertmediacommand.js

@@ -50,6 +50,28 @@ describe( 'MediaEmbedCommand', () => {
 			expect( command.isEnabled ).to.be.true;
 		} );
 
+		it( 'should be true if a media is selected in a table cell', () => {
+			model.schema.register( 'table', { allowIn: '$root', isLimit: true, isObject: true, isBlock: true } );
+			model.schema.register( 'tableRow', { allowIn: 'table', isLimit: true } );
+			model.schema.register( 'tableCell', { allowIn: 'tableRow', isLimit: true, isSelectable: true } );
+			model.schema.extend( 'media', { allowIn: 'tableCell' } );
+
+			setData( model, '<table><tableRow><tableCell>[<media></media>]</tableCell></tableRow></table>' );
+
+			expect( command.isEnabled ).to.be.true;
+		} );
+
+		it( 'should be true if in a table cell', () => {
+			model.schema.register( 'table', { allowIn: '$root', isLimit: true, isObject: true, isBlock: true } );
+			model.schema.register( 'tableRow', { allowIn: 'table', isLimit: true } );
+			model.schema.register( 'tableCell', { allowIn: 'tableRow', isLimit: true, isSelectable: true } );
+			model.schema.extend( '$block', { allowIn: 'tableCell' } );
+
+			setData( model, '<table><tableRow><tableCell><p>foo[]</p></tableCell></tableRow></table>' );
+
+			expect( command.isEnabled ).to.be.true;
+		} );
+
 		it( 'should be true when the selection directly in a block', () => {
 			model.schema.register( 'block', { inheritAllFrom: '$block' } );
 			model.schema.extend( '$text', { allowIn: 'block' } );

+ 8 - 8
packages/ckeditor5-page-break/docs/features/page-break.md

@@ -15,6 +15,14 @@ Use the editor to see the {@link module:page-break/pagebreak~PageBreak} plugin i
 
 {@snippet features/page-break}
 
+## Related features
+
+Here are some useful CKEditor 5 features that you can use together with the page break plugin for an all-around paged editing experience:
+
+* The [pagination feature](https://ckeditor.com/docs/ckeditor5/latest/features/pagination.html) allows you to see where page breaks would be after the document is [exported to PDF](https://ckeditor.com/docs/ckeditor5/latest/features/export-pdf.html) or [to Word](https://ckeditor.com/docs/ckeditor5/latest/features/export-word.html).
+* The [export to Word](https://ckeditor.com/docs/ckeditor5/latest/features/export-word.html) feature will allow you to generate editable, paged `.docx` files out of your editor-created content.
+* The [export to PDF](https://ckeditor.com/docs/ckeditor5/latest/features/export-pdf.html) feature will allow you to generate portable, paged PDF files out of your editor-created content.
+
 ## Installation
 
 To add this feature to your rich-text editor, install the [`@ckeditor/ckeditor5-page-break`](https://www.npmjs.com/package/@ckeditor/ckeditor5-page-break) package:
@@ -41,14 +49,6 @@ ClassicEditor
 	Read more about {@link builds/guides/integration/installing-plugins installing plugins}.
 </info-box>
 
-## Related features
-
-Here are some useful CKEditor 5 features that you can use together with the page break plugin for an all-around paged editing experience:
-
-* The [pagination feature](https://ckeditor.com/docs/ckeditor5/latest/features/pagination.html) allows you to see where page breaks would be after the document is [exported to PDF](https://ckeditor.com/docs/ckeditor5/latest/features/export-pdf.html) or [to Word](https://ckeditor.com/docs/ckeditor5/latest/features/export-word.html).
-* The [export to Word](https://ckeditor.com/docs/ckeditor5/latest/features/export-word.html) feature will allow you to generate editable, paged `.docx` files out of your editor-created content.
-* The [export to PDF](https://ckeditor.com/docs/ckeditor5/latest/features/export-pdf.html) feature will allow you to generate portable, paged PDF files out of your editor-created content.
-
 ## Common API
 
 The {@link module:page-break/pagebreak~PageBreak} plugin registers:

+ 14 - 14
packages/ckeditor5-paste-from-office/tests/_data/image/adjacent-groups/model.edge.word2016.html

@@ -2,30 +2,30 @@
 
 <table>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell colspan="4"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell colspan="4"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell colspan="2"><paragraph></paragraph></tableCell>
-		<tableCell rowspan="2"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell colspan="2"></tableCell>
+		<tableCell rowspan="2"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell rowspan="2"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell rowspan="2"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 </table>
 

+ 8 - 8
packages/ckeditor5-paste-from-office/tests/_data/image/adjacent-groups/model.safari.word2016.html

@@ -1,20 +1,20 @@
 <paragraph></paragraph>
 <table>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell colspan="2"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell colspan="2"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 </table>
 

+ 14 - 14
packages/ckeditor5-paste-from-office/tests/_data/image/adjacent-groups/model.word2016.html

@@ -1,29 +1,29 @@
 <table>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell colspan="4"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell colspan="4"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell colspan="2"><paragraph></paragraph></tableCell>
-		<tableCell rowspan="2"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell colspan="2"></tableCell>
+		<tableCell rowspan="2"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
-		<tableCell rowspan="2"><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
+		<tableCell rowspan="2"></tableCell>
 	</tableRow>
 	<tableRow>
-		<tableCell><paragraph></paragraph></tableCell>
+		<tableCell></tableCell>
 	</tableRow>
 </table>
 

+ 0 - 25
packages/ckeditor5-table/src/converters/upcasttable.js

@@ -84,31 +84,6 @@ export function skipEmptyTableRow() {
 	};
 }
 
-/**
- * A converter that ensures an empty paragraph is inserted in a table cell if no other content was converted.
- *
- * @returns {Function} Conversion helper.
- */
-export function ensureParagraphInTableCell( elementName ) {
-	return dispatcher => {
-		dispatcher.on( `element:${ elementName }`, ( evt, data, conversionApi ) => {
-			// The default converter will create a model range on converted table cell.
-			if ( !data.modelRange ) {
-				return;
-			}
-
-			const tableCell = data.modelRange.start.nodeAfter;
-
-			// Ensure a paragraph in the model for empty table cells for converted table cells.
-			if ( !tableCell.childCount ) {
-				const modelCursor = conversionApi.writer.createPositionAt( tableCell, 0 );
-
-				conversionApi.writer.insertElement( 'paragraph', modelCursor );
-			}
-		}, { priority: 'low' } );
-	};
-}
-
 // Scans table rows and extracts required metadata from the table:
 //
 // headingRows    - The number of rows that go as table headers.

+ 1 - 3
packages/ckeditor5-table/src/tableediting.js

@@ -9,7 +9,7 @@
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 
-import upcastTable, { ensureParagraphInTableCell, skipEmptyTableRow } from './converters/upcasttable';
+import upcastTable, { skipEmptyTableRow } from './converters/upcasttable';
 import {
 	downcastInsertCell,
 	downcastInsertRow,
@@ -106,8 +106,6 @@ export default class TableEditing extends Plugin {
 		// Table cell conversion.
 		conversion.for( 'upcast' ).elementToElement( { model: 'tableCell', view: 'td' } );
 		conversion.for( 'upcast' ).elementToElement( { model: 'tableCell', view: 'th' } );
-		conversion.for( 'upcast' ).add( ensureParagraphInTableCell( 'td' ) );
-		conversion.for( 'upcast' ).add( ensureParagraphInTableCell( 'th' ) );
 
 		conversion.for( 'editingDowncast' ).add( downcastInsertCell() );
 

+ 1 - 1
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -285,7 +285,7 @@ describe( 'upcastTable()', () => {
 		);
 
 		expectModel(
-			'<fooTable><fooRow><fooCell><paragraph></paragraph></fooCell></fooRow></fooTable>'
+			'<fooTable><fooRow><fooCell></fooCell></fooRow></fooTable>'
 		);
 	} );
 

+ 41 - 0
packages/ckeditor5-table/tests/tableclipboard-paste.js

@@ -3917,6 +3917,36 @@ describe( 'table clipboard', () => {
 				[ '02', '21', '22' ]
 			] ) );
 		} );
+
+		it( 'should not blow up when pasting unsupported element in table', async () => {
+			await createEditor( [ TableCellPropertiesEditing ] );
+
+			pasteHtml( editor,
+				'<table>' +
+					'<tbody>' +
+						'<tr>' +
+							'<td>' +
+								'<div>' +
+									'<table>' +
+										'<tbody>' +
+											'<tr>' +
+												'<td style="border: 2px solid rgb(242, 242, 242);">' +
+													'<p>Test</p>' +
+												'</td>' +
+											'</tr>' +
+										'</tbody>' +
+									'</table>' +
+								'</div>' +
+							'</td>' +
+						'</tr>' +
+					'</tbody>' +
+				'</table>'
+			);
+
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
+				[ '<paragraph>Test</paragraph><paragraph></paragraph>' ]
+			] ) );
+		} );
 	} );
 
 	async function createEditor( extraPlugins = [] ) {
@@ -3930,6 +3960,17 @@ describe( 'table clipboard', () => {
 		tableSelection = editor.plugins.get( 'TableSelection' );
 	}
 
+	function pasteHtml( editor, html ) {
+		const data = {
+			dataTransfer: createDataTransfer(),
+			stopPropagation() {},
+			preventDefault() {}
+		};
+
+		data.dataTransfer.setData( 'text/html', html );
+		editor.editing.view.document.fire( 'paste', data );
+	}
+
 	function pasteTable( tableData, attributes = {} ) {
 		const data = {
 			dataTransfer: createDataTransfer(),