-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7835 from ckeditor/i/7794
Feature (image): Introduced the insert image via URL feature. Closes #7794.
- Loading branch information
Showing
20 changed files
with
1,821 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
packages/ckeditor5-image/src/imageupload/ui/imageuploadformrowview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/** | ||
* @module image/imageupload/ui/imageuploadformrowview | ||
*/ | ||
|
||
import View from '@ckeditor/ckeditor5-ui/src/view'; | ||
|
||
import '../../../theme/imageuploadformrowview.css'; | ||
|
||
/** | ||
* The class representing a single row in a complex form, | ||
* used by {@link module:image/imageupload/ui/imageuploadpanelview~ImageUploadPanelView}. | ||
* | ||
* **Note**: For now this class is private. When more use cases arrive (beyond ckeditor5-table and ckeditor5-image), | ||
* it will become a component in ckeditor5-ui. | ||
* | ||
* @private | ||
* @extends module:ui/view~View | ||
*/ | ||
export default class ImageUploadFormRowView extends View { | ||
/** | ||
* Creates an instance of the form row class. | ||
* | ||
* @param {module:utils/locale~Locale} locale The locale instance. | ||
* @param {Object} options | ||
* @param {Array.<module:ui/view~View>} [options.children] | ||
* @param {String} [options.class] | ||
* @param {module:ui/view~View} [options.labelView] When passed, the row gets the `group` and `aria-labelledby` | ||
* DOM attributes and gets described by the label. | ||
*/ | ||
constructor( locale, options = {} ) { | ||
super( locale ); | ||
|
||
const bind = this.bindTemplate; | ||
|
||
/** | ||
* An additional CSS class added to the {@link #element}. | ||
* | ||
* @observable | ||
* @member {String} #class | ||
*/ | ||
this.set( 'class', options.class || null ); | ||
|
||
/** | ||
* A collection of row items (buttons, dropdowns, etc.). | ||
* | ||
* @readonly | ||
* @member {module:ui/viewcollection~ViewCollection} | ||
*/ | ||
this.children = this.createCollection(); | ||
|
||
if ( options.children ) { | ||
options.children.forEach( child => this.children.add( child ) ); | ||
} | ||
|
||
/** | ||
* The role property reflected by the `role` DOM attribute of the {@link #element}. | ||
* | ||
* **Note**: Used only when a `labelView` is passed to constructor `options`. | ||
* | ||
* @private | ||
* @observable | ||
* @member {String} #role | ||
*/ | ||
this.set( '_role', null ); | ||
|
||
/** | ||
* The ARIA property reflected by the `aria-labelledby` DOM attribute of the {@link #element}. | ||
* | ||
* **Note**: Used only when a `labelView` is passed to constructor `options`. | ||
* | ||
* @private | ||
* @observable | ||
* @member {String} #ariaLabelledBy | ||
*/ | ||
this.set( '_ariaLabelledBy', null ); | ||
|
||
if ( options.labelView ) { | ||
this.set( { | ||
_role: 'group', | ||
_ariaLabelledBy: options.labelView.id | ||
} ); | ||
} | ||
|
||
this.setTemplate( { | ||
tag: 'div', | ||
attributes: { | ||
class: [ | ||
'ck', | ||
'ck-form__row', | ||
bind.to( 'class' ) | ||
], | ||
role: bind.to( '_role' ), | ||
'aria-labelledby': bind.to( '_ariaLabelledBy' ) | ||
}, | ||
children: this.children | ||
} ); | ||
} | ||
} |
Oops, something went wrong.