Skip to content

Commit

Permalink
Merge stable into master
Browse files Browse the repository at this point in the history
  • Loading branch information
CKEditorBot authored Aug 27, 2020
2 parents 7aa9528 + ec86491 commit ef3a8ad
Show file tree
Hide file tree
Showing 350 changed files with 1,442 additions and 1,343 deletions.
146 changes: 145 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

47 changes: 24 additions & 23 deletions docs/_snippets/examples/inline-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,29 @@ const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor

Array.from( inlineInjectElements ).forEach( inlineElement => {
const config = {
extraPlugins: [ ImageResize ],
image: {
toolbar: {
viewportTopOffset: window.getViewportTopOffsetConfig()
},
cloudServices: CS_CONFIG
};

if ( inlineElement.tagName.toLowerCase() == 'header' ) {
config.removePlugins = [
'Blockquote',
'Image',
'ImageCaption',
'ImageStyle',
'ImageToolbar',
'ImageUpload',
'List',
'EasyImage',
'CKFinder',
'CKFinderUploadAdapter'
];
config.toolbar.items = [ 'heading', '|', 'bold', 'italic', 'link' ];
} else {
config.extraPlugins = [ ImageResize ];
config.image = {
resizeOptions: [
{
name: 'imageResize:original',
Expand Down Expand Up @@ -42,27 +63,7 @@ Array.from( inlineInjectElements ).forEach( inlineElement => {
'|',
'imageTextAlternative'
]
},
toolbar: {
viewportTopOffset: window.getViewportTopOffsetConfig()
},
cloudServices: CS_CONFIG
};

if ( inlineElement.tagName.toLowerCase() == 'header' ) {
config.removePlugins = [
'Blockquote',
'Image',
'ImageCaption',
'ImageStyle',
'ImageToolbar',
'ImageUpload',
'List',
'EasyImage',
'CKFinder',
'CKFinderUploadAdapter'
];
config.toolbar.items = [ 'heading', '|', 'bold', 'italic', 'link' ];
};
}

InlineEditor
Expand Down
14 changes: 14 additions & 0 deletions docs/_snippets/features/mathtype.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@

<p><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi><mo>=</mo><mfrac><mrow><mo>-</mo><mi>b</mi><mo>&#177;</mo><msqrt><msup><mi>b</mi><mn>2</mn></msup><mo>-</mo><mn>4</mn><mi>a</mi><mi>c</mi></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></math></p>
</div>

<script>
(() => {
const linkElement = document.createElement( 'link' );
linkElement.href = 'https://ckeditor.com/docs/ckeditor5/21.0.0/snippets/features/mathtype/snippet.css';
linkElement.type = 'text/css';
linkElement.rel = 'stylesheet';
linkElement.dataset[ 'cke' ] = 'true';

document.head.appendChild( linkElement );
})()
</script>
<script src="https://ckeditor.com/docs/ckeditor5/21.0.0/assets/snippet.js"></script>
<script src="https://ckeditor.com/docs/ckeditor5/21.0.0/snippets/features/mathtype/snippet.js"></script>
63 changes: 1 addition & 62 deletions docs/_snippets/features/mathtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,4 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* globals window, document, console */

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
import MathType from '@wiris/mathtype-ckeditor5';
import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';

ClassicEditor
.create( document.querySelector( '#mathtype-editor' ), {
plugins: [
ArticlePluginSet,
EasyImage,
MathType
],
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'MathType',
'ChemType',
'|',
'blockQuote',
'link',
'mediaEmbed',
'insertTable',
'|',
'undo',
'redo'
],
viewportTopOffset: window.getViewportTopOffsetConfig()
},
image: {
styles: [
'full',
'alignLeft',
'alignRight'
],
toolbar: [
'imageStyle:alignLeft',
'imageStyle:full',
'imageStyle:alignRight',
'|',
'imageTextAlternative'
]
},
table: {
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
},
cloudServices: CS_CONFIG
} )
.catch( err => {
console.error( err.stack );
} );
/* Content removed as a workaround in #7944. Should be restored once the upstream is fixed. */
6 changes: 3 additions & 3 deletions docs/_snippets/framework/tutorials/block-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class SimpleBoxEditing extends Plugin {
} );
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'simpleBox',
view: ( modelElement, viewWriter ) => {
view: ( modelElement, { writer: viewWriter } ) => {
const section = viewWriter.createContainerElement( 'section', { class: 'simple-box' } );

return toWidget( section, viewWriter, { label: 'simple box widget' } );
Expand All @@ -158,7 +158,7 @@ class SimpleBoxEditing extends Plugin {
} );
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'simpleBoxTitle',
view: ( modelElement, viewWriter ) => {
view: ( modelElement, { writer: viewWriter } ) => {
// Note: You use a more specialized createEditableElement() method here.
const h1 = viewWriter.createEditableElement( 'h1', { class: 'simple-box-title' } );

Expand All @@ -183,7 +183,7 @@ class SimpleBoxEditing extends Plugin {
} );
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'simpleBoxDescription',
view: ( modelElement, viewWriter ) => {
view: ( modelElement, { writer: viewWriter } ) => {
// Note: You use a more specialized createEditableElement() method here.
const div = viewWriter.createEditableElement( 'div', { class: 'simple-box-description' } );

Expand Down
6 changes: 3 additions & 3 deletions docs/_snippets/framework/tutorials/inline-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class PlaceholderEditing extends Plugin {
name: 'span',
classes: [ 'placeholder' ]
},
model: ( viewElement, modelWriter ) => {
model: ( viewElement, { writer: modelWriter } ) => {
// Extract the "name" from "{name}".
const name = viewElement.getChild( 0 ).data.slice( 1, -1 );

Expand All @@ -168,7 +168,7 @@ class PlaceholderEditing extends Plugin {

conversion.for( 'editingDowncast' ).elementToElement( {
model: 'placeholder',
view: ( modelItem, viewWriter ) => {
view: ( modelItem, { writer: viewWriter } ) => {
const widgetElement = createPlaceholderView( modelItem, viewWriter );

// Enable widget handling on a placeholder element inside the editing view.
Expand All @@ -178,7 +178,7 @@ class PlaceholderEditing extends Plugin {

conversion.for( 'dataDowncast' ).elementToElement( {
model: 'placeholder',
view: createPlaceholderView
view: ( modelItem, { writer: viewWriter } ) => createPlaceholderView( modelItem, viewWriter )
} );

// Helper method for both downcast converters.
Expand Down
6 changes: 3 additions & 3 deletions docs/_snippets/framework/tutorials/using-react-in-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ProductPreviewEditing extends Plugin {
name: 'section',
classes: 'product'
},
model: ( viewElement, modelWriter ) => {
model: ( viewElement, { writer: modelWriter } ) => {
// Read the "data-id" attribute from the view and set it as the "id" in the model.
return modelWriter.createElement( 'productPreview', {
id: parseInt( viewElement.getAttribute( 'data-id' ) )
Expand All @@ -82,7 +82,7 @@ class ProductPreviewEditing extends Plugin {
// <productPreview> converters (model → data view)
conversion.for( 'dataDowncast' ).elementToElement( {
model: 'productPreview',
view: ( modelElement, viewWriter ) => {
view: ( modelElement, { writer: viewWriter } ) => {
// In the data view, the model <productPreview> corresponds to:
//
// <section class="product" data-id="..."></section>
Expand All @@ -96,7 +96,7 @@ class ProductPreviewEditing extends Plugin {
// <productPreview> converters (model → editing view)
conversion.for( 'editingDowncast' ).elementToElement( {
model: 'productPreview',
view: ( modelElement, viewWriter ) => {
view: ( modelElement, { writer: viewWriter } ) => {
// In the editing view, the model <productPreview> corresponds to:
//
// <section class="product" data-id="...">
Expand Down
Loading

0 comments on commit ef3a8ad

Please sign in to comment.